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

Íñigo Goiri commented on HDFS-15169:
------------------------------------

Thanks [~hexiaoqiao] for the unit test, it covers my concerns.
I'm thinking about refactoring the main code to:
{code}
/**
 * Get path location using path parameter of fsck request from client.
 */
private Set<String> getNameSpacesForPath(String[] paths) {
  if (paths == null || paths.length == 0) {
    return null;
  }
  String path = paths[0];
  PathLocation pathLocation =
      router.getSubclusterResolver().getDestinationForPath(path);
  return pathLocation.getNamespaces();
}

/**
 * Redirect the request to certain active downstream NameNode if resolve
 * target namespace otherwise redirect the requests to all active
 * downstream NameNodes.
 */
private List<MembershipState> getMembershipsForPath(
    final Set<String> nss, final List<MembershipState> memberships) {
  Set<String> nss = getNameSpacesForPath(paths);
  if (nss == null || nss.isEmpty()) {
    return memberships;
  }
  List<MembershipState> targetMemberships = new ArrayList<>();
  for (String ns : nss) {
    for (MembershipState ms : memberships) {
      if (ms.getState() == FederationNamenodeServiceState.ACTIVE
          && ns.equals(ms.getNameserviceId())) {
        targetMemberships.add(ms);
      }
    }
  }
  return targetMemberships;
}

public void fsck() {
  ...
  String[] paths = pmap.get("path");
  List<MembershipState> targetMemberships = getMembershipsForPath(
      paths, memberships);

  for (MembershipState nn : targetMemberships) {
...
}
{code}

> RBF: Router FSCK should consider the mount table
> ------------------------------------------------
>
>                 Key: HDFS-15169
>                 URL: https://issues.apache.org/jira/browse/HDFS-15169
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: rbf
>            Reporter: Akira Ajisaka
>            Assignee: Xiaoqiao He
>            Priority: Major
>         Attachments: HDFS-15169.001.patch, HDFS-15169.002.patch
>
>
> HDFS-13989 implemented FSCK to DFSRouter, however, it just redirects the 
> requests to all the active downstream NameNodes for now. The DFSRouter should 
> consider the mount table when redirecting the requests.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to