smengcl commented on code in PR #6189:
URL: https://github.com/apache/ozone/pull/6189#discussion_r1483973646
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java:
##########
@@ -334,4 +343,46 @@ public void testSCMSafeModeDisabled() throws Exception {
cluster.restartStorageContainerManager(true);
assertFalse(scm.isInSafeMode());
}
+
+ @Test
+ public void testCreateRetryWhileSCMSafeMode() throws Exception {
+ // Test1: Test safe mode when there are no containers in system.
+ cluster.stop();
+
+ try {
+ cluster = builder.build();
+ } catch (IOException e) {
+ fail("Cluster startup failed.");
+ }
+
+ final String rootPath = String.format("%s://%s/",
+ OZONE_OFS_URI_SCHEME, conf.get(OZONE_OM_ADDRESS_KEY));
+ conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, rootPath);
+
+ try (FileSystem fs = FileSystem.get(conf)) {
+ assertTrue(((SafeMode)fs).setSafeMode(SafeModeAction.GET));
+
+ Thread t = new Thread(() -> {
+ try {
+ LOG.info("Sleep 10 seconds and then start DataNodes.");
+ Thread.sleep(10 * 1000);
Review Comment:
Generally we should avoid calling long `sleep()` like this.
Can we use `GenericTestUtils.waitFor()` with much shorter interval to check
the goal is reached before continuing?
--
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]