Repository navigation
Fix #8982 #8983 #8984: lost update on multi-page docs, double hash index write, non-retryable concurrent delete - #8989
Conversation
|
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. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
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.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe changes detect stale multi-page records, convert selected concurrent deletes into retryable conflicts, and change index handling during commit. Tests cover record updates, concurrent deletes, and indexed-key changes. ChangesMulti-page Record Conflict Detection
Concurrent Delete Conflicts
Index Update Consistency
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant TransactionA
participant LocalDatabase
participant ImmutableDocument
TransactionA->>LocalDatabase: Delete record
LocalDatabase->>ImmutableDocument: Check transaction read marker
ImmutableDocument-->>LocalDatabase: Return loaded-in-transaction match
LocalDatabase-->>TransactionA: Return retryable conflict for matching missing record
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The supplied evidence identifies no issue requiring correction before merge. Mergeability remains subject to normal test checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The changes improve conflict detection and preserve index entries during key swaps. However, deferred commits can serialize a property changed after the last save while indexing and validating its earlier value. This creates a material consistency concern within transactions that already have write access; no new external access or privilege expansion was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
|
Review of #8989 (fixes #8982, #8983, #8984) Solid, well-targeted fixes with a regression test per issue. I read the three engine changes against their call sites and found nothing blocking. Notes below, mostly minor. #8983 (skip re-index at commit flush) - looks correct I verified the claim in the new comment: the in-tx branch of
#8982 (multi-page
#8984 (retryable concurrent delete) - looks correct
Tests
Style / CLAUDE.md No new dependencies, no debug No blocking issues. I suggest fixing the stale |
…s in counter test
Review of #8989 (fixes #8982, #8983, #8984)I read the diff and the surrounding code in #8982: multi-page lost update (
|
…mment, extra index tests
|
Review of PR 8989 The three fixes are well scoped, the comments explain the reasoning, and the regression tests hit each failure shape. I read the diff and the surrounding code but have not run the tests. A few points are worth a look before merge. 1. Issue 8983: a mutation after
final MutableDocument d = ...modify();
d.set("k", 1).save(); // index change queued for k=1
d.set("k", 2); // no second save()
database.commit(); // body written with k=2, index replays k=1The record body and the index can now disagree, where previously the flush corrected the index (with the double-write bug). Mutating after The status check is also a broad filter: 2. Stale comments after the 8983 fix
3. Issue 8982: performance on the write path
If reusing the hardened chain walk is the point, that is reasonable. A Javadoc line about the cost, and a quick benchmark with a 70 KB document, would help. Smaller notes:
4. Issue 8984: behavior change for callers
5. Tests
Security No concerns. The change is internal to engine concurrency control and adds no new inputs. Summary Nothing blocking from the code I read. Point 1 (index and body divergence after an unsaved mutation) needs a test or an explicit decision, point 3 deserves a look at the cost on large documents, and the stale comments in point 2 are best fixed in this PR. |
|
Review round notes: mutating a MutableDocument after its last save() and before commit is deliberately unsupported for index maintenance (the index follows the last save()); every write path in the engine and the SQL/Cypher executors saves after the last mutation. The #6572/#6586 not-found contract for stale references is pinned by Issue6572DanglingVertexReferenceTest and Issue6586MissingVertexDiagnosisTest, which still pass. Release-notes line for #8984 to be added with the docs update. |
Review of #8989Overall this is a well-scoped, well-explained set of three fixes with targeted regression tests. I found no blocking issues; a few points below are worth a look. What looks good
Points to consider
SecurityNo concerns: no new input surface, no new dependencies. VerdictLooks good to merge once the performance impact of point 1 is confirmed acceptable. The rest are suggestions. |
Review of #8989Overall this is a well-scoped set of fixes. Each fix is small, each root cause is explained in the comments, and each has a dedicated regression test. I found no blocking issues. The points below are mostly about cost and edge cases. #8982: multi-page lost update (
|
Review of #8989I read the diff and the surrounding code. I did not build or run the tests. This PR has already had several reviews, so I only repeat the points I think matter and add one that is new. I found nothing blocking. What looks right
Points to consider
Verdict: good to merge once CI is green, with the |
Review of #8989 (fixes #8982, #8983, #8984)I read the diff and the surrounding code. I did not build or run the tests, so my comments are about design and risk. Overall this is a well-scoped set of fixes. The comments explain the reasoning, and each issue has a regression test that exercises the real race. A few points below, most important first. 1. #8983: the index now follows the last
|
Review of #8989 (fixes #8982, #8983, #8984)I read the main-source diff in full and skimmed the tests. I did not build or run anything. The three fixes are targeted and the Javadoc explains the reasoning. Findings are below, most important first. 1. #8983: index can disagree with the stored record after a post-
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
🟢 Coverage 82.50% diff coverage · -5.86% coverage variation
Metric Results Coverage variation ✅ -5.86% coverage variation Diff coverage ✅ 82.50% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (cecb369) 208214 176490 84.76% Head commit (003ffbe) 240847 (+32633) 190041 (+13551) 78.91% (-5.86%) 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 (#8989) 40 33 82.50% 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.
Review of #8989I read the diff and the surrounding code. I did not run the tests. The three fixes are well scoped and the root-cause analysis in the comments is solid. Nothing here blocks the merge. A few points are worth a look first. #8982 (multi-page lost update) -
|
|
Review of PR 8989 I read the diff and the surrounding code in Main concern: the index can now disagree with the stored record (#8983)
d.set("k", 1).save();
d.set("k", 2); // never saved againThe record is persisted with The PR documents this and pins it with a test. Pinning it means that test would have to be rewritten by a future fix, so the inconsistency is locked in.
Smaller points
Positives
Overall: good fixes with solid tests. I would resolve the "index follows last save" decision before merging, and add the 🤖 Generated with Claude Code |
Luca's review note on ArcadeData#8989: changing a record after its last save() and before the commit is unsupported, since indexes follow the last save(). Checked through the bindings on the current engine: in one transaction, set k=1, save, set k=2 (not saved again) commits k=1, and an index on k agrees, so the later change is simply not written. The record docs now say so beside the existing note on saving once. Claude-Session: https://claude.ai/code/session_01Lj5isEaoaGCeaZe5nNoWX4 Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8989 +/- ##
============================================
+ Coverage 76.54% 76.55% +0.01%
- Complexity 3852 3860 +8
============================================
Files 2109 2109
Lines 208214 208247 +33
Branches 43960 43969 +9
============================================
+ Hits 159377 159431 +54
+ Misses 31763 31739 -24
- Partials 17074 17077 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Verified
The last row is a regression on the head: the Cypher form, which already completed, now fails and is not retried. Its cause chain is |
Fixes #8982, #8983, #8984.
LocalBucket.hasRecordChangedSinceReadnow assembles and compares the whole chain of a multi-page record, so a change committed between read and update raisesConcurrentModificationExceptionunder READ_COMMITTED.save()), which wrote HASH indexes twice, bypassed the unique check and left stale entries.ConcurrentModificationExceptioninstead ofRecordNotFoundException/VertexNotFoundException. Stale references (GraphEngine.getEdgeHeadChunkForWrite reports a dangling vertex reference as a retryable conflict, with repair advice aimed at the record that is gone #6572, Follow-ups from #6572: two more paths meet a missing vertex, one calls it a concurrent delete and one says nothing at all #6586) keep the non-retryable verdict.Tests: Issue8982LostUpdateLargeDocumentTest, Issue8983HashIndexKeyChangeTest, Issue8984ConcurrentDeleteRetryTest; Issue6950RecordImageGuardTest updated to the new contract.
Summary by CodeRabbit
TransactionIndexContext.addIndexKeyLocknow keeps the ADD as a REPLACE that also removes the committed holder. Test:recordsSwappingUniqueKeysInOneTransactionKeepEveryEntry.