fix: leave MVStore's chunk retention and versions-to-keep at H2's defaults - #1303
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe MVStore adapter now exposes nullable retention settings. The builder propagates these settings to ChangesMVStore retention configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to MVStore now preserves H2 retention defaults unless values are explicitly configured, while retaining support for the prior zero-value behavior. The changed configuration flow and expected defaults are covered without an identified merge-blocking risk. Sequence Diagram(s)sequenceDiagram
participant MVStoreModuleBuilder
participant MVStoreConfig
participant MVStoreUtils
participant MVStore
MVStoreModuleBuilder->>MVStoreConfig: Build retentionTime and versionsToKeep
MVStoreUtils->>MVStore: Apply non-null retention values
MVStoreUtils->>MVStore: Preserve H2 defaults for null values
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…aults
MVStoreUtils.openOrCreate forced setRetentionTime(0) and setVersionsToKeep(0)
on every store since 2020. With both at 0, H2 may reuse a chunk's blocks while
the chunk map it writes at close still lists that chunk, and the file then
refuses to open, read-only or not, with
MVStoreException: Double mark: 394/5 [...] at FreeSpaceBitSet.markUsed
at RandomAccessStore.readStoreHeader
(h2database/h2database#2752, #4083, both open). Only H2's recovery mode gets
past it. A 24-thread soak of a document workload with a close every 20 seconds
reproduced it on every run at 0/0, with and without close-time compaction, on
h2-mvstore 2.4.240 and on current H2 master, and on none of the runs with
either setting at its H2 default (45 s / 5), including a 1 s retention window.
H2's own javadoc notes the retention window is what lets readers finish
traversing a map.
MVStoreModuleBuilder gains retentionTime(ms) and versionsToKeep(n); both are
null by default, which leaves H2's values in place. Passing 0 restores the old
behaviour for anyone who depends on the file shrinking immediately, at the
cost described above.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dcdee1e to
39af79b
Compare
|
Rebased onto The Ubuntu build failed on Verified locally on the rebase: |
The test pinned the values openOrCreate used to force. versionsToKeep is now H2's own 5; retentionTime stays 0 because an in-memory store has no chunks to retain and H2 sets that itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
39af79b to
0f61892
Compare
Supersedes #1301 by @brettwooldridge, rebased onto
mainwith one added commit.MVStoreUtils.openOrCreateforcedsetRetentionTime(0)andsetVersionsToKeep(0)on every store since 2020. With both at 0, H2 may reuse a chunk's blocks while the chunk map it writes at close still lists that chunk, and the file then refuses to open, read-only or not, with(h2database/h2database#2752, h2database/h2database#4083, both open). Only H2's recovery mode gets past it. A 24-thread soak of a document workload with a close every 20 seconds reproduced it on every run at 0/0, with and without close-time compaction, on h2-mvstore 2.4.240 and on current H2 master, and on none of the runs with either setting at its H2 default (45 s / 5), including a 1 s retention window.
MVStoreModuleBuildergainsretentionTime(ms)andversionsToKeep(n); both are null by default, which leaves H2's values in place. Passing 0 restores the old behaviour.Added on top of #1301:
MVStoreUtilsTeststill pinnedgetVersionsToKeep() == 0, the valueopenOrCreateused to force, and failed. It now asserts H2's default of 5.getRetentionTime()stays 0 there because an in-memory store has no chunks to retain and H2 sets that itself.This is also the corruption behind the intermittent
MigrationTest.cleanUpfailure on CI (AssertionError: chunk:5,block:0,len:0 ... at Chunk.accountForRemovedPage).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests