Repository navigation
Description
Four findings from the work on #6258 (merged as 2a880199c, PR #6262). Filed together because they were found together; each is separable and can be taken on its own. Items 1 and 2 are the same distinction #6258 drew on the read path, missing from the paths either side of it; items 3 and 4 are what makes that distinction fragile to maintain.
Line numbers below are against 2a880199c.
1. The DELETE path still reports a broken chunk chain as contention
#6258 item 2 taught the READ path to tell a chain that does not parse from a record that moved under it: loadMultiPageRecord confirms the break and raises BrokenChunkChainException, which is deliberately not a NeedRetryException. The DELETE path was left as it was, and still conflates the two (LocalBucket.java:2883):
if (chainProblem != null) {
if (!force)
// Chunk was modified/removed by a concurrent operation — signal retry (#4932)
throw new ConcurrentModificationException(
"Multi-page record " + rid + " chunk " + chunkId + " was modified concurrently. Please retry");chainProblem is set a few lines above by exactly the structural conditions #6258 classified as corruption - a pointer past the end of the file, a cleaned slot, a marker that is not NEXT_CHUNK - so a corrupted record being deleted is still reported as a concurrency problem, and still costs the caller's retry machinery a full round of transactions before it gives up.
The cost is not only the message. Because the exception does not say which it is, five call sites still walk the chain a second time to find out:
LocalDatabase.deleteRecordNoLock:1448(index cleanup),:1472(vertex physical delete),:1487(plain-record physical delete)BucketIterator.fetchNext:217and:257LocalBucket.deleteCorruptedRecord:470
Each of those is a !bucket.isChunkChainBroken(rid) probe that exists purely to disambiguate a ConcurrentModificationException. Teaching deleteRecordInternal to raise BrokenChunkChainException for the branches it has already positively identified would let every one of them go, and would make the BrokenChunkChainException arm on LocalDatabase's plain-record branch live - it was deliberately left out in #6258 (with a comment saying why) precisely because deleteRecordInternal never names a broken chain as one.
2. isChunkChainBroken judges from the transaction's pinned view, and it gates force-delete
isChunkChainBroken is the probe all of the above depends on, and it walks the chain through the caller's transaction (LocalBucket.java:2749, and it passes fromNewestCommitted=false at :2760):
final BasePage page = database.getTransaction().getPage(new PageId(database, file.getFileId(), pageId), pageSize);
...
return findBrokenChunkChain(rid, page, recordPositionInPage, false) != null;Under READ_COMMITTED that reads the newest committed image and the answer is sound. Under REPEATABLE_READ the transaction has pinned the pages it walked, so this reads a stale snapshot: a chain that a concurrent commit has since rewritten can present as broken in the pinned image while the committed image walks cleanly. The doc comment on the method claims the opposite ("a transient concurrent modification never reports true"), which holds for the version-blindness it was written about but not for snapshot staleness.
What makes it worth fixing rather than noting is what the answer is used for: deleteCorruptedRecord:470 and LocalDatabase.deleteRecordNoLock:1472/:1487 escalate to force-delete on a true, and check(fix) deletes the record it flags. A false positive there removes a healthy record.
#6258 added exactly the walk this wants - findBrokenChunkChainInNewestCommitted (LocalBucket.java:3572), which reads every page from the PageManager and is already used to confirm a break authoritatively on the read path. Pointing these callers at it (or giving isChunkChainBroken the fromNewestCommitted=true treatment) closes the gap with code that already exists.
Worth pairing with item 1: if the delete path names a broken chain itself, most of these callers stop needing the probe at all, and the remaining ones become the narrow case.
3. IOException carries two opposite meanings inside the same walk
The third round of review on #6262 caught a real bug of this shape: findBrokenChunkChain's blanket catch (final Exception e) { return "error walking chain: " + e.getMessage(); } (LocalBucket.java:2728) turned a transient IOException re-fetching a page into a confirmed, permanent, non-retryable corruption verdict, pointing the operator at a command that deletes the record. That was fixed for the page LOAD by catching at the load site (:2703) and answering null - "cannot prove a break".
The underlying ambiguity is still there. getRecordPositionInPage (LocalBucket.java:3641) reports a corrupt slot offset by throwing an IOException:
if (recordPositionInPage != 0 && recordPositionInPage < contentHeaderSize)
throw new IOException("Invalid record #" + fileId + ":" + ...);So within a few lines of the same walk, IOException means "the disk failed, prove nothing" in one place and "this record is corrupt, report a break" in another, and the only thing keeping them apart is where the try/catch sits. That is a positional invariant, not a structural one: the next person who restructures this walk, or adds a page read to it, has no type-level signal to preserve. The corresponding hazard in the other direction is live today - a genuine I/O failure reading the slot table is still swallowed as corruption by the blanket catch.
A distinct signal for "this page's contents do not make sense" (a PageCorruptionException, or a sentinel return) would make the line permanent. Cheap, and it retires a class of mistake rather than one instance of it.
4. No fault-injection hook for page reads, so the highest-consequence path is untestable
The bug in item 3 was found by reading, not by a test, and it could not have been found by a test: there is no way to make a specific page read fail on demand. PageManager has no test hook (getImmutablePage/loadPage go straight to the read cache, the flush queue, and the file), so "the confirmation walk hits an I/O fault" - a path whose wrong answer is a permanent corruption verdict on a healthy record - has no coverage, and neither does any other I/O-failure path in the engine.
The reviewer flagged the gap explicitly and I could not close it without inventing a hook, which did not belong in that PR.
A test-only failure predicate on PageManager (something like "fail the next read of page X with an IOException"), gated so it costs nothing in production, would cover:
- the
findBrokenChunkChainload failure of item 3 (verdict must be "cannot prove a break", read must retry, not condemn) validateChainRead's deliberate decision to let anIOExceptionescape rather than spend the retry budget on a broken disk (Reading a multi-page record fails with a ConcurrentModificationException when an unrelated record's chunk on the same page is written #6217)- flush and torn-read robustness paths that are today only reasoned about
This is the item I would take first if the goal is keeping the other three fixed once they are fixed.
Activity
lvca commentedon Aug 28, 2026
Fixed in #6870, merged to main for 26.9.1.
What changed for you
Deleting a record whose multi-page chunk chain is corrupted used to report the problem as a concurrency conflict ("was modified concurrently, please retry"). That was misleading and wasteful: the retry could never succeed, so the delete burned a full round of transactions before giving up. It now says plainly that the record is corrupted and points you at
CHECK DATABASE FIX, and it does not retry.Before saying that, the engine double-checks the break against the newest committed state of the pages, so a record that was merely being written by another transaction at that moment still gets the ordinary retry. Genuine contention behaves exactly as before.
Two related hardening changes came out of the same work:
If you have
arcadedb.deleteTolerateBrokenChainenabled, or you runCHECK DATABASE FIX, corrupted records are removed exactly as before.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(engine): name a broken chunk chain on the delete path, and keep t…