hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-13745 Say why a flush was requested in log message
Date Fri, 22 May 2015 18:41:35 GMT
Repository: hbase
Updated Branches:
  refs/heads/master f8893e001 -> c2d73f02e


HBASE-13745 Say why a flush was requested in log message


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c2d73f02
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c2d73f02
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c2d73f02

Branch: refs/heads/master
Commit: c2d73f02ebd8510d42862a15e2fa0633d76136e1
Parents: f8893e0
Author: stack <stack@apache.org>
Authored: Fri May 22 11:41:22 2015 -0700
Committer: stack <stack@apache.org>
Committed: Fri May 22 11:41:22 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/regionserver/HRegion.java   |  5 ++++-
 .../apache/hadoop/hbase/regionserver/HRegionServer.java | 12 +++++++-----
 .../hadoop/hbase/regionserver/TestDefaultMemStore.java  | 10 ++++++----
 3 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c2d73f02/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 2c77697..ced6ccb 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -1937,10 +1937,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
   /**
    * Should the memstore be flushed now
    */
-  boolean shouldFlush() {
+  boolean shouldFlush(final StringBuffer whyFlush) {
+    whyFlush.setLength(0);
     // This is a rough measure.
     if (this.maxFlushedSeqId > 0
           && (this.maxFlushedSeqId + this.flushPerChanges < this.sequenceId.get()))
{
+      whyFlush.append("more than max edits, " + this.flushPerChanges + ", since last flush");
       return true;
     }
     long modifiedFlushCheckInterval = flushCheckInterval;
@@ -1961,6 +1963,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     for (Store s : getStores()) {
       if (s.timeOfOldestEdit() < now - modifiedFlushCheckInterval) {
         // we have an old enough edit in the memstore, flush
+        whyFlush.append(s.toString() + " has an old edit so flush to free WALs");
         return true;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/c2d73f02/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 53a1094..fa56966 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -1553,15 +1553,17 @@ public class HRegionServer extends HasThread implements
 
     @Override
     protected void chore() {
+      final StringBuffer whyFlush = new StringBuffer();
       for (Region r : this.server.onlineRegions.values()) {
-        if (r == null)
-          continue;
-        if (((HRegion)r).shouldFlush()) {
+        if (r == null) continue;
+        if (((HRegion)r).shouldFlush(whyFlush)) {
           FlushRequester requester = server.getFlushRequester();
           if (requester != null) {
             long randomDelay = RandomUtils.nextInt(RANGE_OF_DELAY) + MIN_DELAY_TIME;
-            LOG.info(getName() + " requesting flush for region " +
-              r.getRegionInfo().getRegionNameAsString() + " after a delay of " + randomDelay);
+            LOG.info(getName() + " requesting flush of " +
+              r.getRegionInfo().getRegionNameAsString() + " because " +
+              whyFlush.toString() +
+              " after random delay " + randomDelay + "ms");
             //Throttle the flushes by putting a delay. If we don't throttle, and there
             //is a balanced write-load on the regions in a table, we might end up
             //overwhelming the filesystem with too many flushes at once.

http://git-wip-us.apache.org/repos/asf/hbase/blob/c2d73f02/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java
index 18e3d22..7857590 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDefaultMemStore.java
@@ -929,9 +929,10 @@ public class TestDefaultMemStore extends TestCase {
       edge.setCurrentTimeMillis(1234);
       s.add(KeyValueTestUtil.create("r", "f", "q", 100, "v"));
       edge.setCurrentTimeMillis(1234 + 100);
-      assertTrue(region.shouldFlush() == false);
+      StringBuffer sb = new StringBuffer();
+      assertTrue(region.shouldFlush(sb) == false);
       edge.setCurrentTimeMillis(1234 + 10000);
-      assertTrue(region.shouldFlush() == expected);
+      assertTrue(region.shouldFlush(sb) == expected);
     } finally {
       EnvironmentEdgeManager.reset();
     }
@@ -962,9 +963,10 @@ public class TestDefaultMemStore extends TestCase {
             wFactory.getWAL(hri.getEncodedNameAsBytes()));
     HRegion.addRegionToMETA(meta, r);
     edge.setCurrentTimeMillis(1234 + 100);
-    assertTrue(meta.shouldFlush() == false);
+    StringBuffer sb = new StringBuffer();
+    assertTrue(meta.shouldFlush(sb) == false);
     edge.setCurrentTimeMillis(edge.currentTime() + HRegion.META_CACHE_FLUSH_INTERVAL + 1);
-    assertTrue(meta.shouldFlush() == true);
+    assertTrue(meta.shouldFlush(sb) == true);
   }
 
   private class EnvironmentEdgeForMemstoreTest implements EnvironmentEdge {


Mime
View raw message