yihua commented on code in PR #20321:
URL: https://github.com/apache/hudi/pull/20321#discussion_r4287178407
##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java:
##########
@@ -231,15 +240,12 @@ static int numChecksumBytes(long numBytes, int
bytesPerChecksum) {
* @param bytesPerChecksum number of bytes in a checksum chunk.
* @return the number of checksum chunks.
*/
- static int numChecksumChunks(long numBytes, int bytesPerChecksum) {
+ static long numChecksumChunks(long numBytes, int bytesPerChecksum) {
long numChunks = numBytes / bytesPerChecksum;
if (numBytes % bytesPerChecksum != 0) {
numChunks++;
}
- if (numChunks > Integer.MAX_VALUE / HFileBlock.CHECKSUM_SIZE) {
- throw new IllegalArgumentException("The number of chunks is too large: "
+ numChunks);
- }
Review Comment:
Restored, with the `long` return type; the net change to both helpers is now
just `int` to `long`, and the overflow test is back. One consequence: a header
whose chunk count exceeds `Integer.MAX_VALUE / 4` (for example
`bytesPerChecksum = 1` with a 2 GiB on-disk size) fails in `numChecksumChunks`
with "The number of chunks is too large" before `validateHeader` runs, since
the constructor computes the checksum size first.
--
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]