From 7ced0e8759143bf35f598f0a48c192bb21e5c6be Mon Sep 17 00:00:00 2001 From: Himanshu Date: Wed, 4 Jan 2017 18:52:22 -0600 Subject: [PATCH] log sizes of created smoosh files (#3817) * log when merging of intermediate segments starts during batch ingestion * log sizes of created smoosh files --- .../java/io/druid/indexer/IndexGeneratorJob.java | 7 +++++++ .../java/util/common/io/smoosh/FileSmoosher.java | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java index 60f372da802..7de1194b399 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java @@ -695,9 +695,16 @@ public class IndexGeneratorJob implements Jobby for (File file : toMerge) { indexes.add(HadoopDruidIndexerConfig.INDEX_IO.loadIndex(file)); } + + log.info("starting merge of intermediate persisted segments."); + long mergeStartTime = System.currentTimeMillis(); mergedBase = mergeQueryableIndex( indexes, aggregators, new File(baseFlushFile, "merged"), progressIndicator ); + log.info( + "finished merge of intermediate persisted segments. time taken [%d] ms.", + (System.currentTimeMillis() - mergeStartTime) + ); } final FileSystem outputFS = new Path(config.getSchema().getIOConfig().getSegmentOutputPath()) .getFileSystem(context.getConfiguration()); diff --git a/java-util/src/main/java/io/druid/java/util/common/io/smoosh/FileSmoosher.java b/java-util/src/main/java/io/druid/java/util/common/io/smoosh/FileSmoosher.java index 7e2991e2d01..416eacaa6fd 100644 --- a/java-util/src/main/java/io/druid/java/util/common/io/smoosh/FileSmoosher.java +++ b/java-util/src/main/java/io/druid/java/util/common/io/smoosh/FileSmoosher.java @@ -414,25 +414,27 @@ public class FileSmoosher implements Closeable final int fileNum = outFiles.size(); File outFile = makeChunkFile(baseDir, fileNum); outFiles.add(outFile); - return new Outer(fileNum, new FileOutputStream(outFile), maxChunkSize); + return new Outer(fileNum, outFile, maxChunkSize); } public static class Outer implements SmooshedWriter { private final int fileNum; private final int maxLength; + private final File outFile; private final GatheringByteChannel channel; private final Closer closer = Closer.create(); private int currOffset = 0; - Outer(int fileNum, FileOutputStream output, int maxLength) + Outer(int fileNum, File outFile, int maxLength) throws FileNotFoundException { this.fileNum = fileNum; - this.channel = output.getChannel(); + this.outFile = outFile; this.maxLength = maxLength; - closer.register(output); - closer.register(channel); + + FileOutputStream outStream = closer.register(new FileOutputStream(outFile)); + this.channel = closer.register(outStream.getChannel()); } public int getFileNum() @@ -494,6 +496,7 @@ public class FileSmoosher implements Closeable public void close() throws IOException { closer.close(); + FileSmoosher.LOG.info("Created smoosh file [%s] of size [%s] bytes.", outFile.getAbsolutePath(), outFile.length()); } } }