[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() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
return pathname.isFile() && !"write.lock".equals(pathname.getName()) &&
|
||||
(includePerCommitFiles == true // .del and segments_N are per commit files and might change after corruption
|
||||
|| pathname.getName().startsWith("segments") == false
|
||||
|| pathname.getName().endsWith(".del") == false);
|
||||
if (pathname.isFile() && "write.lock".equals(pathname.getName()) == false) {
|
||||
return (includePerCommitFiles || isPerSegmentFile(pathname.getName()));
|
||||
}
|
||||
return false; // no dirs no write.locks
|
||||
}
|
||||
})));
|
||||
}
|
||||
|
@ -514,6 +514,15 @@ public class CorruptedFileTest extends ElasticsearchIntegrationTest {
|
|||
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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue