Skip to content

Commit

Permalink
Improve watcher cleanup logic (#67554)
Browse files Browse the repository at this point in the history
by waiting for all tasks to complete before deleting watcher history data stream.

Closes #66495
  • Loading branch information
martijnvg authored Jan 15, 2021
1 parent 76d0e35 commit 1c85599
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public void _cleanup() throws Exception {
// Clear all internal watcher state for the next test method:
logger.info("[#{}]: clearing watcher state", getTestName());
stopWatcher();
// Wait for all pending tasks to complete, this to avoid any potential incoming writes
// to watcher history data stream to recreate the data stream after it has been created.
// Otherwise ESIntegTestCase test cluster's wipe cluster logic that deletes all indices may fail,
// because it attempts to remove the write index of an existing data stream.
waitNoPendingTasksOnAll();
String[] dataStreamsToDelete = {HistoryStoreField.DATA_STREAM};
client().execute(DeleteDataStreamAction.INSTANCE, new DeleteDataStreamAction.Request(dataStreamsToDelete));
GetDataStreamAction.Request getDataStreamRequest = new GetDataStreamAction.Request(dataStreamsToDelete);
Expand Down

0 comments on commit 1c85599

Please sign in to comment.