Skip to content

Commit

Permalink
[#23296] xCluster: Skip BackfillMetadataForXRepl for SequencesSystemT…
Browse files Browse the repository at this point in the history
…able

Summary:
CatalogManager::BackfillMetadataForXRepl is intended for backfilling Postgres metadata on tables that we are about to do xCluster cluster or CDC replication on.

In order to replicate sequences, we will also be replicating the sequences_data table. Although it is a PGSQL table, it is not known to Postgres so the backfill currently fails on it.

Here we just add an early exit if we encounter this table.

Fixes #23296
Jira: DB-12217

Test Plan:
```
~/code/yugabyte-db/bin/yb-ctl start --data_dir ~/yugabyte-data1 --ip_start 10 --master_flags "v=2,enable_xcluster_api_v2=true,allowed_preview_flags_csv=enable_xcluster_api_v2"
~/code/yugabyte-db/bin/yb-ctl start --data_dir ~/yugabyte-data2 --ip_start 20 --master_flags "v=2,enable_xcluster_api_v2=true,allowed_preview_flags_csv=enable_xcluster_api_v2"

~/code/yugabyte-db/bin/ysqlsh -h 127.0.0.10 -c 'CREATE SEQUENCE mdl_sequence INCREMENT 42 START 13;'
~/code/yugabyte-db/bin/ysqlsh -h 127.0.0.20 -c 'CREATE SEQUENCE mdl_sequence INCREMENT 42 START 13;'

~/code/yugabyte-db/build/latest/bin/yb-admin -master_addresses 127.0.0.10:7100 list_tables include_db_type include_table_id include_table_type | grep -i 'system_postgres.sequences_data'
# -> ysql.system_postgres.sequences_data 0000ffff00003000800000000000ffff catalog

~/code/yugabyte-db/build/latest/bin/yb-admin -master_addresses 127.0.0.20:7100 setup_universe_replication sequence_replication 127.0.0.10:7100 0000ffff00003000800000000000ffff
```

Reviewers: xCluster, hsunder

Reviewed By: hsunder

Subscribers: ybase

Differential Revision: https://phorge.dev.yugabyte.com/D36871
  • Loading branch information
mdbridge committed Jul 29, 2024
1 parent bda76e9 commit 80c02fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/yb/master/xrepl_catalog_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ Status CatalogManager::BackfillMetadataForXRepl(
{
SharedLock lock(mutex_);
auto l = table->LockForRead();
if (table->IsSequencesSystemTable()) {
// Postgres doesn't know about the sequences_data table so it has neither an OID or PG schema
return Status::OK();
}
if (table->GetTableType() == PGSQL_TABLE_TYPE) {
if (!table->has_pg_type_oid()) {
LOG_WITH_FUNC(INFO) << "backfilling pg_type_oid for table " << table_id;
Expand Down

0 comments on commit 80c02fc

Please sign in to comment.