hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yangzhe1...@apache.org
Subject hbase git commit: HBASE-18390 Sleep too long when finding region location failed
Date Wed, 19 Jul 2017 04:08:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 af359d03b -> 980209579


HBASE-18390 Sleep too long when finding region location failed


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

Branch: refs/heads/branch-1
Commit: 980209579ba13cc1fecc1e2ce5403b38877600bf
Parents: af359d0
Author: Phil Yang <yangzhe1991@apache.org>
Authored: Wed Jul 19 11:34:57 2017 +0800
Committer: Phil Yang <yangzhe1991@apache.org>
Committed: Wed Jul 19 12:05:21 2017 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/client/ConnectionUtils.java    | 14 --------------
 .../client/RegionAdminServiceCallable.java      |  9 +--------
 .../hbase/client/RegionServerCallable.java      |  9 +--------
 .../hbase/client/TestConnectionUtils.java       | 20 --------------------
 4 files changed, 2 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/98020957/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
index 7155659..96e7788 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java
@@ -74,20 +74,6 @@ public class ConnectionUtils {
 
 
   /**
-   * Adds / subs an up to 50% jitter to a pause time. Minimum is 1.
-   * @param pause the expected pause.
-   * @param jitter the jitter ratio, between 0 and 1, exclusive.
-   */
-  public static long addJitter(final long pause, final float jitter) {
-    float lag = pause * (ThreadLocalRandom.current().nextFloat() - 0.5f) * jitter;
-    long newPause = pause + (long) lag;
-    if (newPause <= 0) {
-      return 1;
-    }
-    return newPause;
-  }
-
-  /**
    * @param conn The connection for which to replace the generator.
    * @param cnm Replaces the nonce generator used, for testing.
    * @return old nonce generator.

http://git-wip-us.apache.org/repos/asf/hbase/blob/98020957/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java
index 675a2f9..386925e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionAdminServiceCallable.java
@@ -50,8 +50,6 @@ public abstract class RegionAdminServiceCallable<T> implements RetryingCallable<
   protected final byte[] row;
   protected final int replicaId;
 
-  protected final static int MIN_WAIT_DEAD_SERVER = 10000;
-
   public RegionAdminServiceCallable(ClusterConnection connection,
       RpcControllerFactory rpcControllerFactory, TableName tableName, byte[] row) {
     this(connection, rpcControllerFactory, null, tableName, row);
@@ -138,12 +136,7 @@ public abstract class RegionAdminServiceCallable<T> implements
RetryingCallable<
 
   @Override
   public long sleep(long pause, int tries) {
-    long sleep = ConnectionUtils.getPauseTime(pause, tries);
-    if (sleep < MIN_WAIT_DEAD_SERVER
-        && (location == null || connection.isDeadServer(location.getServerName())))
{
-      sleep = ConnectionUtils.addJitter(MIN_WAIT_DEAD_SERVER, 0.10f);
-    }
-    return sleep;
+    return ConnectionUtils.getPauseTime(pause, tries);
   }
 
   public static RegionLocations getRegionLocations(

http://git-wip-us.apache.org/repos/asf/hbase/blob/98020957/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
index b446c3f..e0b09f3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionServerCallable.java
@@ -51,8 +51,6 @@ public abstract class RegionServerCallable<T> implements RetryingCallable<T>
{
   protected HRegionLocation location;
   private ClientService.BlockingInterface stub;
 
-  protected final static int MIN_WAIT_DEAD_SERVER = 10000;
-
   /**
    * @param connection Connection to use.
    * @param tableName Table name to which <code>row</code> belongs.
@@ -134,12 +132,7 @@ public abstract class RegionServerCallable<T> implements RetryingCallable<T>
{
 
   @Override
   public long sleep(long pause, int tries) {
-    long sleep = ConnectionUtils.getPauseTime(pause, tries);
-    if (sleep < MIN_WAIT_DEAD_SERVER
-        && (location == null || getConnection().isDeadServer(location.getServerName())))
{
-      sleep = ConnectionUtils.addJitter(MIN_WAIT_DEAD_SERVER, 0.10f);
-    }
-    return sleep;
+    return ConnectionUtils.getPauseTime(pause, tries);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/98020957/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionUtils.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionUtils.java
index c148eb0..3d449ae 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestConnectionUtils.java
@@ -55,26 +55,6 @@ public class TestConnectionUtils {
   }
 
   @Test
-  public void testAddJitter() {
-    long basePause = 10000;
-    long maxTimeExpected = (long) (basePause * 1.25f);
-    long minTimeExpected = (long) (basePause * 0.75f);
-    int testTries = 100;
-
-    Set<Long> timeSet = new TreeSet<Long>();
-    for (int i = 0; i < testTries; i++) {
-      long withJitter = ConnectionUtils.addJitter(basePause, 0.5f);
-      assertTrue(withJitter >= minTimeExpected);
-      assertTrue(withJitter <= maxTimeExpected);
-      // Add the long to the set
-      timeSet.add(withJitter);
-    }
-
-    //Make sure that most are unique.  some overlap will happen
-    assertTrue(timeSet.size() > (testTries * 0.90));
-  }
-
-  @Test
   public void testGetPauseTime() {
     long pauseTime;
     long baseTime = 100;


Mime
View raw message