Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15014

RBF: WebHdfs chooseDatanode shouldn't call getDatanodeReport

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • rbf
    • None

    Description

      Currently the chooseDatanode call (which is shared by open, create, append and getFileChecksum) in RBF WebHDFS calls getDatanodeReport from ALL downstream namenodes:

        private DatanodeInfo chooseDatanode(final Router router,
            final String path, final HttpOpParam.Op op, final long openOffset,
            final String excludeDatanodes) throws IOException {
          // We need to get the DNs as a privileged user
          final RouterRpcServer rpcServer = getRPCServer(router);
          UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
          RouterRpcServer.setCurrentUser(loginUser);
      
          DatanodeInfo[] dns = null;
          try {
            dns = rpcServer.getDatanodeReport(DatanodeReportType.LIVE);
          } catch (IOException e) {
            LOG.error("Cannot get the datanodes from the RPC server", e);
          } finally {
            // Reset ugi to remote user for remaining operations.
            RouterRpcServer.resetCurrentUser();
          }
      
          HashSet<Node> excludes = new HashSet<Node>();
          if (excludeDatanodes != null) {
            Collection<String> collection =
                getTrimmedStringCollection(excludeDatanodes);
            for (DatanodeInfo dn : dns) {
              if (collection.contains(dn.getName())) {
                excludes.add(dn);
              }
            }
          }
      ...
      

      The getDatanodeReport is very expensive (particularly in a large cluster) as it need to lock the DatanodeManager which is also shared by calls such as processing heartbeats. Check HDFS-14366 for a similar issue.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              csun Chao Sun
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: