HDFS-17309. RBF: Fix Router Safemode check condition error (#6390) Contributed by liuguanghua.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Reviewed-by: Simbarashe Dzinamarira <sdzinamarira@linkedin.com>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
LiuGuH 2024-01-05 18:36:28 +08:00 committed by GitHub
parent 661c784662
commit 2369f0cddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -169,7 +169,7 @@ public void periodicInvoke() {
} }
StateStoreService stateStore = router.getStateStore(); StateStoreService stateStore = router.getStateStore();
long cacheUpdateTime = stateStore.getCacheUpdateTime(); 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 // Always update to indicate our cache was updated
if (isCacheStale) { if (isCacheStale) {

View File

@ -132,6 +132,8 @@ public StateStoreService() {
// Caches to maintain // Caches to maintain
this.cachesToUpdateInternal = new ArrayList<>(); this.cachesToUpdateInternal = new ArrayList<>();
this.cachesToUpdateExternal = new ArrayList<>(); this.cachesToUpdateExternal = new ArrayList<>();
this.cacheLastUpdateTime = 0;
} }
/** /**