You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "haiyang1987 (via GitHub)" <gi...@apache.org> on 2023/07/26 08:18:07 UTC

[GitHub] [hadoop] haiyang1987 commented on a diff in pull request #5876: HDFS-17116. Reset startupTime and enterSafeModeTime if check time interval is negative during router safe mode exit check

haiyang1987 commented on code in PR #5876:
URL: https://github.com/apache/hadoop/pull/5876#discussion_r1274548707


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterSafemode.java:
##########
@@ -128,7 +129,6 @@ public void testRouterExitSafemode()
 
     assertTrue(router.getSafemodeService().isInSafeMode());
     verifyRouter(RouterServiceState.SAFEMODE);
-

Review Comment:
   Thanks @slfan1989 help me reivew it, i wll update it later.



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterSafemode.java:
##########
@@ -141,6 +141,31 @@ public void testRouterExitSafemode()
     verifyRouter(RouterServiceState.RUNNING);
   }
 
+  @Test
+  public void testRouterExitSafemodeResetUpTime()
+      throws InterruptedException, IllegalStateException, IOException {
+
+    Calendar calendar = Calendar.getInstance();
+    // Get the future times, add one day to the current date.
+    calendar.add(Calendar.DAY_OF_MONTH, 1);
+    long timestampAfterOneDay = calendar.getTimeInMillis();
+    router.getSafemodeService().setStartupTime(timestampAfterOneDay);
+
+    assertTrue(router.getSafemodeService().isInSafeMode());
+    verifyRouter(RouterServiceState.SAFEMODE);
+
+    // Wait for initial time in milliseconds
+    long interval =
+        conf.getTimeDuration(DFS_ROUTER_SAFEMODE_EXTENSION,
+            TimeUnit.SECONDS.toMillis(2), TimeUnit.MILLISECONDS) +
+            conf.getTimeDuration(DFS_ROUTER_CACHE_TIME_TO_LIVE_MS,
+                TimeUnit.SECONDS.toMillis(1), TimeUnit.MILLISECONDS) * 2;
+    Thread.sleep(interval);

Review Comment:
   i wll update it later.



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterSafemode.java:
##########
@@ -141,6 +141,31 @@ public void testRouterExitSafemode()
     verifyRouter(RouterServiceState.RUNNING);
   }
 
+  @Test
+  public void testRouterExitSafemodeResetUpTime()
+      throws InterruptedException, IllegalStateException, IOException {
+
+    Calendar calendar = Calendar.getInstance();
+    // Get the future times, add one day to the current date.
+    calendar.add(Calendar.DAY_OF_MONTH, 1);
+    long timestampAfterOneDay = calendar.getTimeInMillis();
+    router.getSafemodeService().setStartupTime(timestampAfterOneDay);
+
+    assertTrue(router.getSafemodeService().isInSafeMode());
+    verifyRouter(RouterServiceState.SAFEMODE);
+
+    // Wait for initial time in milliseconds
+    long interval =

Review Comment:
   i wll update it later.



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterSafemode.java:
##########
@@ -141,6 +141,31 @@ public void testRouterExitSafemode()
     verifyRouter(RouterServiceState.RUNNING);
   }
 
+  @Test
+  public void testRouterExitSafemodeResetUpTime()
+      throws InterruptedException, IllegalStateException, IOException {
+
+    Calendar calendar = Calendar.getInstance();
+    // Get the future times, add one day to the current date.
+    calendar.add(Calendar.DAY_OF_MONTH, 1);
+    long timestampAfterOneDay = calendar.getTimeInMillis();
+    router.getSafemodeService().setStartupTime(timestampAfterOneDay);
+
+    assertTrue(router.getSafemodeService().isInSafeMode());
+    verifyRouter(RouterServiceState.SAFEMODE);
+
+    // Wait for initial time in milliseconds

Review Comment:
   Thanks @hfutatzhanghb help me reivew it, i wll update it later.



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org