siddhantsangwan commented on code in PR #5678:
URL: https://github.com/apache/ozone/pull/5678#discussion_r1410186695


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestRatisUnhealthyReplicationCheckHandler.java:
##########
@@ -366,29 +352,45 @@ public void overReplicationCheckWithQuasiClosedReplica() {
     final ContainerInfo container = ReplicationTestUtil.createContainerInfo(
         repConfig, 1, HddsProtos.LifeCycleState.CLOSED, sequenceID);
 
-    final Set<ContainerReplica> replicas = new HashSet<>(2);
-    replicas.add(createContainerReplica(container.containerID(), 0,
-        IN_SERVICE, State.CLOSED, sequenceID));
-    replicas.add(createContainerReplica(container.containerID(), 0,
-        IN_SERVICE, State.CLOSED, sequenceID));
-    replicas.add(createContainerReplica(container.containerID(), 0,
-        IN_SERVICE, State.CLOSED, sequenceID));
-
-    final ContainerReplica quasiClosedReplica =
-        createContainerReplica(container.containerID(), 0,
-            IN_SERVICE, State.QUASI_CLOSED, sequenceID - 1);
-    replicas.add(quasiClosedReplica);
+    Set<ContainerReplica> replicas = new HashSet<>(4);
+    for (int i = 0; i < 4; i++) {
+      replicas.add(createContainerReplica(container.containerID(), 0,
+          IN_SERVICE, State.QUASI_CLOSED, sequenceID - 1));

Review Comment:
   > Here we have all replicas with a sequenceID less than the container, which 
is different to the original test - is this intentional?
   
   Yes, I want to intentionally show that 
`RatisUnhealthyReplicationCheckHandler` only handles containers which have 
_all_ replicas unhealthy. Unhealthy meaning the replica is in `UNHEALTHY` state 
or the container is `CLOSED` with the replica in `QUASI_CLOSED` and having 
sequence id less than the container.
   
   > In this case, I guess we have 4 replicas all with "sequenceID - 1", so as 
they have the same sequence and it is less than that of the container, that is 
what makes the container unhealthy, right? Otherwise it would not be handled by 
this handler and the RatisReplicationCheckHandler would take care of it instead?
   
   Right. If the replicas had sequence id equal to the container, I'd expect 
the `MisMatchedReplicasHandler` to try and close the replicas and return false 
so the container can be checked for replication. Then 
`RatisReplicationCheckHandler` would queue it for over replication and return 
true.
   
   Let me know if I can add some more doc in the code to make this clearer!



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to