diff --git a/server/src/main/java/com/metamx/druid/master/SegmentReplicantLookup.java b/server/src/main/java/com/metamx/druid/master/SegmentReplicantLookup.java index 5c5d3bee655..3ba778ababe 100644 --- a/server/src/main/java/com/metamx/druid/master/SegmentReplicantLookup.java +++ b/server/src/main/java/com/metamx/druid/master/SegmentReplicantLookup.java @@ -42,18 +42,7 @@ public class SegmentReplicantLookup for (ServerHolder serverHolder : serversByType) { DruidServer server = serverHolder.getServer(); - for (DruidDataSource dataSource : server.getDataSources()) { - for (DataSegment segment : dataSource.getSegments()) { - Integer numReplicants = segmentsInCluster.get(segment.getIdentifier(), server.getTier()); - if (numReplicants == null) { - numReplicants = 0; - } - segmentsInCluster.put(segment.getIdentifier(), server.getTier(), ++numReplicants); - } - } - - // Also account for queued segments - for (DataSegment segment : serverHolder.getPeon().getSegmentsToLoad()) { + for (DataSegment segment : server.getSegments().values()) { Integer numReplicants = segmentsInCluster.get(segment.getIdentifier(), server.getTier()); if (numReplicants == null) { numReplicants = 0; diff --git a/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java b/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java index f3b5de84bf9..ab093f4e070 100644 --- a/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java +++ b/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java @@ -84,6 +84,7 @@ public abstract class LoadRule implements Rule break; } if (holder.containsSegment(segment)) { + serverQueue.add(holder); continue; } diff --git a/server/src/test/java/com/metamx/druid/master/DruidMasterRuleRunnerTest.java b/server/src/test/java/com/metamx/druid/master/DruidMasterRuleRunnerTest.java index acde8a14707..3d0e28b640c 100644 --- a/server/src/test/java/com/metamx/druid/master/DruidMasterRuleRunnerTest.java +++ b/server/src/test/java/com/metamx/druid/master/DruidMasterRuleRunnerTest.java @@ -536,7 +536,6 @@ public class DruidMasterRuleRunnerTest { mockPeon.dropSegment(EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.expectLastCall().atLeastOnce(); - EasyMock.expect(mockPeon.getSegmentsToLoad()).andReturn(Sets.newHashSet()).atLeastOnce(); EasyMock.expect(mockPeon.getLoadQueueSize()).andReturn(0L).atLeastOnce(); EasyMock.replay(mockPeon); @@ -690,8 +689,6 @@ public class DruidMasterRuleRunnerTest { mockPeon.loadSegment(EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.expectLastCall().atLeastOnce(); - mockPeon.dropSegment(EasyMock.anyObject(), EasyMock.anyObject()); - EasyMock.expectLastCall().atLeastOnce(); EasyMock.expect(mockPeon.getSegmentsToLoad()).andReturn(Sets.newHashSet()).atLeastOnce(); EasyMock.expect(mockPeon.getLoadQueueSize()).andReturn(0L).atLeastOnce(); EasyMock.replay(mockPeon); @@ -759,6 +756,8 @@ public class DruidMasterRuleRunnerTest Assert.assertTrue(stats.getPerTierStats().get("droppedCount") == null); Assert.assertTrue(stats.getGlobalStats().get("deletedCount").get() == 12); + + EasyMock.verify(mockPeon); } @Test @@ -799,12 +798,10 @@ public class DruidMasterRuleRunnerTest mockPeon.dropSegment(EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.expectLastCall().atLeastOnce(); - EasyMock.expect(mockPeon.getSegmentsToLoad()).andReturn(Sets.newHashSet()).atLeastOnce(); EasyMock.expect(mockPeon.getLoadQueueSize()).andReturn(0L).atLeastOnce(); EasyMock.replay(mockPeon); LoadQueuePeon anotherMockPeon = EasyMock.createMock(LoadQueuePeon.class); - EasyMock.expect(anotherMockPeon.getSegmentsToLoad()).andReturn(Sets.newHashSet()).atLeastOnce(); EasyMock.expect(anotherMockPeon.getLoadQueueSize()).andReturn(10L).atLeastOnce(); EasyMock.replay(anotherMockPeon);