HDFS-16391. Avoid evaluation of LOG.debug statement in NameNodeHeartbeatService (#3820)

(cherry picked from commit 8d251bd629)
This commit is contained in:
wangzhaohui 2021-12-21 19:28:57 +08:00 committed by S O'Donnell
parent a4496a0187
commit cc7b7e174c
1 changed files with 8 additions and 4 deletions

View File

@ -221,12 +221,16 @@ public class NamenodeHeartbeatService extends PeriodicService {
LOG.error("Namenode is not operational: {}", getNamenodeDesc());
} else if (report.haStateValid()) {
// block and HA status available
LOG.debug("Received service state: {} from HA namenode: {}",
report.getState(), getNamenodeDesc());
if (LOG.isDebugEnabled()) {
LOG.debug("Received service state: {} from HA namenode: {}",
report.getState(), getNamenodeDesc());
}
} else if (localTarget == null) {
// block info available, HA status not expected
LOG.debug(
"Reporting non-HA namenode as operational: " + getNamenodeDesc());
if (LOG.isDebugEnabled()) {
LOG.debug(
"Reporting non-HA namenode as operational: {}", getNamenodeDesc());
}
} else {
// block info available, HA status should be available, but was not
// fetched do nothing and let the current state stand