You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mp...@apache.org on 2018/02/12 23:30:48 UTC

[3/4] kudu git commit: cmeta: Use more efficient form of GetConsensusRole()

cmeta: Use more efficient form of GetConsensusRole()

Now that there is a form of GetConsensusRole() that can be called
without instantiating an instance of ConsensusStatePB, which requires a
bunch of string copies, let's use that for
ConsensusMetadata::UpdateActiveRole() instead.

Change-Id: Ia192d75ffef614e2c1832df85c1332cb13d49f39
Reviewed-on: http://gerrit.cloudera.org:8080/9261
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <as...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/8760bb0b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/8760bb0b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/8760bb0b

Branch: refs/heads/master
Commit: 8760bb0b787b8b457ae77c7bd42b90284b226b9b
Parents: 17f9753
Author: Mike Percy <mp...@apache.org>
Authored: Thu Feb 8 14:56:39 2018 -0800
Committer: Mike Percy <mp...@apache.org>
Committed: Mon Feb 12 23:29:46 2018 +0000

----------------------------------------------------------------------
 src/kudu/consensus/consensus_meta.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/8760bb0b/src/kudu/consensus/consensus_meta.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus_meta.cc b/src/kudu/consensus/consensus_meta.cc
index 8e6a6a6..b075134 100644
--- a/src/kudu/consensus/consensus_meta.cc
+++ b/src/kudu/consensus/consensus_meta.cc
@@ -314,10 +314,10 @@ std::string ConsensusMetadata::LogPrefix() const {
 
 void ConsensusMetadata::UpdateActiveRole() {
   DFAKE_SCOPED_RECURSIVE_LOCK(fake_lock_);
-  ConsensusStatePB cstate = ToConsensusStatePB();
-  active_role_ = GetConsensusRole(peer_uuid_, cstate);
+  active_role_ = GetConsensusRole(peer_uuid_, leader_uuid_, ActiveConfig());
   VLOG_WITH_PREFIX(1) << "Updating active role to " << RaftPeerPB::Role_Name(active_role_)
-                      << ". Consensus state: " << pb_util::SecureShortDebugString(cstate);
+                      << ". Consensus state: "
+                      << pb_util::SecureShortDebugString(ToConsensusStatePB());
 }
 
 Status ConsensusMetadata::UpdateOnDiskSize() {