HADOOP-19255. Update io.compression.codec.lzo.buffersize to 262144#8601
Open
anshuksi282-ksolves wants to merge 2 commits into
Open
HADOOP-19255. Update io.compression.codec.lzo.buffersize to 262144#8601anshuksi282-ksolves wants to merge 2 commits into
anshuksi282-ksolves wants to merge 2 commits into
Conversation
Author
|
Hi @ayushtkn @dineshchitlangia, thank you for reviewing #7009 earlier. I'm new to contributing to Hadoop and have picked this issue up since the original PR went stale. I've addressed the feedback from that PR:
Would appreciate your review whenever you get a chance. Happy to make any further changes needed. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
This PR fixes HADOOP-18896.
The buffer size in
FSOutputSummeris computed assum.getBytesPerChecksum() * BUFFER_NUM_CHUNKS. Whenfile.bytes-per-checksumis configured to a very large value (e.g. 238609295), this multiplication overflows a signed 32-bit int and wraps around to a negative number, causing aNegativeArraySizeExceptionwhen allocating the internal buffer array.This PR adds a
Preconditions.checkArgumentcheck in theFSOutputSummerconstructor to validate that the computed buffer size is positive, failing fast with a clearIllegalArgumentExceptioninstead of an obscureNegativeArraySizeException.This continues the work started in #6064 by @teamconfx, which went stale. This PR additionally adds a unit test as requested in that PR's review (
test4testscheck had failed on the original PR).How was this patch tested?
TestFSOutputSummerinhadoop-commonwithtestLargeBytesPerChecksumOverflow, using a minimal concrete subclass ofFSOutputSummerto verify the constructor fails withIllegalArgumentException(rather thanNegativeArraySizeException) whenbytesPerChecksum * BUFFER_NUM_CHUNKSoverflows.NegativeArraySizeExceptionwhen the fix is reverted, and passes with the fix applied.mvn -pl hadoop-common-project/hadoop-common test -Dtest=TestFSOutputSummerpasses.Note: the JIRA's original reproduction steps reference an HDFS test (
TestDecommissionWithStriped), but since the buffer overflow bug lives entirely inhadoop-common'sFSOutputSummerclass, this PR adds a focused unit test inhadoop-commoninstead, avoiding an unnecessary cross-module HDFS test dependency.AI Tooling
Contains content generated by Claude (Anthropic). Used to help investigate the root cause, draft the fix, and write/verify the accompanying unit test.