Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8EEF018B70 for ; Wed, 13 May 2015 16:43:29 +0000 (UTC) Received: (qmail 82965 invoked by uid 500); 13 May 2015 16:43:29 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 82923 invoked by uid 500); 13 May 2015 16:43:29 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 82914 invoked by uid 99); 13 May 2015 16:43:29 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2015 16:43:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C614DFC81; Wed, 13 May 2015 16:43:29 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-11830 TestReplicationThrottler.testThrottling failed on virtual boxes Date: Wed, 13 May 2015 16:43:29 +0000 (UTC) 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 Authored: Wed May 13 09:43:16 2015 -0700 Committer: stack 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); + } } }