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 d119d529beb691a84134d02e33ecdce6102a7a35
Author: Adar Dembo <[email protected]>
AuthorDate: Wed Oct 2 23:06:36 2019 -0700

    create-table-itest: deflake TestCreateWhenMajorityOfReplicasFailCreation
    
    The last check in this test only had 10s to complete, which isn't enough in
    TSAN builds due to KUDU-2963. Let's replace it with an ASSERT_EVENTUALLY
    which, besides being cleaner, also gives it more time to finish.
    
    Change-Id: I37da7ea12f5432b947200fe8f08540e7b1ecbcec
    Reviewed-on: http://gerrit.cloudera.org:8080/14358
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <[email protected]>
---
 src/kudu/integration-tests/create-table-itest.cc | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/kudu/integration-tests/create-table-itest.cc 
b/src/kudu/integration-tests/create-table-itest.cc
index ba7fc39..6d41b57 100644
--- a/src/kudu/integration-tests/create-table-itest.cc
+++ b/src/kudu/integration-tests/create-table-itest.cc
@@ -140,15 +140,17 @@ TEST_F(CreateTableITest, 
TestCreateWhenMajorityOfReplicasFailCreation) {
   // The server that was up from the beginning should be left with only
   // one tablet, eventually, since the tablets which failed to get created
   // properly should get deleted.
-  vector<string> tablets;
-  int wait_iter = 0;
-  while (tablets.size() != 1 && wait_iter++ < 100) {
+  //
+  // Note that the tablet count can rise before it falls due to the server
+  // handling a mix of obsolete CreateTablet RPCs (see KUDU-2963 for more
+  // details). This test isn't terribly precise; we may catch the server with
+  // just one tablet during the "upswing", before reaching the steady state.
+  ASSERT_EVENTUALLY([&] {
+    vector<string> tablets = inspect_->ListTabletsWithDataOnTS(0);
     LOG(INFO) << "Waiting for only one tablet to be left on TS 0. Currently 
have: "
               << tablets;
-    SleepFor(MonoDelta::FromMilliseconds(100));
-    tablets = inspect_->ListTabletsWithDataOnTS(0);
-  }
-  ASSERT_EQ(1, tablets.size()) << "Tablets on TS0: " << tablets;
+    ASSERT_EQ(1, tablets.size()) << "Tablets on TS0: " << tablets;
+  });
 }
 
 // Regression test for KUDU-1317. Ensure that, when a table is created,

Reply via email to