Skip to content

Commit

Permalink
Timeout fix backport to 1.x (#1953)
Browse files Browse the repository at this point in the history
* [Bug] Wait for outstanding requests to complete (#1925)

Signed-off-by: Suraj Singh <[email protected]>

* [BUG] Wait for outstanding requests to complete in LastSuccessfulSett… (#1939)

* [BUG] Wait for outstanding requests to complete in LastSuccessfulSettingsUpdate test

Signed-off-by: Suraj Singh <[email protected]>

* [BUG] Wait for outstanding requests to complete in LastSuccessfulSettingsUpdate test

Signed-off-by: Suraj Singh <[email protected]>
  • Loading branch information
dreamer-89 authored Jan 21, 2022
1 parent 5e2af8f commit a97a425
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ public void testShardIndexingPressureEnforcedEnabledDisabledSetting() throws Exc
secondSuccessFuture = client(coordinatingOnlyNode).bulk(bulkRequest);
Thread.sleep(25);

waitForTwoOutstandingRequests(coordinatingShardTracker);

// This request breaches the threshold and hence will be rejected
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());

Expand Down Expand Up @@ -636,6 +638,7 @@ public void testShardIndexingPressureLastSuccessfulSettingsUpdate() throws Excep
IndexingPressureService.class,
coordinatingOnlyNode
).getShardIndexingPressure().getShardIndexingPressureTracker(shardId);
waitForTwoOutstandingRequests(coordinatingShardTracker);
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(coordinatingOnlyNode).bulk(bulkRequest).actionGet());
assertEquals(1, coordinatingShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
assertEquals(
Expand All @@ -648,6 +651,7 @@ public void testShardIndexingPressureLastSuccessfulSettingsUpdate() throws Excep
ShardIndexingPressureTracker primaryShardTracker = internalCluster().getInstance(IndexingPressureService.class, primaryName)
.getShardIndexingPressure()
.getShardIndexingPressureTracker(shardId);
waitForTwoOutstandingRequests(primaryShardTracker);
expectThrows(OpenSearchRejectedExecutionException.class, () -> client(primaryName).bulk(bulkRequest).actionGet());
assertEquals(1, primaryShardTracker.getCoordinatingOperationTracker().getRejectionTracker().getTotalRejections());
assertEquals(
Expand Down Expand Up @@ -920,6 +924,12 @@ private String getCoordinatingOnlyNode() {
.getName();
}

private static void waitForTwoOutstandingRequests(ShardIndexingPressureTracker tracker) throws Exception {
assertBusy(
() -> { assertEquals(tracker.getCoordinatingOperationTracker().getPerformanceTracker().getTotalOutstandingRequests(), 2); }
);
}

private void restartCluster(Settings settings) throws Exception {
internalCluster().fullRestart(new InternalTestCluster.RestartCallback() {
@Override
Expand Down

0 comments on commit a97a425

Please sign in to comment.