Skip to content

Commit

Permalink
HDFS-17358. EC: infinite lease recovery caused by the length of RWR e…
Browse files Browse the repository at this point in the history
…quals to zero.
  • Loading branch information
hfutatzhanghb committed Jan 29, 2024
1 parent 4046751 commit 8ef1574
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ protected void recover() throws IOException {

if (info != null &&
info.getGenerationStamp() >= block.getGenerationStamp() &&
info.getNumBytes() > 0) {
info.getNumBytes() >= 0) {
final BlockRecord existing = syncBlocks.get(blockId);
if (existing == null ||
info.getNumBytes() > existing.rInfo.getNumBytes()) {
Expand Down Expand Up @@ -474,6 +474,13 @@ protected void recover() throws IOException {
ExtendedBlock newBlock = new ExtendedBlock(bpid, block.getBlockId(),
safeLength, recoveryId);
DatanodeProtocolClientSideTranslatorPB nn = getActiveNamenodeForBP(bpid);
if (newBlock.getNumBytes() == 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;
}
nn.commitBlockSynchronization(block, newBlock.getGenerationStamp(),
newBlock.getNumBytes(), true, false, newLocs, newStorages);
}
Expand Down

0 comments on commit 8ef1574

Please sign in to comment.