haiyang1987 commented on PR #6509:
URL: https://github.com/apache/hadoop/pull/6509#issuecomment-1914526790

   > > Contributor
   > 
   > Hi, sir. IIUC, it is safe. The reason is as below, original code is :
   > 
   > ```java
   >       ExtendedBlock newBlock = new ExtendedBlock(bpid, block.getBlockId(),
   >           safeLength, recoveryId);
   >       DatanodeProtocolClientSideTranslatorPB nn = 
getActiveNamenodeForBP(bpid);
   > 
   >       nn.commitBlockSynchronization(block, newBlock.getGenerationStamp(),
   >           newBlock.getNumBytes(), true, false, newLocs, newStorages);
   > ```
   > 
   > We initialize an ExtendedBlock object named newBlock with safeLength 
equals to 0, then passing `newBlock.getNumBytes()` to method 
commitBlockSynchronization which means newlength.
   
   yeah,I mean  is it possible to determine if safeLength is 0, then directly 
call the logic of deleting this block?
   ```
   if (safeLength == 0) {
           nn.commitBlockSynchronization(block, newBlock.getGenerationStamp(),
               newBlock.getNumBytes(), true, true, newLocs, newStorages);
           LOG.info("After block recovery, the length of new block is 0. " +
               "Will remove this block: {} from file.", newBlock);
           return;
    }
   ```


-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to