[ 
https://issues.apache.org/jira/browse/HDFS-17438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17845730#comment-17845730
 ] 

ASF GitHub Bot commented on HDFS-17438:
---------------------------------------

goiri commented on code in PR #6655:
URL: https://github.com/apache/hadoop/pull/6655#discussion_r1597672487


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java:
##########
@@ -404,6 +404,28 @@ public static void waitFor(final Supplier<Boolean> check,
     }
   }
 
+  /**
+   * Wait at least {@code atLeastWaitForMillis} from start to end of the test.
+   *
+   * @param check the test to perform.
+   * @param atLeastWaitForMillis the minimum waiting time from the beginning
+   * to the end of the test.
+   * @throws InterruptedException if the method is interrupted while waiting.
+   */
+  public static <T> T atLeastWaitFor(final Supplier<T> check,
+      long atLeastWaitForMillis) throws InterruptedException {
+    if (atLeastWaitForMillis < 0) {
+      atLeastWaitForMillis = 0;
+    }
+    long st = Time.monotonicNow();
+    T result = check.get();

Review Comment:
   I don't think you are waiting at least, you are getting the value and then 
waiting.
   Either change the method name to execute and wait or actually wait after the 
sleep.





> RBF: The newest STANDBY and UNAVAILABLE nn should be the lowest priority.
> -------------------------------------------------------------------------
>
>                 Key: HDFS-17438
>                 URL: https://issues.apache.org/jira/browse/HDFS-17438
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Jian Zhang
>            Assignee: Jian Zhang
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HDFS-17438.001.patch
>
>
> At present, when the status of all namenodes in an ns in the router is the 
> same, the namenode which is the newest reported will be placed at the top of 
> the cache. when the client accesses the ns through the router, it will first 
> access the namenode.
> If multiple namenodes in this route are in an active state, or if there are 
> namenodes with multiple observer states, the existing logic is not a problem, 
> because the newest reported active or observer state namenode have a higher 
> probability of being true active or observer compared to the namenode that 
> reported active or observer state a long time ago.
> Similarly, the newest reported namenode with a status of standby or 
> unavailable has a higher probability of being a standby or unavailable 
> namenode compared to the namenode reported with a status of standby or 
> unavailable a long time ago. Therefore, the newest nn reported as standby or 
> unavailable status should have a lower priority for access, the oldest nn 
> reported as standby or unavailable status should have a higher priority for 
> access.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to