use of org.opensearch.index.IndexingPressure in project anomaly-detection by opensearch-project.
the class ADResultBulkTransportActionTests method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Settings settings = Settings.builder().put(IndexingPressure.MAX_INDEXING_BYTES.getKey(), "1KB").put(AnomalyDetectorSettings.INDEX_PRESSURE_SOFT_LIMIT.getKey(), 0.8).build();
// without register these settings, the constructor of ADResultBulkTransportAction cannot invoke update consumer
setupTestNodes(AnomalyDetectorSettings.INDEX_PRESSURE_SOFT_LIMIT, AnomalyDetectorSettings.INDEX_PRESSURE_HARD_LIMIT);
transportService = testNodes[0].transportService;
clusterService = testNodes[0].clusterService;
ActionFilters actionFilters = mock(ActionFilters.class);
indexingPressure = mock(IndexingPressure.class);
client = mock(Client.class);
detectorId = randomAlphaOfLength(5);
resultBulk = new ADResultBulkTransportAction(transportService, actionFilters, indexingPressure, settings, clusterService, client);
}
use of org.opensearch.index.IndexingPressure in project OpenSearch by opensearch-project.
the class InternalTestCluster method assertAllPendingWriteLimitsReleased.
private void assertAllPendingWriteLimitsReleased() throws Exception {
assertBusy(() -> {
for (NodeAndClient nodeAndClient : nodes.values()) {
IndexingPressure indexingPressure = getInstance(IndexingPressure.class, nodeAndClient.name);
final long combinedBytes = indexingPressure.getCurrentCombinedCoordinatingAndPrimaryBytes();
if (combinedBytes > 0) {
throw new AssertionError("pending combined bytes [" + combinedBytes + "] bytes on node [" + nodeAndClient.name + "].");
}
final long coordinatingBytes = indexingPressure.getCurrentCoordinatingBytes();
if (coordinatingBytes > 0) {
throw new AssertionError("pending coordinating bytes [" + coordinatingBytes + "] bytes on node [" + nodeAndClient.name + "].");
}
final long primaryBytes = indexingPressure.getCurrentPrimaryBytes();
if (primaryBytes > 0) {
throw new AssertionError("pending primary bytes [" + primaryBytes + "] bytes on node [" + nodeAndClient.name + "].");
}
final long replicaWriteBytes = indexingPressure.getCurrentReplicaBytes();
if (replicaWriteBytes > 0) {
throw new AssertionError("pending replica write bytes [" + combinedBytes + "] bytes on node [" + nodeAndClient.name + "].");
}
}
}, 60, TimeUnit.SECONDS);
}
Aggregations