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 GitBox <gi...@apache.org> on 2022/02/24 09:21:30 UTC

[GitHub] [hadoop] hfutatzhanghb commented on pull request #3976: HDFS-16452. msync RPC should send to acitve namenode directly

hfutatzhanghb commented on pull request #3976:
URL: https://github.com/apache/hadoop/pull/3976#issuecomment-1049649888


   > 
   @xkrogen , very very thanks for replying me so carefully.  
   the code below is the constructor function of ObserverReadProxyProvider. yes, the failoverProxy is an instance of ConfiguredFailoverProxyProvider.
   
   ```java
     public ObserverReadProxyProvider(
         Configuration conf, URI uri, Class<T> xface, HAProxyFactory<T> factory) {
       this(conf, uri, xface, factory,
           new ConfiguredFailoverProxyProvider<>(conf, uri, xface, factory));
     }
   ```
   
   In our implementation, we compute active namenode proxy to perform msync. But it does not effect the subsequent read rpc request to contact with observer namenode, because the code logic is below:
   
   ```java
   if (observerReadEnabled && shouldFindObserver() && isRead(method)) {
           // our code choose active nn to perform msync
           if (!msynced) {
             initializeMsync();
           } else {
             autoMsyncIfNecessary();
           }
   
           // .....
           // code below will choose observer nn to perform read rpc
           for (int i = 0; i < nameNodeProxies.size(); i++) {
             NNProxyInfo<T> current = getCurrentProxy();
             HAServiceState currState = current.getCachedState();
             if (currState != HAServiceState.OBSERVER) {
               if (currState == HAServiceState.ACTIVE) {
                 activeCount++;
               } else if (currState == HAServiceState.STANDBY) {
                 standbyCount++;
               } else if (currState == null) {
                 unreachableCount++;
               }
               changeProxy(current);
               continue;
             }
           
             try {
               retVal = method.invoke(current.proxy, args);
               lastProxy = current;
               return retVal;
             } catch (InvocationTargetException ite) {
               
               // ...
             }
           }
         }
   ```
   
   as the code show above, if we enter the if condition statement,it proves that a read rpc request is invoked. first we confirm which namenode is active and use active namenode to perform msync.  After msync rpc,  we get observer namenode proxy from nameNodeProxies to perfom read rpc request.
   
   In actually, there is no need to send msync  to observer namenode and then failover, it is a waste of network.  


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