hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-13534 Changed Master UI to promptly display if it is a backup master. (Apekshit)
Date Thu, 23 Apr 2015 22:37:39 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 f1c29a838 -> 2b392de64


HBASE-13534 Changed Master UI to promptly display if it is a backup master. (Apekshit)

Signed-off-by: Elliott Clark <eclark@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2b392de6
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2b392de6
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2b392de6

Branch: refs/heads/branch-1
Commit: 2b392de640ac3db135ce25b8ee69209d62957087
Parents: f1c29a8
Author: Apekshit(Appy) Sharma <appy@cloudera.com>
Authored: Wed Apr 22 20:28:14 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Thu Apr 23 15:32:42 2015 -0700

----------------------------------------------------------------------
 .../tmpl/master/BackupMasterStatusTmpl.jamon    | 51 +++++++++-----------
 .../hbase/tmpl/master/MasterStatusTmpl.jamon    |  5 +-
 2 files changed, 25 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/2b392de6/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
index f5fa3de..9d5c2f9 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/BackupMasterStatusTmpl.jamon
@@ -27,32 +27,23 @@ org.apache.hadoop.hbase.master.HMaster;
 org.apache.hadoop.hbase.zookeeper.MasterAddressTracker;
 </%import>
 <%java>
-Collection<ServerName> masters = null;
 MasterAddressTracker masterAddressTracker = master.getMasterAddressTracker();
-if (master.isActiveMaster()) {
-  ClusterStatus status = master.getClusterStatus();
-  masters = status.getBackupMasters();
-} else{
-  ServerName sn = masterAddressTracker == null ? null
-    : masterAddressTracker.getMasterAddress();
-  assert sn != null : "Failed to retreive master's ServerName!";
-  masters = Collections.singletonList(sn);
-}
 </%java>
 
-<%java>
-ServerName [] serverNames = masters.toArray(new ServerName[masters.size()]);
-int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMasterInfoPort();
-</%java>
 <%if (!master.isActiveMaster()) %>
-    <%if serverNames[0] != null %>
-        <h2>Master</h2>
-        <a href="//<% serverNames[0].getHostname() %>:<%
-          infoPort %>/master-status" target="_blank"><%
-          serverNames[0].getHostname() %></a>
-    <%else>
-        Unable to parse master hostname.
-    </%if>
+    <%java>
+    ServerName active_master =
+        (masterAddressTracker == null) ? null : masterAddressTracker.getMasterAddress();
+    assert active_master != null : "Failed to retrieve master's ServerName!";
+    int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker.getMasterInfoPort();
+    </%java>
+    <div class="row inner_header">
+        <div class="page-header">
+            <h1>Backup Master <small><% master.getServerName().getHostname()
%></small></h1>
+        </div>
+    </div>
+    <h4>Current Active Master: <a href="//<% active_master.getHostname() %>:<%
infoPort %>/master-status"
+        target="_blank"><% active_master.getHostname() %></a><h4>
 <%else>
     <h2>Backup Masters</h2>
 
@@ -63,14 +54,16 @@ int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMaster
         <th>Start Time</th>
     </tr>
     <%java>
-    Arrays.sort(serverNames);
-    for (ServerName serverName : serverNames) {
-      infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getBackupMasterInfoPort(serverName);
+    Collection<ServerName> backup_masters = master.getClusterStatus().getBackupMasters();
+    ServerName [] backupServerNames = backup_masters.toArray(new ServerName[backup_masters.size()]);
+    Arrays.sort(backupServerNames);
+    for (ServerName serverName : backupServerNames) {
+      int infoPort = (masterAddressTracker == null) ? 0 : masterAddressTracker
+          .getBackupMasterInfoPort(serverName);
     </%java>
     <tr>
-        <td><a href="//<% serverName.getHostname() %>:<%
-          infoPort %>/master-status" target="_blank"><%
-          serverName.getHostname() %></a>
+        <td><a href="//<% serverName.getHostname() %>:<% infoPort %>/master-status"
+            target="_blank"><% serverName.getHostname() %></a>
         </td>
         <td><% serverName.getPort() %></td>
         <td><% new Date(serverName.getStartcode()) %></td>
@@ -78,6 +71,6 @@ int infoPort = masterAddressTracker == null ? 0 : masterAddressTracker.getMaster
     <%java>
     }
     </%java>
-    <tr><td>Total:<% (masters != null) ? masters.size() : 0 %></td>
+    <tr><td>Total:<% backupServerNames.length %></td>
     </table>
 </%if>

http://git-wip-us.apache.org/repos/asf/hbase/blob/2b392de6/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
index 1c9ad92..6d736eb 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon
@@ -98,7 +98,8 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
 <html lang="en">
   <head>
     <meta charset="utf-8">
-    <title>Master: <% master.getServerName().getHostname() %></title>
+    <title><%if master.isActiveMaster() %>Master: <%else>Backup Master:
</%if>
+    <% master.getServerName().getHostname() %></title>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta name="description" content="">
     <link href="/static/css/bootstrap.min.css" rel="stylesheet">
@@ -138,7 +139,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
 	<%if master.isActiveMaster() %>
         <div class="row inner_header">
             <div class="page-header">
-                <h1>Master <small><% master.getServerName().getHostname()
%> </small></h1>
+                <h1>Master <small><% master.getServerName().getHostname()
%></small></h1>
             </div>
         </div>
 


Mime
View raw message