From cc6b545365e6aebf4ddbb2e3235709c42c22c92f Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Sat, 4 Sep 2021 16:20:08 +0530 Subject: [PATCH] HDFS-16199. Resolve log placeholders in NamenodeBeanMetrics (#3362). Contributed by Viraj Jasani. Signed-off-by: Ayush Saxena --- .../metrics/NamenodeBeanMetrics.java | 68 ++++++++----------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java index 0e6e12a0d3..6a6b3da0b5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/metrics/NamenodeBeanMetrics.java @@ -195,7 +195,7 @@ public long getUsed() { try { return getRBFMetrics().getUsedCapacity(); } catch (IOException e) { - LOG.debug("Failed to get the used capacity", e.getMessage()); + LOG.debug("Failed to get the used capacity", e); } return 0; } @@ -205,7 +205,7 @@ public long getFree() { try { return getRBFMetrics().getRemainingCapacity(); } catch (IOException e) { - LOG.debug("Failed to get remaining capacity", e.getMessage()); + LOG.debug("Failed to get remaining capacity", e); } return 0; } @@ -215,7 +215,7 @@ public long getTotal() { try { return getRBFMetrics().getTotalCapacity(); } catch (IOException e) { - LOG.debug("Failed to Get total capacity", e.getMessage()); + LOG.debug("Failed to Get total capacity", e); } return 0; } @@ -225,7 +225,7 @@ public long getProvidedCapacity() { try { return getRBFMetrics().getProvidedSpace(); } catch (IOException e) { - LOG.debug("Failed to get provided capacity", e.getMessage()); + LOG.debug("Failed to get provided capacity", e); } return 0; } @@ -292,7 +292,7 @@ public long getTotalBlocks() { try { return getRBFMetrics().getNumBlocks(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks", e.getMessage()); + LOG.debug("Failed to get number of blocks", e); } return 0; } @@ -302,7 +302,7 @@ public long getNumberOfMissingBlocks() { try { return getRBFMetrics().getNumOfMissingBlocks(); } catch (IOException e) { - LOG.debug("Failed to get number of missing blocks", e.getMessage()); + LOG.debug("Failed to get number of missing blocks", e); } return 0; } @@ -313,8 +313,7 @@ public long getPendingReplicationBlocks() { try { return getRBFMetrics().getNumOfBlocksPendingReplication(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks pending replica", - e.getMessage()); + LOG.debug("Failed to get number of blocks pending replica", e); } return 0; } @@ -324,8 +323,7 @@ public long getPendingReconstructionBlocks() { try { return getRBFMetrics().getNumOfBlocksPendingReplication(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks pending replica", - e.getMessage()); + LOG.debug("Failed to get number of blocks pending replica", e); } return 0; } @@ -336,8 +334,7 @@ public long getUnderReplicatedBlocks() { try { return getRBFMetrics().getNumOfBlocksUnderReplicated(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks under replicated", - e.getMessage()); + LOG.debug("Failed to get number of blocks under replicated", e); } return 0; } @@ -347,8 +344,7 @@ public long getLowRedundancyBlocks() { try { return getRBFMetrics().getNumOfBlocksUnderReplicated(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks under replicated", - e.getMessage()); + LOG.debug("Failed to get number of blocks under replicated", e); } return 0; } @@ -358,8 +354,7 @@ public long getPendingDeletionBlocks() { try { return getRBFMetrics().getNumOfBlocksPendingDeletion(); } catch (IOException e) { - LOG.debug("Failed to get number of blocks pending deletion", - e.getMessage()); + LOG.debug("Failed to get number of blocks pending deletion", e); } return 0; } @@ -369,8 +364,7 @@ public long getScheduledReplicationBlocks() { try { return getRBFMetrics().getScheduledReplicationBlocks(); } catch (IOException e) { - LOG.debug("Failed to get number of scheduled replication blocks.", - e.getMessage()); + LOG.debug("Failed to get number of scheduled replication blocks", e); } return 0; } @@ -381,7 +375,7 @@ public long getNumberOfMissingBlocksWithReplicationFactorOne() { return getRBFMetrics().getNumberOfMissingBlocksWithReplicationFactorOne(); } catch (IOException e) { LOG.debug("Failed to get number of missing blocks with replication " - + "factor one.", e.getMessage()); + + "factor one.", e); } return 0; } @@ -392,7 +386,7 @@ public long getHighestPriorityLowRedundancyReplicatedBlocks() { return getRBFMetrics().getHighestPriorityLowRedundancyReplicatedBlocks(); } catch (IOException e) { LOG.debug("Failed to get number of highest priority low redundancy " - + "replicated blocks.", e.getMessage()); + + "replicated blocks.", e); } return 0; } @@ -403,8 +397,7 @@ public long getHighestPriorityLowRedundancyECBlocks() { return getRBFMetrics().getHighestPriorityLowRedundancyECBlocks(); } catch (IOException e) { LOG.debug("Failed to get number of highest priority low redundancy EC " - + "blocks.", - e.getMessage()); + + "blocks.", e); } return 0; } @@ -419,7 +412,7 @@ public int getCorruptFilesCount() { try { return getRBFMetrics().getCorruptFilesCount(); } catch (IOException e) { - LOG.debug("Failed to get number of corrupt files.", e.getMessage()); + LOG.debug("Failed to get number of corrupt files", e); } return 0; } @@ -572,7 +565,7 @@ public long getNNStartedTimeInMillis() { try { return getRouter().getStartTime(); } catch (IOException e) { - LOG.debug("Failed to get the router startup time", e.getMessage()); + LOG.debug("Failed to get the router startup time", e); } return 0; } @@ -633,7 +626,7 @@ public long getFilesTotal() { try { return getRBFMetrics().getNumFiles(); } catch (IOException e) { - LOG.debug("Failed to get number of files", e.getMessage()); + LOG.debug("Failed to get number of files", e); } return 0; } @@ -648,7 +641,7 @@ public int getNumLiveDataNodes() { try { return getRBFMetrics().getNumLiveNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of live nodes", e.getMessage()); + LOG.debug("Failed to get number of live nodes", e); } return 0; } @@ -658,7 +651,7 @@ public int getNumDeadDataNodes() { try { return getRBFMetrics().getNumDeadNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of dead nodes", e.getMessage()); + LOG.debug("Failed to get number of dead nodes", e); } return 0; } @@ -668,7 +661,7 @@ public int getNumStaleDataNodes() { try { return getRBFMetrics().getNumStaleNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of stale nodes", e.getMessage()); + LOG.debug("Failed to get number of stale nodes", e); } return 0; } @@ -679,7 +672,7 @@ public int getNumDecomLiveDataNodes() { return getRBFMetrics().getNumDecomLiveNodes(); } catch (IOException e) { LOG.debug("Failed to get the number of live decommissioned datanodes", - e.getMessage()); + e); } return 0; } @@ -690,7 +683,7 @@ public int getNumDecomDeadDataNodes() { return getRBFMetrics().getNumDecomDeadNodes(); } catch (IOException e) { LOG.debug("Failed to get the number of dead decommissioned datanodes", - e.getMessage()); + e); } return 0; } @@ -700,8 +693,7 @@ public int getNumDecommissioningDataNodes() { try { return getRBFMetrics().getNumDecommissioningNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of decommissioning nodes", - e.getMessage()); + LOG.debug("Failed to get number of decommissioning nodes", e); } return 0; } @@ -711,8 +703,7 @@ public int getNumInMaintenanceLiveDataNodes() { try { return getRBFMetrics().getNumInMaintenanceLiveDataNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of live in maintenance nodes", - e.getMessage()); + LOG.debug("Failed to get number of live in maintenance nodes", e); } return 0; } @@ -722,8 +713,7 @@ public int getNumInMaintenanceDeadDataNodes() { try { return getRBFMetrics().getNumInMaintenanceDeadDataNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of dead in maintenance nodes", - e.getMessage()); + LOG.debug("Failed to get number of dead in maintenance nodes", e); } return 0; } @@ -733,8 +723,7 @@ public int getNumEnteringMaintenanceDataNodes() { try { return getRBFMetrics().getNumEnteringMaintenanceDataNodes(); } catch (IOException e) { - LOG.debug("Failed to get number of entering maintenance nodes", - e.getMessage()); + LOG.debug("Failed to get number of entering maintenance nodes", e); } return 0; } @@ -822,8 +811,7 @@ public boolean isSecurityEnabled() { try { return getRBFMetrics().isSecurityEnabled(); } catch (IOException e) { - LOG.debug("Failed to get security status.", - e.getMessage()); + LOG.debug("Failed to get security status", e); } return false; }