vkagamlyk commented on code in PR #3163:
URL: https://github.com/apache/tinkerpop/pull/3163#discussion_r2227439871
##########
tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerTransactionGraphTest.java:
##########
@@ -1705,6 +1706,92 @@ public void
shouldPreventDropUpdateVertexInConcurrentTransactions() {
verifyCommittedSingleVertex(g, "updated");
}
}
+
+ @Test
+ public void
readVertexShouldNotConflictWithDropAddUpdateVertexInSeparateTransaction()
throws InterruptedException {
+ final TinkerTransactionGraph graph = TinkerTransactionGraph.open();
+ final GraphTraversalSource g = graph.traversal();
+ final GraphTraversalSource gtx = g.tx().begin();
+ final int vertexId = 1;
+
+ // commit the initial vertex
+ gtx.addV().property(T.id, vertexId).next();
+ gtx.tx().commit();
+
+ // reader thread which is constantly reading the vertex ids in a
separate transaction
+ CountDownLatch signal = new CountDownLatch(1);
+ Thread reader = new Thread(() -> {
+ while (signal.getCount() > 0) {
+ g.V().id().toList();
+ }
+ });
+ reader.start();
+
+ // drop, add, update the same vertex a number of times to validate
that the reader thread should not interfere with the updates
+ for (int i = 0; i < 50; i++) {
+ Thread.sleep(50);
+ g.V(vertexId).drop().iterate();
+ g.tx().commit();
+ Thread.sleep(50);
+ g.addV().property(T.id, vertexId).next();
+ g.tx().commit();
+ g.V(vertexId).property(VertexProperty.Cardinality.single, "name",
"test").next();
+ g.tx().commit();
+ g.V(vertexId).property(VertexProperty.Cardinality.single, "name",
"updated").next();
+ g.tx().commit();
Review Comment:
same for second test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]