MarkGaox commented on code in PR #2658:
URL: https://github.com/apache/helix/pull/2658#discussion_r1366042565
##########
helix-core/src/main/java/org/apache/helix/controller/rebalancer/waged/WagedRebalancer.java:
##########
@@ -424,6 +426,14 @@ private Map<String, ResourceAssignment>
handleDelayedRebalanceMinActiveReplica(
}
}
+ private static Set<String> filterOutOnOperationInstances(Map<String,
InstanceConfig> instanceConfigMap,
+ Set<String> nodes) {
+ return nodes.stream()
+ .filter(
+ instance ->
!DelayedAutoRebalancer.INSTANCE_OPERATION_TO_EXCLUDE_FROM_ASSIGNMENT.contains(instanceConfigMap.get(instance).getInstanceOperation()))
Review Comment:
We probably need checks before `instanceConfigMap.get()`
##########
helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java:
##########
@@ -338,21 +341,38 @@ public void testMarkEvacuationAfterEMM() throws Exception
{
@Test(dependsOnMethods = "testMarkEvacuationAfterEMM")
public void testEvacuationWithOfflineInstancesInCluster() throws Exception {
+ _participants.get(1).syncStop();
_participants.get(2).syncStop();
- _participants.get(3).syncStop();
- // wait for converge, and set evacuate on instance 0
- Assert.assertTrue(_clusterVerifier.verifyByPolling());
- String evacuateInstanceName = _participants.get(0).getInstanceName();
+ String evacuateInstanceName =
_participants.get(_participants.size()-2).getInstanceName();
_gSetupTool.getClusterManagementTool()
.setInstanceOperation(CLUSTER_NAME, evacuateInstanceName,
InstanceConstants.InstanceOperation.EVACUATE);
- Map<String, IdealState> assignment;
- List<String> currentActiveInstances =
- _participantNames.stream().filter(n ->
(!n.equals(evacuateInstanceName) &&
!n.equals(_participants.get(3).getInstanceName()))).collect(Collectors.toList());
- TestHelper.verify( ()-> {return verifyIS(evacuateInstanceName);},
TestHelper.WAIT_DURATION);
+ Map<String, ExternalView> assignment;
+ // EV should contain all participants, check resources one by one
+ assignment = getEV();
+ for (String resource : _allDBs) {
+ ExternalView ev = assignment.get(resource);
+ for (String partition : ev.getPartitionSet()) {
+ AtomicInteger activeReplicaCount = new AtomicInteger();
+ ev.getStateMap(partition)
+ .values()
+ .stream()
+ .filter(
+ v -> v.equals("MASTER") || v.equals("LEADER") ||
v.equals("SLAVE") || v.equals("FOLLOWER") || v.equals(
+ "STANDBY"))
+ .forEach(v -> activeReplicaCount.getAndIncrement());
+ Assert.assertTrue(activeReplicaCount.get() >= REPLICA-1);
+
Assert.assertFalse(ev.getStateMap(partition).containsKey(evacuateInstanceName)
&& ev.getStateMap(partition)
+ .get(evacuateInstanceName)
+ .equals("MASTER") && ev.getStateMap(partition)
+ .get(evacuateInstanceName)
+ .equals("LEADER"));
+
Review Comment:
nit: empty line
--
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]