kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/5] kudu git commit: rpc-test: fix multi-threaded test from running too long
Date Fri, 30 Mar 2018 18:33:05 GMT
rpc-test: fix multi-threaded test from running too long

In TSAN builds this test was taking several minutes. This makes the test
run based on a timer rather than an explicit count.

Change-Id: I827a07d5b1d2463cb845ef6b04ec36036b2ddfbb
Reviewed-on: http://gerrit.cloudera.org:8080/9856
Reviewed-by: Sailesh Mukil <sailesh@cloudera.com>
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Todd Lipcon <todd@apache.org>


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

Branch: refs/heads/master
Commit: 5508ae7c7e81a026abd2786bd958de4774d56458
Parents: bae6170
Author: Todd Lipcon <todd@apache.org>
Authored: Thu Mar 29 13:57:08 2018 -0700
Committer: Todd Lipcon <todd@apache.org>
Committed: Fri Mar 30 01:58:04 2018 +0000

----------------------------------------------------------------------
 src/kudu/rpc/rpc-test.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5508ae7c/src/kudu/rpc/rpc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/rpc-test.cc b/src/kudu/rpc/rpc-test.cc
index 85f82eb..61a619f 100644
--- a/src/kudu/rpc/rpc-test.cc
+++ b/src/kudu/rpc/rpc-test.cc
@@ -1264,7 +1264,11 @@ static void SendAndCancelRpcs(Proxy* p, const Slice& slice) {
   // Used to generate sleep time between invoking RPC and requesting cancellation.
   Random rand(SeedRandom());
 
-  for (int i = 0; i < 40; ++i) {
+  auto end_time = MonoTime::Now() + MonoDelta::FromSeconds(
+    AllowSlowTests() ? 15 : 3);
+
+  int i = 0;
+  while (MonoTime::Now() < end_time) {
     controller.Reset();
     PushTwoStringsRequestPB request;
     PushTwoStringsResponsePB resp;
@@ -1279,7 +1283,7 @@ static void SendAndCancelRpcs(Proxy* p, const Slice& slice) {
                     request, &resp, &controller,
                     boost::bind(&CountDownLatch::CountDown, boost::ref(latch)));
 
-    if ((i % 8) != 0) {
+    if ((i++ % 8) != 0) {
       // Sleep for a while before cancelling the RPC.
       SleepFor(MonoDelta::FromMicroseconds(rand.Uniform64(100)));
       controller.Cancel();


Mime
View raw message