[TEST] Fix per-segment / per-commit exclude logic in CorruptFileTest
This commit is contained in:
parent
b2827a09a9
commit
88aec9e3c0
|
@ -464,10 +464,10 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest {
|
||||||
files.addAll(Arrays.asList(file.listFiles(new FileFilter() {
|
files.addAll(Arrays.asList(file.listFiles(new FileFilter() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(File pathname) {
|
public boolean accept(File pathname) {
|
||||||
return pathname.isFile() && !"write.lock".equals(pathname.getName()) &&
|
if (pathname.isFile() && "write.lock".equals(pathname.getName()) == false) {
|
||||||
(includePerCommitFiles == true // .del and segments_N are per commit files and might change after corruption
|
return (includePerCommitFiles || isPerSegmentFile(pathname.getName()));
|
||||||
|| pathname.getName().startsWith("segments") == false
|
}
|
||||||
|| pathname.getName().endsWith(".del") == false);
|
return false; // no dirs no write.locks
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@ -514,6 +514,15 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest {
|
||||||
return shardRouting;
|
return shardRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final boolean isPerCommitFile(String fileName) {
|
||||||
|
// .del and segments_N are per commit files and might change after corruption
|
||||||
|
return fileName.startsWith("segments") || fileName.endsWith(".del");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final boolean isPerSegmentFile(String fileName) {
|
||||||
|
return isPerCommitFile(fileName) == false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prunes the list of index files such that only the latest del generation files are contained.
|
* prunes the list of index files such that only the latest del generation files are contained.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue