diff --git a/CHANGES.txt b/CHANGES.txt index bfa3e4e345d..f048f491c8f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -144,6 +144,8 @@ Release 0.21.0 - Unreleased HBASE-2075 Master requires HDFS superuser privileges due to waitOnSafeMode HBASE-2077 NullPointerException with an open scanner that expired causing an immediate region server shutdown (Sam Pullara via JD) + HBASE-2078 Add JMX settings as commented out lines to hbase-env.sh + (Lars George via JD) IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable @@ -262,6 +264,7 @@ Release 0.21.0 - Unreleased HBASE-2045 Update trunk and branch zk to just-release 3.2.2. HBASE-2074 Improvements to the hadoop-config script (Bassam Tabbara via Stack) HBASE-2076 Many javadoc warnings + HBASE-2068 MetricsRate is missing "registry" parameter (Lars George via JD) NEW FEATURES HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write diff --git a/conf/hbase-env.sh b/conf/hbase-env.sh index 0c849810d25..af765e96ed9 100644 --- a/conf/hbase-env.sh +++ b/conf/hbase-env.sh @@ -37,7 +37,16 @@ export HBASE_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode" # Uncomment below to enable java garbage collection logging. -#export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log" +# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log" + +# Uncomment and adjust/create "jmxremote.*" to enable JMX exporting +# export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false" +# export HBASE_JMX_BASE="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.password.file=$HBASE_HOME/conf/jmxremote.password" +# export HBASE_JMX_BASE="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.access.file=$HBASE_HOME/conf/jmxremote.access" +# export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101" +# export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102" +# export HBASE_THRIFT_OPTS="$HBASE_THRIFT_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103" +# export HBASE_ZOOKEEPER_OPTS="$HBASE_ZOOKEEPER_OPTS $HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104" # File naming hosts on which HRegionServers will run. $HBASE_HOME/conf/regionservers by default. # export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers diff --git a/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java b/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java index a86421b04e1..af101c61829 100644 --- a/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java +++ b/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java @@ -19,12 +19,12 @@ package org.apache.hadoop.hbase.master.metrics; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hbase.metrics.MetricsRate; import org.apache.hadoop.metrics.MetricsContext; import org.apache.hadoop.metrics.MetricsRecord; import org.apache.hadoop.metrics.MetricsUtil; import org.apache.hadoop.metrics.Updater; import org.apache.hadoop.metrics.jvm.JvmMetrics; -import org.apache.hadoop.metrics.util.MetricsIntValue; import org.apache.hadoop.metrics.util.MetricsRegistry; @@ -43,8 +43,8 @@ public class MasterMetrics implements Updater { /* * Count of requests to the cluster since last call to metrics update */ - private final MetricsIntValue cluster_requests = - new MetricsIntValue("cluster_requests", registry); + private final MetricsRate cluster_requests = + new MetricsRate("cluster_requests", registry); public MasterMetrics(final String name) { MetricsContext context = MetricsUtil.getContext("hbase"); @@ -71,11 +71,7 @@ public class MasterMetrics implements Updater { */ public void doUpdates(MetricsContext unused) { synchronized (this) { - synchronized(this.cluster_requests) { - this.cluster_requests.pushMetric(metricsRecord); - // Set requests down to zero again. - this.cluster_requests.set(0); - } + this.cluster_requests.pushMetric(metricsRecord); } this.metricsRecord.update(); } @@ -87,16 +83,14 @@ public class MasterMetrics implements Updater { /** * @return Count of requests. */ - public int getRequests() { - return this.cluster_requests.get(); + public float getRequests() { + return this.cluster_requests.getPreviousIntervalValue(); } /** * @param inc How much to add to requests. */ public void incrementRequests(final int inc) { - synchronized(this.cluster_requests) { - this.cluster_requests.set(this.cluster_requests.get() + inc); - } + this.cluster_requests.inc(inc); } } \ No newline at end of file diff --git a/src/java/org/apache/hadoop/hbase/metrics/MetricsRate.java b/src/java/org/apache/hadoop/hbase/metrics/MetricsRate.java index a649b91eb80..13fe5eff72c 100644 --- a/src/java/org/apache/hadoop/hbase/metrics/MetricsRate.java +++ b/src/java/org/apache/hadoop/hbase/metrics/MetricsRate.java @@ -20,25 +20,32 @@ package org.apache.hadoop.hbase.metrics; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.metrics.MetricsRecord; +import org.apache.hadoop.metrics.util.MetricsBase; +import org.apache.hadoop.metrics.util.MetricsRegistry; import org.apache.hadoop.util.StringUtils; /** * Publishes a rate based on a counter - you increment the counter each * time an event occurs (eg: an RPC call) and this publishes a rate. */ -public class MetricsRate { +public class MetricsRate extends MetricsBase { private static final Log LOG = LogFactory.getLog("org.apache.hadoop.hbase.metrics"); - private String name; private int value; private float prevRate; private long ts; - public MetricsRate(final String name) { - this.name = name; + public MetricsRate(final String name, final MetricsRegistry registry, + final String description) { + super(name, description); this.value = 0; this.prevRate = 0; this.ts = System.currentTimeMillis(); + registry.add(name, this); + } + + public MetricsRate(final String name, final MetricsRegistry registry) { + this(name, registry, NO_DESCRIPTION); } public synchronized void inc(final int incr) { @@ -58,15 +65,17 @@ public class MetricsRate { this.ts = now; } + @Override public synchronized void pushMetric(final MetricsRecord mr) { intervalHeartBeat(); try { - mr.setMetric(name, getPreviousIntervalValue()); + mr.setMetric(getName(), getPreviousIntervalValue()); } catch (Exception e) { - LOG.info("pushMetric failed for " + name + "\n" + + LOG.info("pushMetric failed for " + getName() + "\n" + StringUtils.stringifyException(e)); } } + public synchronized float getPreviousIntervalValue() { return this.prevRate; } diff --git a/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java b/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java index 49e81972496..2859aec8b7f 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java @@ -81,7 +81,7 @@ public class RegionServerMetrics implements Updater { /* * Count of requests to the regionservers since last call to metrics update */ - private final MetricsRate requests = new MetricsRate("requests"); + private final MetricsRate requests = new MetricsRate("requests", registry); /** * Count of stores open on the regionserver.