mirror of https://github.com/apache/druid.git
Fix persist of empty indexes in index generator job
This commit is contained in:
parent
4102dbd1e0
commit
778fd0f10e
|
@ -121,6 +121,10 @@ public class IndexMerger
|
|||
final IncrementalIndex index, final Interval dataInterval, File outDir, ProgressIndicator progress
|
||||
) throws IOException
|
||||
{
|
||||
if (index.isEmpty()) {
|
||||
throw new IAE("Trying to persist an empty index!");
|
||||
}
|
||||
|
||||
final long firstTimestamp = index.getMinTime().getMillis();
|
||||
final long lastTimestamp = index.getMaxTime().getMillis();
|
||||
if (!(dataInterval.contains(firstTimestamp) && dataInterval.contains(lastTimestamp))) {
|
||||
|
|
|
@ -321,7 +321,7 @@ public class IndexGeneratorJob implements Jobby
|
|||
List<QueryableIndex> indexes = Lists.newArrayListWithCapacity(indexCount);
|
||||
final File mergedBase;
|
||||
|
||||
if (toMerge.size() == 0) {
|
||||
if (toMerge.size() == 0 && !index.isEmpty()) {
|
||||
mergedBase = new File(baseFlushFile, "merged");
|
||||
IndexMerger.persist(
|
||||
index, interval, mergedBase, new IndexMerger.ProgressIndicator()
|
||||
|
@ -334,6 +334,7 @@ public class IndexGeneratorJob implements Jobby
|
|||
}
|
||||
);
|
||||
} else {
|
||||
if (!index.isEmpty()) {
|
||||
final File finalFile = new File(baseFlushFile, "final");
|
||||
IndexMerger.persist(
|
||||
index, interval, finalFile, new IndexMerger.ProgressIndicator()
|
||||
|
@ -346,6 +347,7 @@ public class IndexGeneratorJob implements Jobby
|
|||
}
|
||||
);
|
||||
toMerge.add(finalFile);
|
||||
}
|
||||
|
||||
for (File file : toMerge) {
|
||||
indexes.add(IndexIO.loadIndex(file));
|
||||
|
|
Loading…
Reference in New Issue