Skip to content

IGNITE-27947 Fix rollback for client piggyback tx#7844

Merged
ptupitsyn merged 20 commits intoapache:mainfrom
tmgodinho:ignite-27947
Apr 22, 2026
Merged

IGNITE-27947 Fix rollback for client piggyback tx#7844
ptupitsyn merged 20 commits intoapache:mainfrom
tmgodinho:ignite-27947

Conversation

@tmgodinho
Copy link
Copy Markdown
Contributor

@tmgodinho tmgodinho commented Mar 20, 2026

Allow rollback for piggyback transactions: piggyback client tx combines transaction start with table operation in one client request. If the table operation is stuck on a lock, the client never receives the transaction id. Instead, we use the requestId (generated on the client) to rollback the transaction.

  • Server-side:
    • TX_ROLLBACK accepts a request id of the first request ("piggyback") of a direct mapped TX. Request Id is encoded in the negative range of resourceId.
    • Track requestId -> txId to roll back piggyback transactions stuck on a lock
    • Update all the operations. RO ops have the same parameters just for consistency.
  • Client Side:
    • Allow multiple onSent callbacks on the payload output object.
    • Add info to ClientLazyTransaction about the first request in the TX, update via PayloadOutputChannel on successful request.
    • Implement TX_ROLLBACK based on firstReqId

https://issues.apache.org/jira/browse/IGNITE-27947

* The first request is tracked for direct transactions.
* The first request id is passed on the Rollback message using the negative range of the resourceId field.
@tmgodinho
Copy link
Copy Markdown
Contributor Author

This should be a simpler implementation than the one on the previous approach.

@tmgodinho tmgodinho marked this pull request as ready for review March 20, 2026 19:21
** Postpone removal of firstReqToTx resource to after the transaction is commited/rolled back.
** Added test
Comment thread modules/client/src/main/java/org/apache/ignite/internal/client/sql/ClientSql.java Outdated
** Fixed type
** Updated javadoc comment on ClientInboundMessageHandler
** Added IGNITE-28405 ticket mention
…andling logic. (For the most part anyway)

** The code is still very hard, its just a little less duplicated.
@ptupitsyn ptupitsyn changed the title IGNITE-27947 Impossible to rollback client first transaction request IGNITE-27947 Fix rollback for client piggyback tx Apr 2, 2026
# Conflicts:
#	modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ProtocolBitmaskFeature.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java
#	modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
@tmgodinho
Copy link
Copy Markdown
Contributor Author

Since https://issues.apache.org/jira/browse/IGNITE-24963 it's already around the corner, we decided to postpone this merge until then.
It will allow us to remove the disable condition from the test, since it will be the default behaviour.

@tmgodinho
Copy link
Copy Markdown
Contributor Author

The other branch has been unlocked. I'll merge the changes and apply the last round of reviews.

# Conflicts:
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlQueryMetadataRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTableCommon.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleContainsAllKeysRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleContainsKeyRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleDeleteAllExactRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleDeleteAllRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleDeleteExactRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleDeleteRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleGetAllRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleGetAndDeleteRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleGetAndReplaceRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleGetAndUpsertRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleGetRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleInsertAllRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleInsertRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleReplaceExactRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleReplaceRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleUpsertAllRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTupleUpsertRequest.java
#	modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/table/ClientTuplesRequestBase.java
…conditions

** This solution creates much more contention but will safeguard against all known race-conditions at this time between the two rollback mechanisms.
** Remove useless comment
# Conflicts:
#	modules/client/src/integrationTest/java/org/apache/ignite/internal/client/ItThinClientTransactionsTest.java
@ptupitsyn ptupitsyn merged commit 3f0806b into apache:main Apr 22, 2026
5 checks passed
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.

2 participants