[
https://issues.apache.org/jira/browse/TINKERPOP-3253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18089536#comment-18089536
]
ASF GitHub Bot commented on TINKERPOP-3253:
-------------------------------------------
kenhuuu opened a new pull request, #3464:
URL: https://github.com/apache/tinkerpop/pull/3464
https://issues.apache.org/jira/browse/TINKERPOP-3253
Adds executeInTx/evaluateInTx to GraphTraversalSource across all GLVs to
wrap the begin/commit/rollback lifecycle, so a lambda receives the
transaction-bound g and is auto-committed on success or rolled back on error.
The methods live on GraphTraversalSource rather than on the Transaction
returned by g.tx() because the closure is a Traversal-API convenience; hosting
it on the Transaction would hand Driver-API users (who submit strings) a
traversal source and mix the two APIs. Keeping it on g also lets Java's
existing g.tx() routing cover both embedded and remote with no interface
changes. The value-returning form is named evaluateInTx rather than call
because call already exists on GraphTraversalSource as the service step, and
the InTx suffix keeps the transactional intent clear now that the methods no
longer sit under tx().
The surface follows each language's idiom rather than forcing uniformity:
dynamic languages expose a single method, while statically typed languages get
a void/value pair. Go returns interface{} instead of using generics, to match
the driver's existing untyped result API.
Behavior is single-shot with no retry, since Gremlin Server has no
standardized retriable-error signal across providers. On commit failure a
rollback is still attempted for server-side resource hygiene, but the original
error stays primary and secondary cleanup failures are only logged. gtx.tx()
still returns the same transaction so the commit path keeps working; only
opening a second transaction errors.
VOTE +1
<!--
Thanks for contributing! Reminders:
+ TARGET the earliest branch where you want the change
3.7-dev -> 3.7.7 (non-breaking only)
3.8-dev -> 3.8.2 (non-breaking only)
master -> 4.0.0
+ Committers will MERGE the PR forward to newer versions
+ ADD entry to the CHANGELOG.asciidoc for the targeted version
Do not reference a JIRA number there
+ ADD JIRA number to title and link in description
+ PRs requires 3 +1s from committers OR
1 +1 and 7 day wait to merge.
+ MORE details: https://s.apache.org/rtnal
-->
> Add convenience lambdas for transactions
> ----------------------------------------
>
> Key: TINKERPOP-3253
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3253
> Project: TinkerPop
> Issue Type: Improvement
> Components: dotnet, driver, go, javascript, python
> Affects Versions: 4.0.0
> Reporter: Ken Hu
> Priority: Major
>
> A common usage for transactions is just to begin, do one operation and then
> commit. This currently requires three separate calls. Add some convenience
> methods that will wrap the operation in a begin() and commit().
> Originally discussed in:
> https://lists.apache.org/thread/khnz10j0ox640ch2ooq3zkpy4kmo6wxj
--
This message was sent by Atlassian Jira
(v8.20.10#820010)