-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10547. Fix the buffer for the datanode checksum calculation #6402
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
Conversation
adoroszlai
left a comment
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 @Cyrill for the patch.
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java
Outdated
Show resolved
Hide resolved
szetszwo
left a comment
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.
@Cyrill , thanks for working on this, good catch on the bug! Please see the comment inlined.
| if (validateChunkChecksumData) { | ||
| try { | ||
| Checksum.verifyChecksum(data, info.getChecksumData(), 0); | ||
| Checksum.verifyChecksum(data.toByteString(byteBufferToByteString), info.getChecksumData(), 0); |
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.
Please use as below. The toByteString may have buffer copying.
data = data.duplicate(data.position(), data.limit());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.
Changed
szetszwo
left a comment
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.
+1 the change looks good.
What changes were proposed in this pull request?
HDDS-10547. Fix the buffer for the datanode checksum calculation
Datanode chunk checksum validation was broken.
computeChecksum code and chunkWrite code shared the same byte buffer, hence the first one to read from the buffer succeeds and the second attempt to read fails as the buffer position is at the end.
Apparently there are no tests to check that. I returned back the previous code to make it work.
There are three places where
validateChunkChecksumDatais called. I added a unit test to check all three. Also I had to changehandlePutSmallFilemethod as it didn't work correctly even with the checksum buffer fix.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10547
How was this patch tested?
Unit tests.