-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDDS-10338. Implement a Client Datanode API to stream a block #6613
base: master
Are you sure you want to change the base?
Conversation
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Show resolved
Hide resolved
...tainer-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking on this effort @chungen0126.
I just had a few questions and some nits.
In single thread read, stream read cut read time from 7.3 - 7.4s to 4.8 - 5.2s. |
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestStreamBlockInput.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java
Outdated
Show resolved
Hide resolved
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientGrpc.java
Outdated
Show resolved
Hide resolved
BlockID blockID = BlockID.getFromProtobuf( | ||
readBlock.getBlockID()); | ||
// This is a new api the block should always be checked. | ||
BlockUtils.verifyReplicaIdx(kvContainer, blockID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if the replicaIndex of the block changes because of containerBalancer running on the background. We would need to take some kind of a lock here to ensure the block data does change after this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 for context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could so happen that the container replica index could change b/w 2 read chunks. You are right about the fact that the replica can still fail, but we can save unnecessary round trips b/w client & server side. It is about narrowing down the possibilty and minor optimization. We need to ensure that the checksums of the chunks do match on the client side. I am still looking through the client side code, just wanted to understand if we are doing a checksum verification for each and every chunk read on the client side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done for adding replica index validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chungen0126 Thanks for working on the patch. I am still reviewing the PR. Posting my first level review comments.
What changes were proposed in this pull request?
To reduce round trips between the Client and Datanode for reading a block, we nee a new API to read.
This is using the ability of gRPC to send bidirectional traffic such that the server can pipeline the chunks to the client without waiting for ReadChunk API calls. This also avoids the client from creating multiple Chunk Stream Clients and should simplify the read path on the client side by a bit.
Please describe your PR in detail:
StreamBlockInput
at client side called from KeyInputStream to read a block from the container.BlockInputStream
.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10338
How was this patch tested?
There are existed test for reading data.