This is an automated email from the ASF dual-hosted git repository.

zhangshuyan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 773dd7cc85d3 HDFS-17275: judge whether the block has been deleted in 
the block report (#6335). Contributed by lei w.
773dd7cc85d3 is described below

commit 773dd7cc85d30bebb42d2f6f59e5e307df332f59
Author: Lei313 <47049042+thinker...@users.noreply.github.com>
AuthorDate: Tue Dec 26 18:25:02 2023 +0800

    HDFS-17275: judge whether the block has been deleted in the block report 
(#6335). Contributed by lei w.
    
    Reviewed-by: He Xiaoqiao <hexiaoq...@apache.org>
    Signed-off-by: Shuyan Zhang <zhangshu...@apache.org>
---
 .../org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
index 76efb353004d..56c86482bd17 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
@@ -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;
     }
 


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

Reply via email to