HDFS-17275: judge whether the block has been deleted in the block report (#6335). Contributed by lei w.

Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Signed-off-by: Shuyan Zhang <zhangshuyan@apache.org>
This commit is contained in:
Lei313 2023-12-26 18:25:02 +08:00 committed by GitHub
parent 7e2ebfc17e
commit 773dd7cc85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3425,7 +3425,7 @@ public class BlockManager implements BlockStatsMXBean {
// find block by blockId
BlockInfo storedBlock = getStoredBlock(block);
if(storedBlock == null) {
if (storedBlock == null) {
// If blocksMap does not contain reported block id,
// The replica should be removed from Datanode, and set NumBytes to BlockCommand.No_ACK to
// avoid useless report to NameNode from Datanode when complete to process it.
@ -3439,8 +3439,8 @@ public class BlockManager implements BlockStatsMXBean {
// Block is on the NN
LOG.debug("In memory blockUCState = {}", ucState);
// Ignore replicas already scheduled to be removed from the DN
if(invalidateBlocks.contains(dn, block)) {
// Ignore replicas already scheduled to be removed from the DN or had been deleted
if (invalidateBlocks.contains(dn, block) || storedBlock.isDeleted()) {
return storedBlock;
}