[TEST] MockRepository should also unblock repositories that are not blocked yet
This commit is contained in:
parent
22ee910f43
commit
625695a92a
|
@ -149,15 +149,15 @@ public abstract class AbstractSnapshotIntegTestCase extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void waitForBlockOnAllDataNodes(String repository, TimeValue timeout) throws InterruptedException {
|
||||
public void waitForBlockOnAnyDataNode(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() == false) {
|
||||
return false;
|
||||
if (mockRepository.blocked()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}, 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 {
|
||||
waitForBlockOnAllDataNodes("test-repo", TimeValue.timeValueMinutes(1));
|
||||
waitForBlockOnAnyDataNode("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");
|
||||
waitForBlockOnAllDataNodes("test-repo", TimeValue.timeValueMinutes(1));
|
||||
waitForBlockOnAnyDataNode("test-repo", TimeValue.timeValueMinutes(1));
|
||||
|
||||
logger.info("--> close index while restore is running");
|
||||
try {
|
||||
|
|
|
@ -176,14 +176,12 @@ public class MockRepository extends FsRepository {
|
|||
}
|
||||
|
||||
public synchronized void unblockExecution() {
|
||||
if (blocked) {
|
||||
blocked = false;
|
||||
// Clean blocking flags, so we wouldn't try to block again
|
||||
blockOnDataFiles = false;
|
||||
blockOnControlFiles = false;
|
||||
blockOnInitialization = false;
|
||||
this.notifyAll();
|
||||
}
|
||||
blocked = false;
|
||||
// Clean blocking flags, so we wouldn't try to block again
|
||||
blockOnDataFiles = false;
|
||||
blockOnControlFiles = false;
|
||||
blockOnInitialization = false;
|
||||
this.notifyAll();
|
||||
}
|
||||
|
||||
public boolean blocked() {
|
||||
|
|
Loading…
Reference in New Issue