Stephen Mallette created TINKERPOP-3308:
-------------------------------------------
Summary: Gremlin Server's transaction sweeps do not handle all
cases well
Key: TINKERPOP-3308
URL: https://issues.apache.org/jira/browse/TINKERPOP-3308
Project: TinkerPop
Issue Type: Improvement
Components: server
Affects Versions: 4.0.0
Reporter: Stephen Mallette
GraphManager has methods that act on the transactions of every registered
graph, or of a named set of graphs: rollbackAll(), commitAll(), rollback(Set),
commit(Set) and hasAnyOpenTransactions(). Two problems remain with them in 4.x.
1. They only see the current thread's transaction. Each method checks
graph.tx().isOpen(), which for a thread-bound Transaction only reports a
transaction open on the calling thread. In 4.x, a remote transaction runs on
its own thread in UnmanagedTransaction, so these methods don't see it.
TINKERPOP-3226 shows this for hasAnyOpenTransactions().
2. They do not handle a closed graph. If a graph registered with the server is
closed, graph.tx() may throw. TinkerGraph will throw IllegalStateException
after TINKERPOP-3290. One closed graph would then make the sweep fail for every
other graph.
Within the server, rollbackAll() is only reached through the GremlinExecutor
hooks that ServerGremlinExecutor sets: beforeEval, afterFailure and
afterTimeout. In 4.x those run only when init scripts are evaluated, because
HTTP requests call scriptEngine.eval directly. The other methods have no
callers in the server. They are still public API on GraphManager, though, so
custom implementations and embedded users can call them.
Possible directions:
- Base hasAnyOpenTransactions() on TransactionManager, which tracks every
UnmanagedTransaction, instead of on graph.tx().
- Decide whether rollbackAll(), commitAll(), rollback(Set) and commit(Set)
still have a purpose in 4.x. If they don't, deprecate or remove them, along
with the rollbackAll() hooks in ServerGremlinExecutor. If they do, make them
skip or report a graph that is closed rather than fail the whole sweep.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)