From bdcefdbf9156b724d11d2d522d2dfa8ec19df977 Mon Sep 17 00:00:00 2001 From: Rishikesh1159 Date: Sat, 3 Dec 2022 00:57:17 +0000 Subject: [PATCH] Add comments for the optional null check. Signed-off-by: Rishikesh1159 --- .../index/ShardIndexingPressureConcurrentExecutionTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java b/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java index 44b7e96cf42f1..8757458e3317e 100644 --- a/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java +++ b/server/src/test/java/org/opensearch/index/ShardIndexingPressureConcurrentExecutionTests.java @@ -269,6 +269,8 @@ public void testCoordinatingPrimaryThreadedUpdateToShardLimitsAndRejections() th nodeStats = shardIndexingPressure.stats(); IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1); + // If rejection count equals NUM_THREADS that means rejections happened until the last request, then we'll get shardStoreStats which + // was updated on the last request. In other cases, the shardStoreStats simply moves to the cold store and null is returned. if (rejectionCount.get() == NUM_THREADS) { assertEquals(10, shardStoreStats.getCurrentPrimaryAndCoordinatingLimits()); } else { @@ -335,6 +337,8 @@ public void testReplicaThreadedUpdateToShardLimitsAndRejections() throws Excepti assertEquals(0, nodeStats.getCurrentReplicaBytes()); IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1); + // If rejection count equals NUM_THREADS that means rejections happened until the last request, then we'll get shardStoreStats which + // was updated on the last request. In other cases, the shardStoreStats simply moves to the cold store and null is returned. if (rejectionCount.get() == NUM_THREADS) { assertEquals(15, shardStoreStats.getCurrentReplicaLimits()); } else {