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 "simbadzina (via GitHub)" <gi...@apache.org> on 2023/08/29 20:54:40 UTC

[GitHub] [hadoop] simbadzina commented on a diff in pull request #5990: HDFS-17166. RBF: Throwing NoNamenodesAvailableException for a long time, when failover

simbadzina commented on code in PR #5990:
URL: https://github.com/apache/hadoop/pull/5990#discussion_r1309343672


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MembershipNamenodeResolver.java:
##########
@@ -478,4 +478,40 @@ private List<MembershipState> getRecentRegistrationForQuery(
   public void setRouterId(String router) {
     this.routerId = router;
   }
+
+  /**
+   * Rotate cache, make the current namenode have the lowest priority,
+   * to ensure that the current namenode will not be accessed first next time.
+   *
+   * @param nsId name service id
+   * @param namenode namenode contexts
+   */
+  @Override
+  public synchronized void rotateCache(String nsId, FederationNamenodeContext namenode) {
+    cacheNS.compute(Pair.of(nsId, false), (ns, namenodeContexts) -> {

Review Comment:
   I think we need to refresh the cache for the key `Pair.of(nsId, true)` at times.
   
   You can extend the signature of rotateCache to 
   ```java
   public synchronized void rotateCache(String nsId, FederationNamenodeContext namenode, boolean listObserversFirst)
   ```
   
   And then call it with
   ```java
   this.namenodeResolver.rotateCache(nsId, namenode, shouldUseObserver);
   ```
   



-- 
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