Update RealtimePlumberSchool.java

Put a check to make sure that we're only looking for the folder those have number-only names, to avoid "merged" directory issue.
This commit is contained in:
kOD-dKOD 2013-06-11 12:05:17 +05:30
parent a0462374b0
commit 270a4993ce
1 changed files with 6 additions and 4 deletions

View File

@ -383,7 +383,7 @@ public class RealtimePlumberSchool implements PlumberSchool
final File[] sinkFiles = sinkDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String fileName) {
return !fileName.equalsIgnoreCase("merged");
return !(Ints.tryParse(fileName) == null);
}
});
Arrays.sort(
@ -409,12 +409,14 @@ public class RealtimePlumberSchool implements PlumberSchool
for (File segmentDir : sinkFiles) {
log.info("Loading previously persisted segment at [%s]", segmentDir);
// Although this is has been tackled at start of this method.
// Although this has been tackled at start of this method.
// Just a doubly-check added to skip "merged" dir. from being added to hydrants
// If 100% sure that this is not needed, this check can be removed.
if(segmentDir.getName().equalsIgnoreCase("merged"))
if(Ints.tryParse(segmentDir.getName()) == null)
{
continue;
}
hydrants.add(
new FireHydrant(
new QueryableIndexSegment(null, IndexIO.loadIndex(segmentDir)),