Skip to content

[ISSUE #10831] fix(store): handle minimum hash index in compaction offset map - #11209

Open
beautyarbutin wants to merge 1 commit into
apache:developfrom
beautyarbutin:fix/compaction-offset-map-min-hash
Open

beautyarbutin wants to merge 1 commit into
apache:developfrom
beautyarbutin:fix/compaction-offset-map-min-hash

Conversation

@beautyarbutin

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

CompactionLog.OffsetMap previously used Math.abs(index) % capacity to select a bucket. For Integer.MIN_VALUE, Math.abs remains negative and can produce an invalid negative ByteBuffer position.

Use Math.floorMod(index, capacity) so every hash maps to a valid non-negative bucket. A deterministic MessageDigest regression test produces Integer.MIN_VALUE and verifies both put and get paths.

This follows up on #10841, which was closed without being merged.

How Did You Test This Change?

  • mvn -B -ntp -pl store -am -DskipITs -Dtest=OffsetMapTest -Dsurefire.failIfNoSpecifiedTests=false -Dspotbugs.skip=true test
  • OffsetMapTest: 3 tests passed
  • Reactor: 4 modules succeeded
  • Checkstyle: 0 violations

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.58%. Comparing base (78b96bc) to head (1c59514).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11209      +/-   ##
=============================================
- Coverage      49.66%   49.58%   -0.09%     
+ Complexity     14332    14305      -27     
=============================================
  Files           1390     1390              
  Lines         103190   103190              
  Branches       13493    13493              
=============================================
- Hits           51250    51163      -87     
- Misses         45763    45832      +69     
- Partials        6177     6195      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compaction OffsetMap fails when hash index is Integer.MIN_VALUE

2 participants