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

BlockReconstructionWork should resetTargets() before BlockManager#validateReconstructionWork return false

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      BlockReconstructionWork should resetTargets() before BlockManager#validateReconstructionWork return false

      the related code is in BlockManager.java

      // code placeholder
      private boolean validateReconstructionWork(BlockReconstructionWork rw) {
        BlockInfo block = rw.getBlock();
        int priority = rw.getPriority();
        ...
        if (block.isDeleted() || !block.isCompleteOrCommitted()) {
          neededReconstruction.remove(block, priority);
          rw.resetTargets();
          return false;
        }
      
        // do not schedule more if enough replicas is already pending
        ...
        if (hasEnoughEffectiveReplicas(block, numReplicas, pendingNum)) {
          neededReconstruction.remove(block, priority);
          rw.resetTargets();
          blockLog.debug("BLOCK* Removing {} from neededReconstruction as" +
              " it has enough replicas", block);
          return false;
        }
      
        DatanodeStorageInfo[] targets = rw.getTargets();
        BlockPlacementStatus placementStatus = getBlockPlacementStatus(block);
        if ((numReplicas.liveReplicas() >= requiredRedundancy) &&
            (!placementStatus.isPlacementPolicySatisfied())) {
          BlockPlacementStatus newPlacementStatus =
              getBlockPlacementStatus(block, targets);
          if (!newPlacementStatus.isPlacementPolicySatisfied() &&
              (newPlacementStatus.getAdditionalReplicasRequired() >=
                  placementStatus.getAdditionalReplicasRequired())) {
            ...
            //Here to add rw.resetTargets();
            return false;
          }
        
          rw.setNotEnoughRack();
        }
      
        ...
        return true;
      }
      

       

      Attachments

        Issue Links

          Activity

            People

              haiyang Hu Haiyang Hu
              haiyang Hu Haiyang Hu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m