xtern commented on code in PR #5146:
URL: https://github.com/apache/ignite-3/pull/5146#discussion_r1937293291


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxStateMeta.java:
##########
@@ -101,17 +108,28 @@ public TxStateMeta(
             @Nullable UUID txCoordinatorId,
             @Nullable TablePartitionId commitPartitionId,
             @Nullable HybridTimestamp commitTimestamp,
+            @Nullable InternalTransaction tx,
             @Nullable Long initialVacuumObservationTimestamp,
             @Nullable Long cleanupCompletionTimestamp
     ) {
         this.txState = txState;
         this.txCoordinatorId = txCoordinatorId;
         this.commitPartitionId = commitPartitionId;
         this.commitTimestamp = commitTimestamp;
+        this.tx = tx;
         this.initialVacuumObservationTimestamp = 
initialVacuumObservationTimestamp;
         this.cleanupCompletionTimestamp = cleanupCompletionTimestamp;
     }
 
+    /**
+     * Gets a transaction object or {@code null} it a current node is not a 
coordinator for this transaction.

Review Comment:
   ```suggestion
        * Gets a transaction object or {@code null} if the current node is not 
a coordinator for this transaction.
   ```



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/views/TransactionsViewProvider.java:
##########
@@ -108,6 +109,7 @@ public Iterator<TxInfo> iterator() {
                     new TransformingIterator<>(roTxIds.iterator(), 
TxInfo::readOnly),
                     rwTxStates.entrySet().stream()
                             .filter(e -> 
localNodeId.equals(e.getValue().txCoordinatorId())
+                                    && e.getValue().tx() != null && 
!e.getValue().tx().isReadOnly()

Review Comment:
   Can `e.getValue().tx() == null` and 
`ocalNodeId.equals(e.getValue().txCoordinatorId())` at the same time?



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/VolatileTxStateMetaStorage.java:
##########
@@ -262,6 +269,10 @@ private static boolean shouldBeVacuumized(
             return true;
         }
 
+        if (initialVacuumObservationTimestamp == null) {
+            LOG.info("InitialVacuumObservationTimestamp is null");

Review Comment:
   looks like a debug message left during development :thinking: 



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java:
##########
@@ -224,6 +224,14 @@ CompletableFuture<Void> cleanup(
      */
     CompletableFuture<Void> vacuum();
 
+    /**
+     * Kills a local transaction by their id. The behavior is similar with the 
transaction rollback.
+     *
+     * @param txId Transaction id.
+     * @return Future will be completed with value true if the transaction was 
started locally and completed.

Review Comment:
   ```suggestion
        * @return Future will be completed with value true if the transaction 
was started locally and completed completed by this call.
   ```
   What happens if the transaction has already been completed by another call 
but has not yet been `vacuumed`?
   



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/TxManager.java:
##########
@@ -224,6 +224,14 @@ CompletableFuture<Void> cleanup(
      */
     CompletableFuture<Void> vacuum();
 
+    /**
+     * Kills a local transaction by their id. The behavior is similar with the 
transaction rollback.

Review Comment:
   ```suggestion
        * Kills a local transaction by its id. The behavior is similar to the 
transaction rollback.
   ```



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/ReadWriteTransactionImpl.java:
##########
@@ -159,18 +162,54 @@ public CompletableFuture<Void> finish(boolean commit, 
@Nullable HybridTimestamp
             return finishFuture;
         }
 
+        return finishInternal(commit, executionTimestamp, full, true);
+    }
+
+    private CompletableFuture<Void> finishInternal(
+            boolean commit,
+            @Nullable HybridTimestamp executionTimestamp,
+            boolean full,
+            boolean isComplete
+    ) {
         enlistPartitionLock.writeLock().lock();
 
         try {
             if (finishFuture == null) {
+                if (killed) {
+                    if (isComplete) {
+                        finishFuture = nullCompletedFuture();
+
+                        return failedFuture(new TransactionException(

Review Comment:
   Why not set `failedFuture` to `finishFuture`?



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