From ca1058b27ab864b9b98d8cfd3c6fcbb063d65da3 Mon Sep 17 00:00:00 2001 From: Chris Nauroth Date: Wed, 26 Jun 2013 22:20:31 +0000 Subject: [PATCH] HDFS-4932. Avoid a wide line on the name node webUI if we have more Journal nodes. Contributed by Fengdong Yu. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1497141 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../server/namenode/NamenodeJspHelper.java | 27 ++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index f720e93c709..25d16820dc4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -414,6 +414,9 @@ Release 2.1.0-beta - 2013-07-02 HDFS-4772. Add number of children in HdfsFileStatus. (brandonli) + HDFS-4932. Avoid a wide line on the name node webUI if we have more Journal + nodes. (Fengdong Yu via cnauroth) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java index 321d9262acd..544599e9c7f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java @@ -249,9 +249,30 @@ class NamenodeJspHelper { + "Journal ManagerState"); for (JournalAndStream jas : log.getJournals()) { out.print(""); - out.print("" + jas.getManager()); - if (jas.isRequired()) { - out.print(" [required]"); + out.print(""); + + /** + * Insert a line break every 3 journal nodes to avoid a very wide line. + */ + JournalManager manager = jas.getManager(); + if (null != manager) { + String[] managers = manager.toString().split(","); + + for (int i = 0; i < managers.length; ++i) { + out.print(managers[i]); + + if (i < managers.length - 1) { + out.print(","); + } + + if ((i+1) % 3 == 0) { + out.print("
"); + } + } + + if (jas.isRequired()) { + out.print(" [required]"); + } } out.print("");