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

GAO Rui updated HDFS-10710:
---------------------------
    Description: 
In BlockManager#rescanPostponedMisreplicatedBlocks(), start and end block 
counts should be get with the protect with lock. Or, log records like "-1 
blocks are removed" which indicate minus blocks are removed could be generated. 

For example, following scenario:
1. thread1 run {{long startPostponedMisReplicatedBlocksCount = 
getPostponedMisreplicatedBlocksCount();}} currently  
startPostponedMisReplicatedBlocksCount get the value 20.
2. before thread1 run {{namesystem.writeLock();}} , thread2 increment 
postponedMisreplicatedBlocksCount by 1, so postponedMisreplicatedBlocksCount is 
21 now.
3. thread1 end the iteration, but no postponed block is removed, so after run 
{{long endPostponedMisReplicatedBlocksCount = 
getPostponedMisreplicatedBlocksCount();}}, endPostponedMisReplicatedBlocksCount 
get the value of 21.
4. thread 1 generate the log:
{noformat}
      LOG.info("Rescan of postponedMisreplicatedBlocks completed in " +
          (Time.monotonicNow() - startTimeRescanPostponedMisReplicatedBlocks) +
          " msecs. " + endPostponedMisReplicatedBlocksCount +
          " blocks are left. " + (startPostponedMisReplicatedBlocksCount -
          endPostponedMisReplicatedBlocksCount) + " blocks are removed.");
{noformat}
Then, we'll get the log record like "-1 blocks are removed."

  was:
In BlockManager#rescanPostponedMisreplicatedBlocks(), start and end block 
counts should be get with the protect with lock. Or, log records like "-1 
blocks are removed" which indicate minus blocks are removed could be generated. 

For example, following scenario:
1. thread1 run {{long startPostponedMisReplicatedBlocksCount = 
getPostponedMisreplicatedBlocksCount();}} currently  
startPostponedMisReplicatedBlocksCount get the value 20.
2. before thread1 run {{namesystem.writeLock();}} , thread2 increment 
postponedMisreplicatedBlocksCount by 1, so postponedMisreplicatedBlocksCount is 
21 now.
3. thread1 end the iteration, but no postponed block is removed, so after run 
{{long endPostponedMisReplicatedBlocksCount = 
getPostponedMisreplicatedBlocksCount();}}, endPostponedMisReplicatedBlocksCount 
get the value of 21.
4. thread 1 generate the log:
{code}
LOG.info("Rescan of postponedMisreplicatedBlocks completed in " +
(Time.monotonicNow() - startTimeRescanPostponedMisReplicatedBlocks) +
" msecs. " + endPostponedMisReplicatedBlocksCount +
" blocks are left. " + (startPostponedMisReplicatedBlocksCount -
endPostponedMisReplicatedBlocksCount) + " blocks are removed.");
{code}
Then, we'll get the log record like "-1 blocks are removed."


> In BlockManager#rescanPostponedMisreplicatedBlocks(), start and end block 
> counts should be get with the protect with lock
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-10710
>                 URL: https://issues.apache.org/jira/browse/HDFS-10710
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>            Reporter: GAO Rui
>            Assignee: GAO Rui
>
> In BlockManager#rescanPostponedMisreplicatedBlocks(), start and end block 
> counts should be get with the protect with lock. Or, log records like "-1 
> blocks are removed" which indicate minus blocks are removed could be 
> generated. 
> For example, following scenario:
> 1. thread1 run {{long startPostponedMisReplicatedBlocksCount = 
> getPostponedMisreplicatedBlocksCount();}} currently  
> startPostponedMisReplicatedBlocksCount get the value 20.
> 2. before thread1 run {{namesystem.writeLock();}} , thread2 increment 
> postponedMisreplicatedBlocksCount by 1, so postponedMisreplicatedBlocksCount 
> is 21 now.
> 3. thread1 end the iteration, but no postponed block is removed, so after run 
> {{long endPostponedMisReplicatedBlocksCount = 
> getPostponedMisreplicatedBlocksCount();}}, 
> endPostponedMisReplicatedBlocksCount get the value of 21.
> 4. thread 1 generate the log:
> {noformat}
>       LOG.info("Rescan of postponedMisreplicatedBlocks completed in " +
>           (Time.monotonicNow() - startTimeRescanPostponedMisReplicatedBlocks) 
> +
>           " msecs. " + endPostponedMisReplicatedBlocksCount +
>           " blocks are left. " + (startPostponedMisReplicatedBlocksCount -
>           endPostponedMisReplicatedBlocksCount) + " blocks are removed.");
> {noformat}
> Then, we'll get the log record like "-1 blocks are removed."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to