You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2008/11/24 22:17:43 UTC
svn commit: r720294 - in /hadoop/hbase/trunk: ./
src/java/org/apache/hadoop/hbase/regionserver/
src/java/org/apache/hadoop/hbase/regionserver/metrics/
Author: apurtell
Date: Mon Nov 24 13:17:43 2008
New Revision: 720294
URL: http://svn.apache.org/viewvc?rev=720294&view=rev
Log:
HBASE-1022 Add storefile index size to hbase metrics
Modified:
hadoop/hbase/trunk/CHANGES.txt
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java
hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=720294&r1=720293&r2=720294&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Nov 24 13:17:43 2008
@@ -137,7 +137,8 @@
HBASE-927 We don't recover if HRS hosting -ROOT-/.META. goes down
HBASE-1013 Add debugging around commit log cleanup
HBASE-972 Update hbase trunk to use released hadoop 0.19.0
-
+ HBASE-1022 Add storefile index size to hbase metrics
+
NEW FEATURES
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
(Andrzej Bialecki via Stack)
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=720294&r1=720293&r2=720294&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStore.java Mon Nov 24 13:17:43 2008
@@ -2137,7 +2137,19 @@
int getStorefilesCount() {
return this.storefiles.size();
}
-
+
+ /**
+ * @return The size of the store file indexes, in bytes.
+ * @throws IOException if there was a problem getting file sizes from the
+ * filesystem
+ */
+ long getStorefilesIndexSize() throws IOException {
+ long size = 0;
+ for (HStoreFile s: storefiles.values())
+ size += s.indexLength();
+ return size;
+ }
+
/*
* Datastructure that holds size and key.
*/
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java?rev=720294&r1=720293&r2=720294&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java Mon Nov 24 13:17:43 2008
@@ -52,7 +52,7 @@
* <p>An HStoreFile usually tracks 4 things: its parent dir, the region
* identifier, the column family, and the file identifier. If you know those
* four things, you know how to obtain the right HStoreFile. HStoreFiles may
- * also refernce store files in another region serving either from
+ * also reference store files in another region serving either from
* the top-half of the remote file or from the bottom-half. Such references
* are made fast splitting regions.
*
@@ -101,6 +101,7 @@
/* If true, this file was product of a major compaction.
*/
private boolean majorCompaction = false;
+ private long indexLength;
/**
* Constructor that fully initializes the object
@@ -381,7 +382,7 @@
out.close();
}
}
-
+
/**
* Delete store map files.
* @throws IOException
@@ -477,6 +478,18 @@
return (isReference())? l / 2: l;
}
+ /**
+ * @return Length of the store map file index.
+ * @throws IOException
+ */
+ public synchronized long indexLength() throws IOException {
+ if (indexLength == 0) {
+ Path p = new Path(getMapFilePath(reference), MapFile.INDEX_FILE_NAME);
+ indexLength = p.getFileSystem(conf).getFileStatus(p).getLen();
+ }
+ return indexLength;
+ }
+
@Override
public String toString() {
return encodedRegionName + "/" + Bytes.toString(colFamily) + "/" + fileId +
Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=720294&r1=720293&r2=720294&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Mon Nov 24 13:17:43 2008
@@ -53,7 +53,13 @@
* Count of storefiles open on the regionserver.
*/
public final MetricsIntValue storefiles = new MetricsIntValue("storefiles");
-
+
+ /**
+ * Sum of all the storefile index sizes in this regionserver in MB
+ */
+ public final MetricsIntValue storefileIndexSizeMB =
+ new MetricsIntValue("storefileIndexSizeMB");
+
/**
* Sum of all the memcache sizes in this regionserver in MB
*/
@@ -81,6 +87,7 @@
public void doUpdates(@SuppressWarnings("unused") MetricsContext unused) {
synchronized (this) {
this.storefiles.pushMetric(this.metricsRecord);
+ this.storefileIndexSizeMB.pushMetric(this.metricsRecord);
this.memcacheSizeMB.pushMetric(this.metricsRecord);
this.regions.pushMetric(this.metricsRecord);
synchronized(this.requests) {
@@ -126,6 +133,9 @@
sb.append(this.regions.get());
sb.append(", storefiles=");
sb.append(this.storefiles.get());
+ sb.append(", storefileIndexSize=");
+ sb.append(this.storefileIndexSizeMB.get());
+ sb.append("MB");
sb.append(", memcacheSize=");
sb.append(this.memcacheSizeMB.get());
sb.append("MB");