jtuglu-netflix commented on code in PR #18162:
URL: https://github.com/apache/druid/pull/18162#discussion_r2157925612
##########
server/src/test/java/org/apache/druid/server/coordinator/simulate/SegmentBalancingTest.java:
##########
@@ -92,6 +92,42 @@ private void testBalancingWithAutoSyncInventory(boolean
autoSyncInventory)
verifyDatasourceIsFullyLoaded(datasource);
}
+ @Test
+ public void testBalancingDoesNotUnderReplicateSegment()
+ {
+ // historicals = 2(T1), replicas = 1(T1)
+ final CoordinatorSimulation sim =
+ CoordinatorSimulation.builder()
+ .withSegments(segments)
+ .withServers(historicalT11, historicalT12)
+ .withRules(datasource, Load.on(Tier.T1,
1).forever())
+ .build();
+
+ // Put all the segments on histT11
+ segments.forEach(historicalT11::addDataSegment);
+
+ // Run cycle and verify that segments have been chosen for balancing
+ startSimulation(sim);
+ runCoordinatorCycle();
+ verifyValue(Metric.MOVED_COUNT, 5L);
+
+ // Load segments, skip callbacks and verify that some segments are now
loaded on histT12
+ loadQueuedSegmentsSkipCallbacks();
+ Assert.assertEquals(10, historicalT11.getTotalSegments());
+ Assert.assertEquals(5, historicalT12.getTotalSegments());
+
+ // Run another coordinator cycle
+ runCoordinatorCycle();
+ loadQueuedSegmentsSkipCallbacks();
+
+ // Verify that segments have not been dropped from either server since
+ // MOVE_FROM operation is still not complete
+ Assert.assertEquals(10, historicalT11.getTotalSegments());
+ Assert.assertEquals(5, historicalT12.getTotalSegments());
+ verifyNotEmitted(Metric.DROPPED_COUNT);
+ verifyNotEmitted(Metric.MOVED_COUNT);
Review Comment:
I know we are "skipping" running the callbacks to test whether the
over-replication will kick in, but it's not a 100% test if we can't confirm the
drops do complete even with in-flight callbacks "running." Can we add a check
to ensure that afterwards, the drops complete from their respective historicals
and the `totalSegments()` are accurate?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]