kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] 01/02: master: plumb metric for master leadership
Date Mon, 09 Mar 2020 04:11:03 GMT
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 f2ebb30d161df319050170114eb8e54561de91bb
Author: Andrew Wong <awong@cloudera.com>
AuthorDate: Sun Mar 8 11:58:55 2020 -0700

    master: plumb metric for master leadership
    
    Change-Id: Ie6972a1b9f803e3e4f293c67b035f5e924c67df2
    Reviewed-on: http://gerrit.cloudera.org:8080/15386
    Reviewed-by: Adar Dembo <adar@cloudera.com>
    Tested-by: Kudu Jenkins
---
 src/kudu/integration-tests/master_replication-itest.cc | 7 +++++--
 src/kudu/master/sys_catalog.cc                         | 3 +--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/kudu/integration-tests/master_replication-itest.cc b/src/kudu/integration-tests/master_replication-itest.cc
index 4f586cf..d527feb 100644
--- a/src/kudu/integration-tests/master_replication-itest.cc
+++ b/src/kudu/integration-tests/master_replication-itest.cc
@@ -206,16 +206,19 @@ TEST_F(MasterReplicationTest, TestSysTablesReplication) {
   // so we need to loop and try all masters.
   while (true) {
     for (int i = 0; i < cluster_->num_masters(); i++) {
-      CatalogManager* catalog =
-          cluster_->mini_master(i)->master()->catalog_manager();
+      Master* master = cluster_->mini_master(i)->master();
+      CatalogManager* catalog = master->catalog_manager();
       CatalogManager::ScopedLeaderSharedLock l(catalog);
       if (l.first_failed_status().ok()) {
+        ASSERT_EQ(1, master->num_raft_leaders()->value());
         bool exists;
         ASSERT_OK(catalog->TableNameExists(kTableId1, &exists));
         ASSERT_TRUE(exists);
         ASSERT_OK(catalog->TableNameExists(kTableId2, &exists));
         ASSERT_TRUE(exists);
         return;
+      } else {
+        ASSERT_EQ(0, master->num_raft_leaders()->value());
       }
     }
     SleepFor(MonoDelta::FromMilliseconds(1));
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index 164b278..5d02dc9 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -401,9 +401,8 @@ Status SysCatalogTable::SetupTablet(
       Bind(&SysCatalogTable::SysCatalogStateChanged,
            Unretained(this),
            metadata->tablet_id())));
-  // TODO(awong): plumb master_->num_raft_leaders() here.
   RETURN_NOT_OK_SHUTDOWN(tablet_replica_->Init({ /*quiescing*/nullptr,
-                                                 /*num_leaders*/nullptr,
+                                                 master_->num_raft_leaders(),
                                                  master_->raft_pool() }),
                          "failed to initialize system catalog replica");
 


Mime
View raw message