From 5cc8c574d110fc68fa5ab71fb11ede3fa0c25e5e Mon Sep 17 00:00:00 2001 From: Ashutosh Gupta Date: Wed, 17 Aug 2022 19:25:09 +0100 Subject: [PATCH] HDFS-16676. DatanodeAdminManager$Monitor reports a node as invalid continuously (#4626) Co-authored-by: Ashutosh Gupta --- .../blockmanagement/DatanodeAdminDefaultMonitor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminDefaultMonitor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminDefaultMonitor.java index 3ff360466c..e642dfba35 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminDefaultMonitor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeAdminDefaultMonitor.java @@ -201,6 +201,7 @@ private void check() { iterkey).iterator(); final List toRemove = new ArrayList<>(); final List unhealthyDns = new ArrayList<>(); + boolean isValidState = true; while (it.hasNext() && !exceededNumBlocksPerCheck() && namesystem .isRunning()) { @@ -265,6 +266,7 @@ private void check() { // to track maintenance expiration. dnAdmin.setInMaintenance(dn); } else { + isValidState = false; Preconditions.checkState(false, "Node %s is in an invalid state! " + "Invalid state: %s %s blocks are on this dn.", @@ -288,7 +290,11 @@ private void check() { // an invalid state. LOG.warn("DatanodeAdminMonitor caught exception when processing node " + "{}.", dn, e); - getPendingNodes().add(dn); + if(isValidState){ + getPendingNodes().add(dn); + } else { + LOG.warn("Ignoring the node {} which is in invalid state", dn); + } toRemove.add(dn); unhealthyDns.remove(dn); } finally {