Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ tests:
- class: org.elasticsearch.xpack.spatial.search.GeoGridAggAndQueryConsistencyIT
method: testGeoShapeGeoHash
issue: https://github.com/elastic/elasticsearch/issues/115664
- class: org.elasticsearch.indices.mapping.UpdateMappingIntegrationIT
issue: https://github.com/elastic/elasticsearch/issues/116126
- class: org.elasticsearch.upgrades.FullClusterRestartIT
method: testSnapshotRestore {cluster=OLD}
issue: https://github.com/elastic/elasticsearch/issues/111777
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ public void indexRandom(boolean forceRefresh, boolean dummyDocuments, boolean ma
}
}
for (CountDownLatch operation : inFlightAsyncOperations) {
safeAwait(operation);
safeAwait(operation, TEST_REQUEST_TIMEOUT);
}
if (bogusIds.isEmpty() == false) {
// delete the bogus types again - it might trigger merges or at least holes in the segments and enforces deleted docs!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,22 @@ public static void safeAwait(CountDownLatch countDownLatch) {
}
}

/**
* Await on the given {@link CountDownLatch} with a supplied timeout, preserving the thread's interrupt status
* flag and asserting that the latch is indeed completed before the timeout.
*/
public static void safeAwait(CountDownLatch countDownLatch, TimeValue timeout) {
try {
assertTrue(
"safeAwait: CountDownLatch did not reach zero within the timeout",
countDownLatch.await(timeout.millis(), TimeUnit.MILLISECONDS)
);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
fail(e, "safeAwait: interrupted waiting for CountDownLatch to reach zero");
}
}

/**
* Acquire a single permit from the given {@link Semaphore}, with a timeout of {@link #SAFE_AWAIT_TIMEOUT}, preserving the thread's
* interrupt status flag and asserting that the permit was successfully acquired.
Expand Down