Skip to content

Commit

Permalink
#3681 [Colocated] Master should issue AddTableToTable only for subseq…
Browse files Browse the repository at this point in the history
…uent tables.

Summary:
The very first table among colocated tables should not issue AddTableToTablet.

The issue was masked by the fact that issuing such an RPC before the CreateTablet RPC succeeded used to fail the RPC right away. The RPC was fixed to retry before giving up in D7943 (#3627). Subsequently, we've seen tservers running into DFATAL in the following tests.

./yb_build.sh --cxx-test pg_libpq-test --gtest_filter PgLibPqTest.TableColocation
./yb_build.sh --java-test org.yb.pgsql.TestPgRegressBetaFeatures

Test Plan:
./yb_build.sh --cxx-test pg_libpq-test --gtest_filter PgLibPqTest.TableColocation
./yb_build.sh --java-test org.yb.pgsql.TestPgRegressBetaFeatures

Reviewers: neha, mihnea, hector, bogdan, jason

Reviewed By: jason

Subscribers: ybase, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D7987
  • Loading branch information
amitanandaiyer committed Feb 20, 2020
1 parent 1244908 commit 5693229
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/yb/master/catalog_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2114,9 +2114,12 @@ Status CatalogManager::CreateTable(const CreateTableRequestPB* orig_req,
CHECK_EQ(SysTablesEntryPB::PREPARING, table->metadata().dirty().pb.state());
if (tablets_exist) {
TRACE("Inserted new table and updating tablet info into CatalogManager maps");
VLOG(1) << "Inserted new table and updating tablet info into "
"CatalogManager maps";
s = sys_catalog_->UpdateItems(tablets, leader_ready_term_);
} else {
TRACE("Inserted new table and tablet info into CatalogManager maps");
VLOG(1) << "Inserted new table and tablet info into CatalogManager maps";
for (const TabletInfo *tablet : tablets) {
CHECK_EQ(SysTabletsEntryPB::PREPARING, tablet->metadata().dirty().pb.state());
}
Expand Down Expand Up @@ -2167,7 +2170,7 @@ Status CatalogManager::CreateTable(const CreateTableRequestPB* orig_req,
tablet->mutable_metadata()->CommitMutation();
}

if (colocated) {
if (colocated && tablets_exist) {
auto call =
std::make_shared<AsyncAddTableToTablet>(master_, worker_pool_.get(), tablets[0], table);
table->AddTask(call);
Expand Down
2 changes: 2 additions & 0 deletions src/yb/tserver/tablet_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ void TabletServiceAdminImpl::CreateTablet(const CreateTabletRequestPB* req,
if (!CheckUuidMatchOrRespond(server_->tablet_manager(), "CreateTablet", req, resp, &context)) {
return;
}
DVLOG(3) << "Received CreateTablet RPC: " << yb::ToString(*req);
TRACE_EVENT1("tserver", "CreateTablet",
"tablet_id", req->tablet_id());

Expand Down Expand Up @@ -1125,6 +1126,7 @@ void TabletServiceAdminImpl::AddTableToTablet(
if (!tablet) {
return;
}
DVLOG(3) << "Received AddTableToTablet RPC: " << yb::ToString(*req);

tserver::ChangeMetadataRequestPB change_req;
*change_req.mutable_add_table() = req->add_table();
Expand Down

0 comments on commit 5693229

Please sign in to comment.