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 2021/02/24 05:52:41 UTC

[kudu] branch master updated: [consensus] DriverType: rename REPLICA to FOLLOWER

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


The following commit(s) were added to refs/heads/master by this push:
     new 1d3cb5c  [consensus] DriverType: rename REPLICA to FOLLOWER
1d3cb5c is described below

commit 1d3cb5cba6fa09d646af3e93ce92632b129cab27
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue Feb 23 19:51:49 2021 -0800

    [consensus] DriverType: rename REPLICA to FOLLOWER
    
    I found it a bit confusing to have DriverType::REPLICA along with
    DriverType::LEADER in the consensus::DriverType enum.  In fact, both
    stand for Raft replica roles, where the former is for a follower and
    the latter is for a leader replica.  To resolve the confusion, this
    patch renames DriverType::REPLICA into DriverType::FOLLOWER.
    
    This patch does not contain any functional modifications.
    
    Change-Id: Id30d5df01f2ea192795aeb23e525399c6869b5d6
    Reviewed-on: http://gerrit.cloudera.org:8080/17113
    Tested-by: Kudu Jenkins
    Reviewed-by: Bankim Bhavsar <ba...@cloudera.com>
---
 src/kudu/consensus/consensus.proto | 6 +++---
 src/kudu/tablet/ops/op_driver.cc   | 4 ++--
 src/kudu/tablet/tablet_replica.cc  | 8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/kudu/consensus/consensus.proto b/src/kudu/consensus/consensus.proto
index 611ef3f..dea1eed 100644
--- a/src/kudu/consensus/consensus.proto
+++ b/src/kudu/consensus/consensus.proto
@@ -97,12 +97,12 @@ enum OperationType {
   PARTICIPANT_OP = 6;
 }
 
-// The op driver type: indicates whether an op is being executed on a leader or
-// a replica.
+// The op driver type: indicates whether an op is being executed on a leader
+// or follower replica.
 enum DriverType {
   UNKNOWN_DRIVER = 0;
   LEADER = 1;
-  REPLICA = 2;
+  FOLLOWER = 2;
 }
 
 // A configuration change request for the tablet with 'tablet_id'.
diff --git a/src/kudu/tablet/ops/op_driver.cc b/src/kudu/tablet/ops/op_driver.cc
index 82b0cbe..554e013 100644
--- a/src/kudu/tablet/ops/op_driver.cc
+++ b/src/kudu/tablet/ops/op_driver.cc
@@ -136,7 +136,7 @@ Status OpDriver::Init(unique_ptr<Op> op,
   }
   op_ = std::move(op);
 
-  if (type == consensus::REPLICA) {
+  if (type == consensus::FOLLOWER) {
     std::lock_guard<simple_spinlock> lock(opid_lock_);
     op_id_copy_ = op_->state()->op_id();
     DCHECK(op_id_copy_.IsInitialized());
@@ -290,7 +290,7 @@ Status OpDriver::Prepare() {
     // atomically with the change of the prepared state. Otherwise if the
     // prepare thread gets preempted after the state is prepared apply can be
     // triggered by another thread without the rpc being registered.
-    if (op_->type() == consensus::REPLICA) {
+    if (op_->type() == consensus::FOLLOWER) {
       RegisterFollowerOpOnResultTracker();
     // ... else we're a client-started op. Make sure we're still the driver of the
     // RPC and give up if we aren't.
diff --git a/src/kudu/tablet/tablet_replica.cc b/src/kudu/tablet/tablet_replica.cc
index 3aa9aca..7f810cb 100644
--- a/src/kudu/tablet/tablet_replica.cc
+++ b/src/kudu/tablet/tablet_replica.cc
@@ -732,7 +732,7 @@ Status TabletReplica::StartFollowerOp(const scoped_refptr<ConsensusRound>& round
               &replicate_msg->write_request(),
               replicate_msg->has_request_id() ? &replicate_msg->request_id() : nullptr));
       op_state->SetResultTracker(result_tracker_);
-      op.reset(new WriteOp(std::move(op_state), consensus::REPLICA));
+      op.reset(new WriteOp(std::move(op_state), consensus::FOLLOWER));
       break;
     }
     case PARTICIPANT_OP:
@@ -745,7 +745,7 @@ Status TabletReplica::StartFollowerOp(const scoped_refptr<ConsensusRound>& round
               tablet_->txn_participant(),
               &replicate_msg->participant_request()));
       op_state->SetResultTracker(result_tracker_);
-      op.reset(new ParticipantOp(std::move(op_state), consensus::REPLICA));
+      op.reset(new ParticipantOp(std::move(op_state), consensus::FOLLOWER));
       break;
     }
     case ALTER_SCHEMA_OP:
@@ -756,7 +756,7 @@ Status TabletReplica::StartFollowerOp(const scoped_refptr<ConsensusRound>& round
           new AlterSchemaOpState(this, &replicate_msg->alter_schema_request(),
                                  nullptr));
       op.reset(
-          new AlterSchemaOp(std::move(op_state), consensus::REPLICA));
+          new AlterSchemaOp(std::move(op_state), consensus::FOLLOWER));
       break;
     }
     default:
@@ -840,7 +840,7 @@ Status TabletReplica::NewReplicaOpDriver(unique_ptr<Op> op,
     prepare_pool_token_.get(),
     apply_pool_,
     &op_order_verifier_);
-  RETURN_NOT_OK(op_driver->Init(std::move(op), consensus::REPLICA));
+  RETURN_NOT_OK(op_driver->Init(std::move(op), consensus::FOLLOWER));
   *driver = std::move(op_driver);
 
   return Status::OK();