From be66d4b8229f77fb97785244859c0b6e67abe816 Mon Sep 17 00:00:00 2001 From: David Lim Date: Tue, 30 Jan 2018 11:33:07 -0700 Subject: [PATCH] clean up intermediate_pushes directory for LocalDataSegmentPusher (#5306) --- .../io/druid/segment/loading/LocalDataSegmentPusher.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/io/druid/segment/loading/LocalDataSegmentPusher.java b/server/src/main/java/io/druid/segment/loading/LocalDataSegmentPusher.java index 0c00e0aeb33..f60228dfeb3 100644 --- a/server/src/main/java/io/druid/segment/loading/LocalDataSegmentPusher.java +++ b/server/src/main/java/io/druid/segment/loading/LocalDataSegmentPusher.java @@ -73,9 +73,8 @@ public class LocalDataSegmentPusher implements DataSegmentPusher @Override public DataSegment push(File dataSegmentFile, DataSegment segment, boolean replaceExisting) throws IOException { - final String storageDir = this.getStorageDir(segment); final File baseStorageDir = config.getStorageDirectory(); - final File outDir = new File(baseStorageDir, storageDir); + final File outDir = new File(baseStorageDir, this.getStorageDir(segment)); log.info("Copying segment[%s] to local filesystem at location[%s]", segment.getIdentifier(), outDir.toString()); @@ -93,7 +92,7 @@ public class LocalDataSegmentPusher implements DataSegmentPusher ); } - final File tmpOutDir = new File(baseStorageDir, intermediateDirFor(storageDir)); + final File tmpOutDir = new File(baseStorageDir, makeIntermediateDir()); log.info("Creating intermediate directory[%s] for segment[%s]", tmpOutDir.toString(), segment.getIdentifier()); FileUtils.forceMkdir(tmpOutDir); @@ -150,9 +149,9 @@ public class LocalDataSegmentPusher implements DataSegmentPusher return ImmutableMap.of("type", "local", "path", finalIndexZipFilePath.getPath()); } - private String intermediateDirFor(String storageDir) + private String makeIntermediateDir() { - return "intermediate_pushes/" + storageDir + "." + UUID.randomUUID().toString(); + return "intermediate_pushes/" + UUID.randomUUID().toString(); } private long compressSegment(File dataSegmentFile, File dest) throws IOException