Merge pull request #2119 from navis/fix-sporadic-testfail2

Fix sporadic fail of DruidCoordinatorTest#testCoordinatorRun
This commit is contained in:
Himanshu 2015-12-21 23:28:32 -06:00
commit 7b5fd76058
2 changed files with 14 additions and 0 deletions

View File

@ -247,6 +247,16 @@ public class DruidCoordinator
return retVal; return retVal;
} }
CountingMap<String> getLoadPendingDatasources() {
final CountingMap<String> retVal = new CountingMap<>();
for (LoadQueuePeon peon : loadManagementPeons.values()) {
for (DataSegment segment : peon.getSegmentsToLoad()) {
retVal.add(segment.getDataSource(), 1);
}
}
return retVal;
}
public Map<String, Double> getLoadStatus() public Map<String, Double> getLoadStatus()
{ {
Map<String, Double> loadStatus = Maps.newHashMap(); Map<String, Double> loadStatus = Maps.newHashMap();

View File

@ -338,6 +338,10 @@ public class DruidCoordinatorTest extends CuratorTestBase
Assert.assertEquals(1, segmentAvailability.size()); Assert.assertEquals(1, segmentAvailability.size());
Assert.assertEquals(0l, segmentAvailability.get(dataSource)); Assert.assertEquals(0l, segmentAvailability.get(dataSource));
while (coordinator.getLoadPendingDatasources().get(dataSource).get() > 0) {
Thread.sleep(50);
}
Map<String, CountingMap<String>> replicationStatus = coordinator.getReplicationStatus(); Map<String, CountingMap<String>> replicationStatus = coordinator.getReplicationStatus();
Assert.assertNotNull(replicationStatus); Assert.assertNotNull(replicationStatus);
Assert.assertEquals(1, replicationStatus.entrySet().size()); Assert.assertEquals(1, replicationStatus.entrySet().size());