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 2015/05/13 18:43:29 UTC

hbase git commit: HBASE-11830 TestReplicationThrottler.testThrottling failed on virtual boxes

Repository: hbase
Updated Branches:
  refs/heads/master 86b91997d -> 94937ddaf


HBASE-11830 TestReplicationThrottler.testThrottling failed on virtual boxes


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

Branch: refs/heads/master
Commit: 94937ddaf25b6eac69b2c7de1c127f9d3de12306
Parents: 86b9199
Author: stack <st...@apache.org>
Authored: Wed May 13 09:43:16 2015 -0700
Committer: stack <st...@apache.org>
Committed: Wed May 13 09:43:16 2015 -0700

----------------------------------------------------------------------
 .../regionserver/TestReplicationThrottler.java  | 27 +++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/94937dda/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationThrottler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationThrottler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationThrottler.java
index 692e9be..e3397a4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationThrottler.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationThrottler.java
@@ -65,8 +65,15 @@ public class TestReplicationThrottler {
     //    sleep 1000/100 = 10 cycles = 1s and make throttler2 sleep 1000/10
     //    = 100 cycles = 10s before the second push occurs -- amortize case
     //    after amortizing, both cycleStartTick and cyclePushSize are reset
-    assertTrue(ticks1 == 1000 || ticks1 == 999);
-    assertTrue(ticks2 == 10000 || ticks2 == 9999);
+    //
+    // Note: in a slow machine, the sleep interval might be less than ideal ticks.
+    // If it is 75% of expected value, its is still acceptable.
+    if (ticks1 != 1000 && ticks1 != 999) {
+      assertTrue(ticks1 >= 750 && ticks1 <=1000);
+    }
+    if (ticks2 != 10000 && ticks2 != 9999) {
+      assertTrue(ticks1 >= 7500 && ticks1 <=10000);
+    }
 
     throttler1.resetStartTick();
     throttler2.resetStartTick();
@@ -83,7 +90,9 @@ public class TestReplicationThrottler {
     // note: in real case, sleep time should cover time elapses during push
     //       operation
     assertTrue(ticks1 == 0);
-    assertTrue(ticks2 == 100 || ticks2 == 99);
+    if (ticks2 != 100 && ticks2 != 99) {
+      assertTrue(ticks1 >= 75 && ticks1 <=100);
+    }
 
     throttler2.resetStartTick();
 
@@ -96,9 +105,13 @@ public class TestReplicationThrottler {
     // 4. when the fourth push(60) arrives and throttling(60) is called, throttler1
     //    delay to next cycle since 45+60 == 105; and throttler2 should firstly sleep
     //    ceiling(45/10)= 5 cycles = 500ms to amortize previous push
-    // note: in real case, sleep time should cover time elapses during push
-    //       operation
-    assertTrue(ticks1 == 100 || ticks1 == 99);
-    assertTrue(ticks2 == 500 || ticks2 == 499);
+    //
+    // Note: in real case, sleep time should cover time elapses during push operation
+    if (ticks1 != 100 && ticks1 != 99) {
+      assertTrue(ticks1 >= 75 && ticks1 <=100);
+    }
+    if (ticks2 != 500 && ticks2 != 499) {
+      assertTrue(ticks1 >= 375 && ticks1 <=500);
+    }
   }
 }