This is an automated email from the ASF dual-hosted git repository. tasanuma 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 3aceec711b29 HDFS-17297. The NameNode should remove block from the BlocksMap if the block is marked as deleted (#6369) 3aceec711b29 is described below commit 3aceec711b291eaaa371f7fda9b00da2c737b860 Author: huhaiyang <huhaiyang...@126.com> AuthorDate: Thu Dec 28 21:13:16 2023 +0800 HDFS-17297. The NameNode should remove block from the BlocksMap if the block is marked as deleted (#6369) Reviewed-by: ZanderXu <zande...@apache.org> Signed-off-by: Takanobu Asanuma <tasan...@apache.org> --- .../java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index c14526b6a11b..277cc42222f5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -3815,7 +3815,10 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, // 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) { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org