Copilot commented on code in PR #7689:
URL: https://github.com/apache/ignite-3/pull/7689#discussion_r2870909617
##########
modules/client/src/main/java/org/apache/ignite/internal/client/tx/ClientTransaction.java:
##########
@@ -241,7 +241,18 @@ public CompletableFuture<Void>
discardDirectMappings(boolean killed) {
enlistPartitionLock.writeLock().unlock();
}
- return sendDiscardRequests().handle((r, e) -> {
+ // The transaction could not be yet rolled back on a coordinator. Make
sure it's rolled back and client resource is cleaned up.
+ CompletableFuture<Void> rollbackFut =
ch.serviceAsync(ClientOp.TX_ROLLBACK, w -> {
+ w.out().packLong(id);
+
+ if (!isReadOnly &&
w.clientChannel().protocolContext().isFeatureSupported(TX_DIRECT_MAPPING)) {
Review Comment:
In `rollbackAndDiscardDirectMappings`, the decision to write the extra `int`
(direct enlistments count) is guarded by `TX_DIRECT_MAPPING`. On the server
side, `ClientTransactionRollbackRequest` expects this `cnt` field only when the
`TX_PIGGYBACK` feature is enabled. If a server supports `TX_DIRECT_MAPPING` but
not `TX_PIGGYBACK` (older protocol combinations), this will desynchronize the
message stream and break the protocol. Use the same feature check as
`rollbackAsync`/server handler (`TX_PIGGYBACK`) for whether to write the
enlistments section (even if `cnt=0`).
```suggestion
if (!isReadOnly &&
w.clientChannel().protocolContext().isFeatureSupported(TX_PIGGYBACK)) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]