[ 
https://issues.apache.org/jira/browse/HDFS-15877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shilun Fan updated HDFS-15877:
------------------------------
          Component/s: block placement
         Hadoop Flags: Reviewed
     Target Version/s: 3.4.0
    Affects Version/s: 3.4.0

> BlockReconstructionWork should resetTargets() before 
> BlockManager#validateReconstructionWork return false
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-15877
>                 URL: https://issues.apache.org/jira/browse/HDFS-15877
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: block placement
>    Affects Versions: 3.4.0
>            Reporter: Haiyang Hu
>            Assignee: Haiyang Hu
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> BlockReconstructionWork should resetTargets() before 
> BlockManager#validateReconstructionWork return false
> the related code is in BlockManager.java
> {code: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;
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to