Skip to content

rebaseRecordDeleteOnPage reports -1 free bytes to updatePageStatistics under concurrent vertex deletes #8401

Closed

Description

@lvca

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 on name), edge type RELATES_TO
  • 16-32 threads, each running short transactions (database.transaction(..., false, 3)) that randomly:
    • create/merge an Entity by name from a hot set of a few hundred names
    • add a RELATES_TO edge between two random entities
    • update/grow/shrink entity properties
    • delete a random entity (about 3% of operations; deleting a vertex deletes its edges)

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

  1. added
    concurrency
    severity:major
    storage
    on Sep 25, 2026
  2. self-assigned this
    on Sep 25, 2026
  3. added
    in progress
    on Sep 25, 2026
  4. added this to the 26.10.1 milestone on Sep 25, 2026
  5. added a commit that references this issue on Sep 25, 2026
  6. lvca commented on Sep 25, 2026

    @lvca
    MemberAuthor

    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 bucketWipeOutOnDelete enabled. 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.

  7. removed
    in progress
    on Sep 25, 2026
  8. added a commit that references this issue on Sep 25, 2026
  9. added a commit that references this issue on Oct 11, 2026
  10. added a commit that references this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugconcurrencyseverity:majorstorage

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions