ascherbakoff commented on code in PR #4821: URL: https://github.com/apache/ignite-3/pull/4821#discussion_r1889933358
########## modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java: ########## @@ -241,30 +215,46 @@ private void onWriteBusy(Iterator<CommandClosure<WriteCommand>> iterator) { storage.acquirePartitionSnapshotsReadLock(); try { + boolean[] applied = {false}; + if (command instanceof UpdateCommand) { - result = handleUpdateCommand((UpdateCommand) command, commandIndex, commandTerm); + result = handleUpdateCommand((UpdateCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof UpdateAllCommand) { - result = handleUpdateAllCommand((UpdateAllCommand) command, commandIndex, commandTerm); + result = handleUpdateAllCommand((UpdateAllCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof FinishTxCommand) { - result = handleFinishTxCommand((FinishTxCommand) command, commandIndex, commandTerm); + result = handleFinishTxCommand((FinishTxCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof WriteIntentSwitchCommand) { - handleWriteIntentSwitchCommand((WriteIntentSwitchCommand) command, commandIndex, commandTerm); + handleWriteIntentSwitchCommand((WriteIntentSwitchCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof SafeTimeSyncCommand) { - handleSafeTimeSyncCommand((SafeTimeSyncCommand) command, commandIndex, commandTerm); + handleSafeTimeSyncCommand((SafeTimeSyncCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof BuildIndexCommand) { - handleBuildIndexCommand((BuildIndexCommand) command, commandIndex, commandTerm); + handleBuildIndexCommand((BuildIndexCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof PrimaryReplicaChangeCommand) { - handlePrimaryReplicaChangeCommand((PrimaryReplicaChangeCommand) command, commandIndex, commandTerm); + handlePrimaryReplicaChangeCommand((PrimaryReplicaChangeCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof VacuumTxStatesCommand) { - handleVacuumTxStatesCommand((VacuumTxStatesCommand) command, commandIndex, commandTerm); + handleVacuumTxStatesCommand((VacuumTxStatesCommand) command, commandIndex, commandTerm, applied); } else if (command instanceof UpdateMinimumActiveTxBeginTimeCommand) { - handleUpdateMinimalActiveTxTimeCommand((UpdateMinimumActiveTxBeginTimeCommand) command, commandIndex, commandTerm); + handleUpdateMinimalActiveTxTimeCommand((UpdateMinimumActiveTxBeginTimeCommand) command, commandIndex, commandTerm, + applied); } else { assert false : "Command was not found [cmd=" + command + ']'; } + + if (applied[0]) { + // Adjust safe time before completing update to reduce waiting. + if (command instanceof SafeTimePropagatingCommand) { + SafeTimePropagatingCommand safeTimePropagatingCommand = (SafeTimePropagatingCommand) command; + + assert safeTimePropagatingCommand.safeTime() != null; + + updateTrackerIgnoringTrackerClosedException(safeTime, safeTimePropagatingCommand.safeTime()); + } + + updateTrackerIgnoringTrackerClosedException(storageIndexTracker, commandIndex); Review Comment: afaik storageIndexTracker is used to guarantee up-to-date state of partition copy on primary replica during lease reassigning and has nothing to do with snapshot. @sanpwc Can you confirm ? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org