adoroszlai commented on code in PR #6779:
URL: https://github.com/apache/ozone/pull/6779#discussion_r1631460296


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/BlockID.java:
##########
@@ -65,6 +76,15 @@ public void setBlockCommitSequenceId(long 
blockCommitSequenceId) {
     this.blockCommitSequenceId = blockCommitSequenceId;
   }
 
+  // Can return a null value in case it is not set.
+  public Integer getReplicaIndex() {
+    return replicaIndex;
+  }
+
+  public void setReplicaIndex(Integer replicaIndex) {
+    this.replicaIndex = replicaIndex;
+  }

Review Comment:
   This is unused.  If removed, `replicaIndex` member can be `final`.



##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/ChunkInputStream.java:
##########
@@ -290,13 +293,27 @@ protected synchronized void releaseClient() {
     }
   }
 
+  /**
+   * Updates DatanodeBlockId which based on blockId.
+   */
+  private void updateDatanodeBlockId() throws IOException {
+    DatanodeDetails closestNode = pipelineSupplier.get().getClosestNode();
+    int replicaIdx = pipelineSupplier.get().getReplicaIndex(closestNode);
+    ContainerProtos.DatanodeBlockID.Builder builder = 
blockID.getDatanodeBlockIDProtobufBuilder();
+    if (replicaIdx > 0) {
+      builder.setReplicaIndex(replicaIdx);
+    }
+    datanodeBlockID = builder.build();
+  }
+
   /**
    * Acquire new client if previous one was released.
    */
   protected synchronized void acquireClient() throws IOException {
     if (xceiverClientFactory != null && xceiverClient == null) {
       xceiverClient = xceiverClientFactory.acquireClientForReadData(
           pipelineSupplier.get());
+      updateDatanodeBlockId();

Review Comment:
   Please store `Pipeline pipeline = pipelineSupplier.get()` and pass it to 
`updateDatanodeBlockId()`.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/ClientVersion.java:
##########
@@ -42,6 +42,9 @@ public enum ClientVersion implements ComponentVersion {
       "This client version has support for Object Store and File " +
           "System Optimized Bucket Layouts."),
 
+  ERASURE_CODING_READ_CHUNK_CORRUPTION_FIX(4,

Review Comment:
   I don't think we need the new version constant (and all the refactoring to 
be able to use it).
   
   New client version constant is needed when server has to decide whether it 
should send some piece of information (e.g. a new type of replication config, 
new bucket type, or new ports) to the client.
   
   If server only wants to decide whether to perform some server-side 
processing, it can do so based on request content received from client.  Like 
if client sends chunk data as a list, it can handle that, otherwise handle the 
single blob.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/BlockUtils.java:
##########
@@ -237,6 +238,24 @@ public static void verifyBCSId(KeyValueContainer 
container, BlockID blockID)
     }
   }
 
+  /**
+   * Verify if request block BCSID is supported.
+   *
+   * @param container container object.
+   * @param blockID requested block info
+   * @throws IOException if cannot support block's blockCommitSequenceId

Review Comment:
   nit: comments leftover from `verifyBCSId`



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