Skip to content

fix(#6196): a placeholder's content record says whose it is, even when it had to spill - #6287

Merged
lvca merged 8 commits into
mainfrom
issue-6196
Aug 17, 2026
Merged

lvca merged 8 commits into
mainfrom
issue-6196

Conversation

@lvca

@lvca lvca commented Aug 17, 2026

Copy link
Copy Markdown
Member

Fixes #6196.

What was wrong

SELECT FROM Doc could return the same record twice, under two different RIDs, and count(@rid) counted it
twice with it. One record shape reached it: a placeholder whose CONTENT record was too large for any page to
hold whole.

A content record is recognised by the NEGATIVE size marker its slot carries, and every reader that walks a page
skips it on that basis. A content record no page can host whole has no size in its slot at all - it is a chunk
chain - so writeMultiPageRecord stamped the plain FIRST_CHUNK marker of an ordinary multi-page record on its
head, and the one thing that said the slot belonged to somebody else was gone at that moment. There was nowhere
else it was written down: the head chunk of a placeholder's content was indistinguishable from the head chunk of
a real record.

So scan() handed the bytes out as a document of their own, in addition to handing the same bytes out through
the pointer that references them. count() counted them. check() had the mirror of the same confusion,
counting the record under totalMultiPageRecords and never under totalSurrogateRecords.

The fix, and why not the issue's own alternative

The issue offered two. The cheaper one - "stop creating the shape: refuse to place a content record that cannot
fit a page, i.e. make the spill branch of updateRecordInternal fall through to chunks for the RECORD ITSELF" -
turns out not to be available. That branch is reached exactly when availableSpaceInCurrentPage < MINIMUM_SPACE_FOR_FIRST_CHUNK, after slotEnlargementForChunkHead has already tried to claim the missing bytes
through the in-page shift: the slot genuinely cannot host a 14-byte chunk header, so the record itself cannot
spill in place, and relocating its content is the only thing left. The premise that the fallback "says nothing
about whether the content will fit a page" is right, but it is not what makes the fallback necessary.

So the marker, FIRST_CHUNK_PLACEHOLDER_CONTENT = -4: the one value the namespace still had free between
NEXT_CHUNK (-3) and the negated sizes (< -5), one zigzag byte exactly like the markers either side of it. The
stored format grows by nothing.

Three refinements over the issue's sketch:

  1. Two predicates instead of a dozen open-coded pairs. isChunkHead(marker) for every reader that walks or
    rewrites the CHAIN (the header, the region and the chain are identical for the two heads), and
    isPlaceholderContent(marker) for the readers that decide whether a slot is a RECORD, which is the one place
    the two differ. scan, count, existsRecord and getRecordInternal without readPlaceHolderContent
    deliberately test == FIRST_CHUNK and not isChunkHead, each with a comment saying so.

  2. The disjoint-slot merge keeps working on this shape. A head-chunk update of a content record was
    rebasable before A placeholder whose CONTENT record had to spill into chunks is returned TWICE by a scan #6196 and stays rebasable, under a SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT of its own -
    the same replay, differing only in the marker it expects to still find on the committed page, which is
    exactly what a kind is for ("the same bytes behind a different marker are a different record"). Poisoning the
    page instead would have been simpler and would have cost this shape the concurrency Slot merge does not cover records that outgrew their page: chunked and placeholder updates poison the page unconditionally #6129 gave it.

  3. Old databases are repaired, not tolerated for ever. The issue accepted that "existing databases keep
    producing the ambiguous shape and the readers have to tolerate both for ever". They do not have to: only the
    pointer can tell the two apart, and check() already walks every pointer. It now follows each one (one page
    read per placeholder, on a shape that is rare to begin with), reports a content record still stored the old
    way as an error naming its RID, and CHECK DATABASE FIX rewrites that one marker. It is a repair and never a
    deletion - not a byte of the record, its chunk header or its chain is touched, so it is reversible even in
    the corrupted-pointer case the javadoc spells out. The identification is collected during the pass and
    reconciled after it, so the answer does not depend on whether the content record happens to sit on a page the
    walk had already left behind.

Verification

New Issue6196PlaceholderContentChainTest (3 tests), all three red on main before the fix:

  • aPlaceholderWhoseContentSpilledIsScannedOnce - the issue as reported: one copy in a scan, surrogate=1 and
    multiPage=1 in check(), and the head chunk invisible to existsRecord and to a direct load.
  • theContentChainKeepsItsMarkerThroughEveryRewrite - large -> larger -> small -> large -> delete, with the
    marker and the copy count asserted at each step and the chain freed with the pointer at the end.
  • checkDatabaseFixRepairsALegacyAmbiguousContentRecord - the marker byte is written back to FIRST_CHUNK to
    fabricate a pre-fix database, the duplicate is asserted to be there, CHECK DATABASE reports it,
    CHECK DATABASE FIX repairs it without deleting anything, and the duplicate is gone.

Issue6178ChunkCollapseTest.aPlaceholderContentStoredAsAChainIsNeverCollapsed asserted the bug deliberately
(with a pointer to #6196 saying so); that line now asserts one copy. Issue5279ConcurrentUpdateTest's rebuilt
placeholder now proves the rebuild by the chunks it gained rather than by a totalMultiPageRecords that
correctly no longer counts it.

The whole engine module suite is green (-DexcludedGroups=benchmark,vector,slow).

Follow-up

#6286: with the shape no longer ambiguous, the one transition still missing is the COLLAPSE of a content
record's chain back into a negated-size record when it shrinks inside its slot. The #6178 guard stays until
collapseChunkChainToRecord can write that marker.

…n it had to spill

A content record is recognised by the NEGATIVE size marker its slot carries, and every reader that walks a
page skips it on that basis. A content record no page can host whole has no size in its slot at all - it is a
chunk chain - and writeMultiPageRecord stamped the plain FIRST_CHUNK marker of an ordinary multi-page record
on its head, losing the one thing that said the slot was somebody else's. A scan then handed those bytes out
twice, under two different RIDs; count() counted them twice; check() reported a multi-page record where there
was a surrogate.

The head chunk of a content record now carries FIRST_CHUNK_PLACEHOLDER_CONTENT (-4), in the one value the
marker namespace still had free between NEXT_CHUNK and the negated sizes. It is one zigzag byte, exactly like
the markers either side of it, so the stored format grows by nothing. Every reader that walks or rewrites the
CHAIN accepts both heads (isChunkHead); the readers that decide whether a slot is a RECORD - scan, count,
existsRecord, getRecordInternal without readPlaceHolderContent - accept only FIRST_CHUNK. The commit-time
disjoint-slot merge keeps the head-chunk rebase for it under a slot kind of its own, so the marker the replay
expects on the committed page is the one the write started from.

Databases written before this hold the ambiguous shape, and only the pointer that leads to it can tell it
from a real record. Rather than have every reader tolerate it for ever, CHECK DATABASE now follows each
placeholder pointer, reports a content record still stored the old way as an error naming its RID, and CHECK
DATABASE FIX repairs it by rewriting that one marker - a repair, never a deletion: not a byte of the record,
its chunk header or its chain is touched.
@lvca lvca self-assigned this Aug 17, 2026
@mergify

mergify Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@codacy-production

codacy-production Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 84.62% diff coverage · -6.53% coverage variation

Metric Results
Coverage variation ✅ -6.53% coverage variation
Diff coverage ✅ 84.62% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2a88019) 158956 125396 78.89%
Head commit (e0b8aa2) 191396 (+32440) 138480 (+13084) 72.35% (-6.53%)

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 (#6287) 117 99 84.62%

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.

@lvca lvca added this to the 26.9.1 milestone Aug 17, 2026
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review: fix(#6196) — placeholder content marker

I read through the full diff (LocalBucket.java, TransactionContext.java, the three test files) and traced the logic of every changed branch (scan, count, check, existsRecord, getRecordInternal, updateRecordInternal, deleteRecordInternal, createRecordInternal, writeMultiPageRecord, rebaseRecordOnPage, offPageContentFingerprint, the chunk-chain read-validation path). Overall this is a very solid, carefully reasoned fix — no correctness bugs found. Notes below are mostly confirmations and one point worth a second pair of eyes.

Correctness

  • The core idea (FIRST_CHUNK_PLACEHOLDER_CONTENT = -4 filling the one free value in the marker namespace) is sound and the isChunkHead/isPlaceholderContent split is applied consistently everywhere I checked — including the less obvious spots: offPageContentFingerprint/placeholderContentFingerprint, getOrderedRecordsInPage, isChunkChainBroken, findBrokenChunkChainInNewestCommitted, and getPageOccupiedInBytes. I didn't find a reader that still tests bare == FIRST_CHUNK where it should have used isChunkHead, or vice versa.
  • writeMultiPageRecord's new isPlaceHolderContent parameter is threaded correctly through both call sites that can legitimately produce a placeholder content chain (createRecordInternal's multi-page branch) and correctly hardcoded to false at the two sites that can't (restoreRecordAtPosition, and the in-place spill inside updateRecordInternal — which is provably never reached for placeholder content, since that shape returns early at the "CANNOT CREATE A PLACEHOLDER OF PLACEHOLDER" branch and gets deleted+recreated instead).
  • rebaseRecordOnPage's new SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT correctly checks the marker the write actually started from (rs[0] != (kind == SLOT_KIND_FIRST_CHUNK ? FIRST_CHUNK : FIRST_CHUNK_PLACEHOLDER_CONTENT)), so a slot that flipped between the two shapes concurrently is correctly treated as a conflict rather than silently replayed. SLOT_KIND_CHUNK_COLLAPSED_TO_RECORD and SLOT_KIND_RECORD_SPILLED_TO_CHUNK are untouched, which is right since neither kind can ever describe placeholder content (collapse is explicitly guarded off for it; spill-to-chunk-in-place never happens for it).
  • check()'s two-pass reconciliation (collect legacyContentHeads while walking pointers, patch totalMultiPageRecords/totalSurrogateRecords after the page loop) correctly handles a legacy content head living on a page the walk already passed — the per-page walk still (harmlessly, only for logging) counts it as multi-page in that page's own tally, but the aggregate totals returned in stats end up correct because the reconciliation adjusts only the running totals, not the per-page log counters.
  • repairLegacyContentHead's belt-and-suspenders check (recordSize[1] != Binary.getNumberSpace(FIRST_CHUNK_PLACEHOLDER_CONTENT)) is dead code on any marker this engine wrote (both -2 and -4 are always 1 zigzag byte) but is a reasonable guard against a hand-patched/corrupted page, as the Javadoc says.

One thing worth confirming intentional

updateRecordInternal's new guard is if (placeholderContentHead && !updatePlaceholderContent) throw RecordNotFoundException, where placeholderContentHead = recordSize[0] == FIRST_CHUNK_PLACEHOLDER_CONTENT — i.e. it only recognizes the new marker. On a not-yet-CHECK DATABASE FIX-ed legacy database, scan() still (as before this fix, and as the PR description says explicitly) hands out the ambiguous content record's bytes as an ordinary document under its own RID — that's the residual bug surface the PR intentionally leaves for CHECK DATABASE FIX to clean up. But that also means a caller who received that duplicate RID from a scan and calls .modify().save() or .delete() directly on it does not hit the new guard (the marker is still plain FIRST_CHUNK, not FIRST_CHUNK_PLACEHOLDER_CONTENT), so the update/delete proceeds as if it were a real record — potentially corrupting or orphaning content the placeholder pointer still references. This looks like the same class of risk that existed pre-fix (nothing new introduced), and the documented answer is "run CHECK DATABASE FIX," which is reasonable — just flagging it explicitly in case it's worth a line in the release notes about running the FIX before relying on write access to full scan results on an old database.

Tests

Issue6196PlaceholderContentChainTest is thorough — it covers the scan/count/exists/load duplication directly, exercises the marker through grow→grow→shrink→grow→delete, and fabricates a pre-fix database (by patching the marker byte back to FIRST_CHUNK) to test the CHECK DATABASE / CHECK DATABASE FIX repair path end-to-end, asserting the fix is a rewrite and not a deletion. The updates to Issue5279ConcurrentUpdateTest and Issue6178ChunkCollapseTest correctly flip their old "duplicate is expected" assertions to "duplicate is gone," and the Issue6178 test's comment update correctly explains why the collapse guard has to stay until #6286.

Style / minor

Didn't run the full build in this environment (mvn was blocked for me here), so this review was done by reading rather than compiling/running — worth confirming CI is green before merge, though the PR description already states the engine module suite passed locally with -DexcludedGroups=benchmark,vector,slow.

…can of an old database

Code review on #6287. Until the FIX has run, the ambiguous content record is still handed out under a RID of
its own, and an application that scans a type and writes back what it got can reach it directly - where
nothing tells it apart from a record and the write lands on content a placeholder pointer still references.
Pre-existing behaviour, and the marker is what closes it, but it is worth saying where a reader of the release
notes will look for it.

Also states in check() that the reconciliation corrects the RETURNED totals only: the per-page tallies of the
verbose log describe the page as the walk found it, which is what a physical-layout log is for.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is an unusually well-documented fix, and I went through LocalBucket.java end-to-end tracing every FIRST_CHUNK call site to check that isChunkHead() / isPlaceholderContent() were applied consistently. Summary below.

Correctness

  • The core mechanism is sound: FIRST_CHUNK_PLACEHOLDER_CONTENT (-4) is the one free value in the marker namespace, it zigzag-encodes to a single byte exactly like FIRST_CHUNK (-2) does, so repairLegacyContentHead's in-place marker rewrite is safe (verified via Binary.getNumberSpace/zigzag math — both markers cost 1 byte, so the "refused unless same size" guard in the javadoc is correct and effectively unreachable through engine-written data, as documented).
  • I checked every remaining == FIRST_CHUNK site that was not converted to isChunkHead() (existsRecord, scan, count, getRecordPositionInPage's two chunk-marker-only sites at the collapse/spill replay branches, placeholderContentFingerprint's "not a chunk head, not negated" fallthrough) and each is deliberately record-only or genuinely unreachable for placeholder content (e.g. the SLOT_KIND_RECORD_SPILLED_TO_CHUNK / SLOT_KIND_CHUNK_COLLAPSED_TO_RECORD replay branches only ever apply to a record spilling/collapsing in place, and the comment at updateRecordInternal around the spill call explicitly notes "a placeholder CONTENT record never reaches here"). I didn't find a spot where the two markers were treated inconsistently.
  • check()'s reconciliation pass (legacyContentHeads) is deferred to after the full page walk rather than done inline, and the comment explains why (a content record can live on a page already walked) — that's correct, and the per-page verbose tallies are explicitly not reconciled, which is a reasonable, documented choice for a physical-layout log.
  • The updateRecordInternal chunk-head branch checks both the placeholderContentHead marker and the updatePlaceholderContent flag before allowing/forbidding collapse — necessary because a legacy (unrepaired) content record still carries the ambiguous FIRST_CHUNK marker, so the marker alone can't tell it apart from a real record mid-transition; the flag is what closes that gap. Traced through and it's correct.
  • rebaseRecordOnPage's disjoint-slot merge now tracks the slot kind the write actually started from (SLOT_KIND_FIRST_CHUNK vs SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT), so a legacy record whose marker is still ambiguous is correctly replayed under the "record" kind since updateMultiPageRecord never touches the marker byte — consistent.

Test coverage

The new Issue6196PlaceholderContentChainTest covers the reported bug, a full rewrite lifecycle (grow/shrink/grow/delete) with marker assertions at each step, and the legacy-database repair path (fabricating the pre-fix shape by hand-writing the old marker byte). Combined with the updated assertions in Issue5279ConcurrentUpdateTest and Issue6178ChunkCollapseTest (which now assert the correct single-copy behavior instead of documenting the bug), this is solid regression coverage. One thing that isn't covered and might be worth a follow-up test: a concurrent-transaction conflict where one tx's slot-merge replay expects SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT but the committed marker has since changed kind (the rs[0] != (kind == ... ? FIRST_CHUNK : FIRST_CHUNK_PLACEHOLDER_CONTENT) conflict path in rebaseRecordOnPage) — low risk given how narrow the window is, but it's new logic with no direct test.

Minor/non-blocking

  • check()'s isLegacyAmbiguousContentHead does one extra page fetch per RECORD_PLACEHOLDER_POINTER encountered (not just the rare chunked-content case) — reads go through the transaction's page cache so it's cheap when the content page is already touched elsewhere, and check() isn't a hot path, but on a database with many legacy placeholders (common pre-Record placeholders are the pre-chunk spill mechanism, and the 14 bytes that force them are usually available #6149) this adds a page fetch per placeholder to every CHECK DATABASE run. Worth a sentence in the PR/release notes if that's an intentional tradeoff (it reads like one, just flagging it explicitly).
  • No new dependencies, no System.out debug leftovers, comments follow the codebase's existing (verbose but precise) style.

Overall: this looks correct, thorough, and unusually well-reasoned for a subtle on-disk-format bug — nice work. I didn't find any bugs that would block merging.

…started from

Code review round 2 on #6287: the slot-kind/marker agreement in rebaseRecordOnPage was new logic with no direct
test. Driven through rebaseRecordOnPage the way Issue6129ChunkedSlotMergeTest already drives the tracking
guards, and for the same reason - no write path produces the transition it refuses, so going through the engine
would prove nothing about the guard. Both refusals AND both positive controls, so a guard that refused
everything would not pass.

Also states the cost of following the pointers in check(): one page fetch per placeholder POINTER, every one of
them and not only the chunked case, against a pass that already reads every page and walks every chunk chain.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a careful, well-documented fix for a real duplicate-scan bug (#6196), and the change is unusually thorough for its size: it introduces a new on-disk marker in the one free slot the zigzag namespace had (FIRST_CHUNK_PLACEHOLDER_CONTENT = -4), threads it consistently through every reader that needs to distinguish "chunk chain of a record" from "chunk chain of a placeholder's content," and adds a CHECK DATABASE FIX repair path for databases written before the fix.

I traced every call site that previously compared against FIRST_CHUNK (scan, count, existsRecord, getRecordInternal, offPageContentFingerprint, placeholderContentFingerprint, isChunkChainBroken, deleteRecordInternal, loadMultiPageRecord/validateChainRead/confirmBrokenChunkChain/findBrokenChunkChainInNewestCommitted, getOrderedRecordsInPage, getPageOccupiedInBytes, rebaseRecordOnPage) and in every case the choice between == FIRST_CHUNK (record-only) vs isChunkHead() (both markers) matches the comment justifying it. I didn't find a site that was missed.

Things that check out:

  • Zigzag encoding claim. Binary.getNumberSpace(-4) does come out to 1 byte (zigzag(-4) = 7 < 128), same as -2/-3, so "costs nothing in the stored format" is accurate, and matches the test's own CONTENT_CHUNK_MARKER = 7 constant.
  • createRecordInternal's isPlaceHolder flag is only ever passed true from the one call site that recreates a placeholder's content record after an in-place spill was refused (updateRecordInternal's "CANNOT CREATE A PLACEHOLDER OF PLACEHOLDER" branch), so the new marker can't leak onto an ordinary record's head chunk.
  • check() reconciliation correctly defers the multi-page → surrogate recount until after the full page pass (since a pointer can reference a content head on a page already walked, or not yet walked), and reverts the counters if repairLegacyContentHead fails partway through a fix run.
  • rebaseRecordOnPage ties the slot kind to the specific marker it expects to still find (SLOT_KIND_FIRST_CHUNK ↔ FIRST_CHUNK, SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT ↔ FIRST_CHUNK_PLACEHOLDER_CONTENT), so a slot that changed shape between the write and the commit-time replay is correctly treated as a conflict rather than silently merged. The third commit adds a direct unit test for this with both refusals and both positive controls, which is good practice since (as the commit message notes) no current write path actually produces the transition being refused.
  • The collapseChunkChainToRecord guard (#6178) is correctly widened to also refuse collapsing a legacy ambiguous content head (!updatePlaceholderContent && !placeholderContentHead), not just the new marker — otherwise a database mid-migration could still reproduce A placeholder whose CONTENT record had to spill into chunks is returned TWICE by a scan #6196 on a record that happened to shrink before CHECK DATABASE FIX ran.

Two observations, neither of which I'd block on:

  1. Permanent per-check() cost. isLegacyAmbiguousContentHead now does one extra page fetch per placeholder pointer on every CHECK DATABASE run, forever — even on a database that has already been fully repaired, or one created entirely after this fix and could never contain the legacy shape. The PR docs are upfront about this cost and argue it's small relative to the rest of check()'s work, which is fair, but it might be worth a follow-up to short-circuit it once a database is known to be clean (e.g., a persisted flag set after a successful CHECK DATABASE FIX), since check() is presumably run periodically/routinely on large databases.
  2. Per-page verbose tallies vs. returned totals. The reconciliation only corrects the totals returned from check(), not the per-page pageMultiPageRecords/pageSurrogateRecords counts written to the verbose log — so a verbose run against a legacy database will show a page's own tally disagreeing with the top-level totals for records the reconciliation moved. This is called out in a code comment as deliberate ("a physical-layout log describes the page as the walk found it"), which is a reasonable stance, but might be worth a line in the release notes too, since it's the kind of thing that reads as a bug report if a user notices it without the comment.

Test coverage is strong: the new Issue6196PlaceholderContentChainTest covers the reported bug directly, the full lifecycle of a content chain through repeated grow/shrink/delete, the legacy-database repair path via CHECK DATABASE / CHECK DATABASE FIX, and (added in the third commit, in response to its own code review) the commit-time slot-kind/marker agreement in rebaseRecordOnPage with both positive and negative controls. The two existing tests that previously asserted the buggy double-count (Issue5279ConcurrentUpdateTest, Issue6178ChunkCollapseTest) were updated to assert the corrected behavior rather than just deleted, which keeps the regression coverage instead of losing it.

Nothing here looks incorrect or missing to me; this reads as ready to merge modulo whatever the team wants to do with the two minor observations above.

…at a verbose run shows

Code review round 3 on #6287, both points documentation.

The probe costs one page fetch per placeholder pointer on every run, including on a database this build created
or one already repaired. The obvious saving - a persisted 'no legacy shape here' flag set by a successful FIX -
is not taken, and the javadoc now says why: the flag would have to stay true through every way old bytes reach
a repaired database (a restore from an older backup, an HA follower resynced from an older leader, a file a
older binary opened and handed back), and a flag that is wrong makes check() skip the one question that finds
the shape.

The release notes now also name the reporting detail a verbose run against an unrepaired database shows: only
the returned totals are reconciled, so a page's own tally disagrees with them for a record the reconciliation
moved. Deliberate - a physical-layout log describes the page as the walk found it - but it reads as a bug
report if nobody said so.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a well-scoped, carefully reasoned fix for a real correctness bug (double-counted/duplicated records for a placeholder whose content spilled into a chunk chain). The marker choice (-4, the one free value in the zigzag namespace), the isChunkHead/isPlaceholderContent predicate split, the SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT addition to the disjoint-slot merge, and the non-destructive CHECK DATABASE FIX repair path are all consistent with the invariants documented in engine/CLAUDE.md. I traced every FIRST_CHUNK/isChunkHead call site touched by the diff (scan, count, existsRecord, getRecordInternal, offPageContentFingerprint/placeholderContentFingerprint, deleteRecordInternal, updateRecordInternal, rebaseRecordOnPage, loadMultiPageRecord/validateChainRead/confirmBrokenChunkChain, getOrderedRecordsInPage, getPageOccupiedInBytes) and the record/surrogate/chunk-head bookkeeping is internally consistent in each of them.

Minor: check(fix=true) double-counts on a rare compound legacy shape

In LocalBucket.check(), a content record that is both (a) still stored with the ambiguous pre-#6196 FIRST_CHUNK marker and (b) has a broken chunk chain hits two independent code paths that don't fully reconcile:

  1. In the per-page loop, isChunkHead(recordSize[0]) is true, so it's counted as totalMultiPageRecords++ (marker is plain FIRST_CHUNK, not FIRST_CHUNK_PLACEHOLDER_CONTENT, so the surrogate branch isn't taken). The broken-chain check then force-deletes it via deleteRecordInternal(rid, true, true, true) and zeroes its slot - but totalMultiPageRecords is never decremented for this deletion (pre-existing behavior, not introduced by this PR).
  2. After the loop, the reconciliation block (legacyContentHeads) still contains this record's position (added earlier from the placeholder-pointer branch), so it calls repairLegacyContentHead(contentRID). Since the slot was already zeroed by the delete above, the marker/space guard in repairLegacyContentHead fails, so the "could not be repaired" branch runs, which does --totalSurrogateRecords; ++totalMultiPageRecords; on top of the already-stale count from (1), and appends a second warning/totalErrors++ for what is really the same underlying defect already reported by the broken-chain warning.

Net effect is purely a reporting artifact (an extra totalErrors/duplicate warning, and totalMultiPageRecords left describing a record that was actually deleted) - the deletion itself is correct and safe, and deletedRecordsAfterFix still lists the right RID. Given how narrow the precondition is (a legacy pre-fix database and an independently corrupted chain on that exact record), this is low severity, but worth a one-line guard (e.g., skip the legacyContentHeads reconciliation for a position that ended up in deletedRecordsAfterFix) or at least a comment acknowledging the interaction, since the surrounding code is otherwise very careful about exactly this kind of double-booking.

Test coverage

The three new Issue6196PlaceholderContentChainTest cases cover the reported bug, the marker surviving every rewrite shape, and the CHECK DATABASE FIX repair path well, and aHeadChunkIsOnlyReplayedOntoTheMarkerItsWriteStartedFrom is a good targeted test of the new SLOT_KIND since no live write path exercises that transition today. The compound scenario above (legacy marker + broken chain) isn't covered, understandably, since it's a fairly deep edge case - not blocking, just noting it as untested.

Nits

  • The docs/release-26.9.1.md addition duplicates a lot of the PR-description prose almost verbatim; that's consistent with how this file is used elsewhere in the repo, so not an issue, just flagging in case a trim is wanted before release.
  • isLegacyAmbiguousContentHead bounds-checks against getTotalPages() rather than the totalPages local snapshot check() already computed - harmless (just a defensive bound), but slightly inconsistent with the rest of the method using the snapshot.

Overall: solid fix, thorough reasoning trail in the commit messages, and the marker/predicate design is sound. The one issue above is cosmetic (reporting only), not a correctness or data-safety concern.

…d once, not twice

Code review round 4 on #6287. Two independent defects can meet on one record: a content head still wearing the
ambiguous FIRST_CHUNK marker whose chunk chain is ALSO broken. The broken-chain branch force-deletes it and
reports it; the ambiguity reconciliation that runs after the pass then found the same position in its set, tried
to repair a slot that was already zeroed, failed, and emitted a second error and a 'could not be repaired'
warning naming a record that was no longer there. Reporting only - the deletion itself was correct, and
deletedRecordsAfterFix already listed the right RID - but the surrounding code is careful about exactly this
kind of double-booking.

The reconciliation now asks again whether the slot still holds the ambiguous shape, and skips it when it does
not. The general form of the guard rather than a membership test against deletedRecordsAfterFix: whatever
removed or rewrote the slot, and whoever reported it, it is no longer this pass's to report. It costs one page
fetch per head actually FOUND in the legacy shape, a set that is empty on every database this build wrote.

Tested by aLegacyContentHeadWithABrokenChainIsReportedOnce, which reports 2 errors and the spurious warning
without the guard. isLegacyAmbiguousContentHead now also bounds against the page-count snapshot check() took
rather than re-reading it, so both of its questions are answered against the bucket the walk covered.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review of #6287 — placeholder content records with a chunked chain no longer duplicate

I traced the fix through every touch point in LocalBucket (scan, count, check, existsRecord, getRecordInternal, deleteRecordInternal, updateRecordInternal, createRecordInternal, offPageContentFingerprint/placeholderContentFingerprint, loadMultiPageRecord/validateChainRead/confirmBrokenChunkChain, and the commit-time slot-merge replay in rebaseRecordOnPage), plus TransactionContext's new SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT. Overall this is a very solid, carefully reasoned fix — the isChunkHead/isPlaceholderContent split correctly separates "walk/rewrite the chain" from "is this slot a record", and every call site that needed the new marker got it (verified by grepping every remaining FIRST_CHUNK reference in the engine module to check for a partial rollout).

Correctness checks that passed:

  • writeMultiPageRecord's three call sites are each correctly parameterized: createRecordInternal forwards its own isPlaceHolder flag, restoreRecordAtPosition always passes false (a restored record is never anonymous placeholder content), and the spill branch of updateRecordInternal also passes false — confirmed by reading the surrounding code that a placeholder-content record can never reach that branch (isPlaceHolder returns earlier via "CANNOT CREATE A PLACEHOLDER OF PLACEHOLDER").
  • rebaseRecordOnPage's new guard correctly ties the slot kind the write started from to the marker it expects still to find, symmetric for both SLOT_KIND_FIRST_CHUNK and the new kind — a shape change under a concurrent commit correctly falls back to a conflict rather than being silently mis-replayed.
  • check()'s legacy-shape reconciliation is done as a second pass after the full page walk (not inline), which is necessary since the content record can live on a page already walked; the compound-failure case (ambiguous marker and a broken chain) is correctly de-duplicated by re-asking isLegacyAmbiguousContentHead before repairing, rather than trusting the first pass's bookkeeping — and there's a dedicated test for exactly that interaction.
  • I checked whether BucketIterator (which is what FetchFromClusterExecutionStep actually uses for ordinary SELECT FROM Type/count(@rid) — a different code path from LocalBucket.scan()/count()) needed a matching change. It doesn't: its if/else if only explicitly yields for > 0, == FIRST_CHUNK, or == RECORD_PLACEHOLDER_POINTER and silently skips everything else, so the new -4 marker falls through correctly without any code change there. Worth confirming since the release notes' example (SELECT FROM Doc) is served by that class, not the one this PR edits directly — but it does check out, and the new test's use of select count(@rid) ... where v = :v exercises that exact path end-to-end.
  • The zigzag encoding claims in the comments/tests check out arithmetically (zigzag(-4) = 7, zigzag(-2) = 3, zigzag(-1) = 1), matching the CONTENT_CHUNK_MARKER/FIRST_CHUNK_MARKER/PLACEHOLDER_POINTER_MARKER constants the new test hard-codes.

Test coverage is genuinely thorough: reproduction of the duplicate (aPlaceholderWhoseContentSpilledIsScannedOnce), marker persistence through grow/shrink/grow/delete (theContentChainKeepsItsMarkerThroughEveryRewrite), the legacy-database repair path including a direct assertion that CHECK DATABASE FIX never appears in deletedRecordsAfterFix (i.e. it's a repair, not a deletion), the compound broken-chain-plus-ambiguous-marker case, and a dedicated unit test of the new rebaseRecordOnPage guard (with both refusal and positive-control assertions, so a guard that refused everything wouldn't pass). Good instinct to keep the Issue6178ChunkCollapseTest guard test and just update what it now measures rather than deleting it.

Minor/non-blocking observations:

  • isLegacyAmbiguousContentHead pays one page fetch per placeholder pointer on every check() run forever, including on databases this build wrote or already repaired — this is deliberately undertaken and well justified in the javadoc (a persisted "no legacy shape" flag would need to survive backups/HA resync/older binaries writing back). Worth flagging only as something to keep in mind for very large check() runs on bucket types that lean heavily on placeholders (pre-Record placeholders are the pre-chunk spill mechanism, and the 14 bytes that force them are usually available #6149 databases); the cost is bounded and the reasoning for not caching it is sound.
  • deletePlaceholderContent/updatePlaceholderContent guards for the new marker (RecordNotFoundException on a direct update/delete of placeholder content) mirror the existing negated-size-shape behavior exactly, which is the correct choice for consistency, but it might be worth a one-line test asserting a direct UPDATE/DELETE by the content RID throws RecordNotFoundException for the chunked shape specifically — the existing tests hit this indirectly (through placeholder.asDocument(true).modify()...) but never directly exercise content.asDocument(true).delete() the way the analogous negated-size case might already be tested elsewhere.
  • Nothing style-wise stands out as inconsistent with the file's existing (very discursive) commenting convention, so I won't flag verbosity — it matches how the rest of LocalBucket/engine/CLAUDE.md already documents these invariants.

No security or performance concerns beyond the bounded, well-justified check() cost above. No stray debug output. Nice work — this is a hard bug to reason about correctly (marker namespace, commit-time replay, and read-side chain validation all had to move together) and the PR does it carefully with matching tests at each step.

…t its own RID

Code review round 5 on #6287. The update and delete guards for the new marker mirror what the negated-size
shape has always done, and the existing tests reached them only indirectly, through the pointer. Driven through
LocalBucket rather than through a document on purpose: content.asDocument() is refused one layer earlier, by the
read that will not hand out a content record, so it would never reach the two guards this is about. Both
assertions go red without them.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review of #6287

I read through the full diff (LocalBucket.java, TransactionContext.java, the three test files) and traced every call site of the new FIRST_CHUNK_PLACEHOLDER_CONTENT marker, isChunkHead()/isPlaceholderContent(), and the check()/repairLegacyContentHead reconciliation path. Overall this is a very well-scoped, carefully reasoned fix for a genuinely subtle on-disk ambiguity. I did not find any blocking correctness issues.

Correctness

  • The marker choice (-4) is sound: it zigzag-encodes to 1 byte, same as FIRST_CHUNK/NEXT_CHUNK, so the on-disk format cost is really zero, and it sits in the one gap the namespace had free.
  • isChunkHead() vs isPlaceholderContent() are applied consistently: every reader/writer that walks or rewrites the chain (offPageContentFingerprint, getLastRecordPositionInPage, isChunkChainBroken, findBrokenChunkChainInNewestCommitted, getOrderedRecordsInPage, getPageOccupiedInBytes) now accepts both heads, while the ones that decide whether a slot is a record (scan, count, existsRecord, getRecordInternal without readPlaceHolderContent) deliberately keep the narrower == FIRST_CHUNK check, each annotated with why. I didn't find a call site that was missed.
  • Checked BucketIterator.java, the one other file that reads LocalBucket.FIRST_CHUNK directly - it wasn't touched by this PR, but it doesn't need to be: its recordSize[0] > 0 || recordSize[0] == FIRST_CHUNK branch naturally excludes -4, and the placeholder-pointer branch still resolves the content once through the pointer's own RID. So a repaired/new-format database is handled correctly there too, "for free."
  • check()'s reconciliation loop (collect while walking pointers, correct totals/repair after the full pass) correctly handles both orderings of pointer-page vs content-page, and the "ask again before repairing" guard for the compound legacy-head + broken-chain case is exercised by its own test (aLegacyContentHeadWithABrokenChainIsReportedOnce) and looks right on inspection.
  • writeMultiPageRecord's new isPlaceHolderContent parameter is threaded through all three call sites correctly (createRecordInternal with the real flag, restoreRecordAtPosition and the in-place spill in updateRecordInternal both hard-coded false, which matches the invariant documented at each site).
  • The rebaseRecordOnPage slot-kind matching for the new SLOT_KIND_FIRST_CHUNK_PLACEHOLDER_CONTENT is symmetric and correctly refuses cross-kind replay.

Test coverage

Good breadth: the new Issue6196PlaceholderContentChainTest covers the reported bug directly, marker persistence across grow/shrink/regrow/delete, the CHECK DATABASE / CHECK DATABASE FIX repair path (including the compound broken-chain case), the write-side guards (update/delete refused at the content record's own RID), and the commit-time slot-merge kind matching driven directly through rebaseRecordOnPage (with both refusal and positive-control assertions, so a guard that refused everything wouldn't pass). The existing Issue5279 and Issue6178 tests were updated consistently with the new counting semantics rather than just widened.

Performance

The one added cost is check()'s one extra page fetch per placeholder pointer to disambiguate the two shapes. That's well justified in the javadoc against the alternative (a persisted "already repaired" flag that could go stale after a restore/resync) and is bounded by an operation that's already O(pages + chunks). No hot-path (read/write) cost is added - the new marker comparisons are all cheap long equality checks.

Security

No concerns. This is purely on-disk storage-engine bookkeeping; no new external input parsing, no serialization of untrusted data, no new dependency.

Minor, non-blocking observations

  • repairLegacyContentHead/isLegacyAmbiguousContentHead trust that a placeholder pointer references only the content record written for it. As the javadoc already states, a corrupted pointer that happens to reference an unrelated real multi-page record would cause CHECK DATABASE FIX to mark that unrelated record as placeholder content (hiding it from scans). This is explicitly documented as an accepted, reversible trade-off, so I'm not flagging it as a defect, just noting it's worth a second pair of eyes given it's a data-mutating repair path.
  • Nothing else stood out stylistically; the change follows the existing file's conventions closely (final params/locals, no unnecessary braces, javadoc density matching the surrounding code).

Nice work tracking down and closing an ambiguity that's been latent since the placeholder/chunk mechanisms were built.

…rs lead to

Code review round 6 on #6287 asked for a second pair of eyes on the repair, since it mutates data on the
strength of one invariant: a placeholder pointer leads to the content record written for it and nothing else. A
corrupted pointer breaks that, and a repair made on it hides a real record from scans - documented as reversible
and accepted, but one form of that corruption can be RECOGNISED rather than merely tolerated.

A content record belongs to exactly one pointer, so a second pointer leading to the same slot is proof that a
pointer is corrupted, and nothing in the bucket says which. That case is now reported and the marker left
exactly as found: the marker is unrecoverable information - it says whose the record is - so refusing beats
guessing. Costs nothing: the pointers were already being collected in a set, and a duplicate is what add()
returning false already told us.

Tested by aContentHeadTwoPointersLeadToIsReportedAndLeftAlone, which fabricates the second pointer over a
neighbouring record and goes red without the refusal. It drops its type at the end, since the corruption it
builds is deliberately the kind FIX cannot repair.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

I did a static read-through of the full diff (I wasn't able to run mvn/git fetch in this sandbox, so no build/test execution here - please treat this as a design/code review, not a CI confirmation).

Overall

This is a well-scoped fix. The new FIRST_CHUNK_PLACEHOLDER_CONTENT (-4) marker closes the actual ambiguity (a chunked placeholder-content head was indistinguishable from an ordinary multi-page record's head), and I traced every call site that branches on FIRST_CHUNK/chunk-head markers in LocalBucket (existsRecord, scan, count, getRecordInternal, offPageContentFingerprint, updateRecordInternal, deleteRecordInternal, rebaseRecordOnPage, check, writeMultiPageRecord, loadMultiPageRecord/validateChainRead/confirmBrokenChunkChain, isChunkChainBroken, getOrderedRecordsInPage, getPageOccupiedInBytes) plus the one external reader, BucketIterator. The split between isChunkHead() (chain-walking readers, which must treat both heads identically) and the deliberate == FIRST_CHUNK checks (readers that decide "is this a record", which must not) is applied consistently everywhere I could find. BucketIterator wasn't touched by the PR but is already correct as-is: an unmatched FIRST_CHUNK_PLACEHOLDER_CONTENT slot silently falls through all its if/else if branches, same as scan().

Things I looked at closely and didn't find bugs in

  • check()'s legacy-repair pass (legacyContentHeads / ambiguousHeadsWithSeveralPointers): the two-phase collect-then-reconcile design correctly avoids double-booking a record whose chain is also broken (re-checked via isLegacyAmbiguousContentHead before repairing, since the broken-chain branch may have already force-deleted it), and LongHashSet.add()'s "true = newly added" semantics are used correctly to detect a second pointer landing on the same content slot.
  • updateRecordInternal: the !updatePlaceholderContent && !placeholderContentHead guard against collapsing a placeholder's content chain back into a plain record is technically redundant (the earlier if (placeholderContentHead && !updatePlaceholderContent) throw already means placeholderContentHead can't be true here unless updatePlaceholderContent is also true), but it's harmless belt-and-suspenders and the comment explains the intent (covering a legacy ambiguous head via the flag, since the marker alone can't tell it apart pre-fix).
  • writeMultiPageRecord/createRecordInternal/restoreRecordAtPosition: the new isPlaceHolderContent parameter is threaded correctly; restoreRecordAtPosition hardcodes false correctly since a record restored at an explicit RID can't be placeholder content.
  • repairLegacyContentHead: only rewrites the marker byte in place, poisons the slot-merge rebase page first, and refuses if the byte-width of the two markers ever differed (defensive, unreachable for anything this engine wrote itself).

One thing worth a second pair of eyes (not asking for a change, just flagging)

isLegacyAmbiguousContentHead/the repair in check() trusts "a placeholder pointer references the content record written for it and nothing else." If a single (not duplicated) placeholder pointer were corrupted to coincidentally reference the head chunk of an unrelated, otherwise-healthy multi-page record still on the plain FIRST_CHUNK marker (a legacy DB), CHECK DATABASE FIX would rewrite that unrelated record's marker to FIRST_CHUNK_PLACEHOLDER_CONTENT, hiding it under its original RID (it becomes reachable only through the corrupted pointer). The PR's own javadoc on repairLegacyContentHead already acknowledges this exact scenario and argues it's a strict improvement over the pre-fix behavior (that record's bytes were already being double-exposed through the corrupted pointer) and that the repair is reversible. I agree with that reasoning, just noting it since it's the one place the fix relies on an invariant it can't independently verify from a single pointer. The two-or-more-pointers case is correctly caught and refused.

Test coverage

Issue6196PlaceholderContentChainTest's 6 tests are thorough: the original duplicate-scan bug, marker persistence across grow/shrink/delete, CHECK DATABASE/FIX on a fabricated legacy DB, write-path refusal (update/delete at the content RID), the compound "legacy + broken chain" case, and the two-pointers-to-one-slot refusal. Issue5279ConcurrentUpdateTest and Issue6178ChunkCollapseTest were updated to assert the new (correct) counts instead of the previously-documented-as-buggy ones, and the #6178 guard's comment now correctly explains why it still needs to exist post-fix (the collapse-back path is deferred to #6286, not a correctness gap in this PR).

Nice attention to detail overall (e.g. release notes spell out the "run FIX before a read-modify-write scan on an unrepaired DB" operational caveat, and the check() cost analysis for the added per-placeholder page fetch is honest about the O(placeholders) trade-off rather than reaching for a stale-prone cached flag).

…ch is redundant

Two review rounds on #6287 stopped to re-derive that the marker test next to the flag cannot be false on its
own - the throw at the top of the branch already rules it out. It is kept so the line states its own
precondition rather than borrowing one from thirty lines up, and the comment now says that instead of implying
both halves are load-bearing.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

I traced this through LocalBucket.java, TransactionContext.java, and the new/updated tests, and cross-checked the trickier claims against the actual encoding (zigzag byte width of FIRST_CHUNK vs FIRST_CHUNK_PLACEHOLDER_CONTENT, the writeMultiPageRecord call sites, and the rebaseRecordOnPage/slot-kind wiring). Overall this is a careful, well-reasoned fix for a real correctness bug (duplicate scan results / double counting for placeholder content that spilled into a chunk chain).

Correctness

  • The core idea holds up: FIRST_CHUNK_PLACEHOLDER_CONTENT = -4 is the one free value in the marker namespace, and Binary.getNumberSpace(-2) and Binary.getNumberSpace(-4) both resolve to 1 byte, so the "costs nothing in the stored format" claim and the repairLegacyContentHead byte-width guard are both correct.
  • I traced the one call site where the new marker actually gets written (createRecordInternal's multi-page branch, LocalBucket.java around line 1660) and confirmed the other two writeMultiPageRecord call sites (restoreRecordAtPosition, and the ordinary spill branch in updateRecordInternal) correctly always pass false - a placeholder's content record can't reach either of those paths, matching the comments that say so.
  • isChunkHead/isPlaceholderContent are used consistently: every reader that walks/rewrites the chain (offPageContentFingerprint, getRecordInternal, isChunkChainBroken, getLastRecordPositionInPage/statistics, findBrokenChunkChainInNewestCommitted, validateChainRead via the new headMarker param) accepts both markers, while scan(), count(), and existsRecord() deliberately keep testing == FIRST_CHUNK only, as the inline comments claim.
  • The check() reconciliation (collect legacy heads while walking pointers, re-verify after the pass, repair) is sound, and the "ask again before touching a slot" guard in the post-loop pass correctly avoids double-booking a record whose chain was also broken and force-deleted earlier in the same pass (the round-4 fix). The two-pointers-to-one-slot corruption case is handled conservatively (report, don't guess) rather than repaired, which is the right call given the marker is otherwise unrecoverable information.
  • deleteRecordInternal's new guard (FIRST_CHUNK_PLACEHOLDER_CONTENT && !deletePlaceholderContent -> throw) is placed after poisonSlotRebasePage, but that mirrors the existing pattern for RECORD_PLACEHOLDER_POINTER and the negated-size content shape a few lines below - poisoning an unwritten page just forces a plain version check at commit instead of a merge replay, not a correctness issue.
  • rebaseRecordOnPage's slot-kind check correctly refuses a replay when the committed marker doesn't match the kind the write started from, closing the concurrent-rewrite gap between the two head shapes.

I didn't find a correctness bug in the core logic. I was not able to run mvn compile/mvn test in this environment (the shell tool blocked the build command), so I've relied on static reading rather than an actual green build - worth having CI confirm, though the PR description states the full engine suite passes locally.

Test coverage

Good breadth in Issue6196PlaceholderContentChainTest: the reported bug itself, full lifecycle (grow/shrink/regrow/delete) with marker assertions at each step, legacy-database repair via CHECK DATABASE FIX, the compound "legacy head + broken chain" double-booking case, the two-pointers corruption case, and a direct rebaseRecordOnPage test for the commit-time merge guard (with both positive and negative controls, so an over-eager "refuse everything" guard wouldn't slip through). The updates to Issue5279ConcurrentUpdateTest and Issue6178ChunkCollapseTest correctly flip their old "documents the bug" assertions to "documents the fix" now that the shape is no longer ambiguous. This is thorough.

Nits (non-blocking)

  • The javadoc/inline-comment density in LocalBucket.java is quite high for this change - many multi-paragraph comments narrating the reasoning and alternatives considered. Useful for archaeology on a subtle bug like this one, but it's a lot of prose mixed into hot-path code; consider whether some of this belongs only in the PR description / issue thread rather than permanently in-line (e.g. the "why not persist a flag" discussion on isLegacyAmbiguousContentHead, or the "why the marker test is redundant" note in updateRecordInternal).
  • check()'s deliberate non-reconciliation of the per-page verbose tallies (only the returned totals are corrected) is a reasonable tradeoff and is documented in three places (release notes, class javadoc, inline comment) - slightly redundant, but not wrong, and it does mean a user diffing a verbose log against the returned JSON on an unrepaired database will see a discrepancy that looks like a bug if they haven't read the docs. Might be worth a one-line callout in the verbose log itself when this happens, but that's a nice-to-have, not a request for this PR.
  • docs/release-26.9.1.md is comprehensive to the point of being long for a release note; the "Verification"-style detail (cost analysis of the check() probe, exact reporting semantics) reads more like engineering documentation than user-facing release notes. Consider trimming for the release notes and keeping the fuller rationale in code comments/PR description only.

Security / performance

No security concerns. Performance-wise, the one added cost is isLegacyAmbiguousContentHead's unconditional extra page fetch per placeholder pointer in check(), on every run forever (not gated by a "already repaired" flag). That's explicitly and convincingly justified in the javadoc (a stale flag would be worse than the fetch), and check() is an admin operation, not a hot path, so this is fine.

Nice work tracking down a genuinely subtle ambiguous-on-disk-shape bug and closing both the read-path duplication and the legacy-database repair story in one PR.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.64957% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.14%. Comparing base (2a88019) to head (e0b8aa2).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...src/main/java/com/arcadedb/engine/LocalBucket.java 72.64% 18 Missing and 14 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6287      +/-   ##
==========================================
+ Coverage   70.12%   70.14%   +0.02%     
==========================================
  Files        1839     1839              
  Lines      158956   159043      +87     
  Branches    33534    33557      +23     
==========================================
+ Hits       111463   111568     +105     
+ Misses      33599    33577      -22     
- Partials    13894    13898       +4     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

A placeholder whose CONTENT record had to spill into chunks is returned TWICE by a scan

1 participant