chungen0126 commented on code in PR #6613:
URL: https://github.com/apache/ozone/pull/6613#discussion_r1806537264
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1329,6 +1333,109 @@ public void deleteUnreferenced(Container container,
long localID)
}
}
+ @Override
+ public ContainerCommandResponseProto streamDataReadOnly(
+ ContainerCommandRequestProto request, KeyValueContainer kvContainer,
+ DispatcherContext dispatcherContext,
+ StreamObserver<ContainerCommandResponseProto> streamObserver) {
+ ContainerCommandResponseProto responseProto = null;
+ try {
+ if (!request.hasReadBlock()) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Malformed Read Block request. trace ID: {}",
+ request.getTraceID());
+ }
+ return malformedRequest(request);
+ }
+ ReadBlockRequestProto readBlock = request.getReadBlock();
+
+ BlockID blockID = BlockID.getFromProtobuf(
+ readBlock.getBlockID());
+ // This is a new api the block should always be checked.
+ BlockUtils.verifyReplicaIdx(kvContainer, blockID);
Review Comment:
> or we would need to validate the replicaIndex and bcsID is the same on
every readChunk call on the file(Basically move this check inside the loop).
Take a look at [HDDS-10983](https://issues.apache.org/jira/browse/HDDS-10983)
for context.
@swamirishi thanks for your review.
I'm still confused of the problem. We validate the replicaIndex and bcsID at
the start of the readBlock, and all the readChunks belong to the same block.
Why do we need to validate again fot every readChunk. If the replicaIndex of
the block changes during the readBlock, a mismatch can still happen after the
validation and before readChunk.
--
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]