You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2020/01/07 17:49:30 UTC

[kudu] 03/03: test: deflake RaftConsensusNumLeadersMetricTest TestNumLeadersMetric

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

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

commit 50a4b763f09ff6a4a8955dd213e0e37a94e38b92
Author: Andrew Wong <aw...@cloudera.com>
AuthorDate: Mon Jan 6 19:17:01 2020 -0800

    test: deflake RaftConsensusNumLeadersMetricTest TestNumLeadersMetric
    
    The test previously wouldn't wait for all tablets to be up and running
    on every tserver before doing stuff. This led to errors when attempting
    to start elections, since the StartElection RPC would be eaten and never
    retried, leaving some tablets with no leader.
    
    The fix is to wait for every tserver to have all running tablets.
    
    Before this fix, the test would fail in TSAN mode 6/1000 times. With it,
    it passed 1000/1000.
    
    Change-Id: I4ef4651e4562ac274982773ebb8c46e5137e38b5
    Reviewed-on: http://gerrit.cloudera.org:8080/14980
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/integration-tests/raft_consensus_election-itest.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/kudu/integration-tests/raft_consensus_election-itest.cc b/src/kudu/integration-tests/raft_consensus_election-itest.cc
index aed18a6..322e05f 100644
--- a/src/kudu/integration-tests/raft_consensus_election-itest.cc
+++ b/src/kudu/integration-tests/raft_consensus_election-itest.cc
@@ -371,8 +371,10 @@ TEST_P(RaftConsensusNumLeadersMetricTest, TestNumLeadersMetric) {
   vector<string> tablet_ids;
   ASSERT_EVENTUALLY([&] {
     vector<string> tablets;
-    ASSERT_OK(ListRunningTabletIds(ts, kTimeout, &tablets));
-    ASSERT_EQ(kNumTablets, tablets.size());
+    for (const auto& ts_iter : tablet_servers_) {
+      ASSERT_OK(ListRunningTabletIds(ts_iter.second, kTimeout, &tablets));
+      ASSERT_EQ(kNumTablets, tablets.size());
+    }
     tablet_ids = std::move(tablets);
   });