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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java:
##########
@@ -2383,6 +2424,35 @@ private CompletableFuture<Object> 
applyCmdWithExceptionHandling(Command cmd) {
         });
     }
 
+    private void applyCmdWithRetryOnSafeTimeReorderException(Command cmd, 
CompletableFuture<Object> resultFuture) {
+        raftClient.run(cmd).whenComplete((res, ex) -> {
+            if (ex != null) {
+                if (ex instanceof SafeTimeReorderException || ex.getCause() 
instanceof SafeTimeReorderException) {
+                    assert cmd instanceof SafeTimePropagatingCommand;
+
+                    SafeTimePropagatingCommand safeTimePropagatingCommand = 
(SafeTimePropagatingCommand) cmd;
+
+                    HybridTimestamp safeTimeForRetry = hybridClock.now();
+
+                    if ((cmd instanceof UpdateCommand && !((UpdateCommand) 
cmd).full())
+                            || (cmd instanceof UpdateAllCommand && 
!((UpdateAllCommand) cmd).full())) {
+                        synchronized (safeTime) {
+                            
updateTrackerIgnoringTrackerClosedException(safeTime, safeTimeForRetry);
+                        }
+                    }
+
+                    
safeTimePropagatingCommand.safeTimeLong(safeTimeForRetry.longValue());
+
+                    
applyCmdWithRetryOnSafeTimeReorderException(safeTimePropagatingCommand, 
resultFuture);

Review Comment:
   Attempts counter along with limit added.



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