kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [7/7] incubator-kudu git commit: KUDU-495 (part 1): new sys_catalog writing API
Date Fri, 01 Apr 2016 03:16:09 GMT
KUDU-495 (part 1): new sys_catalog writing API

The new API allows any arbitrary combination of table or tablet
creation/deletion. With some additional changes, we won't need to "roll
forward" any persistent state following a master failover. There are no
functional changes to the master here; just API updates.

I was hoping to use designated initializer lists to set up WriteActions, but
apparently it's a C-only feature [1].

1. http://stackoverflow.com/q/18731707

Change-Id: I7f5e5ecbff33435c964ced2e421566c41c387e9e
Reviewed-on: http://gerrit.cloudera.org:8080/2648
Tested-by: Kudu Jenkins
Reviewed-by: David Ribeiro Alves <david.alves@cloudera.com>


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

Branch: refs/heads/master
Commit: 626c3a83988efe2de4dcdaccafe71742a37af9c6
Parents: 74c6ae9
Author: Adar Dembo <adar@cloudera.com>
Authored: Mon Mar 28 15:16:53 2016 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Fri Apr 1 03:12:59 2016 +0000

----------------------------------------------------------------------
 src/kudu/master/catalog_manager.cc  |  34 ++++++--
 src/kudu/master/sys_catalog-test.cc |  29 +++++--
 src/kudu/master/sys_catalog.cc      | 145 +++++++++++++------------------
 src/kudu/master/sys_catalog.h       |  38 ++++----
 4 files changed, 132 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/626c3a83/src/kudu/master/catalog_manager.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/catalog_manager.cc b/src/kudu/master/catalog_manager.cc
index 6165ded..0322d7d 100644
--- a/src/kudu/master/catalog_manager.cc
+++ b/src/kudu/master/catalog_manager.cc
@@ -830,7 +830,9 @@ Status CatalogManager::CreateTable(const CreateTableRequestPB* orig_req,
   }
 
   // e. Write Tablets to sys-tablets (in "preparing" state)
