sodonnel commented on code in PR #5678:
URL: https://github.com/apache/ozone/pull/5678#discussion_r1410625671
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestRatisReplicationCheckHandler.java:
##########
@@ -500,6 +501,43 @@ public void
testOverReplicatedContainerWithMismatchedReplicas() {
ReplicationManagerReport.HealthState.OVER_REPLICATED));
}
+ @Test
+ public void shouldQueueForOverReplicationOnlyWhenSafe() {
+ ContainerInfo container =
+ createContainerInfo(repConfig, 1L, HddsProtos.LifeCycleState.CLOSED);
+ Set<ContainerReplica> replicas = createReplicas(container.containerID(),
+ ContainerReplicaProto.State.CLOSED, 0, 0);
+ ContainerReplica unhealthyReplica =
+ createContainerReplica(container.containerID(), 0, IN_SERVICE,
+ ContainerReplicaProto.State.UNHEALTHY);
+ ContainerReplica mismatchedReplica =
+ createContainerReplica(container.containerID(), 0, IN_SERVICE,
+ ContainerReplicaProto.State.QUASI_CLOSED);
+ replicas.add(mismatchedReplica);
+ replicas.add(unhealthyReplica);
+
+ requestBuilder.setContainerReplicas(replicas)
+ .setContainerInfo(container);
+
+ ContainerHealthResult.OverReplicatedHealthResult
+ result = (ContainerHealthResult.OverReplicatedHealthResult)
+ healthCheck.checkHealth(requestBuilder.build());
+
+ assertEquals(ContainerHealthResult.HealthState.OVER_REPLICATED,
+ result.getHealthState());
+ assertEquals(1, result.getExcessRedundancy());
+ assertFalse(result.isReplicatedOkAfterPending());
+
+ // not safe for over replication because we don't have 3 matching replicas
+ assertFalse(result.isSafelyOverReplicated());
+
+ assertTrue(healthCheck.handle(requestBuilder.build()));
+ assertEquals(0, repQueue.underReplicatedQueueSize());
+ assertEquals(0, repQueue.overReplicatedQueueSize());
+ assertEquals(1, report.getStat(
Review Comment:
After some discussion, we decided it is OK to leave this code as it is, as
the over-replication should be corrected when the other replicas get closed,
unless there is a problem.
--
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]