Search in sources :

Example 1 with IndexingPressure

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);
}
Also used : IndexingPressure(org.opensearch.index.IndexingPressure) ActionFilters(org.opensearch.action.support.ActionFilters) Client(org.opensearch.client.Client) AnomalyDetectorSettings(org.opensearch.ad.settings.AnomalyDetectorSettings) Settings(org.opensearch.common.settings.Settings) Before(org.junit.Before)

Example 2 with IndexingPressure

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);
}
Also used : IndexingPressure(org.opensearch.index.IndexingPressure)

Aggregations

IndexingPressure (org.opensearch.index.IndexingPressure)2 Before (org.junit.Before)1 ActionFilters (org.opensearch.action.support.ActionFilters)1 AnomalyDetectorSettings (org.opensearch.ad.settings.AnomalyDetectorSettings)1 Client (org.opensearch.client.Client)1 Settings (org.opensearch.common.settings.Settings)1