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

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

ZanderXu commented on PR #5123:
URL: https://github.com/apache/hadoop/pull/5123#issuecomment-1312352584

   @tomscut Sir, thanks for your review.
   
   >  Class 
org.apache.hadoop.hdfs.federation.protocol.proto.HdfsServerFederationProtos$RouterFederatedStateProto
 defines non-transient non-serializable instance field namespaceStateIds_
   
   I just renamed FederationProtocol.proto from hadoop-hdfs-rbf to 
hadoop-hdfs-client, and didn't modify any content.
   
   > 
org.apache.hadoop.hdfs.ClientGSIContext.mergeRouterFederatedState(ByteString) 
makes inefficient use of keySet iterator instead of entrySet iterator
   
   I think this check is imprecise, because the key will be used. The related 
code as bellows:
   ```
   for (String ns : remoteMapping.keySet()) {
         // Warning here.
         long remoteValue = remoteMapping.get(ns);
         long localValue = localMapping.getOrDefault(ns, 0L);
         localMapping.put(ns, Math.max(remoteValue, localValue));
    }
   ```
   Do you have some good suggestions?
   
   




> [RBF SBN] ClientGSIContext should merge RouterFederatedStates to get the max 
> state id for each namespace
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-16837
>                 URL: https://issues.apache.org/jira/browse/HDFS-16837
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Major
>              Labels: pull-request-available
>
> ClientGSIContext should merge local and remote RouterFederatedState to get 
> the max state id for each namespace.
> And the related code as bellows:
> {code:java}
> @Override
> public synchronized void receiveResponseState(RpcResponseHeaderProto header) {
>   if (header.hasRouterFederatedState()) {
>     // BUG here
>     routerFederatedState = header.getRouterFederatedState();
>   } else {
>     lastSeenStateId.accumulate(header.getStateId());
>   }
> } {code}



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