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


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TxUnlockRequestSender.java:
##########
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.tx.impl;
+
+import static java.util.concurrent.CompletableFuture.allOf;
+import static 
org.apache.ignite.internal.hlc.HybridTimestamp.hybridTimestampToLong;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.hlc.HybridClock;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.replicator.ReplicationGroupId;
+import org.apache.ignite.internal.replicator.TablePartitionId;
+import 
org.apache.ignite.internal.tx.impl.TxManagerImpl.TransactionFailureHandler;
+import org.apache.ignite.internal.tx.message.LockReleaseMessage;
+import org.apache.ignite.internal.tx.message.TxMessagesFactory;
+import org.apache.ignite.internal.util.CompletableFutures;
+import org.apache.ignite.network.ClusterService;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Sends TX Unlock request.
+ */
+public class TxUnlockRequestSender {
+
+    /** Network timeout. */
+    private static final long RPC_TIMEOUT = 3000;
+
+    /** Tx messages factory. */
+    private static final TxMessagesFactory FACTORY = new TxMessagesFactory();
+
+    /** Cluster service. */
+    private final ClusterService clusterService;
+
+    /** Placement driver helper. */
+    private final PlacementDriverHelper placementDriverHelper;
+
+    /** Hybrid clock. */
+    private final HybridClock hybridClock;
+
+    /** Cleanup processor. */
+    private final TxCleanupProcessor txCleanupProcessor;
+
+    /**
+     * The constructor.
+     *
+     * @param clusterService Cluster service.
+     * @param placementDriverHelper Placement driver helper.
+     * @param clock A hybrid logical clock.
+     * @param txCleanupProcessor A cleanup processor.
+     */
+    public TxUnlockRequestSender(
+            ClusterService clusterService,
+            PlacementDriverHelper placementDriverHelper,
+            HybridClock clock,
+            TxCleanupProcessor txCleanupProcessor) {
+        this.clusterService = clusterService;
+        this.placementDriverHelper = placementDriverHelper;
+        this.hybridClock = clock;
+        this.txCleanupProcessor = txCleanupProcessor;
+    }
+
+    /**
+     * Sends unlock request to the primary nodes of each one of {@code 
partitions}.
+     *
+     * @param partitions Enlisted partition groups.
+     * @param commit {@code true} if a commit requested.
+     * @param commitTimestamp Commit timestamp ({@code null} if it's an abort).
+     * @param txId Transaction id.
+     * @return Completable future of Void.
+     */
+    public CompletableFuture<Void> unlock(

Review Comment:
   Naming is still a bit messy. And thus same for components areas of 
responsibilities - it's also messy. On the one hand we consider cleanup as an 
umbrella operations that consists of unlock and write intents conversion, on 
the other hand unlock within given method calls durable cleanup, so it's 
reversed. 
   
   From my point of view, first approach is better. In order not to mix 
writeIntent cleanup with general cleanup that also includes unlock I'd rather 
introduce new term - writeIntentSwitch.
   
   All in all, I believe that proposed changes are good and correct. However 
they worth one more round of refactoring. @Cyrill could you please share list 
of cleanup related actors with corresponding key methods in tx-recovery 
channel? It would be also nice to have a corresponding flow diagram.



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