minor fix for cleanup of historical cache file

This commit is contained in:
fjy 2014-06-20 10:42:03 -07:00
parent 12ee17c4d2
commit b978eb33f1
1 changed files with 5 additions and 6 deletions

View File

@ -20,7 +20,6 @@
package io.druid.server.coordination; package io.druid.server.coordination;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.metamx.common.concurrent.ScheduledExecutorFactory; import com.metamx.common.concurrent.ScheduledExecutorFactory;
@ -236,11 +235,6 @@ public class ZkCoordinator extends BaseZkCoordinator
public void removeSegment(final DataSegment segment, final DataSegmentChangeCallback callback) public void removeSegment(final DataSegment segment, final DataSegmentChangeCallback callback)
{ {
try { try {
File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier());
if (!segmentInfoCacheFile.delete()) {
log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile);
}
announcer.unannounceSegment(segment); announcer.unannounceSegment(segment);
log.info("Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis()); log.info("Completely removing [%s] in [%,d] millis", segment.getIdentifier(), config.getDropSegmentDelayMillis());
@ -252,6 +246,11 @@ public class ZkCoordinator extends BaseZkCoordinator
{ {
try { try {
serverManager.dropSegment(segment); serverManager.dropSegment(segment);
File segmentInfoCacheFile = new File(config.getInfoDir(), segment.getIdentifier());
if (!segmentInfoCacheFile.delete()) {
log.warn("Unable to delete segmentInfoCacheFile[%s]", segmentInfoCacheFile);
}
} }
catch (Exception e) { catch (Exception e) {
log.makeAlert(e, "Failed to remove segment! Possible resource leak!") log.makeAlert(e, "Failed to remove segment! Possible resource leak!")