Skip to content

fix(#10304): the committed edge-list check reads a multi-page or placeholder vertex from the committed pages - #10313

Merged
robfrank merged 1 commit into
mainfrom
fix/10304-committed-edge-list-multipage-vertex
Oct 18, 2026
Merged

robfrank merged 1 commit into
mainfrom
fix/10304-committed-edge-list-multipage-vertex

Conversation

@robfrank

@robfrank robfrank commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #10304

Summary

LocalBucket.getRecordFromCommittedPage (added by #10263, PR #10303) answered only a record stored in place from the committed page; a placeholder pointer or a multi-page record fell back to getRecordInternal, i.e. the transaction's own view. So GraphEngine.committedEdgeListHolds read a vertex that outgrew its page as the transaction held it, edge-list head pointers included, and the #10263 window stayed open for such vertices: a transaction that pinned the vertex's head page (any REPEATABLE_READ read, or a rewrite of the vertex) and then deleted an edge a concurrent commit had just added found no entry in either list and deleted the edge record under an entry that survived.

Now every shape is answered from the committed pages:

The Limit: note on committedEdgeListHolds is replaced accordingly.

Test plan

  • Issue10304CommittedRecordReadTest (new, 5 tests); 3 fail on main (verified by reverse-applying the fix), all pass with it:
    • aMultiPageRecordIsReadAsCommittedNotAsTheTransactionHoldsIt - REPEATABLE_READ pins the chain, a concurrent commit rewrites it, the committed read must equal what a fresh transaction reads (fails on main)
    • aPlaceholderBackedRecordIsReadAsCommittedNotAsTheTransactionHoldsIt - same for a placeholder-backed record built with sealFirstPage (fails on main)
    • aDeletedMultiPageRecordReadsAsNoRecord - deleted chain still answers null
    • deletingAnEdgeOfAMultiPageVertexHeldWithoutAnyListIsAConflictUnderRepeatableRead - the Concurrent transactions that delete edges can leave an extra entry in a vertex's edge list: a deleted edge, another edge that took its RID, or a duplicate #10263 graph window on 200 KB vertices; asserts the CME comes from the committed edge-list check (message pinned) (fails on main: the delete went through)
    • deletingAnEdgeOfAMultiPageVertexHeldWithoutAnyListIsAConflict (READ_COMMITTED) - guard; passes on main too, because under READ_COMMITTED the transaction's own read refreshes the chain
  • Issue10263ConcurrentEdgeDeleteTest (9 tests incl. the two slow stress tests) green
  • Related engine suites: Issue6*, Issue9*, Issue10*, *Edge*, *Graph*, *Bucket*, *MultiPage*, *Chunk* (808 classes, 6120 tests, excluding benchmark,vector): 0 failures, 0 errors

Coverage

Invariant: getRecordFromCommittedPage never answers from the calling transaction's view, whatever shape the record has.

grep -rn getRecordFromCommittedPage engine server (main sources): one caller, GraphEngine.committedRecordContent, used for the vertex, the list head (chunk or StripeDirectory) and every chunk of the chain.

Entry point Shape Status
vertex read in committedEdgeListHolds in place already covered by #10263
vertex read in committedEdgeListHolds multi-page fixed here, tested
vertex read in committedEdgeListHolds placeholder pointer fixed here, tested at bucket level
head chunk / stripe directory / chain chunks in place (chunks are capped below a page) already covered by #10263; the new shapes would be served the same way if one ever appeared

Known gaps: None.

Adversarial pass

Not run: no subagent (Task) tool was available in this session. A self-review covered: lock reentrancy (PageManager extends LockContext, a ReentrantLock, so the nested executeInLock in validateChainReadAgainstOneCommit is safe), a slot that changed shape between the caller's read and the placeholder re-read (served as the new shape), and a broken/in-motion chain (CME, retryable, never a silent "no record").

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency when reading large or placeholder-backed records during concurrent updates.
    • Fixed edge-deletion conflicts involving large vertices with concurrent edge changes, preserving correct edge-list results and database integrity.

…eholder vertex from the committed pages

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d210f084-2fcf-409e-a9e9-c004113ca6be
📥 Commits

Reviewing files that changed from the base of the PR and between 14ce29f and df2d8f6.

📒 Files selected for processing: 3
  • engine/src/main/java/com/arcadedb/engine/LocalBucket.java
  • engine/src/main/java/com/arcadedb/graph/GraphEngine.java
  • engine/src/test/java/com/arcadedb/database/Issue10304CommittedRecordReadTest.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Walkthrough

getRecordFromCommittedPage now resolves placeholder-backed and multi-page records from committed pages. It validates reads against concurrent publication and retries multi-page assembly. Tests cover concurrent updates, deleted records, and edge-deletion conflicts.

Changes: Committed-page record reads and edge-list validation

Layer / File(s) Summary
Committed record resolution and validation
engine/src/main/java/com/arcadedb/engine/LocalBucket.java, engine/src/main/java/com/arcadedb/graph/GraphEngine.java, engine/src/test/java/com/arcadedb/database/Issue10304CommittedRecordReadTest.java
LocalBucket resolves placeholder and multi-page records from committed pages, validates reads across publication, and retries multi-page assembly. GraphEngine documentation reflects the committed-page read path. Tests cover concurrent updates, deleted records, edge-list conflicts, and database integrity.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: lvca

Merge Risk: ⚪ Minimal · up to df2d8

No identified issue remains that should prevent merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the fix for committed edge-list reads of multi-page and placeholder-backed vertices.
Description check Passed The description is detailed and covers the change, motivation, related issue, tests, coverage, and additional review notes. It uses different headings from the template and does not explicitly confirm…
Linked Issues check Passed Issue #10304 requires committed-page reads for multi-page and placeholder-backed vertex records. LocalBucket.getRecordFromCommittedPage now assembles multi-page records from committed pages and vali…
Out of Scope Changes check Passed The changes stay within issue #10304. The production changes update committed record resolution, document its use in the committed edge-list check, and add focused regression tests for the required re…
Full details: Description check

Explanation

The description is detailed and covers the change, motivation, related issue, tests, coverage, and additional review notes. It uses different headings from the template and does not explicitly confirm the mvn clean package checklist item, but the required information is mostly present.

Full details: Linked Issues check

Explanation

Issue #10304 requires committed-page reads for multi-page and placeholder-backed vertex records. LocalBucket.getRecordFromCommittedPage now assembles multi-page records from committed pages and validates one commit. It reads placeholder pointers and their content from committed pages with publication-sequence validation. It handles plain and chunked content, returns null for deletion, and raises a retryable ConcurrentModificationException for an incomplete live chain. GraphEngine.committedEdgeListHolds now uses this behavior for oversized vertices. Issue10304CommittedRecordReadTest covers both record shapes and the edge-delete conflict under both isolation levels.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #10304. The production changes update committed record resolution, document its use in the committed edge-list check, and add focused regression tests for the required record shapes and concurrency window. No unrelated production behavior or unrelated files appear in the reviewed diff.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

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.

@codacy-production

codacy-production Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage 58.21% diff coverage · -4.99% coverage variation

Metric Results
Coverage variation ✅ -4.99% coverage variation
Diff coverage ✅ 58.21% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (14ce29f) 241725 209417 86.63%
Head commit (df2d8f6) 274489 (+32764) 224111 (+14694) 81.65% (-4.99%)

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 (#10313) 67 39 58.21%

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.

@claude

claude Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review

Solid, well-scoped fix. It closes the #10263 window for placeholder and multi-page vertices, reuses assembleFromNewestCommitted and the publication-sequence pattern, and fails safe (retryable CME instead of "no record").

Suggestions

  1. Lock reentrancy. committedPlaceholderContent falls back to executeInLock, and inside it readCommittedPlaceholderContent can call committedMultiPageRecord -> assembleFromNewestCommitted, which may take the publication lock itself. Please confirm it is reentrant, ideally with a test of a placeholder whose content is a chunk head and where the optimistic path is forced to fail.
  2. Untested branches. Not covered: the 'slot changed shape concurrently' fallback in readCommittedPlaceholderContent, the placeholder-to-chunk-head content path (FIRST_CHUNK_PLACEHOLDER_CONTENT and legacy FIRST_CHUNK), and the CME thrown when assembly fails on a non-deleted record. Current tests only cover plain negated-size placeholder content.
  3. Comments. Say why TX_RETRIES is reused as the assemble attempt count, and why an odd publication sequence goes straight to the lock.
  4. Minor. Check contentRID.getPosition() < 0 before deriving contentPageNumber. The getCause() instanceof IOException unwrap after executeInLock is slightly fragile; share a helper if validateChainReadAgainstOneCommit does the same.
  5. Performance. Extra reads only occur for rare placeholder and multi-page shapes; in-place records keep the fast path.
  6. Tests. They follow CLAUDE.md conventions. Consider @Tag("slow") if the 200 KB vertex tests take multiple seconds.

No security concerns. LGTM once item 1 is confirmed.

@tae898

tae898 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

OK to merge. Pre-verified the head df2d8f6e9c against main 14ce29fb67, CI-built jars, embedded, eclipse-temurin 25 (-XX:+UseCompactObjectHeaders).

Repro10304.java
import com.arcadedb.database.*;
import com.arcadedb.graph.*;
import java.util.concurrent.*;

public class Repro10304 {
  public static void main(String[] a) throws Exception {
    DatabaseFactory f = new DatabaseFactory(a[0] + "/r10304"); if (f.exists()) f.open().drop();
    Database db = f.create();
    db.transaction(() -> { db.getSchema().createVertexType("V", 1); db.getSchema().createEdgeType("E", 1); });
    RID[] v = new RID[2];
    db.transaction(() -> {
      v[0] = db.newVertex("V").set("id", 0).set("blob", "x".repeat(200 * 1024)).save().getIdentity();
      v[1] = db.newVertex("V").set("id", 1).set("blob", "y".repeat(200 * 1024)).save().getIdentity();
    });
    ExecutorService other = Executors.newSingleThreadExecutor();
    String outcome;
    db.begin(Database.TRANSACTION_ISOLATION_LEVEL.REPEATABLE_READ);
    v[0].asVertex().modify().set("value", 1).save(); v[1].asVertex().modify().set("value", 1).save();
    RID added = other.submit(() -> { RID[] e = new RID[1]; db.transaction(() -> e[0] = v[0].asVertex().newEdge("E", v[1].asVertex()).getIdentity()); return e[0]; }).get();
    try { added.asEdge().delete(); outcome = "BROKEN delete accepted at delete()"; try { db.commit(); outcome += ", commit ok"; } catch (Exception e2) { outcome += ", commit failed " + e2.getClass().getSimpleName(); } }
    catch (Exception e) { outcome = "FIXED delete() refused: " + e.getClass().getSimpleName() + " " + String.valueOf(e.getMessage()).replace("\n"," ").substring(0, Math.min(90, String.valueOf(e.getMessage()).length())); }
    if (db.isTransactionActive()) db.rollback();
    int[] c = new int[3];
    db.transaction(() -> {
      c[0] = (int) v[0].asVertex().countEdges(Vertex.DIRECTION.OUT, "E"); c[1] = (int) v[1].asVertex().countEdges(Vertex.DIRECTION.IN, "E");
      for (var it = db.iterateType("E", true); it.hasNext(); it.next()) c[2]++;
    });
    System.out.println("RESULT repro10304 " + outcome + " list entries OUT " + c[0] + " IN " + c[1] + ", E records " + c[2] + " (expected 1/1/1 after refused; BROKEN leaves 1/1/0)");
    other.shutdownNow(); db.close(); System.exit(0);
  }
}

LGTM

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.79104% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.48%. Comparing base (14ce29f) to head (df2d8f6).

Files with missing lines Patch % Lines
...src/main/java/com/arcadedb/engine/LocalBucket.java 41.79% 28 Missing and 11 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10313      +/-   ##
============================================
- Coverage     78.50%   78.48%   -0.02%     
  Complexity     4707     4707              
============================================
  Files          2266     2266              
  Lines        241725   241788      +63     
  Branches      52403    52421      +18     
============================================
+ Hits         189767   189774       +7     
- Misses        32350    32395      +45     
- Partials      19608    19619      +11     

☔ 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.

Concurrent edge delete: committed edge-list check reads a multi-page vertex through the transaction's view (follow-up of #10263)

2 participants