From 2aab2a0cd9a2afad78f10cd0c1740629e589c9a5 Mon Sep 17 00:00:00 2001 From: fjy Date: Thu, 19 Jun 2014 16:48:43 -0700 Subject: [PATCH] address cr --- .../java/io/druid/segment/loading/SegmentLoaderConfig.java | 2 +- .../java/io/druid/server/coordination/ZkCoordinator.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/io/druid/segment/loading/SegmentLoaderConfig.java b/server/src/main/java/io/druid/segment/loading/SegmentLoaderConfig.java index 78fc18fb92d..cefb275e946 100644 --- a/server/src/main/java/io/druid/segment/loading/SegmentLoaderConfig.java +++ b/server/src/main/java/io/druid/segment/loading/SegmentLoaderConfig.java @@ -38,7 +38,7 @@ public class SegmentLoaderConfig private boolean deleteOnRemove = true; @JsonProperty("dropSegmentDelayMillis") - private int dropSegmentDelayMillis = 0; + private int dropSegmentDelayMillis = 5 * 60 * 1000; // 5 mins @JsonProperty private File infoDir = null; diff --git a/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java b/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java index b2ab3ec1151..f2d3a2fd854 100644 --- a/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java +++ b/server/src/main/java/io/druid/server/coordination/ZkCoordinator.java @@ -233,7 +233,7 @@ public class ZkCoordinator extends BaseZkCoordinator @Override - public void removeSegment(final DataSegment segment, DataSegmentChangeCallback callback) + public void removeSegment(final DataSegment segment, final DataSegmentChangeCallback callback) { try { File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier()); @@ -243,6 +243,7 @@ public class ZkCoordinator extends BaseZkCoordinator announcer.unannounceSegment(segment); + log.info("Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis()); exec.schedule( new Runnable() { @@ -253,6 +254,9 @@ public class ZkCoordinator extends BaseZkCoordinator serverManager.dropSegment(segment); } catch (Exception e) { + log.makeAlert(e, "Failed to remove segment! Possible resource leak!") + .addData("segment", segment) + .emit(); throw Throwables.propagate(e); } }