Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Flaky Tests testReplicaThreadedUpdateToShardLimitsAndRejections and testCoordinatingPrimaryThreadedUpdateToShardLimitsAndRejections #5439

Merged
merged 4 commits into from
Dec 5, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ public void testCoordinatingPrimaryThreadedUpdateToShardLimitsAndRejections() th

nodeStats = shardIndexingPressure.stats();
IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1);
assertNull(shardStoreStats);
if (rejectionCount.get() == NUM_THREADS) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add a comment here explaining why there is a conditional check. Something like

// 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, l will add it.

assertEquals(10, shardStoreStats.getCurrentPrimaryAndCoordinatingLimits());
} else {
assertNull(shardStoreStats);
}
shardStats = shardIndexingPressure.coldStats();
if (randomBoolean) {
assertEquals(rejectionCount.get(), nodeStats.getCoordinatingRejections());
Expand Down Expand Up @@ -331,7 +335,11 @@ public void testReplicaThreadedUpdateToShardLimitsAndRejections() throws Excepti
assertEquals(0, nodeStats.getCurrentReplicaBytes());

IndexingPressurePerShardStats shardStoreStats = shardIndexingPressure.shardStats().getIndexingPressureShardStats(shardId1);
assertNull(shardStoreStats);
if (rejectionCount.get() == NUM_THREADS) {
assertEquals(15, shardStoreStats.getCurrentReplicaLimits());
} else {
assertNull(shardStoreStats);
}

shardStats = shardIndexingPressure.coldStats();
assertEquals(rejectionCount.get(), shardStats.getIndexingPressureShardStats(shardId1).getReplicaNodeLimitsBreachedRejections());
Expand Down