From e65e6a49a55f70ed5db40472ea3c27cbd63ca7c7 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Wed, 2 Mar 2016 10:09:04 -0800 Subject: [PATCH] RealtimeTuningConfig: Use different default basePersistDirectory per instance. --- .../indexing/RealtimeTuningConfig.java | 12 +++-- .../segment/realtime/FireDepartment.java | 2 +- .../indexing/RealtimeTuningConfigTest.java | 45 +++++++++++++++++++ .../segment/realtime/FireDepartmentTest.java | 4 +- 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 server/src/test/java/io/druid/segment/indexing/RealtimeTuningConfigTest.java diff --git a/server/src/main/java/io/druid/segment/indexing/RealtimeTuningConfig.java b/server/src/main/java/io/druid/segment/indexing/RealtimeTuningConfig.java index e32a25d3040..1e9e4adc999 100644 --- a/server/src/main/java/io/druid/segment/indexing/RealtimeTuningConfig.java +++ b/server/src/main/java/io/druid/segment/indexing/RealtimeTuningConfig.java @@ -40,7 +40,6 @@ public class RealtimeTuningConfig implements TuningConfig private static final int defaultMaxRowsInMemory = 75000; private static final Period defaultIntermediatePersistPeriod = new Period("PT10M"); private static final Period defaultWindowPeriod = new Period("PT10M"); - private static final File defaultBasePersistDirectory = Files.createTempDir(); private static final VersioningPolicy defaultVersioningPolicy = new IntervalStartVersioningPolicy(); private static final RejectionPolicyFactory defaultRejectionPolicyFactory = new ServerTimeRejectionPolicyFactory(); private static final int defaultMaxPendingPersists = 0; @@ -49,14 +48,19 @@ public class RealtimeTuningConfig implements TuningConfig private static final Boolean defaultBuildV9Directly = Boolean.FALSE; private static final Boolean defaultReportParseExceptions = Boolean.FALSE; + private static File createNewBasePersistDirectory() + { + return Files.createTempDir(); + } + // Might make sense for this to be a builder - public static RealtimeTuningConfig makeDefaultTuningConfig() + public static RealtimeTuningConfig makeDefaultTuningConfig(final File basePersistDirectory) { return new RealtimeTuningConfig( defaultMaxRowsInMemory, defaultIntermediatePersistPeriod, defaultWindowPeriod, - defaultBasePersistDirectory, + basePersistDirectory == null ? createNewBasePersistDirectory() : basePersistDirectory, defaultVersioningPolicy, defaultRejectionPolicyFactory, defaultMaxPendingPersists, @@ -105,7 +109,7 @@ public class RealtimeTuningConfig implements TuningConfig ? defaultIntermediatePersistPeriod : intermediatePersistPeriod; this.windowPeriod = windowPeriod == null ? defaultWindowPeriod : windowPeriod; - this.basePersistDirectory = basePersistDirectory == null ? defaultBasePersistDirectory : basePersistDirectory; + this.basePersistDirectory = basePersistDirectory == null ? createNewBasePersistDirectory() : basePersistDirectory; this.versioningPolicy = versioningPolicy == null ? defaultVersioningPolicy : versioningPolicy; this.rejectionPolicyFactory = rejectionPolicyFactory == null ? defaultRejectionPolicyFactory diff --git a/server/src/main/java/io/druid/segment/realtime/FireDepartment.java b/server/src/main/java/io/druid/segment/realtime/FireDepartment.java index 44d1e111851..8114d903256 100644 --- a/server/src/main/java/io/druid/segment/realtime/FireDepartment.java +++ b/server/src/main/java/io/druid/segment/realtime/FireDepartment.java @@ -59,7 +59,7 @@ public class FireDepartment extends IngestionSpec