HBASE-30392 Exclude checksum from onDiskDataSizeWithHeader - #8661
Open
Huginn-kio wants to merge 1 commit into
Open
Huginn-kio wants to merge 1 commit into
Huginn-kio wants to merge 1 commit into
Conversation
wchevreuil
requested changes
Sep 16, 2026
wchevreuil
left a comment
Contributor
There was a problem hiding this comment.
The name of the property here is "onDiskDataSizeWithHeader" so it should record the proper block size on disk. If we apply this change, we won't be recording the actual block size on disk.
Contributor
Can you prove this? Also, there are other parts of the code that set "onDiskDataSizeWithHeader" within the checksum. If we would apply this proposal, we would probably break block comparison when checking the cache, for cacheOnRead, for example, potentially caching an already cached block again. |
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.
HBASE-30392
Summary
Keep the size metadata of cache-on-write HFile blocks consistent with the bytes stored in the cache. See HBASE-30392.
Root cause
HFileBlock.Writer#getBlockForCachingcreates the cache buffer withcloneOnDiskBufferWithHeader(), which contains only the block header and on-disk data. The metadata was nevertheless populated withonDiskBlockBytesWithHeader.size() + onDiskChecksum.length, soonDiskDataSizeWithHeaderdescribed bytes that are not present in the cache buffer.Fix
onDiskDataSizeWithHeaderto the header-plus-data buffer length.onDiskSizeWithoutHeaderunchanged because the physical on-disk block size still includes checksums.Compatibility
Testing
git diff --checkpassed.mvn -pl hbase-server -am -DskipTests -Dcheckstyle.skip=true -Drat.skip=true -Dspotbugs.skip=true compilepassed with JDK 17.