You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/06/10 00:31:53 UTC

svn commit: r665922 - in /hadoop/hbase/branches/0.1: CHANGES.txt src/java/org/apache/hadoop/hbase/HLog.java src/java/org/apache/hadoop/hbase/HRegion.java

Author: stack
Date: Mon Jun  9 15:31:53 2008
New Revision: 665922

URL: http://svn.apache.org/viewvc?rev=665922&view=rev
Log:
HBASE-674 memcache size unreliable

Modified:
    hadoop/hbase/branches/0.1/CHANGES.txt
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HLog.java
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java

Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=665922&r1=665921&r2=665922&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Mon Jun  9 15:31:53 2008
@@ -11,6 +11,7 @@
    HBASE-659   HLog#cacheFlushLock not cleared; hangs a region
    HBASE-663   Incorrect sequence number for cache flush
    HBASE-652   Dropping table fails silently if table isn't disabled 
+   HBASE-674   Memcache size unreliable
 
 Release 0.1.2 - 05/13/2008
 

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HLog.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HLog.java?rev=665922&r1=665921&r2=665922&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HLog.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HLog.java Mon Jun  9 15:31:53 2008
@@ -471,8 +471,8 @@
    * @throws IOException
    */
   void completeCacheFlush(final Text regionName, final Text tableName,
-      final long logSeqId) throws IOException {
-
+    final long logSeqId)
+  throws IOException {
     try {
       if (this.closed) {
         return;

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java?rev=665922&r1=665921&r2=665922&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegion.java Mon Jun  9 15:31:53 2008
@@ -958,7 +958,7 @@
       boolean status = true;
       doRegionCompactionPrep();
       for (HStore store : stores.values()) {
-        if(!store.compact(force)) {
+        if (!store.compact(force)) {
           status = false;
         }
       }
@@ -1105,8 +1105,10 @@
            if (LOG.isDebugEnabled()) {
              LOG.warn("Memcache size went negative " + size + "; resetting");
            }
-           this.memcacheSize.set(0);
         }
+        // Our count is unreliable; HBASE-674.  Just set memcache to zero
+        // rather than rely on our keeping a running accurate count.
+        this.memcacheSize.set(0);
       }
     } catch (Throwable t) {
       // An exception here means that the snapshot was not persisted.
@@ -1129,7 +1131,7 @@
     //     and that all updates to the log for this regionName that have lower 
     //     log-sequence-ids can be safely ignored.
     this.log.completeCacheFlush(this.regionInfo.getRegionName(),
-        regionInfo.getTableDesc().getName(), sequenceId);
+      regionInfo.getTableDesc().getName(), sequenceId);
 
     // D. Finally notify anyone waiting on memcache to clear:
     // e.g. checkResources().
@@ -1466,7 +1468,7 @@
     while (this.memcacheSize.get() >= this.blockingMemcacheSize) {
       if (!blocked) {
         LOG.info("Blocking updates for '" + Thread.currentThread().getName() +
-            "': Memcache size " +
+            "' on region " + getRegionName().toString() + ": Memcache size " +
             StringUtils.humanReadableInt(this.memcacheSize.get()) +
             " is >= than blocking " +
             StringUtils.humanReadableInt(this.blockingMemcacheSize) + " size");
@@ -1633,6 +1635,9 @@
       for (Map.Entry<HStoreKey, byte[]> e: updatesByColumn.entrySet()) {
         HStoreKey key = e.getKey();
         byte[] val = e.getValue();
+        // What if the update fails?  Memcache size will be off by this
+        // entry's size.  Have to discern if the delete is one where data
+        // failed to get added. St.Ack.
         size = this.memcacheSize.addAndGet(getEntrySize(key, val));
         stores.get(HStoreKey.extractFamily(key.getColumn())).add(key, val);
       }