diff --git a/lib/hadoop-0.19.1-core.jar b/lib/hadoop-0.19.1-core.jar deleted file mode 100644 index 440f9d8..0000000 Binary files a/lib/hadoop-0.19.1-core.jar and /dev/null differ diff --git a/lib/hadoop-0.19.1-test.jar b/lib/hadoop-0.19.1-test.jar deleted file mode 100644 index d817731..0000000 Binary files a/lib/hadoop-0.19.1-test.jar and /dev/null differ diff --git a/lib/hadoop-0.20.0-core.jar b/lib/hadoop-0.20.0-core.jar new file mode 100644 index 0000000..c99ce6d Binary files /dev/null and b/lib/hadoop-0.20.0-core.jar differ diff --git a/lib/hadoop-0.20.0-test.jar b/lib/hadoop-0.20.0-test.jar new file mode 100644 index 0000000..02b17d4 Binary files /dev/null and b/lib/hadoop-0.20.0-test.jar differ diff --git a/src/java/org/apache/hadoop/hbase/io/hfile/Compression.java b/src/java/org/apache/hadoop/hbase/io/hfile/Compression.java index 6994844..caa9b40 100644 --- a/src/java/org/apache/hadoop/hbase/io/hfile/Compression.java +++ b/src/java/org/apache/hadoop/hbase/io/hfile/Compression.java @@ -33,7 +33,6 @@ import org.apache.hadoop.io.compress.CompressionOutputStream; import org.apache.hadoop.io.compress.Compressor; import org.apache.hadoop.io.compress.Decompressor; import org.apache.hadoop.io.compress.GzipCodec; -import org.apache.hadoop.io.compress.LzoCodec; /** * Compression related stuff. @@ -72,62 +71,6 @@ public final class Compression { * Compression algorithms. */ public static enum Algorithm { - LZO("lzo") { - private LzoCodec codec; - - @Override - CompressionCodec getCodec() { - if (codec == null) { - Configuration conf = new Configuration(); - conf.setBoolean("hadoop.native.lib", true); - codec = new LzoCodec(); - codec.setConf(conf); - } - - return codec; - } - - @Override - public synchronized InputStream createDecompressionStream( - InputStream downStream, Decompressor decompressor, - int downStreamBufferSize) throws IOException { - InputStream bis1 = null; - if (downStreamBufferSize > 0) { - bis1 = new BufferedInputStream(downStream, downStreamBufferSize); - } - else { - bis1 = downStream; - } - codec.getConf() - .setInt("io.compression.codec.lzo.buffersize", 64 * 1024); - CompressionInputStream cis = - codec.createInputStream(bis1, decompressor); - BufferedInputStream bis2 = new BufferedInputStream(cis, DATA_IBUF_SIZE); - return bis2; - } - - @Override - public synchronized OutputStream createCompressionStream( - OutputStream downStream, Compressor compressor, - int downStreamBufferSize) throws IOException { - OutputStream bos1 = null; - if (downStreamBufferSize > 0) { - bos1 = new BufferedOutputStream(downStream, downStreamBufferSize); - } - else { - bos1 = downStream; - } - codec.getConf() - .setInt("io.compression.codec.lzo.buffersize", 64 * 1024); - CompressionOutputStream cos = - codec.createOutputStream(bos1, compressor); - BufferedOutputStream bos2 = - new BufferedOutputStream(new FinishOnFlushCompressionStream(cos), - DATA_OBUF_SIZE); - return bos2; - } - }, - GZ("gz") { private GzipCodec codec; diff --git a/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java index 9281f68..2a42364 100644 --- a/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/src/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -1341,10 +1341,10 @@ public class HFile { private BlockIndex() { this(null); } - + + /** - * Constructor - * @param trailer File tail structure with index stats. + * @param c comparator used to compare keys. */ BlockIndex(final RawComparatorc) { this.comparator = c; diff --git a/src/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java b/src/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java index 77009ce..69ad443 100644 --- a/src/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java +++ b/src/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java @@ -638,14 +638,13 @@ public class HBaseRPC { rpcMetrics.rpcQueueTime.inc(qTime); rpcMetrics.rpcProcessingTime.inc(processingTime); - MetricsTimeVaryingRate m = rpcMetrics.metricsList.get(call.getMethodName()); + MetricsTimeVaryingRate m = rpcMetrics.get(call.getMethodName()); if (m != null) { m.inc(processingTime); } else { - rpcMetrics.metricsList.put(call.getMethodName(), new MetricsTimeVaryingRate(call.getMethodName())); - m = rpcMetrics.metricsList.get(call.getMethodName()); + m = rpcMetrics.create(call.getMethodName()); m.inc(processingTime); } diff --git a/src/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java b/src/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java index 57ceff4..d1dfc19 100644 --- a/src/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java +++ b/src/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java @@ -30,6 +30,7 @@ import org.apache.hadoop.metrics.MetricsRecord; import org.apache.hadoop.metrics.MetricsUtil; import org.apache.hadoop.metrics.Updater; import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate; +import org.apache.hadoop.metrics.util.MetricsRegistry; /** * @@ -65,14 +66,22 @@ public class HBaseRpcMetrics implements Updater { * - they can be set directly by calling their set/inc methods * -they can also be read directly - e.g. JMX does this. */ - - public MetricsTimeVaryingRate rpcQueueTime = new MetricsTimeVaryingRate("RpcQueueTime"); - public MetricsTimeVaryingRate rpcProcessingTime = new MetricsTimeVaryingRate("RpcProcessingTime"); + public MetricsRegistry registry = new MetricsRegistry(); - public Map metricsList = Collections.synchronizedMap(new HashMap()); + public MetricsTimeVaryingRate rpcQueueTime = new MetricsTimeVaryingRate("RpcQueueTime", registry); + public MetricsTimeVaryingRate rpcProcessingTime = new MetricsTimeVaryingRate("RpcProcessingTime", registry); + + //public Map metricsList = Collections.synchronizedMap(new HashMap()); + + MetricsTimeVaryingRate get(String key) { + return (MetricsTimeVaryingRate) registry.get(key); + } + MetricsTimeVaryingRate create(String key) { + MetricsTimeVaryingRate newMetric = new MetricsTimeVaryingRate(key, this.registry); + registry.add(key, newMetric); + return newMetric; + } - - /** * Push the metrics to the monitoring subsystem on doUpdate() call. * @param context @@ -81,18 +90,14 @@ public class HBaseRpcMetrics implements Updater { rpcQueueTime.pushMetric(metricsRecord); rpcProcessingTime.pushMetric(metricsRecord); - synchronized (metricsList) { - // Iterate through the rpcMetrics hashmap to propogate the different rpc metrics. - Set keys = metricsList.keySet(); - - Iterator keyIter = keys.iterator(); + synchronized (registry) { + // Iterate through the registry to propogate the different rpc metrics. - while (keyIter.hasNext()) { - Object key = keyIter.next(); - MetricsTimeVaryingRate value = metricsList.get(key); + for (String metricName : registry.getKeyList() ) { + MetricsTimeVaryingRate value = (MetricsTimeVaryingRate) registry.get(metricName); - value.pushMetric(metricsRecord); - } + value.pushMetric(metricsRecord); + } } metricsRecord.update(); } diff --git a/src/java/org/apache/hadoop/hbase/master/HMaster.java b/src/java/org/apache/hadoop/hbase/master/HMaster.java index 7c0e827..806b9b7 100644 --- a/src/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/src/java/org/apache/hadoop/hbase/master/HMaster.java @@ -410,7 +410,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface, LOG.info("Stopping infoServer"); try { this.infoServer.stop(); - } catch (InterruptedException ex) { + } catch (Exception ex) { ex.printStackTrace(); } } 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 9f635c0..4d527b0 100644 --- a/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java +++ b/src/java/org/apache/hadoop/hbase/master/metrics/MasterMetrics.java @@ -25,6 +25,7 @@ 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; /** @@ -37,12 +38,12 @@ import org.apache.hadoop.metrics.util.MetricsIntValue; public class MasterMetrics implements Updater { private final Log LOG = LogFactory.getLog(this.getClass()); private final MetricsRecord metricsRecord; - + private final MetricsRegistry registry = new MetricsRegistry(); /* * Count of requests to the cluster since last call to metrics update */ private final MetricsIntValue cluster_requests = - new MetricsIntValue("cluster_requests"); + new MetricsIntValue("cluster_requests", registry); public MasterMetrics() { MetricsContext context = MetricsUtil.getContext("hbase"); @@ -90,7 +91,7 @@ public class MasterMetrics implements Updater { */ public void incrementRequests(final int inc) { synchronized(this.cluster_requests) { - this.cluster_requests.inc(inc); + this.cluster_requests.set(this.cluster_requests.get() + inc); } } } \ No newline at end of file diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 8f8d6d2..45c5ded 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -524,8 +524,8 @@ public class HRegionServer implements HConstants, HRegionInterface, LOG.info("Stopping infoServer"); try { this.infoServer.stop(); - } catch (InterruptedException ex) { - ex.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); } } 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 94216fa..8838e89 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java @@ -32,6 +32,7 @@ import org.apache.hadoop.metrics.jvm.JvmMetrics; import org.apache.hadoop.metrics.util.MetricsIntValue; import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate; import org.apache.hadoop.metrics.util.MetricsLongValue; +import org.apache.hadoop.metrics.util.MetricsRegistry; /** * This class is for maintaining the various regionserver statistics @@ -45,33 +46,36 @@ public class RegionServerMetrics implements Updater { private final MetricsRecord metricsRecord; private long lastUpdate = System.currentTimeMillis(); private static final int MB = 1024*1024; + + private MetricsRegistry registry = new MetricsRegistry(); - public final MetricsTimeVaryingRate atomicIncrementTime = new MetricsTimeVaryingRate("hbase_atomicIncrementTime"); + public final MetricsTimeVaryingRate atomicIncrementTime = + new MetricsTimeVaryingRate("hbase_atomicIncrementTime", registry); /** * Count of regions carried by this regionserver */ - public final MetricsIntValue regions = new MetricsIntValue("hbase_regions"); + public final MetricsIntValue regions = new MetricsIntValue("hbase_regions", registry); /** * Block cache size. */ - public final MetricsLongValue blockCacheSize = new MetricsLongValue("hbase_blockCacheSize"); + public final MetricsLongValue blockCacheSize = new MetricsLongValue("hbase_blockCacheSize", registry); /** * Block cache free size. */ - public final MetricsLongValue blockCacheFree = new MetricsLongValue("hbase_blockCacheFree"); + public final MetricsLongValue blockCacheFree = new MetricsLongValue("hbase_blockCacheFree", registry); /** * Block cache item count. */ - public final MetricsLongValue blockCacheCount = new MetricsLongValue("hbase_blockCacheCount"); + public final MetricsLongValue blockCacheCount = new MetricsLongValue("hbase_blockCacheCount", registry); /** * Block hit ratio. */ - public final MetricsIntValue blockCacheHitRatio = new MetricsIntValue("hbase_blockCacheHitRatio"); + public final MetricsIntValue blockCacheHitRatio = new MetricsIntValue("hbase_blockCacheHitRatio", registry); /* * Count of requests to the regionservers since last call to metrics update @@ -81,24 +85,24 @@ public class RegionServerMetrics implements Updater { /** * Count of stores open on the regionserver. */ - public final MetricsIntValue stores = new MetricsIntValue("hbase_stores"); + public final MetricsIntValue stores = new MetricsIntValue("hbase_stores", registry); /** * Count of storefiles open on the regionserver. */ - public final MetricsIntValue storefiles = new MetricsIntValue("hbase_storefiles"); + public final MetricsIntValue storefiles = new MetricsIntValue("hbase_storefiles", registry); /** * Sum of all the storefile index sizes in this regionserver in MB */ public final MetricsIntValue storefileIndexSizeMB = - new MetricsIntValue("hbase_storefileIndexSizeMB"); + new MetricsIntValue("hbase_storefileIndexSizeMB", registry); /** * Sum of all the memcache sizes in this regionserver in MB */ public final MetricsIntValue memcacheSizeMB = - new MetricsIntValue("hbase_memcacheSizeMB"); + new MetricsIntValue("hbase_memcacheSizeMB", registry); public RegionServerMetrics() { MetricsContext context = MetricsUtil.getContext("hbase");