diff --git a/realtime/src/main/java/com/metamx/druid/realtime/plumber/RealtimePlumberSchool.java b/realtime/src/main/java/com/metamx/druid/realtime/plumber/RealtimePlumberSchool.java index 21a28062537..849cf8ea1a9 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/plumber/RealtimePlumberSchool.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/plumber/RealtimePlumberSchool.java @@ -70,6 +70,7 @@ import org.joda.time.Period; import javax.annotation.Nullable; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.util.Arrays; import java.util.Comparator; @@ -377,7 +378,14 @@ public class RealtimePlumberSchool implements PlumberSchool for (File sinkDir : computeBaseDir(schema).listFiles()) { Interval sinkInterval = new Interval(sinkDir.getName().replace("_", "/")); - final File[] sinkFiles = sinkDir.listFiles(); + //final File[] sinkFiles = sinkDir.listFiles(); + // To avoid reading and listing of "merged" dir + final File[] sinkFiles = sinkDir.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String fileName) { + return !(Ints.tryParse(fileName) == null); + } + }); Arrays.sort( sinkFiles, new Comparator() @@ -400,6 +408,15 @@ public class RealtimePlumberSchool implements PlumberSchool List hydrants = Lists.newArrayList(); for (File segmentDir : sinkFiles) { log.info("Loading previously persisted segment at [%s]", segmentDir); + + // 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(Ints.tryParse(segmentDir.getName()) == null) + { + continue; + } + hydrants.add( new FireHydrant( new QueryableIndexSegment(null, IndexIO.loadIndex(segmentDir)),