neils-dev commented on code in PR #4684:
URL: https://github.com/apache/ozone/pull/4684#discussion_r1191673777
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/health/TestClosingContainerHandler.java:
##########
@@ -210,6 +215,31 @@ public void
testClosingContainerStateIsUpdatedWhenThereAreNotReplicas() {
});
}
+ @Test
+ public void testEmptyContainerInClosingState() throws InterruptedException {
+ /*
+ * Empty Container in CLOSING state should be CLOSED after
+ * a timeout (ReplicationManager Interval * 5)
+ */
+ replicationManager.getConfig().setInterval(Duration.ofSeconds(1));
+ ContainerInfo containerInfo = ReplicationTestUtil.createContainerInfo(
+ RATIS_REPLICATION_CONFIG, 1, CLOSING);
+ Set<ContainerReplica> containerReplicas = new HashSet<>();
+ ReplicationManagerReport report = new ReplicationManagerReport();
+ ContainerCheckRequest request = new ContainerCheckRequest.Builder()
+ .setPendingOps(Collections.emptyList())
+ .setReport(report)
+ .setContainerInfo(containerInfo)
+ .setContainerReplicas(containerReplicas)
+ .build();
+
+ Thread.sleep(Duration.ofSeconds(5).toMillis());
Review Comment:
> Clock object where we can advance the time for the test instantly
Ditto. Sounds like a good change.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java:
##########
@@ -2235,4 +2248,30 @@ private void replicateAnyWithTopology(ContainerInfo
container,
container.getContainerID(), ex);
}
}
+
+ private void closeEmptyContainer(ContainerInfo containerInfo) {
Review Comment:
Nit: if looking to continued support for the `legacyReplicationManager` it
may be useful to add small unit test to `TestLegacyReplicationManager.java` to
handle `CLOSING` lifestate for container with no replicas and no keys.
--
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]