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

Improve choosing datanode storage for block placement

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.0, 3.0.0-alpha1
    • namenode
    • None
    • Reviewed

    Description

      This JIRA is to:
      Improve chooseing datanode storage for block placement:
      In BlockPlacementPolicyDefault (chooseLocalStorage, chooseRandom), we have following logic to choose datanode storage to place block.
      For given storage type, we iterate storages of the datanode. But for datanode, it only cares about the storage type. In the loop, we check according to Storage type and return the first storage if the storages of the type on the datanode fit in requirement. So we can remove the iteration of storages, and just need to do once to find a good storage of given type, it's efficient if the storages of the type on the datanode don't fit in requirement since we don't need to loop all storages and do the same check.
      Besides, no need to shuffle the storages, since we only need to check according to the storage type on the datanode once.
      This also improves the logic and make it more clear.

            if (excludedNodes.add(localMachine) // was not in the excluded list
                && isGoodDatanode(localDatanode, maxNodesPerRack, false,
                    results, avoidStaleNodes)) {
              for (Iterator<Map.Entry<StorageType, Integer>> iter = storageTypes
                  .entrySet().iterator(); iter.hasNext(); ) {
                Map.Entry<StorageType, Integer> entry = iter.next();
                for (DatanodeStorageInfo localStorage : DFSUtil.shuffle(
                    localDatanode.getStorageInfos())) {
                  StorageType type = entry.getKey();
                  if (addIfIsGoodTarget(localStorage, excludedNodes, blocksize,
                      results, type) >= 0) {
                    int num = entry.getValue();
                    ...
      

      (current logic above)

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            hitliuyi Yi Liu Assign to me
            hitliuyi Yi Liu
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment