Repository navigation
fix(#8401): measure the free tail directly on a rebased delete and on the delete wipe - #8416
Conversation
… the delete wipe rebaseRecordDeleteOnPage and wipeOutFreeSpace borrowed the allocator's getFreeSpaceInPage as a measurement of the page's free tail. On a page whose slot table is full that method gives up before measuring anything (it only has to tell the allocator to look elsewhere, #2258) and leaves -1 in place of the free space: - the disjoint-slot merge of a delete reported -1 free bytes to the free-space statistics, tripping the updatePageStatistics tripwire under -ea and failing the commit (reached in seconds by concurrent vertex deletes on edge buckets, whose ~14 byte records fill the 2048 slots of a page with half its bytes free) - the compaction after a delete skipped the wipe of the free tail on those pages, leaving a stale copy of the records the defragmentation moved down, which bucketWipeOutOnDelete exists to prevent Both now measure with findContentInsertionOffset, the same slot scan without the allocator's short-circuit, hole search and per-hole RID allocation. Also SleepStatementExecutionTest measured a Thread.sleep with the wall clock, which reported 957 ms for SLEEP 1000 on a full engine run: it now uses System.nanoTime.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Coverage variation | ✅ -6.13% coverage variation |
| Diff coverage | ✅ 100.00% diff coverage |
Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (a50f817) 191295 159945 83.61% Head commit (ea27712) 223917 (+32622) 173505 (+13560) 77.49% (-6.13%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#8416) 4 4 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughLocalBucket now measures free page tails directly during delete rebasing and free-space wiping. New regression tests cover deletes on full-slot-table pages. The sleep test now measures elapsed time with a monotonic clock. ChangesDelete free-tail measurement
Sleep test timing
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The regression test does not need to require a retained free-space hint. No actionable merge-blocking risk remains after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change improves cleanup of freed page space without adding a new data-access path. No introduced security issue was established. Cleanup remains best-effort if a page wipe fails. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation
✨ 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 |
ReviewI traced through Root cause checks out. The fix is well-targeted. Routing both call sites through
Performance: the claim that this is also cheaper holds up - Tests: the two new regression tests are good - they build the specific "slots full, bytes free" page shape, and the second one directly inspects page bytes past the new content end to prove the wipe actually happened, rather than just asserting no exception was thrown. Reusing The No concerns on security - this is internal storage-engine bookkeeping with no external input surface, and no new dependencies were introduced. One very minor nit, not blocking: the doc comment on Overall: solid, narrowly-scoped fix with a well-reasoned root cause, tests that reproduce the exact failure before the fix and pass after, and no regressions to the allocator behavior the PR correctly leaves untouched. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8416 +/- ##
============================================
+ Coverage 75.28% 75.31% +0.03%
Complexity 2910 2910
============================================
Files 2023 2023
Lines 191295 191372 +77
Branches 40098 40106 +8
============================================
+ Hits 144009 144125 +116
+ Misses 31391 31352 -39
Partials 15895 15895 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #8401
Root cause
rebaseRecordDeleteOnPage(the disjoint-slot merge of a record delete) andwipeOutFreeSpace(the free-tail wipe after a delete's compaction) both used the allocator'sgetFreeSpaceInPageas a measurement of the page's free tail. That method answers a different question, "can a new record go on this page?", and on a page whose slot table is full (recordCount >= maxRecordsInPage) it returns before measuring anything (#2258), leavingspaceAvailableInCurrentPageat its-1default.Small records reach that shape routinely: 2048 edges of ~14 bytes fill the slot table of a 64 KB page with about half of its bytes still free. So:
-1was reported toupdatePageStatisticsas the page's free space. Under-eathis trips the tripwire and fails the commit (page N of bucket 'RELATES_TO_0' is reported with -1 free bytes and a delta of 0). In production the value was absorbed and the commit-time compaction re-measured the page, so the effect there was a transient wrong hint.bucketWipeOutOnDelete(default on) the compaction after a delete skipped zeroing the free tail on these pages, leaving a stale copy of the records the defragmentation had just moved down. That is the leftover content the setting exists to remove.Fix
Both now measure the tail with
findContentInsertionOffset(offset past the last record), which is the same slot scan without the allocator's short-circuit. It is also cheaper than before: no hole search, and noRIDallocation plusisDeletedInTransactionlookup per hole.The allocator keeps its short-circuit on purpose: skipping pages whose slot table is full is the #2258 bulk-insert optimisation, and changing what the allocator considers usable is a separate decision.
Tests
Issue8401RebasedDeleteOnFullSlotTableTestaRebasedDeleteOnAPageWithAFullSlotTableReportsTheRealFreeTail: page 0 with a full slot table, a delete committed after a concurrent update of another record on the same page (so it goes throughrebaseRecordDeleteOnPage). Red before the fix (the assertion above), green after. It also checks that the delete and the concurrent update both survive, and that the hint is the real tail.theCompactionAfterADeleteWipesTheFreeTailOfAPageWithAFullSlotTable: red before the fix (free tail byte at offset 54165 of 65528 must be wiped), green after.-DexcludedGroups=slow,benchmark,vector, 16508 tests): green exceptSleepStatementExecutionTest, which measuredSLEEP 1000with the wall clock and got 957 ms. It now measures withSystem.nanoTime()(test-only change), and passes.Summary by CodeRabbit
Bug Fixes
Tests