-  s = sys_catalog_->AddTablets(tablets);
+  SysCatalogTable::Actions tablet_actions;
+  tablet_actions.tablets_to_add = tablets;
+  s = sys_catalog_->Write(tablet_actions);
   if (!s.ok()) {
     s = s.CloneAndPrepend(Substitute("An error occurred while inserting to sys-tablets: $0",
                                      s.ToString()));
@@ -843,7 +845,9 @@ Status CatalogManager::CreateTable(const CreateTableRequestPB* orig_req,
 
   // f. Update the on-disk table state to "running".
   table->mutable_metadata()->mutable_dirty()->pb.set_state(SysTablesEntryPB::RUNNING);
-  s = sys_catalog_->AddTable(table.get());
+  SysCatalogTable::Actions table_actions;
+  table_actions.table_to_add = table.get();
+  s = sys_catalog_->Write(table_actions);
   if (!s.ok()) {
     s = s.CloneAndPrepend(Substitute("An error occurred while inserting to sys-tablets: $0",
                                      s.ToString()));
@@ -975,7 +979,9 @@ Status CatalogManager::DeleteTable(const DeleteTableRequestPB* req,
                               Substitute("Deleted at $0", LocalTimeAsString()));
 
   // 3. Update sys-catalog with the removed table state.
-  Status s = sys_catalog_->UpdateTable(table.get());
+  SysCatalogTable::Actions actions;
+  actions.table_to_update = table.get();
+  Status s = sys_catalog_->Write(actions);
   if (!s.ok()) {
     // The mutation will be aborted when 'l' exits the scope on early return.
     s = s.CloneAndPrepend(Substitute("An error occurred while updating sys tables: $0",
@@ -1182,7 +1188,9 @@ Status CatalogManager::AlterTable(const AlterTableRequestPB* req,
 
   // 5. Update sys-catalog with the new table schema.
   TRACE("Updating metadata on disk");
-  Status s = sys_catalog_->UpdateTable(table.get());
+  SysCatalogTable::Actions actions;
+  actions.table_to_update = table.get();
+  Status s = sys_catalog_->Write(actions);
   if (!s.ok()) {
     s = s.CloneAndPrepend(
         Substitute("An error occurred while updating sys-catalog tables entry: $0",
@@ -1597,7 +1605,9 @@ Status CatalogManager::HandleReportedTablet(TSDescriptor* ts_desc,
   table_lock.Unlock();
   // We update the tablets each time that someone reports it.
   // This shouldn't be very frequent and should only happen when something in fact changed.
-  Status s = sys_catalog_->UpdateTablets({ tablet.get() });
+  SysCatalogTable::Actions actions;
+  actions.tablets_to_update.push_back(tablet.get());
+  Status s = sys_catalog_->Write(actions);
   if (!s.ok()) {
     LOG(WARNING) << "Error updating tablets: " << s.ToString() << ". Tablet
report was: "
                  << report.ShortDebugString();
@@ -2450,7 +2460,9 @@ void CatalogManager::DeleteTabletsAndSendRequests(const scoped_refptr<TableInfo>
 
     TabletMetadataLock tablet_lock(tablet.get(), TabletMetadataLock::WRITE);
     tablet_lock.mutable_data()->set_state(SysTabletsEntryPB::DELETED, deletion_msg);
-    CHECK_OK(sys_catalog_->UpdateTablets({ tablet.get() }));
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_update.push_back(tablet.get());
+    CHECK_OK(sys_catalog_->Write(actions));
     tablet_lock.Commit();
   }
 }
@@ -2624,7 +2636,9 @@ Status CatalogManager::HandleTabletSchemaVersionReport(TabletInfo *tablet,
uint3
   l.mutable_data()->set_state(SysTablesEntryPB::RUNNING,
                               Substitute("Current schema version=$0", current_version));
 
-  Status s = sys_catalog_->UpdateTable(table);
+  SysCatalogTable::Actions actions;
+  actions.table_to_update = table;
+  Status s = sys_catalog_->Write(actions);
   if (!s.ok()) {
     LOG(WARNING) << "An error occurred while updating sys-tables: " << s.ToString();
     return s;
@@ -2737,8 +2751,10 @@ Status CatalogManager::ProcessPendingAssignments(
 
   // Update the sys catalog with the new set of tablets/metadata.
   if (s.ok()) {
-    s = sys_catalog_->AddAndUpdateTablets(deferred.tablets_to_add,
-                                          deferred.tablets_to_update);
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_add = deferred.tablets_to_add;
+    actions.tablets_to_update = deferred.tablets_to_update;
+    s = sys_catalog_->Write(actions);
     if (!s.ok()) {
       s = s.CloneAndPrepend("An error occurred while persisting the updated tablet metadata");
     }

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/626c3a83/src/kudu/master/sys_catalog-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog-test.cc b/src/kudu/master/sys_catalog-test.cc
index 51de9b0..62729e9 100644
--- a/src/kudu/master/sys_catalog-test.cc
+++ b/src/kudu/master/sys_catalog-test.cc
@@ -126,7 +126,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTablesOperations) {
     l.mutable_data()->pb.set_state(SysTablesEntryPB::PREPARING);
     ASSERT_OK(SchemaToPB(Schema(), l.mutable_data()->pb.mutable_schema()));
     // Add the table
-    ASSERT_OK(master_->catalog_manager()->sys_catalog()->AddTable(table.get()));
+    SysCatalogTable::Actions actions;
+    actions.table_to_add = table.get();
+    ASSERT_OK(master_->catalog_manager()->sys_catalog()->Write(actions));
     l.Commit();
   }
 
@@ -141,7 +143,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTablesOperations) {
     TableMetadataLock l(table.get(), TableMetadataLock::WRITE);
     l.mutable_data()->pb.set_version(1);
     l.mutable_data()->pb.set_state(SysTablesEntryPB::REMOVED);
-    ASSERT_OK(master_->catalog_manager()->sys_catalog()->UpdateTable(table.get()));
+    SysCatalogTable::Actions actions;
+    actions.table_to_update = table.get();
+    ASSERT_OK(master_->catalog_manager()->sys_catalog()->Write(actions));
     l.Commit();
   }
 
@@ -152,7 +156,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTablesOperations) {
 
   // Delete the table
   loader.Reset();
-  ASSERT_OK(master_->catalog_manager()->sys_catalog()->DeleteTable(table.get()));
+  SysCatalogTable::Actions actions;
+  actions.table_to_delete = table.get();
+  ASSERT_OK(master_->catalog_manager()->sys_catalog()->Write(actions));
   ASSERT_OK(master_->catalog_manager()->sys_catalog()->VisitTables(&loader));
   ASSERT_EQ(0, loader.tables.size());
 }
@@ -261,7 +267,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTabletsOperations) {
     loader.Reset();
     TabletMetadataLock l1(tablet1.get(), TabletMetadataLock::WRITE);
     TabletMetadataLock l2(tablet2.get(), TabletMetadataLock::WRITE);
-    ASSERT_OK(sys_catalog->AddTablets(tablets));
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_add = tablets;
+    ASSERT_OK(sys_catalog->Write(actions));
     l1.Commit();
     l2.Commit();
 
@@ -278,7 +286,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTabletsOperations) {
 
     TabletMetadataLock l1(tablet1.get(), TabletMetadataLock::WRITE);
     l1.mutable_data()->pb.set_state(SysTabletsEntryPB::RUNNING);
-    ASSERT_OK(sys_catalog->UpdateTablets(tablets));
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_update = tablets;
+    ASSERT_OK(sys_catalog->Write(actions));
     l1.Commit();
 
     loader.Reset();
@@ -304,7 +314,10 @@ TEST_F(SysCatalogTest, TestSysCatalogTabletsOperations) {
     l2.mutable_data()->pb.set_state(SysTabletsEntryPB::RUNNING);
 
     loader.Reset();
-    ASSERT_OK(sys_catalog->AddAndUpdateTablets(to_add, to_update));
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_add = to_add;
+    actions.tablets_to_update = to_update;
+    ASSERT_OK(sys_catalog->Write(actions));
 
     l1.Commit();
     l2.Commit();
@@ -324,7 +337,9 @@ TEST_F(SysCatalogTest, TestSysCatalogTabletsOperations) {
     tablets.push_back(tablet3.get());
 
     loader.Reset();
-    ASSERT_OK(master_->catalog_manager()->sys_catalog()->DeleteTablets(tablets));
+    SysCatalogTable::Actions actions;
+    actions.tablets_to_delete = tablets;
+    ASSERT_OK(master_->catalog_manager()->sys_catalog()->Write(actions));
     ASSERT_OK(master_->catalog_manager()->sys_catalog()->VisitTablets(&loader));
     ASSERT_EQ(1, loader.tablets.size());
     ASSERT_TRUE(MetadatasEqual(tablet2.get(), loader.tablets[0]));

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/626c3a83/src/kudu/master/sys_catalog.cc
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.cc b/src/kudu/master/sys_catalog.cc
index bd8f7fd..553b728 100644
--- a/src/kudu/master/sys_catalog.cc
+++ b/src/kudu/master/sys_catalog.cc
@@ -355,77 +355,80 @@ Schema SysCatalogTable::BuildTableSchema() {
   return builder.Build();
 }
 
+SysCatalogTable::Actions::Actions()
+    : table_to_add(nullptr),
+      table_to_update(nullptr),
+      table_to_delete(nullptr) {
+}
+
+Status SysCatalogTable::Write(const Actions& actions) {
+  TRACE_EVENT0("master", "SysCatalogTable::Write");
+
+  WriteRequestPB req;
+  WriteResponsePB resp;
+  req.set_tablet_id(kSysCatalogTabletId);
+  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
+
+  if (actions.table_to_add) {
+    RETURN_NOT_OK(ReqAddTable(&req, actions.table_to_add));
+  }
+  if (actions.table_to_update) {
+    RETURN_NOT_OK(ReqUpdateTable(&req, actions.table_to_update));
+  }
+  if (actions.table_to_delete) {
+    RETURN_NOT_OK(ReqDeleteTable(&req, actions.table_to_delete));
+  }
+
+  RETURN_NOT_OK(ReqAddTablets(&req, actions.tablets_to_add));
+  RETURN_NOT_OK(ReqUpdateTablets(&req, actions.tablets_to_update));
+  RETURN_NOT_OK(ReqDeleteTablets(&req, actions.tablets_to_delete));
+
+  RETURN_NOT_OK(SyncWrite(&req, &resp));
+  return Status::OK();
+}
+
 // ==================================================================
 // Table related methods
 // ==================================================================
 
-Status SysCatalogTable::AddTable(const TableInfo *table) {
-  TRACE_EVENT1("master", "SysCatalogTable::AddTable",
-               "table", table->ToString());
+Status SysCatalogTable::ReqAddTable(WriteRequestPB* req, const TableInfo* table) {
   faststring metadata_buf;
   if (!pb_util::SerializeToString(table->metadata().dirty().pb, &metadata_buf)) {
     return Status::Corruption("Unable to serialize SysCatalogTablesEntryPB for tablet",
                               table->metadata().dirty().name());
   }
 
-  WriteRequestPB req;
-  WriteResponsePB resp;
-  req.set_tablet_id(kSysCatalogTabletId);
-  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
-
   KuduPartialRow row(&schema_);
   CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLES_ENTRY));
   CHECK_OK(row.SetString(kSysCatalogTableColId, table->id()));
   CHECK_OK(row.SetString(kSysCatalogTableColMetadata, metadata_buf));
-  RowOperationsPBEncoder enc(req.mutable_row_operations());
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
   enc.Add(RowOperationsPB::INSERT, row);
-
-  RETURN_NOT_OK(SyncWrite(&req, &resp));
   return Status::OK();
 }
 
-Status SysCatalogTable::UpdateTable(const TableInfo *table) {
-  TRACE_EVENT1("master", "SysCatalogTable::UpdateTable",
-               "table", table->ToString());
-
+Status SysCatalogTable::ReqUpdateTable(WriteRequestPB* req, const TableInfo* table) {
   faststring metadata_buf;
   if (!pb_util::SerializeToString(table->metadata().dirty().pb, &metadata_buf)) {
     return Status::Corruption("Unable to serialize SysCatalogTablesEntryPB for tablet",
                               table->id());
   }
 
-  WriteRequestPB req;
-  WriteResponsePB resp;
-  req.set_tablet_id(kSysCatalogTabletId);
-  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
-
   KuduPartialRow row(&schema_);
   CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLES_ENTRY));
   CHECK_OK(row.SetString(kSysCatalogTableColId, table->id()));
   CHECK_OK(row.SetString(kSysCatalogTableColMetadata, metadata_buf));
-  RowOperationsPBEncoder enc(req.mutable_row_operations());
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
   enc.Add(RowOperationsPB::UPDATE, row);
-
-  RETURN_NOT_OK(SyncWrite(&req, &resp));
   return Status::OK();
 }
 
-Status SysCatalogTable::DeleteTable(const TableInfo *table) {
-  TRACE_EVENT1("master", "SysCatalogTable::DeleteTable",
-               "table", table->ToString());
-  WriteRequestPB req;
-  WriteResponsePB resp;
-  req.set_tablet_id(kSysCatalogTabletId);
-  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
-
+Status SysCatalogTable::ReqDeleteTable(WriteRequestPB* req, const TableInfo* table) {
   KuduPartialRow row(&schema_);
   CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLES_ENTRY));
   CHECK_OK(row.SetString(kSysCatalogTableColId, table->id()));
-
-  RowOperationsPBEncoder enc(req.mutable_row_operations());
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
   enc.Add(RowOperationsPB::DELETE, row);
-
-  RETURN_NOT_OK(SyncWrite(&req, &resp));
   return Status::OK();
 }
 
@@ -476,13 +479,12 @@ Status SysCatalogTable::VisitTableFromRow(const RowBlockRow& row,
 // Tablet related methods
 // ==================================================================
 
-Status SysCatalogTable::AddTabletsToPB(const vector<TabletInfo*>& tablets,
-                                       RowOperationsPB::Type op_type,
-                                       RowOperationsPB* ops) const {
+Status SysCatalogTable::ReqAddTablets(WriteRequestPB* req,
+                                      const vector<TabletInfo*>& tablets) {
   faststring metadata_buf;
   KuduPartialRow row(&schema_);
-  RowOperationsPBEncoder enc(ops);
-  for (const TabletInfo *tablet : tablets) {
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
+  for (auto tablet : tablets) {
     if (!pb_util::SerializeToString(tablet->metadata().dirty().pb, &metadata_buf))
{
       return Status::Corruption("Unable to serialize SysCatalogTabletsEntryPB for tablet",
                                 tablet->tablet_id());
@@ -491,65 +493,42 @@ Status SysCatalogTable::AddTabletsToPB(const vector<TabletInfo*>&
tablets,
     CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLETS_ENTRY));
     CHECK_OK(row.SetString(kSysCatalogTableColId, tablet->tablet_id()));
     CHECK_OK(row.SetString(kSysCatalogTableColMetadata, metadata_buf));
-    enc.Add(op_type, row);
+    enc.Add(RowOperationsPB::INSERT, row);
   }
+
   return Status::OK();
 }
 
-Status SysCatalogTable::AddAndUpdateTablets(const vector<TabletInfo*>& tablets_to_add,
-                                            const vector<TabletInfo*>& tablets_to_update)
{
-  TRACE_EVENT2("master", "AddAndUpdateTablets",
-               "num_add", tablets_to_add.size(),
-               "num_update", tablets_to_update.size());
-
-  WriteRequestPB req;
-  WriteResponsePB resp;
-  req.set_tablet_id(kSysCatalogTabletId);
-  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
-
-  // Insert new Tablets
-  if (!tablets_to_add.empty()) {
-    RETURN_NOT_OK(AddTabletsToPB(tablets_to_add, RowOperationsPB::INSERT,
-                                 req.mutable_row_operations()));
-  }
+Status SysCatalogTable::ReqUpdateTablets(WriteRequestPB* req,
+                                         const vector<TabletInfo*>& tablets) {
+  faststring metadata_buf;
+  KuduPartialRow row(&schema_);
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
+  for (auto tablet : tablets) {
+    if (!pb_util::SerializeToString(tablet->metadata().dirty().pb, &metadata_buf))
{
+      return Status::Corruption("Unable to serialize SysCatalogTabletsEntryPB for tablet",
+                                tablet->tablet_id());
+    }
 
-  // Update already existing Tablets
-  if (!tablets_to_update.empty()) {
-    RETURN_NOT_OK(AddTabletsToPB(tablets_to_update, RowOperationsPB::UPDATE,
-                                 req.mutable_row_operations()));
+    CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLETS_ENTRY));
+    CHECK_OK(row.SetString(kSysCatalogTableColId, tablet->tablet_id()));
+    CHECK_OK(row.SetString(kSysCatalogTableColMetadata, metadata_buf));
+    enc.Add(RowOperationsPB::UPDATE, row);
   }
 
-  RETURN_NOT_OK(SyncWrite(&req, &resp));
   return Status::OK();
 }
 
-Status SysCatalogTable::AddTablets(const vector<TabletInfo*>& tablets) {
-  vector<TabletInfo*> empty_tablets;
-  return AddAndUpdateTablets(tablets, empty_tablets);
-}
-
-Status SysCatalogTable::UpdateTablets(const vector<TabletInfo*>& tablets) {
-  vector<TabletInfo*> empty_tablets;
-  return AddAndUpdateTablets(empty_tablets, tablets);
-}
-
-Status SysCatalogTable::DeleteTablets(const vector<TabletInfo*>& tablets) {
-  TRACE_EVENT1("master", "DeleteTablets",
-               "num_tablets", tablets.size());
-  WriteRequestPB req;
-  WriteResponsePB resp;
-  req.set_tablet_id(kSysCatalogTabletId);
-  RETURN_NOT_OK(SchemaToPB(schema_, req.mutable_schema()));
-
-  RowOperationsPBEncoder enc(req.mutable_row_operations());
+Status SysCatalogTable::ReqDeleteTablets(WriteRequestPB* req,
+                                         const vector<TabletInfo*>& tablets) {
   KuduPartialRow row(&schema_);
-  for (const TabletInfo* tablet : tablets) {
+  RowOperationsPBEncoder enc(req->mutable_row_operations());
+  for (auto tablet : tablets) {
     CHECK_OK(row.SetInt8(kSysCatalogTableColType, TABLETS_ENTRY));
     CHECK_OK(row.SetString(kSysCatalogTableColId, tablet->tablet_id()));
     enc.Add(RowOperationsPB::DELETE, row);
   }
 
-  RETURN_NOT_OK(SyncWrite(&req, &resp));
   return Status::OK();
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/626c3a83/src/kudu/master/sys_catalog.h
----------------------------------------------------------------------
diff --git a/src/kudu/master/sys_catalog.h b/src/kudu/master/sys_catalog.h
index a588082..6f563e6 100644
--- a/src/kudu/master/sys_catalog.h
+++ b/src/kudu/master/sys_catalog.h
@@ -93,25 +93,22 @@ class SysCatalogTable {
   // Create the new Metadata and initialize the TabletPeer for the sys-table.
   Status CreateNew(FsManager *fs_manager);
 
-  // ==================================================================
-  // Tables related methods
-  // ==================================================================
-  Status AddTable(const TableInfo* table);
-  Status UpdateTable(const TableInfo* table);
-  Status DeleteTable(const TableInfo* table);
+  // Perform a series of table/tablet actions in one WriteTransaction.
+  struct Actions {
+    Actions();
+
+    TableInfo* table_to_add;
+    TableInfo* table_to_update;
+    TableInfo* table_to_delete;
+    std::vector<TabletInfo*> tablets_to_add;
+    std::vector<TabletInfo*> tablets_to_update;
+    std::vector<TabletInfo*> tablets_to_delete;
+  };
+  Status Write(const Actions& actions);
 
   // Scan of the table-related entries.
   Status VisitTables(TableVisitor* visitor);
 
-  // ==================================================================
-  // Tablets related methods
-  // ==================================================================
-  Status AddTablets(const vector<TabletInfo*>& tablets);
-  Status UpdateTablets(const vector<TabletInfo*>& tablets);
-  Status AddAndUpdateTablets(const vector<TabletInfo*>& tablets_to_add,
-                             const vector<TabletInfo*>& tablets_to_update);
-  Status DeleteTablets(const vector<TabletInfo*>& tablets);
-
   // Scan of the tablet-related entries.
   Status VisitTablets(TabletVisitor* visitor);
 
@@ -180,6 +177,17 @@ class SysCatalogTable {
   // Crashes due to an invariant check if the rpc server is not running.
   void InitLocalRaftPeerPB();
 
+  // Add an operation to a write adding/updating/deleting a table or tablet.
+  Status ReqAddTable(tserver::WriteRequestPB* req, const TableInfo* table);
+  Status ReqUpdateTable(tserver::WriteRequestPB* req, const TableInfo* table);
+  Status ReqDeleteTable(tserver::WriteRequestPB* req, const TableInfo* table);
+  Status ReqAddTablets(tserver::WriteRequestPB* req,
+                       const std::vector<TabletInfo*>& tablets);
+  Status ReqUpdateTablets(tserver::WriteRequestPB* req,
+                          const std::vector<TabletInfo*>& tablets);
+  Status ReqDeleteTablets(tserver::WriteRequestPB* req,
+                          const std::vector<TabletInfo*>& tablets);
+
   // Table schema, without IDs, used to send messages to the TabletPeer
   Schema schema_;
   Schema key_schema_;


Mime
View raw message