Skip to content

Conversation

@sadanand48
Copy link
Contributor

What changes were proposed in this pull request?

After HDDS-10983 , it requires every getBlock request be assigned a replicaIndex in case of an EC block. The request constructed for getBlock in this tool didn't have that. This change sets the replicaIndex if key is EC in the getBlock request.
I have reconstructed the request after unpacking the existing request which could have been avoided but since the usecase is just a debug tool and it was simple change, I went with it.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-11069

How was this patch tested?

Unit test

@SaketaChalamchala
Copy link
Contributor

@swamirishi could you please take a look?

Comment on lines 335 to 346
int replicaIdx = pipeline.getReplicaIndex(dn);
ContainerProtos.GetBlockRequestProto getBlockRequestProto =
request.getGetBlock();
DatanodeBlockID datanodeBlockID = getBlockRequestProto.getBlockID();
DatanodeBlockID newDatanodeBlockID =
DatanodeBlockID.newBuilder(datanodeBlockID)
.setReplicaIndex(replicaIdx).build();
ContainerProtos.GetBlockRequestProto newGetBlockRequestProto =
ContainerProtos.GetBlockRequestProto.newBuilder(getBlockRequestProto)
.setBlockID(newDatanodeBlockID).build();
request = ContainerCommandRequestProto.newBuilder(request)
.setGetBlock(newGetBlockRequestProto).build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int replicaIdx = pipeline.getReplicaIndex(dn);
ContainerProtos.GetBlockRequestProto getBlockRequestProto =
request.getGetBlock();
DatanodeBlockID datanodeBlockID = getBlockRequestProto.getBlockID();
DatanodeBlockID newDatanodeBlockID =
DatanodeBlockID.newBuilder(datanodeBlockID)
.setReplicaIndex(replicaIdx).build();
ContainerProtos.GetBlockRequestProto newGetBlockRequestProto =
ContainerProtos.GetBlockRequestProto.newBuilder(getBlockRequestProto)
.setBlockID(newDatanodeBlockID).build();
request = ContainerCommandRequestProto.newBuilder(request)
.setGetBlock(newGetBlockRequestProto).build();
ContainerProtos.GetBlockRequestProto gbr = request.getGetBlock();
request = request.toBuilder().setGetBlock(gbr.toBuilder().setBlockID(
gbr.getBlockID().toBuilder().setReplicaIndex(
pipeline.getReplicaIndex(dn)).build()).build()).build();

Copy link
Contributor Author

@sadanand48 sadanand48 Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks , updated the patch.

Copy link
Contributor

@aryangupta1998 aryangupta1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aryangupta1998
Copy link
Contributor

Thanks @sadanand48 for the patch, @nandakumar131 for the review.

@aryangupta1998 aryangupta1998 merged commit a8c377f into apache:master Jul 12, 2024
xichen01 pushed a commit to xichen01/ozone that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants