[TEST] Wait on all data nodes to be blocked if blocks active
Fixes race condition in MockRepository where unblock happens before block
This commit is contained in:
parent
422df6089c
commit
afb54bab44
|
@ -149,15 +149,15 @@ public abstract class AbstractSnapshotIntegTestCase extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void waitForBlockOnAnyDataNode(String repository, TimeValue timeout) throws InterruptedException {
|
||||
public void waitForBlockOnAllDataNodes(String repository, TimeValue timeout) throws InterruptedException {
|
||||
if (false == awaitBusy(() -> {
|
||||
for(RepositoriesService repositoriesService : internalCluster().getDataNodeInstances(RepositoriesService.class)) {
|
||||
MockRepository mockRepository = (MockRepository) repositoriesService.repository(repository);
|
||||
if (mockRepository.blocked()) {
|
||||
return true;
|
||||
if (mockRepository.blocked() == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}, timeout.millis(), TimeUnit.MILLISECONDS)) {
|
||||
fail("Timeout waiting for repository block on any data node!!!");
|
||||
}
|
||||
|
|
|
@ -1860,7 +1860,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|||
if (initBlocking) {
|
||||
waitForBlock(internalCluster().getMasterName(), "test-repo", TimeValue.timeValueMinutes(1));
|
||||
} else {
|
||||
waitForBlockOnAnyDataNode("test-repo", TimeValue.timeValueMinutes(1));
|
||||
waitForBlockOnAllDataNodes("test-repo", TimeValue.timeValueMinutes(1));
|
||||
}
|
||||
try {
|
||||
if (allowPartial) {
|
||||
|
@ -1957,7 +1957,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
|||
.execute();
|
||||
|
||||
logger.info("--> waiting for block to kick in");
|
||||
waitForBlockOnAnyDataNode("test-repo", TimeValue.timeValueSeconds(60));
|
||||
waitForBlockOnAllDataNodes("test-repo", TimeValue.timeValueMinutes(1));
|
||||
|
||||
logger.info("--> close index while restore is running");
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue