[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(() -> {
|
if (false == awaitBusy(() -> {
|
||||||
for(RepositoriesService repositoriesService : internalCluster().getDataNodeInstances(RepositoriesService.class)) {
|
for(RepositoriesService repositoriesService : internalCluster().getDataNodeInstances(RepositoriesService.class)) {
|
||||||
MockRepository mockRepository = (MockRepository) repositoriesService.repository(repository);
|
MockRepository mockRepository = (MockRepository) repositoriesService.repository(repository);
|
||||||
if (mockRepository.blocked() == false) {
|
if (mockRepository.blocked()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}, timeout.millis(), TimeUnit.MILLISECONDS)) {
|
}, timeout.millis(), TimeUnit.MILLISECONDS)) {
|
||||||
fail("Timeout waiting for repository block on any data node!!!");
|
fail("Timeout waiting for repository block on any data node!!!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1860,7 +1860,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
||||||
if (initBlocking) {
|
if (initBlocking) {
|
||||||
waitForBlock(internalCluster().getMasterName(), "test-repo", TimeValue.timeValueMinutes(1));
|
waitForBlock(internalCluster().getMasterName(), "test-repo", TimeValue.timeValueMinutes(1));
|
||||||
} else {
|
} else {
|
||||||
waitForBlockOnAllDataNodes("test-repo", TimeValue.timeValueMinutes(1));
|
waitForBlockOnAnyDataNode("test-repo", TimeValue.timeValueMinutes(1));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (allowPartial) {
|
if (allowPartial) {
|
||||||
|
@ -1957,7 +1957,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
logger.info("--> waiting for block to kick in");
|
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");
|
logger.info("--> close index while restore is running");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -176,7 +176,6 @@ public class MockRepository extends FsRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void unblockExecution() {
|
public synchronized void unblockExecution() {
|
||||||
if (blocked) {
|
|
||||||
blocked = false;
|
blocked = false;
|
||||||
// Clean blocking flags, so we wouldn't try to block again
|
// Clean blocking flags, so we wouldn't try to block again
|
||||||
blockOnDataFiles = false;
|
blockOnDataFiles = false;
|
||||||
|
@ -184,7 +183,6 @@ public class MockRepository extends FsRepository {
|
||||||
blockOnInitialization = false;
|
blockOnInitialization = false;
|
||||||
this.notifyAll();
|
this.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public boolean blocked() {
|
public boolean blocked() {
|
||||||
return blocked;
|
return blocked;
|
||||||
|
|
Loading…
Reference in New Issue