Catch NoSuchDirectoryException on consistency check - the directory might not be there anymore
This commit is contained in:
parent
7a6fb892c9
commit
8163107be5
|
@ -210,6 +210,7 @@ public final class DistributorDirectory extends BaseDirectory {
|
|||
static boolean assertConsistency(ESLogger logger, DistributorDirectory dir) throws IOException {
|
||||
boolean consistent = true;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
try {
|
||||
Directory[] all = dir.distributor.all();
|
||||
for (Directory d : all) {
|
||||
for (String file : d.listAll()) {
|
||||
|
@ -233,6 +234,10 @@ public final class DistributorDirectory extends BaseDirectory {
|
|||
logger.info(builder.toString());
|
||||
}
|
||||
assert consistent: builder.toString();
|
||||
} catch (NoSuchDirectoryException ex) {
|
||||
// that's fine - we can't check the directory since we might have already been wiped by a shutdown or
|
||||
// a test cleanup ie the directory is not there anymore.
|
||||
}
|
||||
return consistent; // return boolean so it can be easily be used in asserts
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue