This is an automated email from the ASF dual-hosted git repository.

mgreber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new d2a9636e3 KUDU-3611: fix flakiness in one scenario of rpc-test
d2a9636e3 is described below

commit d2a9636e30b41593ccf056bbae9d47e10aa3b193
Author: Alexey Serbin <ale...@apache.org>
AuthorDate: Wed Aug 21 22:27:14 2024 -0700

    KUDU-3611: fix flakiness in one scenario of rpc-test
    
    This patch addresses a rare flakiness in the
    TestRpc.TimedOutOnResponseMetricServiceQueue scenario.
    
    Change-Id: I080e5ea5beaa74e0220bc6ae14d2f926d5602f0f
    Reviewed-on: http://gerrit.cloudera.org:8080/21710
    Tested-by: Kudu Jenkins
    Reviewed-by: Marton Greber <greber...@gmail.com>
---
 src/kudu/rpc/rpc-test.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/kudu/rpc/rpc-test.cc b/src/kudu/rpc/rpc-test.cc
index 74284735c..1efbe8ebb 100644
--- a/src/kudu/rpc/rpc-test.cc
+++ b/src/kudu/rpc/rpc-test.cc
@@ -1423,8 +1423,13 @@ TEST_P(TestRpc, TimedOutOnResponseMetricServiceQueue) {
   // Wait for the completion of both requests sent asynchronously above.
   latch.Wait();
 
-  // The have been 3 requests total in this scenario.
-  ASSERT_EQ(3, latency_histogram->TotalCount());
+  // The Histogram::TotalCount() metric is read in lock-free/no-barrier manner,
+  // so ASSERT_EVENTUALLY helps in very rare cases when TotalCount() reads
+  // something less than 3 in the very first pass.
+  ASSERT_EVENTUALLY([&]{
+    // There were three requests in total: the warm-up one and req0, req1.
+    ASSERT_EQ(3, latency_histogram->TotalCount());
+  });
 
   // The first RPC should return OK.
   ASSERT_OK(ctl0.status());

Reply via email to