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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java:
##########
@@ -231,6 +229,10 @@ public void onWrite(Iterator<CommandClosure<WriteCommand>> 
iterator) {
                 storage.releasePartitionSnapshotsReadLock();
             }
 
+            // Completing the closure out of the partition snapshots lock to 
reduce possibility of deadlocks as it might

Review Comment:
   I didn't get this point. Why it's possible to have a deadlock here?



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -1765,6 +1760,21 @@ private CompletableFuture<Void> 
applyWriteIntentSwitchCommand(
                 .thenApply(res -> null);
     }
 
+    private void switchWriteIntentsUnderSnapshotsLock(UUID transactionId, 
boolean commit, HybridTimestamp commitTimestamp) {
+        storageUpdateHandler.acquirePartitionSnapshotsReadLock();
+
+        try {
+            storageUpdateHandler.switchWriteIntents(
+                    transactionId,
+                    commit,
+                    commitTimestamp,
+                    indexIdsAtRwTxBeginTs(transactionId)
+            );
+        } finally {
+            storageUpdateHandler.releasePartitionSnapshotsReadLock();

Review Comment:
   I'm not sure that we should use snapshot lock within partition replica 
listener. I've scheduled a meeting to discuss this.



##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -2665,37 +2686,11 @@ private CompletableFuture<CompletableFuture<?>> 
applyUpdateAllCommand(
 
             if (!cmd.full()) {
                 if (skipDelayedAck) {
-                    // TODO: 
https://issues.apache.org/jira/browse/IGNITE-20124 Temporary code below
-                    synchronized (safeTime) {
-                        storageUpdateHandler.handleUpdateAll(
-                                cmd.txId(),
-                                cmd.rowsToUpdate(),
-                                cmd.tablePartitionId().asTablePartitionId(),
-                                true,
-                                null,
-                                null,
-                                indexIdsAtRwTxBeginTs(transactionId)
-                        );
-
-                        updateTrackerIgnoringTrackerClosedException(safeTime, 
cmd.safeTime());
-                    }
+                    
handleUpdateAllUnderLocksOnSnapshotsAndSafeTime(transactionId, cmd);

Review Comment:
   I don't think that all that private methods actually increase readability. 
Matter of taste though.



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