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

Vinayakumar B commented on HDFS-13443:
--------------------------------------

Hi [~arshad.mohammad], thanks for much required patch. Please find some 
comments here.

1. Refresh() should actually refresh MountTableResolver for user operations, 
otherwise users will continue to get exceptions. 
{{MountTableResolver#loadCache()}} internally refreshes MountTable entries as 
well.
   {{RouterAdminServer#refreshMountTableEntries()}} can be implemented as below 
to refresh MountTableResolver directly. and skip MountTableStoreImpl 
implementation, as it never be used.
{code:title=RouterAdminServer.java}
  @Override
  public RefreshMountTableEntriesResponse refreshMountTableEntries(
    RefreshMountTableEntriesRequest request) throws IOException {
    boolean result = getRouter().getStateStore()
      .loadCache(MountTableResolver.class, true);
    RefreshMountTableEntriesResponse response = RefreshMountTableEntriesResponse
      .newInstance();
    response.setResult(result);
    return response;
  }
{code}

2. There is no need of Two separate threads to call local and remote. Both can 
be handled in same Class (i.e.
 MountTableRefreshThread ) as below.
   i. Current patch passes 'MountTableStore' reference to LocalRefresh thread 
and 'RouterRpcClient' reference to Remote refresh thread. Instead pass 
'MountTableManager' reference to a same thread.
      a. In case of Local call, pass RouterAdminServer reference as 
MountTableManager
      b. In case of remote pass client.getMountTableManager() which is proxy to 
Remote Admin's MountTableManager;


{code:title=MountTableRefreshThread.java}
  public MountTableRefreshThread(MountTableManager client, String adminAddress) 
{
    this.client = client;
    this.adminAddress = adminAddress;
    setName("MountTableRefresh_" + adminAddress);
    setDaemon(true);
  }
{code}

{code:title=MountTableRefreshService#refresh}
   MountTableManager mountTableManager;
   if (isLocalAdmin(adminAddress)) {
     mountTableManager = router.getAdminServer();
   } else {
     mountTableManager = client.getMountTableManager();
   }
   refreshThreads.add(new MountTableRefreshThread(mountTableManager,
     adminAddress));
{code}

> RBF: Update mount table cache immediately after changing (add/update/remove) 
> mount table entries.
> -------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-13443
>                 URL: https://issues.apache.org/jira/browse/HDFS-13443
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: fs
>            Reporter: Mohammad Arshad
>            Assignee: Mohammad Arshad
>            Priority: Major
>              Labels: RBF
>         Attachments: HDFS-13443-branch-2.001.patch, 
> HDFS-13443-branch-2.002.patch, HDFS-13443.001.patch, HDFS-13443.002.patch, 
> HDFS-13443.003.patch, HDFS-13443.004.patch, HDFS-13443.005.patch, 
> HDFS-13443.006.patch, HDFS-13443.007.patch, HDFS-13443.008.patch, 
> HDFS-13443.009.patch
>
>
> Currently mount table cache is updated periodically, by default cache is 
> updated every minute. After change in mount table, user operations may still 
> use old mount table. This is bit wrong.
> To update mount table cache, maybe we can do following
>  * *Add refresh API in MountTableManager which will update mount table cache.*
>  * *When there is a change in mount table entries, router admin server can 
> update its cache and ask other routers to update their cache*. For example if 
> there are three routers R1,R2,R3 in a cluster then add mount table entry API, 
> at admin server side, will perform following sequence of action
>  ## user submit add mount table entry request on R1
>  ## R1 adds the mount table entry in state store
>  ## R1 call refresh API on R2
>  ## R1 calls refresh API on R3
>  ## R1 directly freshest its cache
>  ## Add mount table entry response send back to user.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to