Repository navigation
Description
Summary
Under concurrent vertex deletes, the disjoint-slot merge of a record delete (LocalBucket.rebaseRecordDeleteOnPage) reports a page of the edge bucket with -1 free bytes to updatePageStatistics. With assertions enabled (Surefire's default) this trips the tripwire and fails the commit:
com.arcadedb.exception.DatabaseOperationException: Error during read lock
at com.arcadedb.database.LocalDatabase.executeInReadLock(LocalDatabase.java:2422)
at com.arcadedb.database.LocalDatabase.commit(LocalDatabase.java:702)
Caused by: java.lang.AssertionError: page 2 of bucket 'RELATES_TO_0' is reported with -1 free bytes and a delta of 0
at com.arcadedb.engine.LocalBucket.updatePageStatistics(LocalBucket.java:6198)
at com.arcadedb.engine.LocalBucket.rebaseRecordDeleteOnPage(LocalBucket.java:3076)
at com.arcadedb.database.TransactionContext.rebaseSlots(TransactionContext.java:1712)
at com.arcadedb.database.TransactionContext.commit1stPhase(TransactionContext.java:2223)
at com.arcadedb.database.TransactionContext.commit(TransactionContext.java:367)
In production (no -ea) the branches after the assertion absorb the value, so the visible effect is wrong free-space statistics for that page rather than a failed commit. No data corruption observed: CHECK DATABASE is clean after the same workload with assertions disabled.
How to reproduce
Reproducible in a few seconds on current main (80219fa2ef) with an embedded database, one bucket per type:
- vertex type
Entity(unique LSM index onname), edge typeRELATES_TO - 16-32 threads, each running short transactions (
database.transaction(..., false, 3)) that randomly:- create/merge an
Entityby name from a hot set of a few hundred names - add a
RELATES_TOedge between two random entities - update/grow/shrink entity properties
- delete a random entity (about 3% of operations; deleting a vertex deletes its edges)
- create/merge an
Without the delete operations the assertion never fires. The failing call is always the rebase of an edge record delete onto a newer committed page of the edge bucket.
Analysis pointers
rebaseRecordDeleteOnPage measures the free tail with getFreeSpaceInPage(pageAnalysis) after zeroing the slot and passes it as (spaceAvailableInCurrentPage, 0). The measurement comes out as -1 on the rebased page, so either getFreeSpaceInPage computes the tail from a record table/record count that does not match the rebased page (the local recordCountInPage is read before the slot is freed and the rebased page may carry records the transaction's original image did not), or a record on that page extends one byte past what the analysis assumes. Worth comparing with the measurement compressPage makes on the same page a moment later at commit.
Expected
The rebased delete measures a non-negative free tail, identical to what the commit-time compaction measures for that page.
Activity
Merge pull request #8416 from ArcadeData/fix/8401-rebase-delete-free-…
lvca commentedon Sep 25, 2026
Fixed in #8416 (26.10.1).
When a record was deleted on a page whose record slots were all in use (common with small records such as edges), the engine measured the page's free space the wrong way and got -1. In production this only produced a short-lived wrong free-space hint, corrected by the commit itself. In test builds, where Java assertions are on, it made the commit fail.
The same mistake also skipped the zeroing of the freed bytes on those pages, so stale copies of record data could stay in the file even with
bucketWipeOutOnDeleteenabled. Both cases now measure the free space correctly.No data was ever lost or corrupted, and nothing changes for users.
❤️ 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(ArcadeData#8401): measure the free tail directly on a rebased del…
fix(ArcadeData#9694): stop concurrent inserts into one bucket from co…
fix(#9694): stop concurrent inserts into one bucket from conflicting …