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

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

commit 2c0bb26bab0110659b37ba7c31ebd761ffc9980b
Author: Andrew Wong <[email protected]>
AuthorDate: Wed Sep 16 13:22:10 2020 -0700

    test: deflake tablet_server_quiescing-itest
    
    It was possible that TestScansRetry would fail with more than the one
    active scanner at the end of the test. This is possible because the
    client scanner in the test that may have lingering retries from a
    previous scan attmpts.
    
    This patch updates to allow for multiple scan attempts, since it doesn't
    detract from testing the fact that the keep-alive calls are working.
    
    It also reenstates the quiescing state before calling the keep-alives,
    which appears to be the original intent based on comments.
    
    Change-Id: Ib6525b913cbe9acbdbc59d8a52df81c85327d0c7
    Reviewed-on: http://gerrit.cloudera.org:8080/16463
    Reviewed-by: Grant Henke <[email protected]>
    Tested-by: Kudu Jenkins
---
 src/kudu/integration-tests/tablet_server_quiescing-itest.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/kudu/integration-tests/tablet_server_quiescing-itest.cc 
b/src/kudu/integration-tests/tablet_server_quiescing-itest.cc
index 5ece984..2fc6eb5 100644
--- a/src/kudu/integration-tests/tablet_server_quiescing-itest.cc
+++ b/src/kudu/integration-tests/tablet_server_quiescing-itest.cc
@@ -628,9 +628,9 @@ TEST_P(TServerQuiescingParamITest, TestScansRetry) {
   // This should result in a failure to start scanning anything.
   shared_ptr<KuduTable> table;
   ASSERT_OK(client_->OpenTable(table_name, &table));
-  KuduScanner scanner(table.get());
-  ASSERT_OK(scanner.SetTimeoutMillis(1000));
   {
+    KuduScanner scanner(table.get());
+    ASSERT_OK(scanner.SetTimeoutMillis(1000));
     Status s = scanner.Open();
     ASSERT_TRUE(s.IsTimedOut()) << s.ToString();
     ASSERT_STR_CONTAINS(s.ToString(), "exceeded configured scan timeout");
@@ -645,14 +645,19 @@ TEST_P(TServerQuiescingParamITest, TestScansRetry) {
   auto* ts = cluster_->mini_tablet_server(0)->server();
   *ts->mutable_quiescing() = false;
   KuduScanBatch batch;
+  KuduScanner scanner(table.get());
   ASSERT_OK(scanner.Open());
   ASSERT_OK(scanner.NextBatch(&batch));
 
   // Keep the scanner alive, even as we're quiescing.
   const auto past_original_expiration =
       MonoTime::Now() + MonoDelta::FromMilliseconds(2 * FLAGS_scanner_ttl_ms);
+  *ts->mutable_quiescing() = true;
   while (MonoTime::Now() < past_original_expiration) {
-    ASSERT_EQ(1, ts->scanner_manager()->CountActiveScanners());
+    // NOTE: despite destructing the first KuduScanner, the first Open() call
+    // may still have in-flight scans running that may yield an active scanner
+    // on the tserver, so we can only check that at least one scanner exists.
+    ASSERT_LE(1, ts->scanner_manager()->CountActiveScanners());
     ASSERT_OK(scanner.KeepAlive());
     SleepFor(MonoDelta::FromMilliseconds(10));
   }

Reply via email to