You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2026/09/04 13:49:24 UTC
(tinkerpop) 19/20: Document TinkerStorageGraph single-writer stance; enforce meta-property conflict
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch tinkergraph-storage
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit eb33eb3153b1edd853e03f3429c791f9195a39bb
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Thu Aug 20 15:07:03 2026 +0000
Document TinkerStorageGraph single-writer stance; enforce meta-property conflict
Add a comment explaining why supportsConcurrentAccess() is false: a persistent
TinkerStorageGraph is a single-writer store (DirectoryLock), and the feature
denotes multiple connections/instances sharing the same data, not the
intra-instance multi-thread transaction access the graph already provides.
Re-enable the stale commented-out fail() in the concurrent meta-property test
and strengthen its assertion so it proves the losing transaction rolled back,
turning a decorative test into a real guard for conflict detection.
Assisted-by: Claude Code:claude-opus-4-8
---
.../gremlin/tinkergraph/structure/TinkerStorageGraph.java | 6 ++++++
.../gremlin/tinkergraph/structure/TinkerStorageGraphTest.java | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraph.java
index 0eced39af1..803cc27dcf 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraph.java
@@ -545,6 +545,12 @@ public final class TinkerStorageGraph extends AbstractTinkerGraph {
private TinkerGraphGraphFeatures() {
}
+ /**
+ * A persistent {@link TinkerStorageGraph} is a single-writer store: {@code DirectoryLock} permits only one
+ * graph instance to open a given storage directory at a time. This feature denotes multiple connections /
+ * instances sharing the same data — not the intra-instance, multi-thread transaction access that the
+ * thread-local {@link TinkerTransaction} already provides — so it is {@code false}.
+ */
@Override
public boolean supportsConcurrentAccess() {
return false;
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraphTest.java
index af5e79124a..67bb6bffdd 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerStorageGraphTest.java
@@ -1415,14 +1415,16 @@ public class TinkerStorageGraphTest {
try {
gtx.tx().commit();
- //fail("should throw TransactionException");
+ fail("should throw TransactionException");
} catch (TransactionException e) {
}
- // should be only 1 vertex with updated property
+ // tx2 committed first and wins; tx1 conflicted and rolled back, so its meta1 was never persisted
assertEquals(1L, (long) gtx.V().count().next());
- assertEquals("tx2", gtx.V(v1.id()).properties("test").values("meta1", "meta2").next());
+ assertEquals(1L, (long) gtx.V(v1.id()).properties("test").properties().count().next());
+ assertEquals("tx2", gtx.V(v1.id()).properties("test").values("meta2").next());
+ assertFalse(gtx.V(v1.id()).properties("test").values("meta1").hasNext());
}
@Test