From 55fc2d6485702a99c6d4bb261a720d1f0498af2b Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Mon, 11 Dec 2017 16:42:25 -0800 Subject: [PATCH] HDFS-12891. Do not invalidate blocks if toInvalidate is empty. Contributed by Zsolt Venczel. --- .../hdfs/server/blockmanagement/InvalidateBlocks.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java index 75561caabac..ff68c020f31 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java @@ -293,10 +293,12 @@ class InvalidateBlocks { getBlocksToInvalidateByLimit(nodeToECBlocks.get(dn), toInvalidate, numECBlocks, remainingLimit); } - if (toInvalidate.size() > 0 && getBlockSetsSize(dn) == 0) { - remove(dn); + if (toInvalidate.size() > 0) { + if (getBlockSetsSize(dn) == 0) { + remove(dn); + } + dn.addBlocksToBeInvalidated(toInvalidate); } - dn.addBlocksToBeInvalidated(toInvalidate); return toInvalidate; }