siddhantsangwan commented on code in PR #6555:
URL: https://github.com/apache/ozone/pull/6555#discussion_r1584596854
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/node/TestDecommissionAndMaintenance.java:
##########
@@ -310,6 +310,77 @@ public void
testDecommissioningNodesCompleteDecommissionOnSCMRestart()
waitForDnToReachPersistedOpState(newDn, IN_SERVICE);
}
+ @Test
+ // Decommissioning few nodes which leave insufficient nodes for replication
+ // should not be allowed if the decommissioning is not forced.
+ public void testInsufficientNodesCannotBeDecommissioned()
+ throws Exception {
+ // Generate some data on the empty cluster to create some containers
+ generateData(20, "key", ratisRepConfig);
+
+ final List<DatanodeDetails> toDecommission = nm.getAllNodes();
+
+ // trying to decommission 5 nodes should leave the cluster with 2 nodes,
+ // which is not sufficient for RATIS.THREE replication. It should not be
allowed.
+
scmClient.decommissionNodes(Arrays.asList(toDecommission.get(0).getIpAddress(),
+ toDecommission.get(1).getIpAddress(),
toDecommission.get(2).getIpAddress(),
+ toDecommission.get(3).getIpAddress(),
toDecommission.get(4).getIpAddress()), false);
+
+ // Ensure no nodes transitioned to DECOMMISSIONING
+ List<DatanodeDetails> decomNodes = nm.getNodes(
+ DECOMMISSIONED,
+ HEALTHY);
+ assertEquals(0, decomNodes.size());
Review Comment:
Shouldn't we ensure that the DN is neither decommissioned nor
decommissioning? When a decommission command is received, the DN will
transition from in service to decommissioning to decommissioned. So I think we
should check for both of these states.
--
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]