You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2017/10/17 21:54:21 UTC

kudu git commit: consensus: Rename CHANGE_ROLE op => CHANGE_REPLICA_TYPE

Repository: kudu
Updated Branches:
  refs/heads/master 827c35bc3 -> abbfa49de


consensus: Rename CHANGE_ROLE op => CHANGE_REPLICA_TYPE

"Role" is currently a pretty ambiguous term in Kudu because role is
currently defined as LEADER, FOLLOWER, LEARNER, etc. "member_type" is
the standard type name but "replica" is more descriptive. Let's rename
this operation CHANGE_REPLICA_TYPE.

This is a wire-compatible change.

Change-Id: I29c8bed1f6b5c84b86be3997b76ac4f825fa2f0e
Reviewed-on: http://gerrit.cloudera.org:8080/8295
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/abbfa49d
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/abbfa49d
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/abbfa49d

Branch: refs/heads/master
Commit: abbfa49dee52d49dc4658c1ef57ed8467e43bb5d
Parents: 827c35b
Author: Mike Percy <mp...@apache.org>
Authored: Tue Oct 10 12:56:13 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Tue Oct 17 21:50:28 2017 +0000

----------------------------------------------------------------------
 src/kudu/consensus/consensus.proto   | 2 +-
 src/kudu/consensus/raft_consensus.cc | 4 ++--
 src/kudu/tools/tool_action_tablet.cc | 7 ++++---
 3 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/abbfa49d/src/kudu/consensus/consensus.proto
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/consensus.proto b/src/kudu/consensus/consensus.proto
index c2acf7b..c8abd5d 100644
--- a/src/kudu/consensus/consensus.proto
+++ b/src/kudu/consensus/consensus.proto
@@ -120,7 +120,7 @@ enum ChangeConfigType {
   UNKNOWN_CHANGE = 0;
   ADD_SERVER = 1;
   REMOVE_SERVER = 2;
-  CHANGE_ROLE = 3;
+  CHANGE_REPLICA_TYPE = 3;
 }
 
 // A configuration change request for the tablet with 'tablet_id'.

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbfa49d/src/kudu/consensus/raft_consensus.cc
----------------------------------------------------------------------
diff --git a/src/kudu/consensus/raft_consensus.cc b/src/kudu/consensus/raft_consensus.cc
index 66a3c81..581bace 100644
--- a/src/kudu/consensus/raft_consensus.cc
+++ b/src/kudu/consensus/raft_consensus.cc
@@ -1646,8 +1646,8 @@ Status RaftConsensus::ChangeConfig(const ChangeConfigRequestPB& req,
         }
         break;
 
-      // TODO: Support role change.
-      case CHANGE_ROLE:
+      // TODO(mpercy): Support changing between VOTER and NON_VOTER.
+      case CHANGE_REPLICA_TYPE:
       default:
         return Status::NotSupported("Role change is not yet implemented.");
     }

http://git-wip-us.apache.org/repos/asf/kudu/blob/abbfa49d/src/kudu/tools/tool_action_tablet.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tools/tool_action_tablet.cc b/src/kudu/tools/tool_action_tablet.cc
index 3677cf9..8faa214 100644
--- a/src/kudu/tools/tool_action_tablet.cc
+++ b/src/kudu/tools/tool_action_tablet.cc
@@ -166,7 +166,8 @@ Status DoChangeConfig(const vector<string>& master_addresses,
   if (cc_type == consensus::REMOVE_SERVER && member_type) {
     return Status::InvalidArgument("cannot supply Raft member type when removing a server");
   }
-  if ((cc_type == consensus::ADD_SERVER || cc_type == consensus::CHANGE_ROLE) && !member_type) {
+  if ((cc_type == consensus::ADD_SERVER || cc_type == consensus::CHANGE_REPLICA_TYPE) &&
+      !member_type) {
     return Status::InvalidArgument(
         "must specify member type when adding a server or changing member type");
   }
@@ -219,7 +220,7 @@ Status ChangeConfig(const RunnerContext& context, ChangeConfigType cc_type) {
   const string& tablet_id = FindOrDie(context.required_args, kTabletIdArg);
   const string& replica_uuid = FindOrDie(context.required_args, kTsUuidArg);
   boost::optional<RaftPeerPB::MemberType> member_type;
-  if (cc_type == consensus::ADD_SERVER || cc_type == consensus::CHANGE_ROLE) {
+  if (cc_type == consensus::ADD_SERVER || cc_type == consensus::CHANGE_REPLICA_TYPE) {
     const string& replica_type = FindOrDie(context.required_args, kReplicaTypeArg);
     string uppercase_peer_type;
     ToUpperCase(replica_type, &uppercase_peer_type);
@@ -238,7 +239,7 @@ Status AddReplica(const RunnerContext& context) {
 }
 
 Status ChangeReplicaType(const RunnerContext& context) {
-  return ChangeConfig(context, consensus::CHANGE_ROLE);
+  return ChangeConfig(context, consensus::CHANGE_REPLICA_TYPE);
 }
 
 Status RemoveReplica(const RunnerContext& context) {