You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2026/07/13 23:01:36 UTC

Re: [PR] HDDS-15093. Make RackScatter intra-rack placement capacity-aware [ozone]

jojochuang commented on code in PR #10648:
URL: https://github.com/apache/ozone/pull/10648#discussion_r3574814792


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/TestSCMContainerPlacementRackScatter.java:
##########
@@ -900,6 +919,34 @@ public void testAllNodesOnRackExcludedReducesRackCount2()
     assertEquals(1, chosenNodes.size());
   }
 
+  /**
+   * Within a single rack holding an emptier and a fuller datanode, the intra
+   * rack selection should prefer the less utilized node instead of choosing
+   * uniformly at random.
+   */
+  @Test
+  public void chooseNodeWithinRackPrefersLessUtilized() throws SCMException {
+    // Single rack with two datanodes.
+    setup(2, 2);
+    updateStorageInDatanode(0, 10, 90);   // emptier node
+    updateStorageInDatanode(1, 90, 10);   // fuller node
+
+    Map<DatanodeDetails, Integer> selectedCount = new HashMap<>();
+    selectedCount.put(datanodes.get(0), 0);
+    selectedCount.put(datanodes.get(1), 0);
+
+    for (int i = 0; i < 1000; i++) {

Review Comment:
   A thousand times seems too much for a simple test. For the sake of saving test run time, let's just run it 100 times:
   
   ```suggestion
       for (int i = 0; i < 100; i++) {
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org