sanpwc commented on code in PR #4684: URL: https://github.com/apache/ignite-3/pull/4684#discussion_r1832533806
########## modules/replicator/build.gradle: ########## @@ -37,6 +37,7 @@ dependencies { implementation project(':ignite-placement-driver-api') implementation project(':ignite-failure-handler') implementation project(':ignite-partition-distribution') + implementation project(':ignite-metastorage-api') Review Comment: The fact that MG is currently implemented directly over raft instead of using a replicas layer is generally bad design. I mean that from the top-level point of view, both MG and Partitions should use replicator and thus replicator should not depend on MG. ########## modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java: ########## @@ -259,6 +264,7 @@ public ReplicaManager( RaftManager raftManager, RaftGroupOptionsConfigurer partitionRaftConfigurer, LogStorageFactoryCreator volatileLogStorageFactoryCreator, + ClusterTime clusterTime, Review Comment: Here and in other places: Javadoc update is missing. ########## modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java: ########## @@ -1086,16 +1097,64 @@ private void idleSafeTimeSync() { } } - private void sendSafeTimeSyncIfReplicaReady(CompletableFuture<Replica> replicaFuture) { - if (isCompletedSuccessfully(replicaFuture)) { - Replica replica = replicaFuture.join(); + private void sendSafeTimeSyncIfReplicaReady(CompletableFuture<Replica> replicaFuture, HybridTimestamp proposedSafeTime) { + if (!isCompletedSuccessfully(replicaFuture)) { + return; + } - ReplicaSafeTimeSyncRequest req = REPLICA_MESSAGES_FACTORY.replicaSafeTimeSyncRequest() - .groupId(toReplicationGroupIdMessage(replica.groupId())) - .build(); + Replica replica = replicaFuture.join(); - replica.processRequest(req, localNodeId); + if (!shouldAdvanceIdleSafeTime(replica, proposedSafeTime)) { + // If previous attempt might still be waiting on the Metastorage SafeTime, we should not send the command ourselves as this + // might be an indicator that Metastorage SafeTime has stuck for some time; if we send the command, it will have to add its + // future, increasing (most probably, uselessly) heap pressure. + return; } + + getOrCreateContext(replica).lastIdleSafeTimeProposal = proposedSafeTime; Review Comment: Do you expect proposedSafeTime to grow monotically? -- 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