mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-29 18:03:32 -04:00
Catch NoSuchDirectoryException on consistency check - the directory might not be there anymore
This commit is contained in:
parent
7a6fb892c9
commit
8163107be5
1 changed files with 25 additions and 20 deletions
|
@ -210,6 +210,7 @@ public final class DistributorDirectory extends BaseDirectory {
|
||||||
static boolean assertConsistency(ESLogger logger, DistributorDirectory dir) throws IOException {
|
static boolean assertConsistency(ESLogger logger, DistributorDirectory dir) throws IOException {
|
||||||
boolean consistent = true;
|
boolean consistent = true;
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
try {
|
||||||
Directory[] all = dir.distributor.all();
|
Directory[] all = dir.distributor.all();
|
||||||
for (Directory d : all) {
|
for (Directory d : all) {
|
||||||
for (String file : d.listAll()) {
|
for (String file : d.listAll()) {
|
||||||
|
@ -233,6 +234,10 @@ public final class DistributorDirectory extends BaseDirectory {
|
||||||
logger.info(builder.toString());
|
logger.info(builder.toString());
|
||||||
}
|
}
|
||||||
assert consistent: 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
|
return consistent; // return boolean so it can be easily be used in asserts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue