This is an automated email from the ASF dual-hosted git repository.

slfan1989 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2369f0cddbb5 HDFS-17309. RBF: Fix Router Safemode check condition 
error (#6390) Contributed by liuguanghua.
2369f0cddbb5 is described below

commit 2369f0cddbb5e2ce20882d819760a58deeb13583
Author: LiuGuH <444506...@qq.com>
AuthorDate: Fri Jan 5 18:36:28 2024 +0800

    HDFS-17309. RBF: Fix Router Safemode check condition error (#6390) 
Contributed by liuguanghua.
    
    Reviewed-by: Inigo Goiri <inigo...@apache.org>
    Reviewed-by: Simbarashe Dzinamarira <sdzinamar...@linkedin.com>
    Signed-off-by: Shilun Fan <slfan1...@apache.org>
---
 .../hadoop/hdfs/server/federation/router/RouterSafemodeService.java     | 2 +-
 .../apache/hadoop/hdfs/server/federation/store/StateStoreService.java   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterSafemodeService.java
 
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterSafemodeService.java
index 35ed85406528..c50f6dc469af 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterSafemodeService.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterSafemodeService.java
@@ -169,7 +169,7 @@ public class RouterSafemodeService extends PeriodicService {
     }
     StateStoreService stateStore = router.getStateStore();
     long cacheUpdateTime = stateStore.getCacheUpdateTime();
-    boolean isCacheStale = (now - cacheUpdateTime) > this.staleInterval;
+    boolean isCacheStale = (cacheUpdateTime == 0) || (now - cacheUpdateTime) > 
this.staleInterval;
 
     // Always update to indicate our cache was updated
     if (isCacheStale) {
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java
 
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java
index 74997e86be3d..b198d969bbc4 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/StateStoreService.java
@@ -132,6 +132,8 @@ public class StateStoreService extends CompositeService {
     // Caches to maintain
     this.cachesToUpdateInternal = new ArrayList<>();
     this.cachesToUpdateExternal = new ArrayList<>();
+
+    this.cacheLastUpdateTime = 0;
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to