kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [1/5] kudu git commit: Rename TabletPeer to TabletReplica
Date Thu, 04 May 2017 22:14:26 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 14e9d3d26 -> 7f72105b7


http://git-wip-us.apache.org/repos/asf/kudu/blob/7f72105b/src/kudu/tserver/tablet_service.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_service.h b/src/kudu/tserver/tablet_service.h
index 8a9f102..f378e34 100644
--- a/src/kudu/tserver/tablet_service.h
+++ b/src/kudu/tserver/tablet_service.h
@@ -38,14 +38,14 @@ class ServerBase;
 
 namespace tablet {
 class Tablet;
-class TabletPeer;
+class TabletReplica;
 class TransactionState;
 } // namespace tablet
 
 namespace tserver {
 
 class ScanResultCollector;
-class TabletPeerLookupIf;
+class TabletReplicaLookupIf;
 class TabletServer;
 
 class TabletServiceImpl : public TabletServerServiceIf {
@@ -88,7 +88,7 @@ class TabletServiceImpl : public TabletServerServiceIf {
   virtual void Shutdown() OVERRIDE;
 
  private:
-  Status HandleNewScanRequest(tablet::TabletPeer* tablet_peer,
+  Status HandleNewScanRequest(tablet::TabletReplica* tablet_replica,
                               const ScanRequestPB* req,
                               const rpc::RpcContext* rpc_context,
                               ScanResultCollector* result_collector,
@@ -105,7 +105,7 @@ class TabletServiceImpl : public TabletServerServiceIf {
   Status HandleScanAtSnapshot(const NewScanRequestPB& scan_pb,
                               const rpc::RpcContext* rpc_context,
                               const Schema& projection,
-                              tablet::TabletPeer* tablet_peer,
+                              tablet::TabletReplica* tablet_replica,
                               gscoped_ptr<RowwiseIterator>* iter,
                               Timestamp* snap_timestamp);
 
@@ -139,7 +139,7 @@ class TabletServiceAdminImpl : public TabletServerAdminServiceIf {
 class ConsensusServiceImpl : public consensus::ConsensusServiceIf {
  public:
   ConsensusServiceImpl(server::ServerBase* server,
-                       TabletPeerLookupIf* tablet_manager);
+                       TabletReplicaLookupIf* tablet_manager);
 
   virtual ~ConsensusServiceImpl();
 
@@ -189,7 +189,7 @@ class ConsensusServiceImpl : public consensus::ConsensusServiceIf {
 
  private:
   server::ServerBase* server_;
-  TabletPeerLookupIf* tablet_manager_;
+  TabletReplicaLookupIf* tablet_manager_;
 };
 
 } // namespace tserver

http://git-wip-us.apache.org/repos/asf/kudu/blob/7f72105b/src/kudu/tserver/ts_tablet_manager-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager-test.cc b/src/kudu/tserver/ts_tablet_manager-test.cc
index 9aeca50..7b290bf 100644
--- a/src/kudu/tserver/ts_tablet_manager-test.cc
+++ b/src/kudu/tserver/ts_tablet_manager-test.cc
@@ -25,7 +25,7 @@
 #include "kudu/consensus/metadata.pb.h"
 #include "kudu/fs/fs_manager.h"
 #include "kudu/master/master.pb.h"
-#include "kudu/tablet/tablet_peer.h"
+#include "kudu/tablet/tablet_replica.h"
 #include "kudu/tablet/tablet-test-util.h"
 #include "kudu/tserver/heartbeater.h"
 #include "kudu/tserver/mini_tablet_server.h"
@@ -46,7 +46,7 @@ using consensus::kInvalidOpIdIndex;
 using consensus::RaftConfigPB;
 using master::ReportedTabletPB;
 using master::TabletReportPB;
-using tablet::TabletPeer;
+using tablet::TabletReplica;
 
 static const char* const kTabletId = "my-tablet-id";
 
@@ -78,22 +78,22 @@ class TsTabletManagerTest : public KuduTest {
 
   Status CreateNewTablet(const std::string& tablet_id,
                          const Schema& schema,
-                         scoped_refptr<tablet::TabletPeer>* out_tablet_peer) {
+                         scoped_refptr<tablet::TabletReplica>* out_tablet_replica) {
     Schema full_schema = SchemaBuilder(schema).Build();
     std::pair<PartitionSchema, Partition> partition = tablet::CreateDefaultPartition(full_schema);
 
-    scoped_refptr<tablet::TabletPeer> tablet_peer;
+    scoped_refptr<tablet::TabletReplica> tablet_replica;
     RETURN_NOT_OK(tablet_manager_->CreateNewTablet(tablet_id, tablet_id, partition.second,
                                                    tablet_id,
                                                    full_schema, partition.first,
                                                    config_,
-                                                   &tablet_peer));
-    if (out_tablet_peer) {
-      (*out_tablet_peer) = tablet_peer;
+                                                   &tablet_replica));
+    if (out_tablet_replica) {
+      (*out_tablet_replica) = tablet_replica;
     }
 
-    RETURN_NOT_OK(tablet_peer->WaitUntilConsensusRunning(MonoDelta::FromMilliseconds(2000)));
-    return tablet_peer->consensus()->WaitUntilLeaderForTests(MonoDelta::FromSeconds(10));
+    RETURN_NOT_OK(tablet_replica->WaitUntilConsensusRunning(MonoDelta::FromMilliseconds(2000)));
+    return tablet_replica->consensus()->WaitUntilLeaderForTests(MonoDelta::FromSeconds(10));
   }
 
   void GenerateFullTabletReport(TabletReportPB* report) {
@@ -126,10 +126,10 @@ class TsTabletManagerTest : public KuduTest {
 
 TEST_F(TsTabletManagerTest, TestCreateTablet) {
   // Create a new tablet.
-  scoped_refptr<TabletPeer> peer;
-  ASSERT_OK(CreateNewTablet(kTabletId, schema_, &peer));
-  ASSERT_EQ(kTabletId, peer->tablet()->tablet_id());
-  peer.reset();
+  scoped_refptr<TabletReplica> replica;
+  ASSERT_OK(CreateNewTablet(kTabletId, schema_, &replica));
+  ASSERT_EQ(kTabletId, replica->tablet()->tablet_id());
+  replica.reset();
 
   // Re-load the tablet manager from the filesystem.
   LOG(INFO) << "Shutting down tablet manager";
@@ -142,8 +142,8 @@ TEST_F(TsTabletManagerTest, TestCreateTablet) {
   tablet_manager_ = mini_server_->server()->tablet_manager();
 
   // Ensure that the tablet got re-loaded and re-opened off disk.
-  ASSERT_TRUE(tablet_manager_->LookupTablet(kTabletId, &peer));
-  ASSERT_EQ(kTabletId, peer->tablet()->tablet_id());
+  ASSERT_TRUE(tablet_manager_->LookupTablet(kTabletId, &replica));
+  ASSERT_EQ(kTabletId, replica->tablet()->tablet_id());
 }
 
 static void AssertMonotonicReportSeqno(int64_t* report_seqno,
@@ -228,7 +228,7 @@ TEST_F(TsTabletManagerTest, TestTabletReports) {
   ASSERT_OK(CreateNewTablet("tablet-2", schema_, nullptr));
 
   // Wait up to 10 seconds to get a tablet report from tablet-2.
-  // TabletPeer does not mark tablets dirty until after it commits the
+  // TabletReplica does not mark tablets dirty until after it commits the
   // initial configuration change, so there is also a window for tablet-1 to
   // have been marked dirty since the last report.
   MonoDelta timeout(MonoDelta::FromSeconds(10));

http://git-wip-us.apache.org/repos/asf/kudu/blob/7f72105b/src/kudu/tserver/ts_tablet_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager.cc b/src/kudu/tserver/ts_tablet_manager.cc
index 9bfa941..45c7016 100644
--- a/src/kudu/tserver/ts_tablet_manager.cc
+++ b/src/kudu/tserver/ts_tablet_manager.cc
@@ -44,7 +44,7 @@
 #include "kudu/tablet/tablet.pb.h"
 #include "kudu/tablet/tablet_bootstrap.h"
 #include "kudu/tablet/tablet_metadata.h"
-#include "kudu/tablet/tablet_peer.h"
+#include "kudu/tablet/tablet_replica.h"
 #include "kudu/tserver/heartbeater.h"
 #include "kudu/tserver/tablet_copy_client.h"
 #include "kudu/tserver/tablet_server.h"
@@ -147,7 +147,7 @@ using tablet::TABLET_DATA_READY;
 using tablet::TABLET_DATA_TOMBSTONED;
 using tablet::TabletDataState;
 using tablet::TabletMetadata;
-using tablet::TabletPeer;
+using tablet::TabletReplica;
 using tablet::TabletStatusListener;
 using tablet::TabletStatusPB;
 using tserver::TabletCopyClient;
@@ -225,7 +225,7 @@ Status TSTabletManager::Init() {
       CHECK_OK(StartTabletStateTransitionUnlocked(meta->tablet_id(), "opening tablet", &deleter));
     }
 
-    scoped_refptr<TabletPeer> tablet_peer = CreateAndRegisterTabletPeer(meta, NEW_PEER);
+    scoped_refptr<TabletReplica> replica = CreateAndRegisterTabletReplica(meta, NEW_REPLICA);
     RETURN_NOT_OK(open_tablet_pool_->SubmitFunc(boost::bind(&TSTabletManager::OpenTablet,
                                                 this, meta, deleter)));
   }
@@ -260,7 +260,7 @@ Status TSTabletManager::CreateNewTablet(const string& table_id,
                                         const Schema& schema,
                                         const PartitionSchema& partition_schema,
                                         RaftConfigPB config,
-                                        scoped_refptr<TabletPeer>* tablet_peer) {
+                                        scoped_refptr<TabletReplica>* replica) {
   CHECK_EQ(state(), MANAGER_RUNNING);
   CHECK(IsRaftConfigMember(server_->instance_pb().permanent_uuid(), config));
 
@@ -275,7 +275,7 @@ Status TSTabletManager::CreateNewTablet(const string& table_id,
     TRACE("Acquired tablet manager lock");
 
     // Sanity check that the tablet isn't already registered.
-    scoped_refptr<TabletPeer> junk;
+    scoped_refptr<TabletReplica> junk;
     if (LookupTabletUnlocked(tablet_id, &junk)) {
       return Status::AlreadyPresent("Tablet already registered", tablet_id);
     }
@@ -300,19 +300,19 @@ Status TSTabletManager::CreateNewTablet(const string& table_id,
     "Couldn't create tablet metadata");
 
   // We must persist the consensus metadata to disk before starting a new
-  // tablet's TabletPeer and Consensus implementation.
+  // tablet's TabletReplica and Consensus implementation.
   unique_ptr<ConsensusMetadata> cmeta;
   RETURN_NOT_OK_PREPEND(ConsensusMetadata::Create(fs_manager_, tablet_id, fs_manager_->uuid(),
                                                   config, consensus::kMinimumTerm, &cmeta),
                         "Unable to create new ConsensusMeta for tablet " + tablet_id);
-  scoped_refptr<TabletPeer> new_peer = CreateAndRegisterTabletPeer(meta, NEW_PEER);
+  scoped_refptr<TabletReplica> new_replica = CreateAndRegisterTabletReplica(meta, NEW_REPLICA);
 
   // We can run this synchronously since there is nothing to bootstrap.
   RETURN_NOT_OK(open_tablet_pool_->SubmitFunc(boost::bind(&TSTabletManager::OpenTablet,
                                               this, meta, deleter)));
 
-  if (tablet_peer) {
-    *tablet_peer = new_peer;
+  if (replica) {
+    *replica = new_replica;
   }
   return Status::OK();
 }
@@ -421,14 +421,14 @@ void TSTabletManager::RunTabletCopy(
   CALLBACK_RETURN_NOT_OK(HostPortFromPB(req->copy_peer_addr(), &copy_source_addr));
   int64_t leader_term = req->caller_term();
 
-  scoped_refptr<TabletPeer> old_tablet_peer;
+  scoped_refptr<TabletReplica> old_replica;
   scoped_refptr<TabletMetadata> meta;
   bool replacing_tablet = false;
   scoped_refptr<TransitionInProgressDeleter> deleter;
   {
     std::lock_guard<rw_spinlock> lock(lock_);
-    if (LookupTabletUnlocked(tablet_id, &old_tablet_peer)) {
-      meta = old_tablet_peer->tablet_metadata();
+    if (LookupTabletUnlocked(tablet_id, &old_replica)) {
+      meta = old_replica->tablet_metadata();
       replacing_tablet = true;
     }
     Status ret = StartTabletStateTransitionUnlocked(tablet_id, "copying tablet",
@@ -440,7 +440,7 @@ void TSTabletManager::RunTabletCopy(
   }
 
   if (replacing_tablet) {
-    // Make sure the existing tablet peer is shut down and tombstoned.
+    // Make sure the existing tablet replica is shut down and tombstoned.
     TabletDataState data_state = meta->tablet_data_state();
     switch (data_state) {
       case TABLET_DATA_COPYING:
@@ -453,7 +453,7 @@ void TSTabletManager::RunTabletCopy(
         break;
       }
       case TABLET_DATA_READY: {
-        Log* log = old_tablet_peer->log();
+        Log* log = old_replica->log();
         if (!log) {
           CALLBACK_AND_RETURN(
               Status::IllegalState("Log unavailable. Tablet is not running", tablet_id));
@@ -464,7 +464,7 @@ void TSTabletManager::RunTabletCopy(
         CALLBACK_RETURN_NOT_OK(CheckLeaderTermNotLower(tablet_id, leader_term, last_logged_term));
 
         // Tombstone the tablet and store the last-logged OpId.
-        old_tablet_peer->Shutdown();
+        old_replica->Shutdown();
         // TODO(mpercy): Because we begin shutdown of the tablet after we check our
         // last-logged term against the leader's term, there may be operations
         // in flight and it may be possible for the same check in the tablet
@@ -507,9 +507,9 @@ void TSTabletManager::RunTabletCopy(
   // state, and we need to tombtone the tablet if additional steps prior to
   // getting to a TABLET_DATA_READY state fail.
 
-  // Registering a non-initialized TabletPeer offers visibility through the Web UI.
-  RegisterTabletPeerMode mode = replacing_tablet ? REPLACEMENT_PEER : NEW_PEER;
-  scoped_refptr<TabletPeer> tablet_peer = CreateAndRegisterTabletPeer(meta, mode);
+  // Registering a non-initialized TabletReplica offers visibility through the Web UI.
+  RegisterTabletReplicaMode mode = replacing_tablet ? REPLACEMENT_REPLICA : NEW_REPLICA;
+  scoped_refptr<TabletReplica> replica = CreateAndRegisterTabletReplica(meta, mode);
 
   // Now we invoke the StartTabletCopy callback and respond success to the
   // remote caller. Then we proceed to do most of the actual tablet copying work.
@@ -521,7 +521,7 @@ void TSTabletManager::RunTabletCopy(
   // From this point onward, we do not notify the caller about progress or success.
 
   // Download all of the remote files.
-  Status s = tc_client.FetchAll(implicit_cast<TabletStatusListener*>(tablet_peer.get()));
+  Status s = tc_client.FetchAll(implicit_cast<TabletStatusListener*>(replica.get()));
   if (!s.ok()) {
     LOG(WARNING) << LogPrefix(tablet_id) << "Tablet Copy: Unable to fetch data from remote peer "
                                          << kSrcPeerInfo << ": " << s.ToString();
@@ -539,21 +539,22 @@ void TSTabletManager::RunTabletCopy(
     return;
   }
 
-  // We don't tombstone the tablet if opening the tablet fails, because on next
   // startup it's still in a valid, fully-copied state.
   OpenTablet(meta, deleter);
 }
 
-// Create and register a new TabletPeer, given tablet metadata.
-scoped_refptr<TabletPeer> TSTabletManager::CreateAndRegisterTabletPeer(
-    const scoped_refptr<TabletMetadata>& meta, RegisterTabletPeerMode mode) {
-  scoped_refptr<TabletPeer> tablet_peer(
-      new TabletPeer(meta,
-                     local_peer_pb_,
-                     apply_pool_.get(),
-                     Bind(&TSTabletManager::MarkTabletDirty, Unretained(this), meta->tablet_id())));
-  RegisterTablet(meta->tablet_id(), tablet_peer, mode);
-  return tablet_peer;
+// Create and register a new TabletReplica, given tablet metadata.
+scoped_refptr<TabletReplica> TSTabletManager::CreateAndRegisterTabletReplica(
+    const scoped_refptr<TabletMetadata>& meta, RegisterTabletReplicaMode mode) {
+  scoped_refptr<TabletReplica> replica(
+      new TabletReplica(meta,
+                        local_peer_pb_,
+                        apply_pool_.get(),
+                        Bind(&TSTabletManager::MarkTabletDirty,
+                             Unretained(this),
+                             meta->tablet_id())));
+  RegisterTablet(meta->tablet_id(), replica, mode);
+  return replica;
 }
 
 Status TSTabletManager::DeleteTablet(
@@ -571,7 +572,7 @@ Status TSTabletManager::DeleteTablet(
 
   TRACE("Deleting tablet $0", tablet_id);
 
-  scoped_refptr<TabletPeer> tablet_peer;
+  scoped_refptr<TabletReplica> replica;
   scoped_refptr<TransitionInProgressDeleter> deleter;
   {
     // Acquire the lock in exclusive mode as we'll add a entry to the
@@ -580,7 +581,7 @@ Status TSTabletManager::DeleteTablet(
     TRACE("Acquired tablet manager lock");
     RETURN_NOT_OK(CheckRunningUnlocked(error_code));
 
-    if (!LookupTabletUnlocked(tablet_id, &tablet_peer)) {
+    if (!LookupTabletUnlocked(tablet_id, &replica)) {
       *error_code = TabletServerErrorPB::TABLET_NOT_FOUND;
       return Status::NotFound("Tablet not found", tablet_id);
     }
@@ -594,7 +595,7 @@ Status TSTabletManager::DeleteTablet(
 
   // If the tablet is already deleted, the CAS check isn't possible because
   // consensus and therefore the log is not available.
-  TabletDataState data_state = tablet_peer->tablet_metadata()->tablet_data_state();
+  TabletDataState data_state = replica->tablet_metadata()->tablet_data_state();
   bool tablet_deleted = (data_state == TABLET_DATA_DELETED || data_state == TABLET_DATA_TOMBSTONED);
 
   // They specified an "atomic" delete. Check the committed config's opid_index.
@@ -603,7 +604,7 @@ Status TSTabletManager::DeleteTablet(
   // restarting the tablet if the local replica committed a higher config
   // change op during that time, or potentially something else more invasive.
   if (cas_config_opid_index_less_or_equal && !tablet_deleted) {
-    scoped_refptr<consensus::Consensus> consensus = tablet_peer->shared_consensus();
+    scoped_refptr<consensus::Consensus> consensus = replica->shared_consensus();
     if (!consensus) {
       *error_code = TabletServerErrorPB::TABLET_NOT_RUNNING;
       return Status::IllegalState("Consensus not available. Tablet shutting down");
@@ -618,25 +619,25 @@ Status TSTabletManager::DeleteTablet(
     }
   }
 
-  tablet_peer->Shutdown();
+  replica->Shutdown();
 
   boost::optional<OpId> opt_last_logged_opid;
-  if (tablet_peer->log()) {
+  if (replica->log()) {
     OpId last_logged_opid;
-    tablet_peer->log()->GetLatestEntryOpId(&last_logged_opid);
+    replica->log()->GetLatestEntryOpId(&last_logged_opid);
     opt_last_logged_opid = last_logged_opid;
   }
 
-  Status s = DeleteTabletData(tablet_peer->tablet_metadata(), delete_type, opt_last_logged_opid);
+  Status s = DeleteTabletData(replica->tablet_metadata(), delete_type, opt_last_logged_opid);
   if (PREDICT_FALSE(!s.ok())) {
     s = s.CloneAndPrepend(Substitute("Unable to delete on-disk data from tablet $0",
                                      tablet_id));
     LOG(WARNING) << s.ToString();
-    tablet_peer->SetFailed(s);
+    replica->SetFailed(s);
     return s;
   }
 
-  tablet_peer->StatusMessage("Deleted tablet blocks from disk");
+  replica->StatusMessage("Deleted tablet blocks from disk");
 
   // We only remove DELETED tablets from the tablet map.
   if (delete_type == TABLET_DATA_DELETED) {
@@ -713,8 +714,8 @@ void TSTabletManager::OpenTablet(const scoped_refptr<TabletMetadata>& meta,
   TRACE_EVENT1("tserver", "TSTabletManager::OpenTablet",
                "tablet_id", tablet_id);
 
-  scoped_refptr<TabletPeer> tablet_peer;
-  CHECK(LookupTablet(tablet_id, &tablet_peer))
+  scoped_refptr<TabletReplica> replica;
+  CHECK(LookupTablet(tablet_id, &replica))
       << "Tablet not registered prior to OpenTabletAsync call: " << tablet_id;
 
   shared_ptr<Tablet> tablet;
@@ -732,52 +733,52 @@ void TSTabletManager::OpenTablet(const scoped_refptr<TabletMetadata>& meta,
     ADOPT_TRACE(nullptr);
     // TODO: handle crash mid-creation of tablet? do we ever end up with a
     // partially created tablet here?
-    tablet_peer->SetBootstrapping();
+    replica->SetBootstrapping();
     s = BootstrapTablet(meta,
                         scoped_refptr<server::Clock>(server_->clock()),
                         server_->mem_tracker(),
                         server_->result_tracker(),
                         metric_registry_,
-                        implicit_cast<TabletStatusListener*>(tablet_peer.get()),
+                        implicit_cast<TabletStatusListener*>(replica.get()),
                         &tablet,
                         &log,
-                        tablet_peer->log_anchor_registry(),
+                        replica->log_anchor_registry(),
                         &bootstrap_info);
     if (!s.ok()) {
       LOG(ERROR) << LogPrefix(tablet_id) << "Tablet failed to bootstrap: "
                  << s.ToString();
-      tablet_peer->SetFailed(s);
+      replica->SetFailed(s);
       return;
     }
   }
 
   MonoTime start(MonoTime::Now());
   LOG_TIMING_PREFIX(INFO, LogPrefix(tablet_id), "starting tablet") {
-    TRACE("Initializing tablet peer");
-    s =  tablet_peer->Init(tablet,
-                           scoped_refptr<server::Clock>(server_->clock()),
-                           server_->messenger(),
-                           server_->result_tracker(),
-                           log,
-                           tablet->GetMetricEntity());
+    TRACE("Initializing tablet replica");
+    s =  replica->Init(tablet,
+                       scoped_refptr<server::Clock>(server_->clock()),
+                       server_->messenger(),
+                       server_->result_tracker(),
+                       log,
+                       tablet->GetMetricEntity());
 
     if (!s.ok()) {
       LOG(ERROR) << LogPrefix(tablet_id) << "Tablet failed to init: "
                  << s.ToString();
-      tablet_peer->SetFailed(s);
+      replica->SetFailed(s);
       return;
     }
 
-    TRACE("Starting tablet peer");
-    s = tablet_peer->Start(bootstrap_info);
+    TRACE("Starting tablet replica");
+    s = replica->Start(bootstrap_info);
     if (!s.ok()) {
       LOG(ERROR) << LogPrefix(tablet_id) << "Tablet failed to start: "
                  << s.ToString();
-      tablet_peer->SetFailed(s);
+      replica->SetFailed(s);
       return;
     }
 
-    tablet_peer->RegisterMaintenanceOps(server_->maintenance_manager());
+    replica->RegisterMaintenanceOps(server_->maintenance_manager());
   }
 
   int elapsed_ms = (MonoTime::Now() - start).ToMilliseconds();
@@ -821,14 +822,14 @@ void TSTabletManager::Shutdown() {
   // Shut down the bootstrap pool, so no new tablets are registered after this point.
   open_tablet_pool_->Shutdown();
 
-  // Take a snapshot of the peers list -- that way we don't have to hold
+  // Take a snapshot of the replicas list -- that way we don't have to hold
   // on to the lock while shutting them down, which might cause a lock
   // inversion. (see KUDU-308 for example).
-  vector<scoped_refptr<TabletPeer> > peers_to_shutdown;
-  GetTabletPeers(&peers_to_shutdown);
+  vector<scoped_refptr<TabletReplica> > replicas_to_shutdown;
+  GetTabletReplicas(&replicas_to_shutdown);
 
-  for (const scoped_refptr<TabletPeer>& peer : peers_to_shutdown) {
-    peer->Shutdown();
+  for (const scoped_refptr<TabletReplica>& replica : replicas_to_shutdown) {
+    replica->Shutdown();
   }
 
   // Shut down the apply pool.
@@ -838,7 +839,7 @@ void TSTabletManager::Shutdown() {
     std::lock_guard<rw_spinlock> l(lock_);
     // We don't expect anyone else to be modifying the map after we start the
     // shut down process.
-    CHECK_EQ(tablet_map_.size(), peers_to_shutdown.size())
+    CHECK_EQ(tablet_map_.size(), replicas_to_shutdown.size())
       << "Map contents changed during shutdown!";
     tablet_map_.clear();
 
@@ -847,44 +848,44 @@ void TSTabletManager::Shutdown() {
 }
 
 void TSTabletManager::RegisterTablet(const std::string& tablet_id,
-                                     const scoped_refptr<TabletPeer>& tablet_peer,
-                                     RegisterTabletPeerMode mode) {
+                                     const scoped_refptr<TabletReplica>& replica,
+                                     RegisterTabletReplicaMode mode) {
   std::lock_guard<rw_spinlock> lock(lock_);
-  // If we are replacing a tablet peer, we delete the existing one first.
-  if (mode == REPLACEMENT_PEER && tablet_map_.erase(tablet_id) != 1) {
-    LOG(FATAL) << "Unable to remove previous tablet peer " << tablet_id << ": not registered!";
+  // If we are replacing a tablet replica, we delete the existing one first.
+  if (mode == REPLACEMENT_REPLICA && tablet_map_.erase(tablet_id) != 1) {
+    LOG(FATAL) << "Unable to remove previous tablet replica " << tablet_id << ": not registered!";
   }
-  if (!InsertIfNotPresent(&tablet_map_, tablet_id, tablet_peer)) {
-    LOG(FATAL) << "Unable to register tablet peer " << tablet_id << ": already registered!";
+  if (!InsertIfNotPresent(&tablet_map_, tablet_id, replica)) {
+    LOG(FATAL) << "Unable to register tablet replica " << tablet_id << ": already registered!";
   }
 
-  TabletDataState data_state = tablet_peer->tablet_metadata()->tablet_data_state();
+  TabletDataState data_state = replica->tablet_metadata()->tablet_data_state();
   LOG(INFO) << LogPrefix(tablet_id) << Substitute("Registered tablet (data state: $0)",
                                                   TabletDataState_Name(data_state));
 }
 
 bool TSTabletManager::LookupTablet(const string& tablet_id,
-                                   scoped_refptr<TabletPeer>* tablet_peer) const {
+                                   scoped_refptr<TabletReplica>* replica) const {
   shared_lock<rw_spinlock> l(lock_);
-  return LookupTabletUnlocked(tablet_id, tablet_peer);
+  return LookupTabletUnlocked(tablet_id, replica);
 }
 
 bool TSTabletManager::LookupTabletUnlocked(const string& tablet_id,
-                                           scoped_refptr<TabletPeer>* tablet_peer) const {
-  const scoped_refptr<TabletPeer>* found = FindOrNull(tablet_map_, tablet_id);
+                                           scoped_refptr<TabletReplica>* replica) const {
+  const scoped_refptr<TabletReplica>* found = FindOrNull(tablet_map_, tablet_id);
   if (!found) {
     return false;
   }
-  *tablet_peer = *found;
+  *replica = *found;
   return true;
 }
 
-Status TSTabletManager::GetTabletPeer(const string& tablet_id,
-                                      scoped_refptr<tablet::TabletPeer>* tablet_peer) const {
-  if (!LookupTablet(tablet_id, tablet_peer)) {
+Status TSTabletManager::GetTabletReplica(const string& tablet_id,
+                                         scoped_refptr<tablet::TabletReplica>* replica) const {
+  if (!LookupTablet(tablet_id, replica)) {
     return Status::NotFound("Tablet not found", tablet_id);
   }
-  TabletDataState data_state = (*tablet_peer)->tablet_metadata()->tablet_data_state();
+  TabletDataState data_state = (*replica)->tablet_metadata()->tablet_data_state();
   if (data_state != TABLET_DATA_READY) {
     return Status::IllegalState("Tablet data state not TABLET_DATA_READY: " +
                                 TabletDataState_Name(data_state),
@@ -897,9 +898,9 @@ const NodeInstancePB& TSTabletManager::NodeInstance() const {
   return server_->instance_pb();
 }
 
-void TSTabletManager::GetTabletPeers(vector<scoped_refptr<TabletPeer> >* tablet_peers) const {
+void TSTabletManager::GetTabletReplicas(vector<scoped_refptr<TabletReplica> >* replicas) const {
   shared_lock<rw_spinlock> l(lock_);
-  AppendValuesFromMap(tablet_map_, tablet_peers);
+  AppendValuesFromMap(tablet_map_, replicas);
 }
 
 void TSTabletManager::MarkTabletDirty(const std::string& tablet_id, const std::string& reason) {
@@ -933,19 +934,19 @@ void TSTabletManager::InitLocalRaftPeerPB() {
 }
 
 void TSTabletManager::CreateReportedTabletPB(const string& tablet_id,
-                                             const scoped_refptr<TabletPeer>& tablet_peer,
+                                             const scoped_refptr<TabletReplica>& replica,
                                              ReportedTabletPB* reported_tablet) const {
   reported_tablet->set_tablet_id(tablet_id);
-  reported_tablet->set_state(tablet_peer->state());
-  reported_tablet->set_tablet_data_state(tablet_peer->tablet_metadata()->tablet_data_state());
-  if (tablet_peer->state() == tablet::FAILED) {
+  reported_tablet->set_state(replica->state());
+  reported_tablet->set_tablet_data_state(replica->tablet_metadata()->tablet_data_state());
+  if (replica->state() == tablet::FAILED) {
     AppStatusPB* error_status = reported_tablet->mutable_error();
-    StatusToPB(tablet_peer->error(), error_status);
+    StatusToPB(replica->error(), error_status);
   }
-  reported_tablet->set_schema_version(tablet_peer->tablet_metadata()->schema_version());
+  reported_tablet->set_schema_version(replica->tablet_metadata()->schema_version());
 
-  // We cannot get consensus state information unless the TabletPeer is running.
-  scoped_refptr<consensus::Consensus> consensus = tablet_peer->shared_consensus();
+  // We cannot get consensus state information unless the TabletReplica is running.
+  scoped_refptr<consensus::Consensus> consensus = replica->shared_consensus();
   if (consensus) {
     *reported_tablet->mutable_committed_consensus_state() =
         consensus->ConsensusState(consensus::CONSENSUS_CONFIG_COMMITTED);
@@ -963,11 +964,11 @@ void TSTabletManager::PopulateIncrementalTabletReport(TabletReportPB* report,
                                                       const vector<string>& tablet_ids) const {
   shared_lock<rw_spinlock> shared_lock(lock_);
   for (const auto& id : tablet_ids) {
-    const scoped_refptr<tablet::TabletPeer>* tablet_peer =
+    const scoped_refptr<tablet::TabletReplica>* replica =
         FindOrNull(tablet_map_, id);
-    if (tablet_peer) {
+    if (replica) {
       // Dirty entry, report on it.
-      CreateReportedTabletPB(id, *tablet_peer, report->add_updated_tablets());
+      CreateReportedTabletPB(id, *replica, report->add_updated_tablets());
     } else {
       // Removed.
       report->add_removed_tablet_ids(id);
@@ -1007,7 +1008,7 @@ Status TSTabletManager::HandleNonReadyTabletOnStartup(const scoped_refptr<Tablet
   // allows us to permanently delete replica tombstones when a table gets
   // deleted.
   if (data_state == TABLET_DATA_TOMBSTONED) {
-    CreateAndRegisterTabletPeer(meta, NEW_PEER);
+    CreateAndRegisterTabletReplica(meta, NEW_REPLICA);
   }
 
   return Status::OK();

http://git-wip-us.apache.org/repos/asf/kudu/blob/7f72105b/src/kudu/tserver/ts_tablet_manager.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/ts_tablet_manager.h b/src/kudu/tserver/ts_tablet_manager.h
index 6f437be..f234f56 100644
--- a/src/kudu/tserver/ts_tablet_manager.h
+++ b/src/kudu/tserver/ts_tablet_manager.h
@@ -27,7 +27,7 @@
 
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/ref_counted.h"
-#include "kudu/tserver/tablet_peer_lookup.h"
+#include "kudu/tserver/tablet_replica_lookup.h"
 #include "kudu/tserver/tserver_admin.pb.h"
 #include "kudu/tserver/tserver.pb.h"
 #include "kudu/util/locks.h"
@@ -58,7 +58,7 @@ class ResultTracker;
 
 namespace tablet {
 class TabletMetadata;
-class TabletPeer;
+class TabletReplica;
 class TabletStatusPB;
 class TabletStatusListener;
 }
@@ -76,7 +76,7 @@ class TransitionInProgressDeleter;
 // TODO: will also be responsible for keeping the local metadata about
 // which tablets are hosted on this server persistent on disk, as well
 // as re-opening all the tablets at startup, etc.
-class TSTabletManager : public tserver::TabletPeerLookupIf {
+class TSTabletManager : public tserver::TabletReplicaLookupIf {
  public:
   // Construct the tablet manager.
   // 'fs_manager' must remain valid until this object is destructed.
@@ -103,7 +103,7 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
   // Create a new tablet and register it with the tablet manager. The new tablet
   // is persisted on disk and opened before this method returns.
   //
-  // If tablet_peer is non-NULL, the newly created tablet will be returned.
+  // If 'replica' is non-NULL, the newly created tablet will be returned.
   //
   // If another tablet already exists with this ID, logs a DFATAL
   // and returns a bad Status.
@@ -114,7 +114,7 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
                          const Schema& schema,
                          const PartitionSchema& partition_schema,
                          consensus::RaftConfigPB config,
-                         scoped_refptr<tablet::TabletPeer>* tablet_peer);
+                         scoped_refptr<tablet::TabletReplica>* replica);
 
   // Delete the specified tablet.
   // 'delete_type' must be one of TABLET_DATA_DELETED or TABLET_DATA_TOMBSTONED
@@ -129,18 +129,18 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
                       const boost::optional<int64_t>& cas_config_opid_index_less_or_equal,
                       boost::optional<TabletServerErrorPB::Code>* error_code);
 
-  // Lookup the given tablet peer by its ID.
+  // Lookup the given tablet replica by its ID.
   // Returns true if the tablet is found successfully.
   bool LookupTablet(const std::string& tablet_id,
-                    scoped_refptr<tablet::TabletPeer>* tablet_peer) const;
+                    scoped_refptr<tablet::TabletReplica>* replica) const;
 
   // Same as LookupTablet but doesn't acquired the shared lock.
   bool LookupTabletUnlocked(const std::string& tablet_id,
-                            scoped_refptr<tablet::TabletPeer>* tablet_peer) const;
+                            scoped_refptr<tablet::TabletReplica>* replica) const;
 
-  virtual Status GetTabletPeer(const std::string& tablet_id,
-                               scoped_refptr<tablet::TabletPeer>* tablet_peer) const
-                               override;
+  virtual Status GetTabletReplica(const std::string& tablet_id,
+                                  scoped_refptr<tablet::TabletReplica>* replica) const
+                                  override;
 
   virtual const NodeInstancePB& NodeInstance() const override;
 
@@ -165,7 +165,7 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
                                        const std::vector<std::string>& tablet_ids) const;
 
   // Get all of the tablets currently hosted on this server.
-  void GetTabletPeers(std::vector<scoped_refptr<tablet::TabletPeer> >* tablet_peers) const;
+  void GetTabletReplicas(std::vector<scoped_refptr<tablet::TabletReplica> >* replicas) const;
 
   // Marks tablet with 'tablet_id' as dirty so that it'll be included in the
   // next round of master heartbeats.
@@ -187,10 +187,10 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
  private:
   FRIEND_TEST(TsTabletManagerTest, TestPersistBlocks);
 
-  // Flag specified when registering a TabletPeer.
-  enum RegisterTabletPeerMode {
-    NEW_PEER,
-    REPLACEMENT_PEER
+  // Flag specified when registering a TabletReplica.
+  enum RegisterTabletReplicaMode {
+    NEW_REPLICA,
+    REPLACEMENT_REPLICA
   };
 
   // Standard log prefix, given a tablet id.
@@ -222,7 +222,7 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
   // This method does not return anything as it can be run asynchronously.
   // Upon completion of this method the tablet should be initialized and running.
   // If something wrong happened on bootstrap/initialization the relevant error
-  // will be set on TabletPeer along with the state set to FAILED.
+  // will be set on TabletReplica along with the state set to FAILED.
   //
   // The tablet must be registered and an entry corresponding to this tablet
   // must be put into the transition_in_progress_ map before calling this
@@ -234,30 +234,30 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
 
   // Open a tablet whose metadata has already been loaded.
   void BootstrapAndInitTablet(const scoped_refptr<tablet::TabletMetadata>& meta,
-                              scoped_refptr<tablet::TabletPeer>* peer);
+                              scoped_refptr<tablet::TabletReplica>* replica);
 
   // Add the tablet to the tablet map.
   // 'mode' specifies whether to expect an existing tablet to exist in the map.
-  // If mode == NEW_PEER but a tablet with the same name is already registered,
-  // or if mode == REPLACEMENT_PEER but a tablet with the same name is not
+  // If mode == NEW_REPLICA but a tablet with the same name is already registered,
+  // or if mode == REPLACEMENT_REPLICA but a tablet with the same name is not
   // registered, a FATAL message is logged, causing a process crash.
   // Calls to this method are expected to be externally synchronized, typically
   // using the transition_in_progress_ map.
   void RegisterTablet(const std::string& tablet_id,
-                      const scoped_refptr<tablet::TabletPeer>& tablet_peer,
-                      RegisterTabletPeerMode mode);
+                      const scoped_refptr<tablet::TabletReplica>& replica,
+                      RegisterTabletReplicaMode mode);
 
-  // Create and register a new TabletPeer, given tablet metadata.
+  // Create and register a new TabletReplica, given tablet metadata.
   // Calls RegisterTablet() with the given 'mode' parameter after constructing
   // the TablerPeer object. See RegisterTablet() for details about the
   // semantics of 'mode' and the locking requirements.
-  scoped_refptr<tablet::TabletPeer> CreateAndRegisterTabletPeer(
+  scoped_refptr<tablet::TabletReplica> CreateAndRegisterTabletReplica(
       const scoped_refptr<tablet::TabletMetadata>& meta,
-      RegisterTabletPeerMode mode);
+      RegisterTabletReplicaMode mode);
 
   // Helper to generate the report for a single tablet.
   void CreateReportedTabletPB(const std::string& tablet_id,
-                              const scoped_refptr<tablet::TabletPeer>& tablet_peer,
+                              const scoped_refptr<tablet::TabletReplica>& replica,
                               master::ReportedTabletPB* reported_tablet) const;
 
   // Handle the case on startup where we find a tablet that is not in
@@ -287,7 +287,7 @@ class TSTabletManager : public tserver::TabletPeerLookupIf {
 
   consensus::RaftPeerPB local_peer_pb_;
 
-  typedef std::unordered_map<std::string, scoped_refptr<tablet::TabletPeer> > TabletMap;
+  typedef std::unordered_map<std::string, scoped_refptr<tablet::TabletReplica> > TabletMap;
 
   // Lock protecting tablet_map_, dirty_tablets_, state_,
   // transition_in_progress_, and perm_deleted_tablet_ids_.

http://git-wip-us.apache.org/repos/asf/kudu/blob/7f72105b/src/kudu/tserver/tserver-path-handlers.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tserver-path-handlers.cc b/src/kudu/tserver/tserver-path-handlers.cc
index 9dc4b53..f12e4b9 100644
--- a/src/kudu/tserver/tserver-path-handlers.cc
+++ b/src/kudu/tserver/tserver-path-handlers.cc
@@ -34,7 +34,7 @@
 #include "kudu/server/webui_util.h"
 #include "kudu/tablet/tablet.pb.h"
 #include "kudu/tablet/tablet_bootstrap.h"
-#include "kudu/tablet/tablet_peer.h"
+#include "kudu/tablet/tablet_replica.h"
 #include "kudu/tserver/scanners.h"
 #include "kudu/tserver/tablet_server.h"
 #include "kudu/tserver/ts_tablet_manager.h"
@@ -51,7 +51,7 @@ using kudu::MaintenanceManagerStatusPB;
 using kudu::MaintenanceManagerStatusPB_CompletedOpPB;
 using kudu::MaintenanceManagerStatusPB_MaintenanceOpPB;
 using kudu::tablet::Tablet;
-using kudu::tablet::TabletPeer;
+using kudu::tablet::TabletReplica;
 using kudu::tablet::TabletStatusPB;
 using kudu::tablet::Transaction;
 using std::endl;
@@ -110,8 +110,8 @@ void TabletServerPathHandlers::HandleTransactionsPage(const Webserver::WebReques
                                                       std::ostringstream* output) {
   bool as_text = ContainsKey(req.parsed_args, "raw");
 
-  vector<scoped_refptr<TabletPeer> > peers;
-  tserver_->tablet_manager()->GetTabletPeers(&peers);
+  vector<scoped_refptr<TabletReplica> > replicas;
+  tserver_->tablet_manager()->GetTabletReplicas(&replicas);
 
   string arg = FindWithDefault(req.parsed_args, "include_traces", "false");
   Transaction::TraceType trace_type = ParseLeadingBoolValue(
@@ -125,14 +125,14 @@ void TabletServerPathHandlers::HandleTransactionsPage(const Webserver::WebReques
       "Total time in-flight</th><th>Description</th></tr>\n";
   }
 
-  for (const scoped_refptr<TabletPeer>& peer : peers) {
+  for (const scoped_refptr<TabletReplica>& replica : replicas) {
     vector<TransactionStatusPB> inflight;
 
-    if (peer->tablet() == nullptr) {
+    if (replica->tablet() == nullptr) {
       continue;
     }
 
-    peer->GetInFlightTransactions(trace_type, &inflight);
+    replica->GetInFlightTransactions(trace_type, &inflight);
     for (const TransactionStatusPB& inflight_tx : inflight) {
       string total_time_str = Substitute("$0 us.", inflight_tx.running_for_micros());
       string description;
@@ -146,13 +146,13 @@ void TabletServerPathHandlers::HandleTransactionsPage(const Webserver::WebReques
       if (!as_text) {
         (*output) << Substitute(
           "<tr><th>$0</th><th>$1</th><th>$2</th><th>$3</th><th>$4</th></tr>\n",
-          EscapeForHtmlToString(peer->tablet_id()),
+          EscapeForHtmlToString(replica->tablet_id()),
           EscapeForHtmlToString(SecureShortDebugString(inflight_tx.op_id())),
           OperationType_Name(inflight_tx.tx_type()),
           total_time_str,
           EscapeForHtmlToString(description));
       } else {
-        (*output) << "Tablet: " << peer->tablet_id() << endl;
+        (*output) << "Tablet: " << replica->tablet_id() << endl;
         (*output) << "Op ID: " << SecureShortDebugString(inflight_tx.op_id()) << endl;
         (*output) << "Type: " << OperationType_Name(inflight_tx.tx_type()) << endl;
         (*output) << "Running: " << total_time_str;
@@ -178,32 +178,32 @@ string TabletLink(const string& id) {
 
 void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& req,
                                                  std::ostringstream *output) {
-  vector<scoped_refptr<TabletPeer>> peers;
-  tserver_->tablet_manager()->GetTabletPeers(&peers);
+  vector<scoped_refptr<TabletReplica>> replicas;
+  tserver_->tablet_manager()->GetTabletReplicas(&replicas);
 
   // Sort by (table_name, tablet_id) tuples.
-  std::sort(peers.begin(), peers.end(),
-            [](const scoped_refptr<TabletPeer>& peer_a,
-               const scoped_refptr<TabletPeer>& peer_b) {
-              return std::make_pair(peer_a->tablet_metadata()->table_name(), peer_a->tablet_id()) <
-                     std::make_pair(peer_b->tablet_metadata()->table_name(), peer_b->tablet_id());
+  std::sort(replicas.begin(), replicas.end(),
+            [](const scoped_refptr<TabletReplica>& rep_a,
+               const scoped_refptr<TabletReplica>& rep_b) {
+              return std::make_pair(rep_a->tablet_metadata()->table_name(), rep_a->tablet_id()) <
+                     std::make_pair(rep_b->tablet_metadata()->table_name(), rep_b->tablet_id());
             });
 
   auto generate_table = [this](const string& header,
-                               const vector<scoped_refptr<TabletPeer>>& peers,
+                               const vector<scoped_refptr<TabletReplica>>& replicas,
                                ostream* output) {
     *output << "<h3>" << header << "</h3>\n";
     *output << "<table class='table table-striped'>\n";
     *output << "  <tr><th>Table name</th><th>Tablet ID</th>"
          "<th>Partition</th>"
          "<th>State</th><th>On-disk size</th><th>RaftConfig</th><th>Last status</th></tr>\n";
-    for (const scoped_refptr<TabletPeer>& peer : peers) {
+    for (const scoped_refptr<TabletReplica>& replica : replicas) {
       TabletStatusPB status;
-      peer->GetTabletStatusPB(&status);
+      replica->GetTabletStatusPB(&status);
       string id = status.tablet_id();
       string table_name = status.table_name();
       string tablet_id_or_link;
-      if (peer->tablet() != nullptr) {
+      if (replica->tablet() != nullptr) {
         tablet_id_or_link = TabletLink(id);
       } else {
         tablet_id_or_link = EscapeForHtmlToString(id);
@@ -212,13 +212,13 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re
       if (status.has_estimated_on_disk_size()) {
         n_bytes = HumanReadableNumBytes::ToString(status.estimated_on_disk_size());
       }
-      string partition = peer->tablet_metadata()
-                             ->partition_schema()
-                              .PartitionDebugString(peer->tablet_metadata()->partition(),
-                                                    peer->tablet_metadata()->schema());
+      string partition = replica->tablet_metadata()
+                                ->partition_schema()
+                                 .PartitionDebugString(replica->tablet_metadata()->partition(),
+                                                       replica->tablet_metadata()->schema());
 
       // TODO(unknown): would be nice to include some other stuff like memory usage
-      scoped_refptr<consensus::Consensus> consensus = peer->shared_consensus();
+      scoped_refptr<consensus::Consensus> consensus = replica->shared_consensus();
       (*output) << Substitute(
           // Table name, tablet id, partition
           "<tr><td>$0</td><td>$1</td><td>$2</td>"
@@ -227,7 +227,7 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re
           EscapeForHtmlToString(table_name), // $0
           tablet_id_or_link, // $1
           EscapeForHtmlToString(partition), // $2
-          EscapeForHtmlToString(peer->HumanReadableState()), n_bytes, // $3, $4
+          EscapeForHtmlToString(replica->HumanReadableState()), n_bytes, // $3, $4
           consensus ? ConsensusStatePBToHtml(consensus->
               ConsensusState(CONSENSUS_CONFIG_COMMITTED))
                     : "", // $5
@@ -236,21 +236,21 @@ void TabletServerPathHandlers::HandleTabletsPage(const Webserver::WebRequest& re
     *output << "</table>\n";
   };
 
-  vector<scoped_refptr<TabletPeer>> live_peers;
-  vector<scoped_refptr<TabletPeer>> tombstoned_peers;
-  for (const scoped_refptr<TabletPeer>& peer : peers) {
-    if (peer->HumanReadableState() != "TABLET_DATA_TOMBSTONED") {
-      live_peers.push_back(peer);
+  vector<scoped_refptr<TabletReplica>> live_replicas;
+  vector<scoped_refptr<TabletReplica>> tombstoned_replicas;
+  for (const scoped_refptr<TabletReplica>& replica : replicas) {
+    if (replica->HumanReadableState() != "TABLET_DATA_TOMBSTONED") {
+      live_replicas.push_back(replica);
     } else {
-      tombstoned_peers.push_back(peer);
+      tombstoned_replicas.push_back(replica);
     }
   }
 
-  if (!live_peers.empty()) {
-    generate_table("Live Tablets", live_peers, output);
+  if (!live_replicas.empty()) {
+    generate_table("Live Tablets", live_replicas, output);
   }
-  if (!tombstoned_peers.empty()) {
-    generate_table("Tombstoned Tablets", tombstoned_peers, output);
+  if (!tombstoned_replicas.empty()) {
+    generate_table("Tombstoned Tablets", tombstoned_replicas, output);
     *output << "<p><small>Tombstoned tablets are tablets that previously "
            "stored a replica on this server.</small></p>";
   }
@@ -304,19 +304,19 @@ bool GetTabletID(const Webserver::WebRequest& req, string* id, std::ostringstrea
   return true;
 }
 
-bool GetTabletPeer(TabletServer* tserver, const Webserver::WebRequest& req,
-                   scoped_refptr<TabletPeer>* peer, const string& tablet_id,
-                   std::ostringstream* out) {
-  if (!tserver->tablet_manager()->LookupTablet(tablet_id, peer)) {
+bool GetTabletReplica(TabletServer* tserver, const Webserver::WebRequest& req,
+                      scoped_refptr<TabletReplica>* replica, const string& tablet_id,
+                      std::ostringstream* out) {
+  if (!tserver->tablet_manager()->LookupTablet(tablet_id, replica)) {
     (*out) << "Tablet " << EscapeForHtmlToString(tablet_id) << " not found";
     return false;
   }
   return true;
 }
 
-bool TabletBootstrapping(const scoped_refptr<TabletPeer>& peer, const string& tablet_id,
+bool TabletBootstrapping(const scoped_refptr<TabletReplica>& replica, const string& tablet_id,
                          std::ostringstream* out) {
-  if (peer->state() == tablet::BOOTSTRAPPING) {
+  if (replica->state() == tablet::BOOTSTRAPPING) {
     (*out) << "Tablet " << EscapeForHtmlToString(tablet_id) << " is still bootstrapping";
     return false;
   }
@@ -327,11 +327,11 @@ bool TabletBootstrapping(const scoped_refptr<TabletPeer>& peer, const string& ta
 // tablet is found, and is in a non-bootstrapping state.
 bool LoadTablet(TabletServer* tserver,
                 const Webserver::WebRequest& req,
-                string* tablet_id, scoped_refptr<TabletPeer>* peer,
+                string* tablet_id, scoped_refptr<TabletReplica>* replica,
                 std::ostringstream* out) {
   if (!GetTabletID(req, tablet_id, out)) return false;
-  if (!GetTabletPeer(tserver, req, peer, *tablet_id, out)) return false;
-  if (!TabletBootstrapping(*peer, *tablet_id, out)) return false;
+  if (!GetTabletReplica(tserver, req, replica, *tablet_id, out)) return false;
+  if (!TabletBootstrapping(*replica, *tablet_id, out)) return false;
   return true;
 }
 
@@ -340,24 +340,24 @@ bool LoadTablet(TabletServer* tserver,
 void TabletServerPathHandlers::HandleTabletPage(const Webserver::WebRequest& req,
                                                 std::ostringstream *output) {
   string tablet_id;
-  scoped_refptr<TabletPeer> peer;
-  if (!LoadTablet(tserver_, req, &tablet_id, &peer, output)) return;
+  scoped_refptr<TabletReplica> replica;
+  if (!LoadTablet(tserver_, req, &tablet_id, &replica, output)) return;
 
-  string table_name = peer->tablet_metadata()->table_name();
+  string table_name = replica->tablet_metadata()->table_name();
   RaftPeerPB::Role role = RaftPeerPB::UNKNOWN_ROLE;
-  auto consensus = peer->consensus();
+  auto consensus = replica->consensus();
   if (consensus) {
     role = consensus->role();
   }
 
   *output << "<h1>Tablet " << EscapeForHtmlToString(tablet_id)
-          << " (" << peer->HumanReadableState()
+          << " (" << replica->HumanReadableState()
           << "/" << RaftPeerPB::Role_Name(role) << ")</h1>\n";
   *output << "<h3>Table " << EscapeForHtmlToString(table_name) << "</h3>";
 
   // Output schema in tabular format.
   *output << "<h2>Schema</h2>\n";
-  const Schema& schema = peer->tablet_metadata()->schema();
+  const Schema& schema = replica->tablet_metadata()->schema();
   HtmlOutputSchemaTable(schema, output);
 
   *output << "<h2>Other Tablet Info Pages</h2>" << endl;
@@ -390,9 +390,9 @@ void TabletServerPathHandlers::HandleTabletPage(const Webserver::WebRequest& req
 void TabletServerPathHandlers::HandleTabletSVGPage(const Webserver::WebRequest& req,
                                                    std::ostringstream* output) {
   string id;
-  scoped_refptr<TabletPeer> peer;
-  if (!LoadTablet(tserver_, req, &id, &peer, output)) return;
-  shared_ptr<Tablet> tablet = peer->shared_tablet();
+  scoped_refptr<TabletReplica> replica;
+  if (!LoadTablet(tserver_, req, &id, &replica, output)) return;
+  shared_ptr<Tablet> tablet = replica->shared_tablet();
   if (!tablet) {
     *output << "Tablet " << EscapeForHtmlToString(id) << " not running";
     return;
@@ -407,22 +407,22 @@ void TabletServerPathHandlers::HandleTabletSVGPage(const Webserver::WebRequest&
 void TabletServerPathHandlers::HandleLogAnchorsPage(const Webserver::WebRequest& req,
                                                     std::ostringstream* output) {
   string tablet_id;
-  scoped_refptr<TabletPeer> peer;
-  if (!LoadTablet(tserver_, req, &tablet_id, &peer, output)) return;
+  scoped_refptr<TabletReplica> replica;
+  if (!LoadTablet(tserver_, req, &tablet_id, &replica, output)) return;
 
   *output << "<h1>Log Anchors for Tablet " << EscapeForHtmlToString(tablet_id) << "</h1>"
           << std::endl;
 
-  string dump = peer->log_anchor_registry()->DumpAnchorInfo();
+  string dump = replica->log_anchor_registry()->DumpAnchorInfo();
   *output << "<pre>" << EscapeForHtmlToString(dump) << "</pre>" << std::endl;
 }
 
 void TabletServerPathHandlers::HandleConsensusStatusPage(const Webserver::WebRequest& req,
                                                          std::ostringstream* output) {
   string id;
-  scoped_refptr<TabletPeer> peer;
-  if (!LoadTablet(tserver_, req, &id, &peer, output)) return;
-  scoped_refptr<consensus::Consensus> consensus = peer->shared_consensus();
+  scoped_refptr<TabletReplica> replica;
+  if (!LoadTablet(tserver_, req, &id, &replica, output)) return;
+  scoped_refptr<consensus::Consensus> consensus = replica->shared_consensus();
   if (!consensus) {
     *output << "Tablet " << EscapeForHtmlToString(id) << " not running";
     return;
@@ -471,8 +471,8 @@ string TabletServerPathHandlers::ScannerToHtml(const Scanner& scanner) const {
   scanner.GetIteratorStats(&stats);
   CHECK_EQ(stats.size(), projection->num_columns());
   html << Substitute("<td>$0</td>", IteratorStatsToHtml(*projection, stats));
-  scoped_refptr<TabletPeer> tablet_peer;
-  if (!tserver_->tablet_manager()->LookupTablet(scanner.tablet_id(), &tablet_peer)) {
+  scoped_refptr<TabletReplica> tablet_replica;
+  if (!tserver_->tablet_manager()->LookupTablet(scanner.tablet_id(), &tablet_replica)) {
     html << Substitute("<td colspan=\"2\"><b>Tablet $0 is no longer valid.</b></td></tr>\n",
                        scanner.tablet_id());
   } else {


Mime
View raw message