address cr

This commit is contained in:
fjy 2014-06-19 16:48:43 -07:00
parent b313601a3b
commit 2aab2a0cd9
2 changed files with 6 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public class SegmentLoaderConfig
private boolean deleteOnRemove = true; private boolean deleteOnRemove = true;
@JsonProperty("dropSegmentDelayMillis") @JsonProperty("dropSegmentDelayMillis")
private int dropSegmentDelayMillis = 0; private int dropSegmentDelayMillis = 5 * 60 * 1000; // 5 mins
@JsonProperty @JsonProperty
private File infoDir = null; private File infoDir = null;

View File

@ -233,7 +233,7 @@ public class ZkCoordinator extends BaseZkCoordinator
@Override @Override
public void removeSegment(final DataSegment segment, DataSegmentChangeCallback callback) public void removeSegment(final DataSegment segment, final DataSegmentChangeCallback callback)
{ {
try { try {
File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier()); File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier());
@ -243,6 +243,7 @@ public class ZkCoordinator extends BaseZkCoordinator
announcer.unannounceSegment(segment); announcer.unannounceSegment(segment);
log.info("Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis());
exec.schedule( exec.schedule(
new Runnable() new Runnable()
{ {
@ -253,6 +254,9 @@ public class ZkCoordinator extends BaseZkCoordinator
serverManager.dropSegment(segment); serverManager.dropSegment(segment);
} }
catch (Exception e) { catch (Exception e) {
log.makeAlert(e, "Failed to remove segment! Possible resource leak!")
.addData("segment", segment)
.emit();
throw Throwables.propagate(e); throw Throwables.propagate(e);
} }
} }