Tejaskriya commented on code in PR #6555:
URL: https://github.com/apache/ozone/pull/6555#discussion_r1587170021
##########
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:
Thanks for the review! I have added checks for both decommissioning and
decommissioned now. Could you please take another look at it and approve the
workflows if everything seems fine?
--
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]