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

BlockPlacementPolicyDefault.chooseTargetInOrder Not Checking Return Value for NULL

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.2.0, 3.1.1, 3.0.4
    • Component/s: namenode
    • Labels:
      None

      Description

      BlockPlacementPolicyDefault.java
      protected Node chooseTargetInOrder(int numOfReplicas, 
                                       Node writer,
                                       final Set<Node> excludedNodes,
                                       final long blocksize,
                                       final int maxNodesPerRack,
                                       final List<DatanodeStorageInfo> results,
                                       final boolean avoidStaleNodes,
                                       final boolean newBlock,
                                       EnumMap<StorageType, Integer> storageTypes)
                                       throws NotEnoughReplicasException {
          final int numOfResults = results.size();
          if (numOfResults == 0) {
            writer = chooseLocalStorage(writer, excludedNodes, blocksize,
                maxNodesPerRack, results, avoidStaleNodes, storageTypes, true)
                .getDatanodeDescriptor();
            if (--numOfReplicas == 0) {
              return writer;
            }
          }
      ...
      

      The method chooseLocalStorage can return a null value but it's not being checked here and the method getDatanodeDescriptor() is immediately being called on the result. Please check for a null value first.

        Attachments

        1. HDFS-13155.02.patch
          1 kB
          Zsolt Venczel
        2. HDFS-13155.01.patch
          1 kB
          Zsolt Venczel

          Activity

            People

            • Assignee:
              zvenczel Zsolt Venczel
              Reporter:
              belugabehr BELUGA BEHR
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: