siddhantsangwan commented on code in PR #4204:
URL: https://github.com/apache/ozone/pull/4204#discussion_r1086484635
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestRatisReplicationCheckHandler.java:
##########
@@ -294,6 +296,80 @@ public void testUnderReplicatedAndUnrecoverable() {
ReplicationManagerReport.HealthState.MISSING));
}
+ /**
+ * Replicas with ContainerReplicaProto#State UNHEALTHY don't contribute to
+ * the redundancy of a container. This tests that a CLOSED container with {
+ * CLOSED, CLOSED, UNHEALTHY, UNHEALTHY} replicas is under replicated.
+ */
+ @Test
+ public void testUnderReplicatedWithUnhealthyReplicas() {
+ ContainerInfo container = createContainerInfo(repConfig);
+ Set<ContainerReplica> replicas
+ = createReplicas(container.containerID(), State.CLOSED, 0, 0);
+ Set<ContainerReplica> unhealthyReplicas =
+ createReplicas(container.containerID(), State.UNHEALTHY, 0, 0);
+ replicas.addAll(unhealthyReplicas);
+ requestBuilder.setContainerReplicas(replicas)
+ .setContainerInfo(container);
+ UnderReplicatedHealthResult result = (UnderReplicatedHealthResult)
+ healthCheck.checkHealth(requestBuilder.build());
+
+ Assert.assertEquals(HealthState.UNDER_REPLICATED, result.getHealthState());
+ Assert.assertEquals(1, result.getRemainingRedundancy());
+ Assert.assertFalse(result.isReplicatedOkAfterPending());
+ Assert.assertFalse(result.underReplicatedDueToDecommission());
+
+ Assert.assertTrue(healthCheck.handle(requestBuilder.build()));
+ Assert.assertEquals(1, repQueue.underReplicatedQueueSize());
+ Assert.assertEquals(0, repQueue.overReplicatedQueueSize());
+ Assert.assertEquals(1, report.getStat(
+ ReplicationManagerReport.HealthState.UNDER_REPLICATED));
+ }
+
+ @Test
+ public void testSufficientReplicationWithMismatchedReplicas() {
+ ContainerInfo container = createContainerInfo(repConfig);
+ Set<ContainerReplica> replicas
+ = createReplicas(container.containerID(), State.CLOSING, 0, 0, 0);
Review Comment:
Yes
--
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]