From 5eaaabce7f03b31146585a58689377ba4e6f7845 Mon Sep 17 00:00:00 2001 From: Fangjin Yang Date: Fri, 22 Mar 2013 17:05:39 -0700 Subject: [PATCH 1/2] fix for concurrent modifications in druid server --- .../main/java/com/metamx/druid/client/DruidServer.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/com/metamx/druid/client/DruidServer.java b/client/src/main/java/com/metamx/druid/client/DruidServer.java index a71d8a15ac7..ff565e04fce 100644 --- a/client/src/main/java/com/metamx/druid/client/DruidServer.java +++ b/client/src/main/java/com/metamx/druid/client/DruidServer.java @@ -24,8 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; import com.metamx.common.logger.Logger; - - import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -41,7 +39,7 @@ public class DruidServer implements Comparable private final String name; private final ConcurrentMap dataSources; - private final Map segments; + private final ConcurrentMap segments; private final String host; private final long maxSize; @@ -80,7 +78,7 @@ public class DruidServer implements Comparable this.tier = tier; this.dataSources = new ConcurrentHashMap(); - this.segments = new HashMap(); + this.segments = new ConcurrentHashMap(); } public String getName() @@ -132,7 +130,7 @@ public class DruidServer implements Comparable @JsonProperty public Map getSegments() { - return segments; + return ImmutableMap.copyOf(segments); } public DataSegment getSegment(String segmentName) From dcd10e69c720d7281a1a92ce0235e177e843eac8 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Sun, 24 Mar 2013 18:19:32 -0700 Subject: [PATCH 2/2] WorkerTaskMonitor: Fix isTaskRunning check --- .../java/com/metamx/druid/merger/worker/WorkerTaskMonitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merger/src/main/java/com/metamx/druid/merger/worker/WorkerTaskMonitor.java b/merger/src/main/java/com/metamx/druid/merger/worker/WorkerTaskMonitor.java index 400abec76fe..02e95a0ef39 100644 --- a/merger/src/main/java/com/metamx/druid/merger/worker/WorkerTaskMonitor.java +++ b/merger/src/main/java/com/metamx/druid/merger/worker/WorkerTaskMonitor.java @@ -175,7 +175,7 @@ public class WorkerTaskMonitor implements QuerySegmentWalker private boolean isTaskRunning(final Task task) { for (final Task runningTask : running) { - if (runningTask.equals(task.getId())) { + if (runningTask.getId().equals(task.getId())) { return true; } }