[ https://issues.apache.org/jira/browse/HDFS-17514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17846015#comment-17846015 ]
ASF GitHub Bot commented on HDFS-17514: --------------------------------------- simbadzina commented on code in PR #6804: URL: https://github.com/apache/hadoop/pull/6804#discussion_r1598782895 ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/PoolAlignmentContext.java: ########## @@ -64,7 +64,11 @@ public void updateResponseState(RpcHeaderProtos.RpcResponseHeaderProto.Builder h */ @Override public void receiveResponseState(RpcHeaderProtos.RpcResponseHeaderProto header) { - sharedGlobalStateId.accumulate(header.getStateId()); + if (header.getStateId() == 0 && sharedGlobalStateId.get() > 0) { + sharedGlobalStateId.reset(); + } else { + sharedGlobalStateId.accumulate(header.getStateId()); Review Comment: The sharedGlobalStateID is created as [`new LongAccumulator(Math::max, Long.MIN_VALUE)`](https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterStateIdContext.java#L111) So accumulate either keeps the current value or moves it forward. > RBF: Routers keep using cached stateID even when active NN returns unset > header > ------------------------------------------------------------------------------- > > Key: HDFS-17514 > URL: https://issues.apache.org/jira/browse/HDFS-17514 > Project: Hadoop HDFS > Issue Type: Improvement > Components: rbf > Reporter: Simbarashe Dzinamarira > Assignee: Simbarashe Dzinamarira > Priority: Minor > Labels: pull-request-available > > When a namenode that had "dfs.namenode.state.context.enabled" set to true is > restarted with the configuration set to false, routers will keep using a > previously cached state ID. > Without RBF > * clients that fetched the old stateID could have stale reads even after > msyncing > * new clients will go to the active. > With RBF > * client that fetched the old stateID could have stale reads like above. > * New clients will also fetch the stale stateID and potentially have stale > reads > New clients that are created after the restart should not fetch the stale > state ID. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org