slfan1989 commented on code in PR #10272:
URL: https://github.com/apache/ozone/pull/10272#discussion_r3249285894


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestWritableECContainerProvider.java:
##########
@@ -194,6 +194,23 @@ void testPipelinesCreatedBasedOnTotalDiskCountWithFactor(
     assertReusesExisting(allocated, pipelineLimit);
   }
 
+  @ParameterizedTest
+  @MethodSource("policies")
+  void testPipelinesCreatedBasedOnTotalDiskCountWithFractionalFactor(
+      PipelineChoosePolicy policy) throws IOException {
+    provider = createSubject(policy);
+    double factor = 0.5;
+    providerConf.setMinimumPipelines(1);
+    providerConf.setPipelinePerVolumeFactor(factor);
+    nodeManager.setNumHealthyVolumes(20);
+
+    int volumeCount = nodeManager.totalHealthyVolumeCount();
+    int pipelineLimit =
+        (int) (factor * volumeCount / repConfig.getRequiredNodes());
+    Set<ContainerInfo> allocated = assertDistinctContainers(pipelineLimit);
+    assertReusesExisting(allocated, pipelineLimit);
+  }
+

Review Comment:
   Updated the existing factor test to use a fractional value and removed the 
duplicate test case.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableECContainerProvider.java:
##########
@@ -187,7 +187,8 @@ private int getMaximumPipelines(ECReplicationConfig 
repConfig) {
     int volumeBasedCount = 0;
     if (factor > 0) {
       int volumes = nodeManager.totalHealthyVolumeCount();
-      volumeBasedCount = (int) factor * volumes / repConfig.getRequiredNodes();
+      volumeBasedCount =
+          (int) (factor * volumes / repConfig.getRequiredNodes());

Review Comment:
   Fixed, moved it back to a single 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]

Reply via email to