hanishakoneru commented on code in PR #3258:
URL: https://github.com/apache/ozone/pull/3258#discussion_r853442107


##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestReplicationManager.java:
##########
@@ -1461,6 +1462,71 @@ public void testUnderReplicatedNotHealthySource() throws 
IOException {
     assertUnderReplicatedCount(1);
   }
 
+  /**
+   * When all the replicas are unstable (unhealthy or quasi-closed with bcsId <
+   * container bcsId), no replica should be deleted.
+   */
+  @Test
+  public void testAllUnstableReplicas() throws Exception {
+    // Default test bcsId for container = 10000L
+    final ContainerInfo container = createContainer(LifeCycleState.CLOSED);
+    addReplica(container, NodeStatus.inServiceHealthy(), QUASI_CLOSED, 990L);
+    addReplica(container, NodeStatus.inServiceHealthy(), QUASI_CLOSED, 990L);
+    addReplica(container, NodeStatus.inServiceHealthy(), UNHEALTHY, 980L);

Review Comment:
   You are right. But with unhealthy replicas, it is hard to determine if the 
replica can be recovered and if recovered, will the bcsId also change. That's 
why we thought of keeping the replica around if the closed container is lost. 
   
   But with the same argument, do we never delete unhealthy containers? I guess 
there is no absolutely right answer for this. The only thing we can be certain 
about is when we have a closed replica, it can be assumed to be the source of 
truth. 
   
   > The PR description currently says
   >> An unhealthy replica should be deleted only if it's bcsId is < than all 
quasi-closed and closed replicas bcsId.
   
   The 2nd proposed fix in the PR description is what handles this case 
currently:
   > If all the replicas are unstable (either unhealthy or quasi-closed with 
lesser bcsId than container), then no replica should be deleted.
   
   cc. @nandakumar131 



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