From 0e4db00d5448038274ad600748099b2ac28fd66e Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Mon, 11 Mar 2013 11:15:19 -0700 Subject: [PATCH] TaskQueue: Fix task ordering when bootstrapping --- .../com/metamx/druid/merger/coordinator/TaskQueue.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/merger/src/main/java/com/metamx/druid/merger/coordinator/TaskQueue.java b/merger/src/main/java/com/metamx/druid/merger/coordinator/TaskQueue.java index e16912b4c6e..8dd44cb5131 100644 --- a/merger/src/main/java/com/metamx/druid/merger/coordinator/TaskQueue.java +++ b/merger/src/main/java/com/metamx/druid/merger/coordinator/TaskQueue.java @@ -105,17 +105,17 @@ public class TaskQueue } // Sort locks by version - final Ordering byVersionOrdering = new Ordering() + final Ordering> byVersionOrdering = new Ordering>() { @Override - public int compare(TaskLock left, TaskLock right) + public int compare(Map.Entry left, Map.Entry right) { - return left.getVersion().compareTo(right.getVersion()); + return left.getKey().getVersion().compareTo(right.getKey().getVersion()); } }; // Acquire as many locks as possible, in version order - for(final Map.Entry taskAndLock : tasksByLock.entries()) { + for(final Map.Entry taskAndLock : byVersionOrdering.sortedCopy(tasksByLock.entries())) { final Task task = taskAndLock.getValue(); final TaskLock savedTaskLock = taskAndLock.getKey();