[ 
https://issues.apache.org/jira/browse/HDFS-16452?focusedWorklogId=724810&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-724810
 ]

ASF GitHub Bot logged work on HDFS-16452:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Feb/22 21:58
            Start Date: 10/Feb/22 21:58
    Worklog Time Spent: 10m 
      Work Description: ayushtkn commented on a change in pull request #3976:
URL: https://github.com/apache/hadoop/pull/3976#discussion_r804141267



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
##########
@@ -368,6 +368,21 @@ private boolean shouldFindObserver() {
     return true;
   }
 
+  private void confirmActiveToMsync() throws IOException {
+    ClientProtocol activeProxy = (ClientProtocol) getCurrentProxy().proxy;
+    for (int i = 0; i < nameNodeProxies.size(); i++) {
+      NNProxyInfo<T> current = getCurrentProxy();
+      HAServiceState currState = current.getCachedState();
+      if (currState == HAServiceState.ACTIVE) {
+        activeProxy = getProxyAsClientProtocol(current.proxy);
+        LOG.info("active proxy is choosed :{}", current);
+        break;
+      } else {
+        changeProxy(current);

Review comment:
       hmm, the current proxy in observer proxy provider in general should be 
pointing to Observer namenode, you seems to change  the current proxy itself to 
active here? What would happen to subsequent calls, will they go to active or 
the concurrent calls

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ObserverReadProxyProvider.java
##########
@@ -342,7 +342,7 @@ private synchronized void initializeMsync() throws 
IOException {
     if (msynced) {
       return; // No need for an msync
     }
-    getProxyAsClientProtocol(failoverProxy.getProxy().proxy).msync();

Review comment:
       what does failoverProxy.getProxy().proxy points to?
   the same logic seems to be used for invocation as well
   ```
         // Either all observers have failed, observer reads are disabled,
         // or this is a write request. In any case, forward the request to
         // the active NameNode.
         LOG.debug("Using failoverProxy to service {}", method.getName());
         ProxyInfo<T> activeProxy = failoverProxy.getProxy();
         try {
           retVal = method.invoke(activeProxy.proxy, args);
         } catch (InvocationTargetException e) {
           // This exception will be handled by higher layers
           throw e.getCause();
         }
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 724810)
    Time Spent: 0.5h  (was: 20m)

> msync RPC  should send to Acitve Namenode directly
> --------------------------------------------------
>
>                 Key: HDFS-16452
>                 URL: https://issues.apache.org/jira/browse/HDFS-16452
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namanode
>    Affects Versions: 3.3.1
>            Reporter: zhanghaobo
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In current ObserverReadProxyProvider implementation,   we use the following 
> code to  invoke msync RPC.
> {code:java}
> getProxyAsClientProtocol(failoverProxy.getProxy().proxy).msync(); {code}
> But msync RPC maybe send to Observer NameNode in this way, and then failover 
> to Active NameNode.   This can be avoid by applying this patch. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to