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

BlockPlacementPolicyDefault choose favoredNodes in turn which may cause imbalance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-alpha1
    • None
    • None
    • None

    Description

      if client transfer favoredNodes when it writes files into hdfs,chooseTarget in BlockPlacementPolicyDefault prior chooseTarget in turn:

      DatanodeStorageInfo[] chooseTarget(String src,
      int numOfReplicas,
      Node writer,
      Set<Node> excludedNodes,
      long blocksize,
      List<DatanodeDescriptor> favoredNodes,
      BlockStoragePolicy storagePolicy) {
      try {
      ...

      for (int i = 0; i < favoredNodes.size() && results.size() < numOfReplicas; i++) {
      DatanodeDescriptor favoredNode = favoredNodes.get;
      // Choose a single node which is local to favoredNode.
      // 'results' is updated within chooseLocalNode
      final DatanodeStorageInfo target = chooseLocalStorage(favoredNode,
      favoriteAndExcludedNodes, blocksize, maxNodesPerRack,
      results, avoidStaleNodes, storageTypes, false);
      ...

      why not shuffle it here? Make block more balanced, save the cost balancer will pay and make cluster more stable.

      for (DatanodeDescriptor favoredNode : DFSUtil.shuffle(favoredNodes.toArray(new DatanodeDescriptor[favoredNodes.size()])))

      Attachments

        1. HDFS-11104.patch
          7 kB
          Doris Gu

        Issue Links

          Activity

            People

              ajithshetty Ajith S
              doris Doris Gu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: