denis-chudov commented on code in PR #2856:
URL: https://github.com/apache/ignite-3/pull/2856#discussion_r1422406992


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -516,13 +522,32 @@ private CompletableFuture<Void> 
processTxRecoveryAction(TxRecoveryMessage reques
         boolean transactionAlreadyFinished = txMeta != null && 
isFinalState(txMeta.txState());
 
         if (transactionAlreadyFinished) {
-            return nullCompletedFuture();
+            if (txMeta.locksReleased()) {
+                // Locks released - nothing to do.
+                return nullCompletedFuture();
+            }
+            // Locks were not released - send cleanup.
+            if (txMeta.enlistedPartitions().isEmpty()) {

Review Comment:
   by the way, if you call `txManager.finish` like below, you will never get 
empty list here: even in case of recovery you will send a tx finish request to 
commit partition with one partition in `enlistedPartitions` collection: the 
commit partition itself.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -516,13 +522,32 @@ private CompletableFuture<Void> 
processTxRecoveryAction(TxRecoveryMessage reques
         boolean transactionAlreadyFinished = txMeta != null && 
isFinalState(txMeta.txState());
 
         if (transactionAlreadyFinished) {
-            return nullCompletedFuture();
+            if (txMeta.locksReleased()) {
+                // Locks released - nothing to do.
+                return nullCompletedFuture();
+            }
+            // Locks were not released - send cleanup.
+            if (txMeta.enlistedPartitions().isEmpty()) {
+                // No enlisted partitions, send cleanup only back to the 
initiator.
+                return txManager.cleanup(nodeConsistentId, txId);
+            } else {
+                // If enlisted partitions exist, we can do the cleanup.
+                return (CompletableFuture<Void>) durableCleanup(txId, txMeta);
+            }
         }
 
         LOG.info("Orphan transaction has to be aborted [tx={}].", txId);
 
-        // TODO: IGNITE-20735 Implement initiate recovery handling logic.
-        return nullCompletedFuture();
+        // If the transaction state is pending, then the transaction should be 
rolled back,
+        // meaning that the state is changed to aborted and a corresponding 
cleanup request
+        // is sent in a common durable manner to a partition that have 
initiated recovery.
+        return txManager.finish(

Review Comment:
   now we must check on PartitionListener side that the state that is already 
in txStateStorage, is not final, while doing CAS. If there is already a final 
state, the operation should be aborted.



-- 
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]

Reply via email to