I need some help understanding transactions for gremlin-server and janusgraph. Checking the capabilities of a Graph instance via features
for gremlin-server:
gremlin> :remote connect tinkerpop.server conf/gremlin-server.yaml
==>Configured host.docker.internal/192.168.65.2:8182
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [host.docker.internal/192.168.65.2:8182] - type ':remote console' to return to local mode
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.features()
==>FEATURES
> GraphFeatures
>-- Transactions: false
>-- Computer: true
>-- Persistence: true
>-- ConcurrentAccess: false
>-- ThreadedTransactions: false
>-- IoRead: true
>-- IoWrite: true
>-- OrderabilitySemantics: true
>-- ServiceCall: true
...
Checking the capabilities of a Graph instance via features
for janusgraph:
gremlin> :remote connect tinkerpop.server conf/janusgraph.yaml
==>Configured host.docker.internal/192.168.65.2:8183
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [host.docker.internal/192.168.65.2:8183] - type ':remote console' to return to local mode
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.features()
==>FEATURES
> GraphFeatures
>-- Computer: true
>-- ConcurrentAccess: true
>-- ThreadedTransactions: true
>-- IoRead: true
>-- IoWrite: true
>-- Transactions: true
>-- Persistence: true
...
Gremlin-server does not support transactions, whereby janusgraph does. Now, does this only hold for the specific graph instance we created? Or, the other way around, does not gremlin-server support transactions at all? If gremlin-server supports transactions, how to configure transactions for graphs in gremlin-server.
Apart from that, Tinkerpop documentation about gremlin-server transactions states:
The third and final point involves transactions. Under this model, one traversal is equivalent to a single transaction and there is no way in TinkerPop to string together multiple traversals into the same transaction.
Can someone rephrase this paragraph, preferably with some example. Thinking out loud, my first approach to explain would be the following:
g.addV("test") // one traversal and a single transaction
g.addV("test").addV("test") // not a single transaction
Maybe this also explains why g.addV("test").addV("test").next()
only returns last vertex created, another ....next()
returns E0903: there are no results left
. At first, I assumed first next()
call would return first vertex created and second next()
call would return second vertex created. How to get each vertex when calling g.addV("test").addV("test")
?
Hope it is not to confusing. Maybe I am mixing things up here.
EDIT:
tx := gremlingo.Traversal_().WithRemote(...).Tx()
gtx, err := tx.Begin()
if err != nil {
tx.Close()
return nil, err
}
// Just some query ...
_, err = gtx.AddV("test").Next()
if err != nil {
tx.Rollback()
return nil, err
}
err = tx.Commit()
if err != nil {
tx.Rollback()
return nil, err
}
Above code block works fine when connecting to janusgraph, but fails with stackTrace:java.lang.UnsupportedOperationException: Graph does not support transactions
when connecting to gremlin-server. Does not gremlin-server support transactions at all or just the graph instance used? If gremlin-server supports transactions, how to configure graph instance to allow transactions.