chungen0126 commented on code in PR #6613:
URL: https://github.com/apache/ozone/pull/6613#discussion_r1867504010
##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java:
##########
@@ -618,6 +624,69 @@ private void decreasePendingMetricsAndReleaseSemaphore() {
return new XceiverClientReply(replyFuture);
}
+ public XceiverClientReply sendCommandReadBlock(
+ ContainerCommandRequestProto request, DatanodeDetails dn)
+ throws IOException, InterruptedException {
+
+ CompletableFuture<ContainerCommandResponseProto> future =
+ new CompletableFuture<>();
+ ContainerCommandResponseProto.Builder response =
+ ContainerCommandResponseProto.newBuilder();
+ ContainerProtos.ReadBlockResponseProto.Builder readBlock =
+ ContainerProtos.ReadBlockResponseProto.newBuilder();
+ checkOpen(dn);
+ UUID dnID = dn.getUuid();
+ Type cmdType = request.getCmdType();
+ semaphore.acquire();
+ long requestTime = System.currentTimeMillis();
+ metrics.incrPendingContainerOpsMetrics(cmdType);
+
+ final StreamObserver<ContainerCommandRequestProto> requestObserver =
+ asyncStubs.get(dnID).withDeadlineAfter(timeout, TimeUnit.SECONDS)
+ .send(new StreamObserver<ContainerCommandResponseProto>() {
+ @Override
+ public void onNext(
+ ContainerCommandResponseProto responseProto) {
+ if (responseProto.getResult() == Result.SUCCESS) {
+ readBlock.addReadChunk(responseProto.getReadChunk());
+ } else {
+ future.complete(
+ ContainerCommandResponseProto.newBuilder(responseProto)
+ .setCmdType(Type.ReadBlock).build());
+ }
+ }
+
+ @Override
+ public void onError(Throwable t) {
+ future.completeExceptionally(t);
+ metrics.decrPendingContainerOpsMetrics(cmdType);
+ metrics.addContainerOpsLatency(
+ cmdType, System.currentTimeMillis() - requestTime);
+
Review Comment:
Done
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/ContainerDispatcher.java:
##########
@@ -93,4 +94,15 @@ default StateMachine.DataChannel getStreamDataChannel(
throw new UnsupportedOperationException(
"getStreamDataChannel not supported.");
}
+
+ /**
+ * When reading data form client using stream, get StreamDataChannel.
+ */
+ default void streamDataReadOnly(
+ ContainerCommandRequestProto msg,
+ StreamObserver<ContainerCommandResponseProto> streamObserver,
+ DispatcherContext dispatcherContext) {
+ throw new UnsupportedOperationException(
+ "getStreamDataChannel not supported.");
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]