sanpwc commented on code in PR #6960:
URL: https://github.com/apache/ignite-3/pull/6960#discussion_r2546614729


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxCleanupRequestSender.java:
##########
@@ -122,18 +123,39 @@ private void onCleanupReplicated(CleanupReplicatedInfo 
info) {
     private void markTxnCleanupReplicated(UUID txId, TxState state, 
ReplicationGroupId commitPartitionId) {
         long cleanupCompletionTimestamp = System.currentTimeMillis();
 
-        txStateVolatileStorage.updateMeta(txId, oldMeta ->
+        TxStateMeta txStateMeta = txStateVolatileStorage.state(txId);
+        final CompletableFuture<HybridTimestamp> commitTimestampFuture;
+        if (state == TxState.COMMITTED && (txStateMeta == null || 
txStateMeta.commitTimestamp() == null)) {
+            commitTimestampFuture = 
placementDriverHelper.awaitPrimaryReplicaWithExceptionHandling(commitPartitionId)
+                    .thenCompose(replicaMeta -> {
+                                String primaryNode = 
replicaMeta.getLeaseholder();
+                                HybridTimestamp startTime = 
replicaMeta.getStartTime();
+                                return 
txMessageSender.resolveTxStateFromCommitPartition(
+                                        primaryNode,
+                                        txId,
+                                        commitPartitionId,
+                                        
startTime.longValue()).thenApply(TransactionMeta::commitTimestamp);
+                            }
+                    );
+        } else {
+            HybridTimestamp existingCommitTs = txStateMeta == null ? null : 
txStateMeta.commitTimestamp();
+            commitTimestampFuture = 
CompletableFuture.completedFuture(existingCommitTs);
+        }
+
+        commitTimestampFuture.thenAccept(commitTimestamp -> 
txStateVolatileStorage.updateMeta(txId, oldMeta ->
                 new TxStateMeta(
                         oldMeta == null ? state : oldMeta.txState(),
                         oldMeta == null ? null : oldMeta.txCoordinatorId(),
                         commitPartitionId,
-                        oldMeta == null ? null : oldMeta.commitTimestamp(),
+                        oldMeta == null ? commitTimestamp : 
oldMeta.commitTimestamp(),
                         oldMeta == null ? null : oldMeta.tx(),
                         oldMeta == null ? null : 
oldMeta.initialVacuumObservationTimestamp(),
                         cleanupCompletionTimestamp,
                         oldMeta == null ? null : 
oldMeta.isFinishedDueToTimeout()
                 )
+                )
         );
+

Review Comment:
   Unnecessary empty line.



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