Merge pull request #2530 from himanshug/fix_plumber

In persistAndMerge, increase the scope of try-catch block so that any…
This commit is contained in:
Nishant 2016-02-24 22:41:32 +05:30
commit 6ac32c5518
1 changed files with 37 additions and 36 deletions

View File

@ -48,8 +48,8 @@ import io.druid.common.guava.ThreadRenamingCallable;
import io.druid.common.guava.ThreadRenamingRunnable;
import io.druid.common.utils.VMUtils;
import io.druid.concurrent.Execs;
import io.druid.data.input.Committer;
import io.druid.concurrent.TaskThreadPriority;
import io.druid.data.input.Committer;
import io.druid.data.input.InputRow;
import io.druid.query.MetricsEmittingQueryRunner;
import io.druid.query.NoopQueryRunner;
@ -59,7 +59,6 @@ import io.druid.query.QueryRunnerFactory;
import io.druid.query.QueryRunnerFactoryConglomerate;
import io.druid.query.QueryRunnerHelper;
import io.druid.query.QueryToolChest;
import io.druid.query.ReportTimelineMissingSegmentQueryRunner;
import io.druid.query.SegmentDescriptor;
import io.druid.query.spec.SpecificSegmentQueryRunner;
import io.druid.query.spec.SpecificSegmentSpec;
@ -69,7 +68,6 @@ import io.druid.segment.IndexSpec;
import io.druid.segment.Metadata;
import io.druid.segment.QueryableIndex;
import io.druid.segment.QueryableIndexSegment;
import io.druid.segment.ReferenceCountingSegment;
import io.druid.segment.Segment;
import io.druid.segment.incremental.IndexSizeExceededException;
import io.druid.segment.indexing.DataSchema;
@ -90,7 +88,6 @@ import org.joda.time.Interval;
import org.joda.time.Period;
import javax.annotation.Nullable;
import javax.ws.rs.HEAD;
import java.io.Closeable;
import java.io.File;
import java.io.FilenameFilter;
@ -481,11 +478,13 @@ public class RealtimePlumber implements Plumber
mergeExecutor.execute(
new ThreadRenamingRunnable(threadName)
{
final Interval interval = sink.getInterval();
Stopwatch mergeStopwatch = null;
@Override
public void doRun()
{
final Interval interval = sink.getInterval();
try {
// Bail out if this sink has been abandoned by a previously-executed task.
if (sinks.get(truncatedTime) != sink) {
log.info("Sink[%s] was abandoned, bailing out of persist-n-merge.", sink);
@ -523,8 +522,8 @@ public class RealtimePlumber implements Plumber
}
}
final long mergeThreadCpuTime = VMUtils.safeGetThreadCpuTime();
final Stopwatch mergeStopwatch = Stopwatch.createStarted();
try {
mergeStopwatch = Stopwatch.createStarted();
List<QueryableIndex> indexes = Lists.newArrayList();
for (FireHydrant fireHydrant : sink) {
Segment segment = fireHydrant.getSegment();
@ -575,10 +574,12 @@ public class RealtimePlumber implements Plumber
}
}
finally {
if (mergeStopwatch != null) {
mergeStopwatch.stop();
}
}
}
}
);
handoffNotifier.registerSegmentHandoffCallback(
new SegmentDescriptor(sink.getInterval(), sink.getVersion(), config.getShardSpec().getPartitionNum()),