devmadhuu commented on code in PR #12179:
URL: https://github.com/apache/ozone/pull/12179#discussion_r4716322587


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableECContainerProvider.java:
##########
@@ -96,12 +96,10 @@ public ContainerInfo getContainer(final long size,
       ECReplicationConfig repConfig, String owner, ExcludeList excludeList,
       @Nonnull StorageTier storageTier)
       throws IOException {
-    // TODO StoragePolicy Support EC
     int maximumPipelines = getMaximumPipelines(repConfig);
     int openPipelineCount;
     synchronized (this) {
-      openPipelineCount = pipelineManager.getPipelineCount(repConfig,
-          Pipeline.PipelineState.OPEN);
+      openPipelineCount = pipelineManager.getPipelines(repConfig, 
Pipeline.PipelineState.OPEN, storageTier).size();

Review Comment:
   A test that fills one tier to its cap and checks a new pipeline is created 
for that tier would better test this cap limit per tier, so kindly include or 
write a new integration test to cover this.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableECContainerProvider.java:
##########
@@ -258,12 +256,15 @@ private ContainerInfo getContainerFromPipeline(Pipeline 
pipeline)
     // on a stale / dead node event (via close pipeline).
     NavigableSet<ContainerID> containers =
         pipelineManager.getContainersInPipeline(pipeline.getId());
-    // Assume 1 container per pipeline for EC
-    if (containers.isEmpty()) {
-      return null;
+    // Assume 1 container per pipeline for EC. Only a container of the 
requested StorageTier can be used;
+    // a container without a StorageTier (created before StorageTiers) never 
matches.
+    for (ContainerID containerID : containers) {
+      ContainerInfo container = containerManager.getContainer(containerID);
+      if (storageTier.equals(container.getStorageTier())) {

Review Comment:
   The tests written are covering the null-tier case in 
`testContainerWithoutTierIsNotReused`, but not a non-null mismatched tier 
reaching this loop (e.g. an SSD pipeline whose container reports DISK). Worth 
one more case so both the null and the mismatch branches are tested.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockOutputStreamEntry.java:
##########
@@ -84,7 +84,7 @@ void checkStream() throws IOException {
             new ECBlockOutputStream(getBlockID(), getXceiverClientManager(),
                 createSingleECBlockPipeline(getPipeline(), nodes.get(i), i + 
1),
                 getBufferPool(), getConf(), getToken(), getClientMetrics(), 
getStreamBufferArgs(),
-                getExecutorServiceSupplier());
+                getExecutorServiceSupplier(), getStorageType());

Review Comment:
   Can you write a test assertion that checks the ECBlockOutputStreamEntry 
object and verifies if it passes correctly to Stream object , so  a tiny unit 
test — "make an Entry with SSD, let it create its Stream, assert the Stream got 
SSD".



-- 
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