rakeshadr commented on a change in pull request #2919:
URL: https://github.com/apache/ozone/pull/2919#discussion_r778752509
##########
File path:
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
##########
@@ -301,4 +320,46 @@ public static RetryPolicy createRetryPolicy(int
maxRetryCount,
public static List<Class<? extends Exception>> getExceptionList() {
return EXCEPTION_LIST;
}
+
+ /**
+ * Send RPC call to get the block info from the container.
+ * @return List of chunks in this block.
+ */
+ public static List<ContainerProtos.ChunkInfo> getChunkInfos(Pipeline
pipeline,
+ BlockID blockID, Token<OzoneBlockTokenIdentifier> token,
+ XceiverClientFactory xceiverClientFactory, XceiverClientSpi xceiverClient
+ ) throws IOException {
+ // irrespective of the container state, we will always read via Standalone
+ // protocol.
+ if (pipeline.getType() != HddsProtos.ReplicationType.STAND_ALONE) {
+ pipeline = Pipeline.newBuilder(pipeline)
+ .setReplicationConfig(new StandaloneReplicationConfig(
+ ReplicationConfig
+ .getLegacyFactor(pipeline.getReplicationConfig())))
+ .build();
+ }
+ xceiverClient = xceiverClientFactory.acquireClientForReadData(pipeline);
+ boolean success = false;
+ List<ContainerProtos.ChunkInfo> chunks;
+ try {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Sending request to get key to access {}",
+ blockID.getContainerID());
+ }
+
+ ContainerProtos.DatanodeBlockID datanodeBlockID = blockID
+ .getDatanodeBlockIDProtobuf();
+ ContainerProtos.GetBlockResponseProto response = ContainerProtocolCalls
+ .getBlock(xceiverClient, datanodeBlockID, token);
+
+ chunks = response.getBlockData().getChunksList();
+ success = true;
+ } finally {
+ if (!success) {
Review comment:
`if (!success) {`
I'm wondering, why it's not releasing the `xceiverClient` on success case?
--
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]