hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-10499 In write heavy scenario one of the regions does not get flushed causing RegionTooBusyException (Ram and Ted)
Date Fri, 23 Jan 2015 17:43:07 GMT
Repository: hbase
Updated Branches:
  refs/heads/master ab18158e6 -> 74adb11f4


HBASE-10499 In write heavy scenario one of the regions does not get flushed causing RegionTooBusyException
(Ram and Ted)


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

Branch: refs/heads/master
Commit: 74adb11f4c504abbb6a52de72b53883ad7b952b4
Parents: ab18158
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Jan 23 09:43:01 2015 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Jan 23 09:43:01 2015 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/MemStoreFlusher.java   | 15 +++++++++++----
 .../hbase/regionserver/TestFlushRegionEntry.java     |  5 +++--
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/74adb11f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
index a345a05..e5ad590 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
@@ -619,7 +619,8 @@ class MemStoreFlusher implements FlushRequester {
     return this.globalMemStoreLimit;
   }
 
-  interface FlushQueueEntry extends Delayed {}
+  interface FlushQueueEntry extends Delayed {
+  }
 
   /**
    * Token to insert into the flush queue that ensures that the flusher does not sleep
@@ -639,7 +640,6 @@ class MemStoreFlusher implements FlushRequester {
     public boolean equals(Object obj) {
       return (this == obj);
     }
-
   }
 
   /**
@@ -709,8 +709,14 @@ class MemStoreFlusher implements FlushRequester {
 
     @Override
     public int compareTo(Delayed other) {
-      return Long.valueOf(getDelay(TimeUnit.MILLISECONDS) -
+      // Delay is compared first. If there is a tie, compare region's hash code
+      int ret = Long.valueOf(getDelay(TimeUnit.MILLISECONDS) -
         other.getDelay(TimeUnit.MILLISECONDS)).intValue();
+      if (ret != 0) {
+        return ret;
+      }
+      FlushQueueEntry otherEntry = (FlushQueueEntry) other;
+      return hashCode() - otherEntry.hashCode();
     }
 
     @Override
@@ -720,7 +726,8 @@ class MemStoreFlusher implements FlushRequester {
 
     @Override
     public int hashCode() {
-      return (int) getDelay(TimeUnit.MILLISECONDS);
+      int hash = (int) getDelay(TimeUnit.MILLISECONDS);
+      return hash ^ region.hashCode();
     }
 
    @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/74adb11f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
index 676885b..bd50f59 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
@@ -34,8 +34,9 @@ public class TestFlushRegionEntry {
 
   @Test
   public void test() {
-    FlushRegionEntry entry = new FlushRegionEntry(Mockito.mock(HRegion.class), true);
-    FlushRegionEntry other = new FlushRegionEntry(Mockito.mock(HRegion.class), true);
+    HRegion r = Mockito.mock(HRegion.class);
+    FlushRegionEntry entry = new FlushRegionEntry(r, true);
+    FlushRegionEntry other = new FlushRegionEntry(r, true);
 
     assertEquals(entry.hashCode(), other.hashCode());
     assertEquals(entry, other);


Mime
View raw message