HDFS-16676. DatanodeAdminManager$Monitor reports a node as invalid continuously (#4626)

Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com>
This commit is contained in:
Ashutosh Gupta 2022-08-17 19:25:09 +01:00 committed by GitHub
parent 86abeb401e
commit 5cc8c574d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,6 +201,7 @@ private void check() {
iterkey).iterator(); iterkey).iterator();
final List<DatanodeDescriptor> toRemove = new ArrayList<>(); final List<DatanodeDescriptor> toRemove = new ArrayList<>();
final List<DatanodeDescriptor> unhealthyDns = new ArrayList<>(); final List<DatanodeDescriptor> unhealthyDns = new ArrayList<>();
boolean isValidState = true;
while (it.hasNext() && !exceededNumBlocksPerCheck() && namesystem while (it.hasNext() && !exceededNumBlocksPerCheck() && namesystem
.isRunning()) { .isRunning()) {
@ -265,6 +266,7 @@ private void check() {
// to track maintenance expiration. // to track maintenance expiration.
dnAdmin.setInMaintenance(dn); dnAdmin.setInMaintenance(dn);
} else { } else {
isValidState = false;
Preconditions.checkState(false, Preconditions.checkState(false,
"Node %s is in an invalid state! " "Node %s is in an invalid state! "
+ "Invalid state: %s %s blocks are on this dn.", + "Invalid state: %s %s blocks are on this dn.",
@ -288,7 +290,11 @@ private void check() {
// an invalid state. // an invalid state.
LOG.warn("DatanodeAdminMonitor caught exception when processing node " LOG.warn("DatanodeAdminMonitor caught exception when processing node "
+ "{}.", dn, e); + "{}.", 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); toRemove.add(dn);
unhealthyDns.remove(dn); unhealthyDns.remove(dn);
} finally { } finally {