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 21:44:04 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 7bbbaaeb5 -> 973961b23


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/973961b2
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/973961b2
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/973961b2

Branch: refs/heads/branch-1.0
Commit: 973961b23fc6f3e4748ae7a213c9a89ff89dbb33
Parents: 7bbbaae
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Jan 23 13:43:56 2015 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Jan 23 13:43:56 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/973961b2/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 53d1ed2..51d7060 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
@@ -614,7 +614,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
@@ -634,7 +635,6 @@ class MemStoreFlusher implements FlushRequester {
     public boolean equals(Object obj) {
       return (this == obj);
     }
-
   }
 
   /**
@@ -694,8 +694,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
@@ -705,7 +711,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/973961b2/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 00bf09b..470ff60 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
@@ -33,8 +33,9 @@ public class TestFlushRegionEntry {
 
   @Test
   public void test() {
-    FlushRegionEntry entry = new FlushRegionEntry(Mockito.mock(HRegion.class));
-    FlushRegionEntry other = new FlushRegionEntry(Mockito.mock(HRegion.class));
+    HRegion r = Mockito.mock(HRegion.class);
+    FlushRegionEntry entry = new FlushRegionEntry(r);
+    FlushRegionEntry other = new FlushRegionEntry(r);
 
     assertEquals(entry.hashCode(), other.hashCode());
     assertEquals(entry, other);
@@ -44,4 +45,4 @@ public class TestFlushRegionEntry {
   public void teardown() {
     EnvironmentEdgeManager.reset();
   }
-}
\ No newline at end of file
+}


Mime
View raw message