HDFS-17297. The NameNode should remove block from the BlocksMap if the block is marked as deleted (#6369)

Reviewed-by: ZanderXu <zanderxu@apache.org>
Signed-off-by: Takanobu Asanuma <tasanuma@apache.org>
This commit is contained in:
huhaiyang 2023-12-28 21:13:16 +08:00 committed by GitHub
parent fc71dc3e94
commit 3aceec711b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3815,7 +3815,10 @@ boolean internalReleaseLease(Lease lease, String src, INodesInPath iip,
// 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);
BlockInfo lastBlockInfo = pendingFile.removeLastBlock(lastBlock);
if (lastBlockInfo != null) {
blockManager.removeBlock(lastBlockInfo);
}
finalizeINodeFileUnderConstruction(src, pendingFile,
iip.getLatestSnapshotId(), false);
if (uc.getNumExpectedLocations() == 0) {