Summary:
Currently we try to do this in the catalog manager:
```
~/code/yugabyte-db/src/yb/master/catalog_manager.cc:3972:
const bool colocated =
(is_colocated_via_database || req.has_tablegroup_id() || is_vector_index) &&
// Any tables created in the xCluster DDL replication extension should not be colocated.
!IsXClusterDDLReplicationTable(req);
```
however, this setting to colocated is invisible to Postgres so when
ysql_dump runs, it dumps the table as non-colocated. This causes the
running of the dump on the target to fail with:
```
I0519 11:57:55.997388 17960 yb_cmds.c:621] Creating Table colocated_test_db.yb_xcluster_ddl_replication.ddl_queue with DocDB table name ddl_queue
2025-05-19 11:57:55.998 PDT [17960] ERROR: cannot colocate hash partitioned table
2025-05-19 11:57:55.998 PDT [17960] STATEMENT: CREATE TABLE yb_xcluster_ddl_replication.ddl_queue (
ddl_end_time bigint NOT NULL,
query_id bigint NOT NULL,
yb_data jsonb NOT NULL,
CONSTRAINT ddl_queue_pkey PRIMARY KEY((ddl_end_time) HASH, query_id ASC)
);
```
(This check is done on the Postgres side before we ever get to catalog
manager.)
The fix is to instead set the non-colocated status directly in the
extension using SQL so Postgres knows about it.
**Upgrade/Rollback safety:**
This diff changes the Postgres tables the extension creates.
However, this extension only exists while automatic mode replication is ongoing and it is not possible to upgrade to this version while automatic mode is running. (This is the first stable release with automatic mode available and we have banned upgrading between preview releases with automatic mode on.)
Therefore, this extension will not exist while upgrading so there is no safety issue.
Fixes #27100
Jira: DB-16586
Test Plan:
The following test used to fail but now passes:
```
time ybd release --cxx-test xcluster_ddl_replication-test --gtest_filter '*.DDLReplicationTablesNotColocated' --test-args '' >& /tmp/generic.mdl.log
```
Reviewers: xCluster, jhe, jason
Reviewed By: jhe
Subscribers: jason, ybase, yql
Differential Revision: https://phorge.dev.yugabyte.com/D44078