Repository navigation
Fix TinkerTransactionGraph vertex index lookup and rollback bugs - #3705
Conversation
|
Thanks for submitting the PR @sshmendez, I'll try to give it a proper review soon. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.7-dev #3705 +/- ##
=============================================
+ Coverage 75.49% 75.97% +0.47%
- Complexity 13161 13324 +163
=============================================
Files 1092 1095 +3
Lines 67208 67564 +356
Branches 7391 7456 +65
=============================================
+ Hits 50742 51330 +588
+ Misses 13837 13577 -260
- Partials 2629 2657 +28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
For committers - Created PR root bead: tp-wfn 🤖 Agent assisted comment. |
| } | ||
|
|
||
| @Test | ||
| public void shouldFindIndexedVertexAfterAddingEdgeToItInSameTransaction() { |
There was a problem hiding this comment.
could you please add an analogous test for this for the Edge index? i think the bug is the same there - seems like we may as well have both cases covered.
There was a problem hiding this comment.
Added in f4c0b69: shouldFindIndexedEdgeAfterChangingAnotherPropertyInSameTransaction (https://github.com/sshmendez/tinkerpop/blob/f4c0b69f722789850c78827207ac9f1d6d704029/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerTransactionGraphTest.java#L1898-L1908). It fails without the fix, so the edge index had the same bug.
|
Thanks for submitting this. I'd actually ran into these problems elsewhere recently but noted you had the fix handy. Hate to nit-pick but could you amend your commit messages to align to our form for agent signoff. So instead of:
do:
For further details on our preferences, see https://github.com/apache/tinkerpop/blob/master/AGENTS.md#licensing-and-provenance |
| } | ||
|
|
||
| @Test | ||
| public void shouldRollbackWithVertexIndexAndNoEdgeIndex() { |
There was a problem hiding this comment.
Please consider adding a regression test for rollback with an edge index but no vertex index. Before this fix, the incorrect vertexIndex guard also skipped edgeIndex.rollback() in that configuration, leaving the thread-local edge-index entries available to later transactions on the same thread. The test should add an indexed edge, roll back, then verify a subsequent indexed lookup does not return it
There was a problem hiding this comment.
Added in f4c0b69: shouldRollbackWithEdgeIndexAndNoVertexIndex (https://github.com/sshmendez/tinkerpop/blob/f4c0b69f722789850c78827207ac9f1d6d704029/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerTransactionGraphTest.java#L1911-L1922). It adds an indexed edge, rolls back, and checks that the indexed lookup returns nothing. It fails without the fix.
|
VOTE +1 pending resolution to the small changes requested in the above comments. |
|
VOTE +1 pending the test additions requested above. |
Assisted-by: Claude Code:claude-opus-5-5
… transaction, and rollback NPE without an edge index Assisted-by: Claude Code:claude-opus-5-5
…f an edge modified in the transaction, and rollback with an edge index but no vertex index Assisted-by: Claude Code:claude-opus-5-5
9897585 to
f4c0b69
Compare
|
anything else? |
Two bugs in
TinkerTransactionGraphwhen a vertex index exists.1. Indexed lookup misses a vertex modified in the current transaction
TinkerTransactionalIndex.getNotModifiedElementsdrops every element whose containerisChanged(). Adding an edge touches both endpoint vertices, but they never enter the transaction-local index (only property writes do), so they disappear from the lookup until commit.Fix: keep a changed element if its current value still holds the indexed key/value.
2.
NullPointerExceptionon rollback with a vertex index but no edge indexTinkerTransaction.doRollbackchecksvertexIndexbefore callingedgeIndex.rollback(). The NPE skips the rest of the cleanup, so the thread's transaction is never closed. Under Gremlin Server this leaves a worker thread whose later requests never get a response.Fix: check
edgeIndex.Tests for both are in
TinkerTransactionGraphTest; they fail before the fix. The fulltinkergraph-gremlinsuite passes.Assisted-by: Claude Code:claude-opus-5-5