alievmirza commented on code in PR #3492:
URL: https://github.com/apache/ignite-3/pull/3492#discussion_r1540648667
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -495,6 +495,8 @@ private CompletableFuture<Replica> startReplicaInternal(
TopologyAwareRaftGroupService raftClient,
PendingComparableValuesTracker<Long, Void> storageIndexTracker
) {
+ LOG.info("Replica is about to start [replicationGroupId={}].",
replicaGrpId);
Review Comment:
Shouldn't we change the level of logs here from "INFO" to "DEBUG"?
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -779,6 +783,18 @@ private void idleSafeTimeSync() {
* @return True if the replica is started.
*/
public boolean isReplicaStarted(ReplicationGroupId replicaGrpId) {
+ CompletableFuture<Replica> replicaFuture = replicas.get(replicaGrpId);
+ return replicaFuture != null && isCompletedSuccessfully(replicaFuture);
Review Comment:
We can use
`org.apache.ignite.internal.util.CompletableFutures#isCompletedSuccessfully`
here and remove
`org.apache.ignite.internal.replicator.ReplicaManager#isCompletedSuccessfully`
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -779,6 +783,18 @@ private void idleSafeTimeSync() {
* @return True if the replica is started.
*/
public boolean isReplicaStarted(ReplicationGroupId replicaGrpId) {
+ CompletableFuture<Replica> replicaFuture = replicas.get(replicaGrpId);
+ return replicaFuture != null && isCompletedSuccessfully(replicaFuture);
+ }
+
+ /**
+ * Check if replica was touched by an any actor.
+ *
+ * @param replicaGrpId Replication group id.
+ * @return True if the replica was touched.
+ */
+ @TestOnly
+ public boolean isReplicaTouched(ReplicationGroupId replicaGrpId) {
Review Comment:
Javadoc is a bit confusing, if replica was stopped, do we still think that
replica was touched or not?
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/ReplicaManager.java:
##########
@@ -511,10 +513,12 @@ private CompletableFuture<Replica> startReplicaInternal(
CompletableFuture<Replica> replicaFuture =
replicas.compute(replicaGrpId, (k, existingReplicaFuture) -> {
if (existingReplicaFuture == null ||
existingReplicaFuture.isDone()) {
assert existingReplicaFuture == null ||
isCompletedSuccessfully(existingReplicaFuture);
+ LOG.info("Replica is started [replicationGroupId={}].",
replicaGrpId);
return completedFuture(newReplica);
} else {
existingReplicaFuture.complete(newReplica);
+ LOG.info("Replica is started, existing waiter was completed
[replicationGroupId={}].", replicaGrpId);
Review Comment:
It could be not so obvious from the user perspective what the waiter is.
--
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]