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

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

commit 49e0d6d428eed80dd8d96ab191c2d5062a9ed5dd
Author: Alexey Serbin <ale...@apache.org>
AuthorDate: Thu Apr 7 17:37:22 2022 -0700

    [tests] make one scenario of client-test more stable
    
    This patch makes ClientTest.TestScannerKeepAlive more stable.
    
    The motivation for this patch was seeing the following test
    failure in a TSAN build [1]:
    
      src/kudu/client/client-test.cc:2763
      Failed
      Bad status: Not found: Scanner 0d9072070e4443ba8c49b089806415b4 not found 
(it may have expired)
    
    Before: 2 out of 32 failed
      http://dist-test.cloudera.org/job?job_id=aserbin.1649379879.23423
    
    After:  0 out of 32 failed
      http://dist-test.cloudera.org/job?job_id=aserbin.1649381490.37476
    
    [1] http://jenkins.kudu.apache.org/job/kudu-gerrit/25299/BUILD_TYPE=TSAN
    
    Change-Id: Ia7ebddc5499d59e37282e4f1e6513bc5f83cdb8a
    Reviewed-on: http://gerrit.cloudera.org:8080/18396
    Reviewed-by: Yingchun Lai <acelyc1112...@gmail.com>
    Tested-by: Alexey Serbin <ale...@apache.org>
---
 src/kudu/client/client-test.cc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index 75b2bce1d..c8597bd29 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -2722,9 +2722,11 @@ int64_t SumResults(const KuduScanBatch& batch) {
 } // anonymous namespace
 
 TEST_F(ClientTest, TestScannerKeepAlive) {
+  SKIP_IF_SLOW_NOT_ALLOWED();
+
   NO_FATALS(InsertTestRows(client_table_.get(), 1000));
-  // Set the scanner ttl really low
-  FLAGS_scanner_ttl_ms = 100; // 100 milliseconds
+  // Set the scanner TTL low.
+  FLAGS_scanner_ttl_ms = 500;
   // Start a scan but don't get the whole data back
   KuduScanner scanner(client_table_.get());
   // This will make sure we have to do multiple NextBatch calls to the second 
tablet.
@@ -2756,9 +2758,11 @@ TEST_F(ClientTest, TestScannerKeepAlive) {
   sum += SumResults(batch);
   ASSERT_TRUE(scanner.HasMoreRows());
 
-  // Now loop while keeping the scanner alive. Each time we loop we sleep 1/2 
a scanner
-  // ttl interval (the garbage collector is running each 50 msecs too.).
-  for (int i = 0; i < 5; i++) {
+  // Now loop while keeping the scanner alive. Each loop we sleep about 1/10
+  // of the scanner's TTL interval to avoid flakiness due to scheduling
+  // anomalies. The garbage collector runs each 50 msec as well in this test
+  // scenario (controlled by FLAGS_scanner_gc_check_interval_us).
+  for (int i = 0; i < 15; i++) {
     SleepFor(MonoDelta::FromMilliseconds(50));
     ASSERT_OK(scanner.KeepAlive());
   }
@@ -2772,7 +2776,7 @@ TEST_F(ClientTest, TestScannerKeepAlive) {
   }
 
   ASSERT_TRUE(scanner.HasMoreRows());
-  for (int i = 0; i < 5; i++) {
+  for (int i = 0; i < 15; i++) {
     SleepFor(MonoDelta::FromMilliseconds(50));
     ASSERT_OK(scanner.KeepAlive());
   }

Reply via email to