haiyang1987 opened a new pull request, #6369:
URL: https://github.com/apache/hadoop/pull/6369

   ### Description of PR
   https://issues.apache.org/jira/browse/HDFS-17297
   
   When call internalReleaseLease method:
   
   ```
   boolean internalReleaseLease(
   ...
   int minLocationsNum = 1;
   if (lastBlock.isStriped()) {
     minLocationsNum = ((BlockInfoStriped) lastBlock).getRealDataBlockNum();
   }
   
   if (uc.getNumExpectedLocations() < minLocationsNum &&
       lastBlock.getNumBytes() == 0) {
     // There is no datanode reported to this block.
     // may be client have crashed before writing data to pipeline.
     // This blocks doesn't need any recovery.
     // We can remove this block and close the file.
     pendingFile.removeLastBlock(lastBlock);
     finalizeINodeFileUnderConstruction(src, pendingFile,
         iip.getLatestSnapshotId(), false); 
   ...
   }
   ```
   if the condition `uc.getNumExpectedLocations() < minLocationsNum && 
lastBlock.getNumBytes() == 0` is met during the execution of UNDER_RECOVERY 
logic, the block is removed from the block list in the inode file and marked as 
deleted.
   However it is not removed from the BlocksMap, it may cause memory leak.
   
   Therefore it is necessary to remove the block from the BlocksMap at this 
point as well.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to