From dcb718d0c5d2f7d62f4b53a6939141c968a81dca Mon Sep 17 00:00:00 2001
From: Nicolas Spiegelberg
Date: Tue, 18 Oct 2011 21:05:14 +0000
Subject: [PATCH] HBASE-4418 Show all the hbase configuration in the web ui
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1185859 13f79535-47bb-0310-9956-ffa450edef68
---
CHANGES.txt | 1 +
.../hbase/tmpl/master/MasterStatusTmpl.jamon | 6 +++++-
.../hbase/tmpl/regionserver/RSStatusTmpl.jamon | 6 +++++-
.../apache/hadoop/hbase/HBaseConfiguration.java | 16 ++++++++++++++++
.../org/apache/hadoop/hbase/util/InfoServer.java | 2 +-
5 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index fbb09aa3468..bebfa1caccc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -16,6 +16,7 @@ Release 0.93.0 - Unreleased
CacheConf class (jgray)
HBASE-4102 atomicAppend: A put that appends to the latest version of a cell (Lars H)
HBASE-4469 Avoid top row seek by looking up bloomfilter (liyin via jgray)
+ HBASE-4418 Show all the hbase configuration in the web ui
BUG FIXES
HBASE-4488 Store could miss rows during flush (Lars H via jgray)
diff --git a/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon b/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon
index abeb8507ee2..85a44732bb0 100644
--- a/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon
+++ b/src/main/jamon/org/apache/hbase/tmpl/master/MasterStatusTmpl.jamon
@@ -42,6 +42,7 @@ org.apache.hadoop.hbase.ServerName;
org.apache.hadoop.hbase.client.HBaseAdmin;
org.apache.hadoop.hbase.client.HConnectionManager;
org.apache.hadoop.hbase.HTableDescriptor;
+org.apache.hadoop.hbase.HBaseConfiguration;
%import>
<%if format.equals("json") %>
<& ../common/TaskMonitorTmpl; filter = filter; format = "json" &>
@@ -62,7 +63,10 @@ org.apache.hadoop.hbase.HTableDescriptor;
Local logs,
Thread Dump,
Log Level,
- Debug dump
+ Debug dump,
+<%if HBaseConfiguration.isShowConfInServlet()%>
+ HBase Configuration
+%if>
diff --git a/src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon
index be6fceb0fef..5fb0aae616f 100644
--- a/src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon
+++ b/src/main/jamon/org/apache/hbase/tmpl/regionserver/RSStatusTmpl.jamon
@@ -34,6 +34,7 @@ org.apache.hadoop.hbase.HConstants;
org.apache.hadoop.hbase.HServerInfo;
org.apache.hadoop.hbase.HServerLoad;
org.apache.hadoop.hbase.HRegionInfo;
+org.apache.hadoop.hbase.HBaseConfiguration;
%import>
<%if format.equals("json") %>
<& ../common/TaskMonitorTmpl; filter = filter; format = "json" &>
@@ -66,7 +67,10 @@ org.apache.hadoop.hbase.HRegionInfo;
Local logs,
Thread Dump,
Log Level,
- Debug dump
+ Debug dump,
+<%if HBaseConfiguration.isShowConfInServlet() %>
+ HBase Configuration
+%if>
diff --git a/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java b/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
index 06fd29c881e..da74cca50bc 100644
--- a/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
+++ b/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
@@ -122,4 +122,20 @@ public class HBaseConfiguration extends Configuration {
destConf.set(e.getKey(), e.getValue());
}
}
+
+ /**
+ *
+ * @return whether to show HBase Configuration in servlet
+ */
+ public static boolean isShowConfInServlet() {
+ boolean isShowConf = false;
+ try {
+ if (Class.forName("org.apache.hadoop.conf.ConfServlet") != null) {
+ isShowConf = true;
+ }
+ } catch (Exception e) {
+
+ }
+ return isShowConf;
+ }
}
diff --git a/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java b/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
index d204eab851d..552974502bf 100644
--- a/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
+++ b/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
@@ -57,7 +57,7 @@ public class InfoServer extends HttpServer {
public InfoServer(String name, String bindAddress, int port, boolean findPort,
final Configuration c)
throws IOException {
- super(name, bindAddress, port, findPort, HBaseConfiguration.create());
+ super(name, bindAddress, port, findPort, c);
this.config = c;
fixupLogsServletLocation();
}