swamirishi commented on code in PR #6779:
URL: https://github.com/apache/ozone/pull/6779#discussion_r1631830856
##########
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:
done
##########
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:
done
--
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]