Skip to content

Commit

Permalink
[yugabyte#11352] DocDB: Skip system tables for splitting
Browse files Browse the repository at this point in the history
Summary: Changes to fail the splitting of system tables early on Master during validation

Test Plan: Added a targeted unit test to ensure that system table splits fail early during validation

Reviewers: rthallam, bogdan, asrivastava

Reviewed By: asrivastava

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D16146
  • Loading branch information
lingamsandeep authored and nathanhjli committed Mar 31, 2022
1 parent 6543d21 commit 4c8c788
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/yb/integration-tests/tablet-split-itest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,28 @@ TEST_F(TabletSplitITest, SlowSplitSingleTablet) {
ASSERT_OK(CreateSingleTabletAndSplit(kNumRows));
}

TEST_F(TabletSplitITest, SplitSystemTable) {
ANNOTATE_UNPROTECTED_WRITE(FLAGS_TEST_validate_all_tablet_candidates) = false;

auto* catalog_mgr = ASSERT_RESULT(catalog_manager());

// Attempt splits on "sys.catalog" and "tables" system tables and verify that they fail.
std::vector<master::TableInfoPtr> systables = {
catalog_mgr->GetTableInfo("sys.catalog.uuid"),
catalog_mgr->GetTableInfoFromNamespaceNameAndTableName(
YQL_DATABASE_CQL, "system_schema", "tables")};

for (const auto& systable : systables) {
for (const auto& tablet : systable->GetTablets()) {
LOG(INFO) << "Splitting : " << systable->name() << " Tablet :" << tablet->id();
auto s = catalog_mgr->TEST_SplitTablet(tablet, true /* select_all_tablets_for_split */);
LOG(INFO) << s.ToString();
EXPECT_TRUE(s.IsNotSupported());
LOG(INFO) << "Split of system table failed as expected";
}
}
}

TEST_F(TabletSplitITest, SplitTabletDuringReadWriteLoad) {
constexpr auto kNumTablets = 3;

Expand Down
8 changes: 8 additions & 0 deletions src/yb/master/tablet_split_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ Status TabletSplitManager::ValidateSplitCandidateTable(const TableInfo& table) {
"Tablet splitting is not supported for transaction status tables, table_id: $0",
table.id());
}
if (table.is_system()) {
VLOG(1) << Substitute("Tablet splitting is not supported for system table: $0 with "
"table_id: $1", table.name(), table.id());
return STATUS_FORMAT(
NotSupported,
"Tablet splitting is not supported for system table: $0 with table_id: $1",
table.name(), table.id());
}
if (table.GetTableType() == REDIS_TABLE_TYPE) {
VLOG(1) << Substitute("Tablet splitting is not supported for YEDIS tables, table_id: $0",
table.id());
Expand Down

0 comments on commit 4c8c788

Please sign in to comment.