Skip to content

feat(#6970): share the tx-overlay REMOVE/REPLACE filtering rules across the index read paths - #8741

Merged
robfrank merged 5 commits into
mainfrom
feat/6970-dedupe-tx-overlay-remove-filtering
Sep 30, 2026
Merged

robfrank merged 5 commits into
mainfrom
feat/6970-dedupe-tx-overlay-remove-filtering

Conversation

@robfrank

@robfrank robfrank commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #6970

Summary

LSMTreeIndex.get(), HashIndex.get() and LSMTreeIndexCursor.getClosestEntryInTx() each had their own copy of the rules that decide which disk RIDs a pending transaction removal hides from a read. The rules now live in one place, the new com.arcadedb.index.PendingIndexRemovals. Each caller folds the per-key overlay entries through PendingIndexRemovals.accumulate(current, entry, unique) and applies the answer to its own result shape: hides(rid) for the point lookups, removeFrom(mergedRIDs) for the range cursor. The rules are:

  1. REMOVE with a RID hides that RID.
  2. REMOVE with no RID, or any REMOVE on a unique index, hides the whole key.
  3. REPLACE with a non-null oldRid hides oldRid, the removal TransactionIndexContext.commit() replays.

The class Javadoc names TransactionIndexContext.commit() / addIndexKeyLock as the code it has to stay in step with, so a new operation shape has one place to re-audit. Rule 2 is also available on its own as PendingIndexRemovals.removesWholeKey(entry, unique). The point lookups call it for their unique-index early exit, so that shortcut does not carry its own copy of the rule.

This is a refactor with no behavior change:

  • Hot path: accumulate returns null and allocates nothing for a key with no pending removal, the same as the old lazy set/flag. When there is a removal it allocates one small holder plus the RID set, and it skips the set entirely for a key-wide removal.
  • Unique-index REMOVE in get(): it still returns EMPTY_CURSOR straight away. The check (removesWholeKey) runs before accumulate, so that path allocates nothing either.
  • limit early exit in get(): unchanged.

Test plan

Coverage

Invariant: every index read that merges the transaction overlay hides exactly the disk RIDs that commit's replay will remove, decided by one function.

Sweep: grep -rn "getIndexKeys(" --include='*.java' . | grep -v /test/

Entry point Status
LSMTreeIndex.get() (point lookup, LSM) fixed here: uses PendingIndexRemovals
HashIndex.get() (point lookup, HASH) fixed here: uses PendingIndexRemovals
LSMTreeIndexCursor.getClosestEntryInTx() + fetchNext() (range scan) fixed here: uses PendingIndexRemovals
TransactionVectorOverlay / SparseTransactionOverlay not the same rules: vector overlays keep one value per RID and use their own last-write-wins semantics, and only mention getIndexKeys in a comment
TransactionIndexContext.getTxDeletedEntries() (REMOVE/REPLACE -> deleted RID, for the unique check) not the same rules: it builds a key -> deleted-RID map for the commit-time uniqueness check, it does not filter a read

Known gaps: None

Adversarial pass

This session had no subagent tool, so the independent Phase 1.5 reviewer could not be spawned. The author did the pass instead, which makes it less independent. It re-derived each caller's old behavior against the helper:

  • unique REMOVE early return
  • limit early exit
  • key-wide plus per-RID ordering
  • REPLACE with a null oldRid
  • cursor state reset at all three reset points

No findings. The three bot reviews below did the same equivalence trace independently and also found no behavior change.

Review cycles

Cycle Head Changes Bot outcome
1 53c5ce16ae initial refactor + tests no blockers. Suggested documenting the unique early exit, hoisting isUnique(), rewrapping a long comment, a DB-free helper test, and an LSM unique lookup case. All applied in 171e8f671c
2 171e8f671c cycle-1 fixes no blockers. Suggested a Javadoc note that accumulate's result must be reassigned, removeFrom on a widened key, and a pointer to the rule-3 lookup coverage. All applied in 7081c7c7eb
3 7081c7c7eb cycle-2 fixes no blockers. Suggested merging the REMOVE branches in get(), hoisting isUnique() in the cursor, testing REPLACE after key-wide, and fixing the test count. All applied in 27f0336105
4 27f0336105 cycle-3 fixes no blockers. Suggested sharing rule 2 via a predicate instead of the literal false, a cursor coverage pointer, and a test count fix. Applied in 9626016427, which no bot has reviewed (max cycles reached)

Deferred items

These were skipped. They are optional and the reviewer marked them non-blocking.

  • "Two test files for one class ... could be merged." Kept apart on purpose: PendingIndexRemovalsTest needs no database and runs in milliseconds, while Issue6970PendingIndexRemovalsTest drives the callers through a real transaction.
  • "A name like addTo or fold would make the in-place update a bit more obvious. Optional." Kept accumulate. The Javadoc says the result must be reassigned, and every caller does so.
  • "The comment blocks in get() ... could be trimmed to a one-liner." Trimmed to one line in cycle 4. The #N references are kept, following the convention used across engine/.
  • "final var type is used in a few places." Kept, to match the neighbouring Issue6927RangeScanTxRemovesTest.

Final state

max-cycles-reached. All four bot reviews were "no blockers / LGTM once CI is green". The last commit (9626016427, rule 2 shared through removesWholeKey) passed the local run but has not been bot-reviewed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed index lookups during transactions so records marked for removal no longer appear in results.
    • Non-unique index lookups continue to return other matching records when only one record is removed.
    • Unique index lookups return no match after the matching record is deleted within a transaction.
    • Applied the corrected behavior to HASH and LSM indexes.

…ss the three index read paths

LSMTreeIndex.get(), HashIndex.get() and LSMTreeIndexCursor.getClosestEntryInTx()
each re-implemented which disk RIDs a pending transaction removal hides. The
rules now live in PendingIndexRemovals; each caller folds the per-key overlay
entries through accumulate() and applies the answer to its own result shape.
No allocation when the key has no pending removal.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@robfrank robfrank added this to the 26.10.1 milestone Sep 30, 2026
@robfrank robfrank added enhancement New feature or request engine Core engine: document/schema API labels Sep 30, 2026
@mergify

mergify Bot commented Sep 30, 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.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 2c886751-62be-462c-9ee4-2bfbd034a7e3

📥 Commits

Reviewing files that changed from the base of the PR and between f21a576 and 9626016.

📒 Files selected for processing (6)
  • engine/src/main/java/com/arcadedb/index/PendingIndexRemovals.java
  • engine/src/main/java/com/arcadedb/index/hash/HashIndex.java
  • engine/src/main/java/com/arcadedb/index/lsm/LSMTreeIndex.java
  • engine/src/main/java/com/arcadedb/index/lsm/LSMTreeIndexCursor.java
  • engine/src/test/java/com/arcadedb/index/Issue6970PendingIndexRemovalsTest.java
  • engine/src/test/java/com/arcadedb/index/PendingIndexRemovalsTest.java
 ______________________________________________________________________
< Stop swallowing exceptions. They don't become less real in the dark. >
 ----------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@codacy-production

codacy-production Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity

Metric Results
Complexity 7

View in Codacy

🟢 Coverage 100.00% diff coverage · -6.02% coverage variation

Metric Results
Coverage variation ✅ -6.02% coverage variation
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (f21a576) 200476 168989 84.29%
Head commit (9626016) 233036 (+32560) 182408 (+13419) 78.27% (-6.02%)

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 (#8741) 47 47 100.00%

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 Sep 30, 2026

Copy link
Copy Markdown

Review

Overall this is a clean, well-scoped refactor. I traced the old logic against PendingIndexRemovals.accumulate for all three callers and found no behavior change:

  • REMOVE non-unique with RID, REMOVE with null RID, unique REMOVE, and REPLACE with oldRid all map to the same hide sets as before.
  • "Key-wide wins in either order" is preserved (rids = null on widening, !keyWide guard on later per-RID adds).
  • txRemovals is reset in getClosestEntryInTx, after the batch is consumed, and in close(), matching the old two-field reset.
  • The hot path stays allocation-free (accumulate returns the passed-in null for ADD / oldRid-less REPLACE), and the removeFrom / hides calls are equivalent to the old inline code.

Suggestions (none blocking)

  1. The "single place" claim is not fully true. Rule 2 (unique REMOVE hides the key) is still special-cased in the callers: LSMTreeIndex.get() and HashIndex.get() each keep if (REMOVE && isUnique()) return EMPTY_CURSOR, and both also keep an if (op == REMOVE) continue; after accumulate. That is a legitimate early exit (it also drops overlay ADDs), but it means a future rule change still needs edits in two get() bodies plus the helper. Consider either exposing isKeyWide() and doing the early return off the accumulated result, or noting in the Javadoc that the unique early-exit lives in the callers.
  2. Comment style. CLAUDE.md asks for comments only where the WHY is non-obvious. Several of the new/edited comments reference issue numbers and callers (#6970, "shared by every index read path", "shared with LSMTreeIndex.get() and HashIndex.get()"), which rot as code moves. The class Javadoc naming the callers has the same issue; the TransactionIndexContext.commit() / addIndexKeyLock sync note is the valuable part, and I'd keep just that. Also, the reworded comment in LSMTreeIndexCursor ((both now built by PendingIndexRemovals, #6970): without it a key deleted - or re-keyed by an UPDATE, which DocumentIndexer turns) looks like it runs past the 160-column print width; it would be worth re-wrapping.
  3. Tests:
    • The helper-only tests (first 7) extend TestHelper, so each one creates and drops a database it never uses. A plain test class for those, or splitting the caller tests out, would be faster and clearer.
    • Coverage gaps: there is no LSM unique-index point lookup case (only HASH unique), and no REPLACE-with-oldRid case through an actual get(). Issue6927RangeScanTxRemovesTest likely covers the range cursor, but a get() on LSM unique after an update of the same key would pin rule 3 for the point-lookup path.
    • hides() and removeFrom() with a Collection<RID> are only tested with a List; fine, just noting.
  4. Minor: isUnique() is re-evaluated per overlay entry in the get() loops (it was before too, just once per REMOVE). Hoisting it to a local before the loop is trivial and makes the intent clearer.
  5. Unused imports: I could not compile locally, so please confirm HashSet / RID / Set are still all used in the three edited files (they are likely still needed for txChanges and other code, but the removed fields were the obvious candidates for leftover imports).

Security and performance: no concerns; no new dependencies, and no extra allocation on the common path.

Nice cleanup, and the mutation-check evidence in the description is a good touch.

…it helper tests, add LSM unique lookup case

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review

I read the full diff and compared each call site to the code it replaces. I did not compile or run the tests. This is a behavior-preserving refactor and I found no regressions.

Behavior check

  • LSMTreeIndex.get() and HashIndex.get():
    • The unique-index REMOVE still returns EMPTY_CURSOR before accumulate, as before.
    • removals != null matches the old hasRemoves (REMOVE with or without a RID, and REPLACE with an oldRid).
    • hides() matches the old keyWideRemove || removedRids.contains(...).
  • LSMTreeIndexCursor.getClosestEntryInTx():
    • accumulate runs at the same point in the loop as the old inline code, and keyContributes is unchanged.
    • Non-contributing keys never allocate a holder, so nothing leaks from a skipped key into the batch that is returned.
    • removeFrom(mergedRIDs) matches the old clear() / removeAll(...).
    • The reset points (getClosestEntryInTx, batch consumed, close) are all covered.
  • Hot path: a key with no removal returns null and allocates nothing. A key-wide removal never allocates the set. This meets the CLAUDE.md performance requirement.
  • Imports: HashSet, Set and RID are still used in all three touched files, so there are no unused imports.

Suggestions (non-blocking)

  1. Rule 2 is still duplicated in the two get() methods. REMOVE && unique -> EMPTY_CURSOR is a caller-side copy of the rule. The Javadoc documents this, which is good, but it is exactly the drift risk Refactor: the tx-overlay REMOVE/REPLACE filtering rules are duplicated across three index read paths #6970 is meant to remove. An isKeyWide()-based early exit would avoid it, but that gives up the "no allocation on the unique path" property. If you keep the shortcut, one test that fails when the two disagree would make the note in the Javadoc enforceable. I don't think it is worth blocking on.
  2. accumulate mutates current and also returns it. This is a reasonable trade for the null-means-nothing hot path. Say in the Javadoc that the returned reference must be reassigned, since a caller that ignores the return value when current == null silently loses the removal. The example in PendingIndexRemovalsTest shows the pattern, but the class doc should too.
  3. Two test files for one class. PendingIndexRemovalsTest and Issue6970PendingIndexRemovalsTest could be merged into one class. Keeping the unit-level rules separate from the DB-backed caller tests is defensible, so this is a matter of taste.
  4. Coverage gaps:
    • There is no get()-level test for REPLACE.oldRid on HASH and LSM point lookups. Issue6927RangeScanTxRemovesTest may cover it. If it does, add a line to the class Javadoc saying so.
    • removeFrom on a key-wide holder that already has a per-RID set is only tested through hides. The "widened" case in removalsAccumulateAcrossEntriesAndKeyWideWinsInEitherOrder does not call removeFrom. This is minor.
  5. Style nit in the tests: final var type is used in a few places. That is fine if it matches neighbouring tests. Elsewhere in this diff you use explicit types.

Conventions

The code follows CLAUDE.md: it reuses existing components, uses assertThat(...).isTrue(), has no System.out, has no wall-clock assertions, adds no new dependencies, and the tests do not use server ports. The PR includes a regression test and a mutation check. LGTM once CI is green.

…veFrom on a widened key, point to rule-3 lookup coverage

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review: share tx-overlay REMOVE/REPLACE filtering (#6970)

Overall: a clean, behavior-preserving refactor. I traced the old inline logic in the three call sites against PendingIndexRemovals.accumulate and found no semantic differences. Nothing here blocks the merge.

What I checked

  • Rules parity. REMOVE with RID, key-wide REMOVE (no RID or unique), and REPLACE with oldRid all map 1:1 to the old code. Key-wide wins in either order (rids = null on widening, and per-RID adds are skipped once keyWide), which matches the old keyWideRemove || contains(...) check.
  • Hot path. accumulate returns current (null) with no allocation for ADD / REPLACE-without-oldRid, so the common case is as cheap as before. The unique-index REMOVE early return in get() still runs before accumulate.
  • Cursor. txRemovals is reset in getClosestEntryInTx, after the batch is consumed, and in close(), matching the old two-field reset. The comment about subtracting before the ADDs are merged is preserved.
  • Imports. RID/HashSet/Set are still used in all three files, so no dead imports.
  • Style. Follows CLAUDE.md (imports rather than FQNs, final params, single-statement if without braces, assertThat(...) style). No debug output left behind.

Minor suggestions (non-blocking)

  1. Duplicated REMOVE check in get() (LSMTreeIndex.java and HashIndex.java). The sequence is if (REMOVE && unique) return EMPTY_CURSOR; removals = accumulate(...); if (REMOVE) continue;, so the operation is tested three times per entry. It is cheap, but the two REMOVE-related branches could be merged:
    if (value.operation == IndexKeyOperation.REMOVE) {
      if (unique) return EMPTY_CURSOR;
      removals = PendingIndexRemovals.accumulate(removals, value, false);
      continue;
    }
    removals = PendingIndexRemovals.accumulate(removals, value, unique);
    That also makes it obvious that the early return is the one thing the helper does not own (the Javadoc already warns about it, which is good).
  2. Unique-REMOVE mirror is a manual invariant. Rule 2 for unique indexes is now implemented in the helper and separately as a shortcut in two get() methods. The Javadoc calls this out, and lsmIndexLookupIsEmptyAfterARemoveOnAUniqueKey / hashIndexLookupIsEmptyAfterARemoveOnAUniqueKey pin the behavior, so I consider this acceptable.
  3. index.isUnique() per entry in LSMTreeIndexCursor. It is called inside the entry loop, while get() hoists it into a local. Hoisting it outside the loop would be more consistent (likely negligible cost, but the cursor is a scan hot path).
  4. PR description count. It says 11 new test cases; I count 12 (5 in Issue6970PendingIndexRemovalsTest + 7 in PendingIndexRemovalsTest). Cosmetic only.
  5. Test naming. Two classes cover the same feature (PendingIndexRemovalsTest for the pure helper, Issue6970...Test for callers). That split is reasonable and documented in the Javadoc. The helper test could optionally include a case for REPLACE-with-oldRid arriving after a key-wide REMOVE (stays wide), which is the one ordering the current test does not exercise.

Tests

Coverage is good: the helper is tested in isolation with no DB, the point-lookup shapes not reached by Issue6927RangeScanTxRemovesTest (HASH non-unique per-RID and key-wide, LSM non-unique per-RID, unique delete on both) are added, and the mutation check in the description is a nice touch. Tests use rollback() in finally so no state leaks. No timing assertions or hardcoded ports. I did not run the suite locally; the reported 1361-test run plus CI should cover it.

Security / performance

No security concerns (internal read-path logic only). No performance regression expected; the extra allocation is one small holder object only when a removal is actually pending, versus a lazy set/flag before.

LGTM once CI is green.

…in the cursor, test REPLACE after a key-wide removal

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review of #8741: share tx-overlay REMOVE/REPLACE filtering rules (#6970)

I read the diff only. I did not compile the branch or run the tests here.

Verdict: no blockers. The refactor looks behavior-preserving.

Behavior equivalence (checked against the old code)

  • Point lookups: LSMTreeIndex.get() and HashIndex.get() are equivalent. removals != null replaces hasRemoves, and hides() replaces keyWideRemove || removedRids.contains(...). Unique-index REMOVE still returns EMPTY_CURSOR before anything is allocated.
  • Range cursor: LSMTreeIndexCursor.getClosestEntryInTx() is equivalent. The accumulate call sits after the value == null check, so null entries still don't count. keyContributes = true is kept for REMOVE-only keys. txRemovals is reset in all three places that used to reset the two old fields (entry of getClosestEntryInTx, after the merge, close()).
  • Key-wide wins in both orders: accumulate nulls rids on key-wide and skips adding RIDs once keyWide is set. The unit test covers this.
  • Hot path: no allocation for keys with no pending removal, as claimed.

Suggestions (non-blocking)

  1. The unique-index shortcut duplicates rule 2. get() in both LSM and Hash checks if (unique) return EMPTY_CURSOR before calling accumulate. The Javadoc admits "a change to rule 2 has to be mirrored there", which works against the goal of one place for the rules. It is a valid early exit, but two tradeoffs follow from it:

    • The first accumulate(removals, value, false) call passes a literal false only to bypass the unique branch. That reads oddly.
    • The second call passes unique, but it can only matter for REMOVE, and REMOVE has already continued by then.

    It would be cleaner to either drop the early exit and let hides() answer, or add a small static boolean removesWholeKey(IndexKey, boolean unique) that both the early exit and accumulate use. The early exit skips reading the disk result at all. If that matters, keep it, but then the shared predicate is the honest way to keep it in step.

  2. accumulate mutates current in place. The Javadoc explains that callers must reassign the result, which is fine. A name like addTo or fold would make the in-place update a bit more obvious. Optional.

  3. Test count in the description. The PR text says the new test has "11 cases". I count 5 in Issue6970PendingIndexRemovalsTest and 7 in PendingIndexRemovalsTest, so 12 in total. That is cosmetic.

  4. Test coverage gap: no new test drives LSMTreeIndexCursor with a unique index through the helper. Issue6927RangeScanTxRemovesTest covers it, per the PR text. A one-line pointer in the Javadoc of Issue6970PendingIndexRemovalsTest would help, since the class comment only lists get() callers.

Style (CLAUDE.md)

  • New code uses final on variables and parameters, imports rather than FQNs, and the assertThat(...).isTrue() form.
  • The tests use no wall-clock assertions, need no tags, and start no server ports.
  • No new dependencies and no System.out.
  • The comment blocks in get() (#6970: the rules deciding...) repeat what the class Javadoc already says. CLAUDE.md asks for minimal comments, so these could be trimmed to a one-liner.

Nice cleanup overall, and the mutation-check result in the PR description is a good sign for test strength.

…eKey so the unique early exit has no copy of it

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review: PendingIndexRemovals refactor (#6970)

I compared the old and new logic path by path and found no blockers.

Behavior equivalence

  • Unique-index get(): the old code returned EMPTY_CURSOR on any REMOVE. The new guard unique && removesWholeKey(value, true) gives the same result, because removesWholeKey is true for every REMOVE when unique is true. No allocation happens on that path.
  • Non-unique get(): a REMOVE with a RID hides that RID, and a REMOVE with no RID hides the whole key. A REPLACE with an oldRid hides the oldRid and still falls through to the txChanges add. The if (REMOVE) continue after accumulate keeps the old control flow. The txChanges != null || removals != null condition matches the old hasRemoves.
  • LSMTreeIndexCursor: the keyContributes = true; continue; handling for REMOVE is unchanged. Hoisting index.isUnique() out of the entry loop is safe. Every reset site (getClosestEntryInTx, batch consumed, close()) now nulls a single field, where before it reset two.
  • Key-wide dominance: once keyWide is set, later per-RID removals and REPLACE.oldRid are ignored and rids stays null. This matches the old behavior, where the set had no effect once keyWideRemove was true. The last test in PendingIndexRemovalsTest pins it in both orders.
  • Hot path: accumulate returns current without allocating when nothing is hidden. That preserves the lazy-allocation property the old code had.

Minor suggestions (non-blocking)

  1. Mutating static. accumulate(current, ...) mutates current and also returns it, so the caller must reassign. The Javadoc says so, and the test covers it. An instance-level add(entry, unique) with a lazily created holder at the call site would be harder to misuse. The current design does keep the "null means no allocation" guarantee, so I would keep it unless you want to change the API shape.
  2. Test-only accessor. isKeyWide() looks used only by tests. It is fine to keep as a small public surface, but consider package-private visibility. The test is in the same package.
  3. Comment style. The all-caps inline comment ("ON A UNIQUE INDEX NOTHING SURVIVES ...") follows the surrounding legacy style. Under the CLAUDE.md guidance on comments it could be a plain sentence.
  4. Possibly unused imports. RID and HashSet in HashIndex and LSMTreeIndex, and HashSet in LSMTreeIndexCursor, may no longer be needed after this change. Please check that none are unused.
  5. Test coverage. The tests cover the helper rules, the HASH and LSM point-lookup paths, and (via Issue6927RangeScanTxRemovesTest) the range cursor. One extra case would help: a non-unique key holding both a per-RID REMOVE and a re-ADD of a different RID in the same transaction, through get(). This is optional, since the helper rules are already pinned.

The new files follow the repo conventions (license header, AssertJ assertThat(...).isTrue() style, no wall-clock assertions, no fixed ports). I did not run the build or tests locally, so please confirm CI is green before merging. Nice consolidation of three copies of a subtle rule set.

@robfrank
robfrank merged commit ac74907 into main Sep 30, 2026
30 of 31 checks passed
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.61702% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.99%. Comparing base (f21a576) to head (9626016).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
.../java/com/arcadedb/index/PendingIndexRemovals.java 91.66% 0 Missing and 2 partials ⚠️
...c/main/java/com/arcadedb/index/hash/HashIndex.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8741      +/-   ##
============================================
- Coverage     76.01%   75.99%   -0.02%     
+ Complexity     3656     3654       -2     
============================================
  Files          2067     2068       +1     
  Lines        200476   200466      -10     
  Branches      42236    42230       -6     
============================================
- Hits         152388   152350      -38     
- Misses        31529    31560      +31     
+ Partials      16559    16556       -3     

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

robfrank added a commit that referenced this pull request Oct 6, 2026
…ss the index read paths (#8741)

(cherry picked from commit ac74907)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine Core engine: document/schema API enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: the tx-overlay REMOVE/REPLACE filtering rules are duplicated across three index read paths

1 participant