Skip to content

Add explicit transaction support to non-Java GLVs#3434

Merged
kenhuuu merged 2 commits into
masterfrom
tx-glv
Jun 9, 2026
Merged

Add explicit transaction support to non-Java GLVs#3434
kenhuuu merged 2 commits into
masterfrom
tx-glv

Conversation

@kenhuuu

@kenhuuu kenhuuu commented May 28, 2026

Copy link
Copy Markdown
Contributor

Implement Transaction classes in gremlin-python, gremlin-go, gremlin-javascript, and gremlin-dotnet that mirror the Java HttpRemoteTransaction. Transaction wraps a Client and provides begin/commit/rollback/close lifecycle plus a submit() method for plain gremlin-lang strings.

gremlin-driver's default transaction close behavior is now rollback to match all GLVs.

Also changes how requests are submitted in gremlin-go. In particular it now waits for response headers before returning. This allows users to check if the response returns an err (pretty much any non-200 OK response), before having to check the ResultSet itself.

Comment thread docs/src/reference/gremlin-variants.asciidoc Outdated
Comment thread docs/src/reference/intro.asciidoc Outdated
Comment thread docs/src/upgrade/release-4.x.x.asciidoc Outdated

@GumpacG GumpacG left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VOTE +1

Comment thread gremlin-js/gremlin-javascript/lib/driver/remote-connection.ts Outdated
Comment thread gremlin-dotnet/src/Gremlin.Net/Driver/RemoteTransaction.cs Outdated
Comment thread gremlin-go/driver/transaction.go Outdated
Comment thread gremlin-dotnet/src/Gremlin.Net/Driver/RemoteTransaction.cs
Base automatically changed from implicit-tx to master June 2, 2026 19:48
Comment thread gremlin-go/driver/transaction_test.go
@Cole-Greer

Copy link
Copy Markdown
Contributor

I agree with above comments from Stephen and Guian, but overall LGTM.

VOTE +1 (pending comment resolutions)

@Cole-Greer

Copy link
Copy Markdown
Contributor

One extra thing to note, this PR deletes a lot of the old commented out/skipped transaction tests in favour of a fresh set of tests. I'm fine with that change but I was comparing the old and new tests and found a few minor gaps:

First of all there are still some old skipped transaction tests in python which have not been cleaned up here:

@pytest.mark.skip(reason="enable after transaction is implemented in HTTP")

Also the old Python and Go transaction tests seemed to have been a bit richer than the other GLVs, and contain a few cases which are not replicated in the new tests:

Old scenario Go old test Python old test In new tests?
Two concurrent txns, both rolled back, graph unchanged Test multi rollback Transaction test_multi_rollback_transaction ❌ No
Two concurrent txns, one commits + one rolls back, only committed data persists Test multi commit and rollback Transaction test_multi_commit_and_rollback ❌ No
Close from parent: closing the parent DriverRemoteConnection closes/rolls back child txns Test Transaction close tx from parent test_transaction_close_tx_from_parent ❌ No

Comment thread gremlin-go/driver/transactionRemoteConnection.go
@xiazcy

xiazcy commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

VOTE +1 pending comment resolution

Split executeAndStream() into sendRequest() (synchronous HTTP call) and
streamResponse() (async body streaming). submit() now blocks until the
server acknowledges the request (response headers received), then streams
the body in the background.

Non-GraphBinary HTTP errors (400/500 with text/JSON bodies) are now
returned directly from submit() instead of being embedded in the
ResultSet. Tests updated accordingly.

Assisted-by: Kiro:claude-opus-4-6
Implement Transaction classes in gremlin-python, gremlin-go,
gremlin-javascript, and gremlin-dotnet that mirror the Java
HttpRemoteTransaction. Transaction wraps a Client and provides
begin/commit/rollback/close lifecycle plus a submit() method for
plain gremlin-lang strings.

Key design decisions:
- Default close behavior changed from commit to rollback (all GLVs)
- Transactions are single-use (terminal state after commit/rollback)
- gtx.tx() returns the same Transaction (enables gtx.tx().commit())

Assisted-by: Kiro:claude-opus-4-6
@kenhuuu

kenhuuu commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

VOTE +1

@kenhuuu kenhuuu merged commit 637baaa into master Jun 9, 2026
68 of 69 checks passed
@kenhuuu kenhuuu deleted the tx-glv branch June 9, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants