You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2016/12/12 04:55:13 UTC

[3/5] kudu git commit: Make tablet_copy-itest less flaky

Make tablet_copy-itest less flaky

The test TestDisableTabletCopy_NoTightLoopWhenTabletDeleted sometimes
sleeps longer than 1 second when we call SleepFor() due to system load,
so we average our "per second" calculation over the time actually
elapsed.

Also bump slightly the number of log messages we tolerate due to
spurious log messages for unrelated components.

Change-Id: I5132d3ea99a8ecd05191a576edca83ffb210a90e
Reviewed-on: http://gerrit.cloudera.org:8080/5441
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


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

Branch: refs/heads/master
Commit: 88745f32ca5ba69041170173ecede34c2ed85a39
Parents: 28a07bf
Author: Mike Percy <mp...@apache.org>
Authored: Wed Dec 7 15:42:36 2016 +0000
Committer: Todd Lipcon <to...@apache.org>
Committed: Mon Dec 12 04:39:21 2016 +0000

----------------------------------------------------------------------
 src/kudu/integration-tests/tablet_copy-itest.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/88745f32/src/kudu/integration-tests/tablet_copy-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/tablet_copy-itest.cc b/src/kudu/integration-tests/tablet_copy-itest.cc
index 4d2482d..41980db 100644
--- a/src/kudu/integration-tests/tablet_copy-itest.cc
+++ b/src/kudu/integration-tests/tablet_copy-itest.cc
@@ -711,18 +711,23 @@ TEST_F(TabletCopyITest, TestDisableTabletCopy_NoTightLoopWhenTabletDeleted) {
   // Ensure that, if we sleep for a second while still doing writes to the leader:
   // a) we don't spew logs on the leader side
   // b) we don't get hit with a lot of UpdateConsensus calls on the replica.
+  MonoTime start = MonoTime::Now();
   int64_t num_update_rpcs_initial = CountUpdateConsensusCalls(replica_ets, tablet_id);
   int64_t num_logs_initial = CountLogMessages(leader_ts);
 
   SleepFor(MonoDelta::FromSeconds(1));
   int64_t num_update_rpcs_after_sleep = CountUpdateConsensusCalls(replica_ets, tablet_id);
   int64_t num_logs_after_sleep = CountLogMessages(leader_ts);
+  MonoTime end = MonoTime::Now();
+  MonoDelta elapsed = end - start;
 
   // Calculate rate per second of RPCs and log messages
-  int64_t update_rpcs_per_second = num_update_rpcs_after_sleep - num_update_rpcs_initial;
+  int64_t update_rpcs_per_second =
+      (num_update_rpcs_after_sleep - num_update_rpcs_initial) / elapsed.ToSeconds();
   EXPECT_LT(update_rpcs_per_second, 20);
-  int64_t num_logs_per_second = num_logs_after_sleep - num_logs_initial;
-  EXPECT_LT(num_logs_per_second, 20);
+  int64_t num_logs_per_second =
+      (num_logs_after_sleep - num_logs_initial) / elapsed.ToSeconds();
+  EXPECT_LT(num_logs_per_second, 30); // We might occasionally get unrelated log messages.
 }
 
 // Test that if a Tablet Copy is taking a long time but the client peer is still responsive,