Skip to content

Commit

Permalink
[#8257] ybase: Disable tablet splitting for PITR tracked tables
Browse files Browse the repository at this point in the history
Summary: Currently, we do not support PITR on split tablets, so as a short-term solution, we will disable automatic tablet splitting for them.

Test Plan: ybd --cxx_test tablet-split-itest --gtest-filter TabletSplitITest.SplittingWithPitr

Reviewers: timur, rsami, bogdan, sergei

Reviewed By: sergei

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D11941
  • Loading branch information
sanketkedia committed Jul 7, 2021
1 parent 9c6b8e6 commit 7b8babc
Show file tree
Hide file tree
Showing 21 changed files with 671 additions and 519 deletions.
2 changes: 2 additions & 0 deletions ent/src/yb/master/catalog_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ class CatalogManager : public yb::master::CatalogManager, SnapshotCoordinatorCon

int64_t LeaderTerm() override;

Result<bool> IsTablePartOfSomeSnapshotSchedule(const TableInfo& table_info) override;

Result<SnapshotSchedulesToObjectIdsMap> MakeSnapshotSchedulesToObjectIdsMap(
SysRowEntry::Type type) override;

Expand Down
4 changes: 4 additions & 0 deletions ent/src/yb/master/catalog_manager_ent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3593,6 +3593,10 @@ Result<SnapshotSchedulesToObjectIdsMap> CatalogManager::MakeSnapshotSchedulesToO
return snapshot_coordinator_.MakeSnapshotSchedulesToObjectIdsMap(type);
}

Result<bool> CatalogManager::IsTablePartOfSomeSnapshotSchedule(const TableInfo& table_info) {
return snapshot_coordinator_.IsTableCoveredBySomeSnapshotSchedule(table_info);
}

void CatalogManager::SysCatalogLoaded(int64_t term) {
return snapshot_coordinator_.SysCatalogLoaded(term);
}
Expand Down
39 changes: 2 additions & 37 deletions ent/src/yb/master/restore_sys_catalog_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "yb/master/master.pb.h"
#include "yb/master/master_backup.pb.h"
#include "yb/master/master_snapshot_coordinator.h"
#include "yb/master/master_util.h"
#include "yb/master/sys_catalog_writer.h"

#include "yb/util/pb_util.h"
Expand Down Expand Up @@ -153,42 +154,6 @@ Status RestoreSysCatalogState::DetermineEntries(
return Status::OK();
}

Result<bool> RestoreSysCatalogState::Objects::TableMatchesIdentifier(
const TableId& id, const SysTablesEntryPB& table,
const TableIdentifierPB& table_identifier) const {
VLOG_WITH_FUNC(4) << "id: " << id << ", table: " << table.ShortDebugString()
<< ", table_identifier: " << table_identifier.ShortDebugString();

if (table_identifier.has_table_id()) {
return id == table_identifier.table_id();
}
if (!table_identifier.table_name().empty() && table_identifier.table_name() != table.name()) {
return false;
}
if (table_identifier.has_namespace_()) {
auto namespace_it = namespaces.find(table.namespace_id());
if (namespace_it == namespaces.end()) {
return STATUS_FORMAT(Corruption, "Namespace $0 was not loaded", table.namespace_id());
}

const auto& ns = table_identifier.namespace_();
if (ns.has_id()) {
return table.namespace_id() == ns.id();
}
if (ns.has_database_type() && ns.database_type() != namespace_it->second.database_type()) {
return false;
}
if (ns.has_name()) {
return table.namespace_name() == ns.name();
}

return STATUS_FORMAT(
InvalidArgument, "Wrong namespace identifier format: $0", ns);
}
return STATUS_FORMAT(
InvalidArgument, "Wrong table identifier format: $0", table_identifier);
}

std::string RestoreSysCatalogState::Objects::SizesToString() const {
return Format("{ tablets: $0 tables: $1 namespaces: $2 }",
tablets.size(), tables.size(), namespaces.size());
Expand All @@ -204,7 +169,7 @@ Result<bool> RestoreSysCatalogState::Objects::MatchTable(
return false;
}
for (const auto& table_identifier : filter.tables().tables()) {
if (VERIFY_RESULT(TableMatchesIdentifier(id, table, table_identifier))) {
if (VERIFY_RESULT(master::TableMatchesIdentifier(id, table, table_identifier))) {
return true;
}
}
Expand Down
4 changes: 0 additions & 4 deletions ent/src/yb/master/restore_sys_catalog_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ class RestoreSysCatalogState {
const SnapshotScheduleFilterPB& filter, const TableId& id,
const SysTablesEntryPB& table) const;

Result<bool> TableMatchesIdentifier(
const TableId& id, const SysTablesEntryPB& table,
const TableIdentifierPB& table_identifier) const;

std::string SizesToString() const;
};

Expand Down
2 changes: 1 addition & 1 deletion src/yb/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ target_link_libraries(yb_client_test_util
gmock
yb_client)

add_library(ql-dml-test-base ql-dml-test-base.cc txn-test-base.cc snapshot_test_base.cc)
add_library(ql-dml-test-base ql-dml-test-base.cc txn-test-base.cc snapshot_test_util.cc)
target_link_libraries(ql-dml-test-base integration-tests)

# Tests
Expand Down
Loading

0 comments on commit 7b8babc

Please sign in to comment.