use of org.opensearch.index.stats.IndexingPressurePerShardStats in project OpenSearch by opensearch-project.
the class IndexingPressureServiceTests method testPrimaryOperationForIndexingPressure.
public void testPrimaryOperationForIndexingPressure() {
IndexingPressureService service = new IndexingPressureService(settings, clusterService);
Index index = new Index("IndexName", "UUID");
ShardId shardId = new ShardId(index, 0);
Settings.Builder updated = Settings.builder();
clusterSettings.updateDynamicSettings(Settings.builder().put(ShardIndexingPressureSettings.SHARD_INDEXING_PRESSURE_ENABLED.getKey(), false).build(), Settings.builder().put(settings), updated, getTestClass().getName());
clusterSettings.applySettings(updated.build());
Releasable releasable = service.markPrimaryOperationStarted(shardId, 1024, false);
IndexingPressurePerShardStats shardStats = service.shardStats(CommonStatsFlags.ALL).getIndexingPressureShardStats(shardId);
assertNull(shardStats);
IndexingPressureStats nodeStats = service.nodeStats();
assertEquals(1024, nodeStats.getCurrentPrimaryBytes());
releasable.close();
}
use of org.opensearch.index.stats.IndexingPressurePerShardStats in project OpenSearch by opensearch-project.
the class IndexingPressureServiceTests method testCoordinatingOperationForIndexingPressure.
public void testCoordinatingOperationForIndexingPressure() {
IndexingPressureService service = new IndexingPressureService(settings, clusterService);
Index index = new Index("IndexName", "UUID");
ShardId shardId = new ShardId(index, 0);
Settings.Builder updated = Settings.builder();
clusterSettings.updateDynamicSettings(Settings.builder().put(ShardIndexingPressureSettings.SHARD_INDEXING_PRESSURE_ENABLED.getKey(), false).build(), Settings.builder().put(settings), updated, getTestClass().getName());
clusterSettings.applySettings(updated.build());
BulkRequest bulkRequest = new BulkRequest();
Releasable releasable = service.markCoordinatingOperationStarted(bulkRequest::ramBytesUsed, false);
IndexingPressurePerShardStats shardStats = service.shardStats(CommonStatsFlags.ALL).getIndexingPressureShardStats(shardId);
assertNull(shardStats);
IndexingPressureStats nodeStats = service.nodeStats();
assertEquals(bulkRequest.ramBytesUsed(), nodeStats.getCurrentCoordinatingBytes());
releasable.close();
}
use of org.opensearch.index.stats.IndexingPressurePerShardStats in project OpenSearch by opensearch-project.
the class IndexingPressureServiceTests method testLocalPrimaryOperationForShardIndexingPressure.
public void testLocalPrimaryOperationForShardIndexingPressure() {
IndexingPressureService service = new IndexingPressureService(settings, clusterService);
Index index = new Index("IndexName", "UUID");
ShardId shardId = new ShardId(index, 0);
Releasable releasable = service.markPrimaryOperationLocalToCoordinatingNodeStarted(shardId, 1024);
IndexingPressurePerShardStats shardStats = service.shardStats(CommonStatsFlags.ALL).getIndexingPressureShardStats(shardId);
assertEquals(1024, shardStats.getCurrentPrimaryBytes());
releasable.close();
}
Aggregations