Skip to content

2.27.0.0-b419

@hari90 hari90 tagged this 06 Aug 21:09
Summary:
Allow the user to run DDLs related to temporary tables and materialized views on an Automatic mode xCluster Target universe without having to set any special GUC.
As part of this change we now also properly block other DDLs from the user on the Target. This happens at the `PgClientSession` layer where DMLs are also blocked. A new flag `xcluster_target_ddl_bypass` is added to `PgPerformOptionsPB`. DDLs are only allowed if this is set.
`yb_xcluster_ddl_replication` extension now sets `xcluster_target_ddl_bypass` on the target if `enable_manual_ddl_replication` or `yb_xcluster_automatic_mode_target_ddl` is set, if its a matview or temp table DDL.
Temp table DDLs do not have any special command tags that can help us differentiate them from persisted relations, and we can only detect their presence in the `handle_ddl_end` trigger, but this is too late, since the writes to pg catalog and DocDB table creations would have already happened by then. Temp Table DDLs set `YBCDdlEnableForceCatalogModification` so that they can execute during Ysql Major upgrades. This function has been replaced with `YBCRecordTempRelationDDL`, which includes a execution hook. The extension uses this hook to sets `xcluster_target_ddl_bypass` for the target temp table DDLs.

MatView DDLs are also now allowed to execute on the Source cluster without any need for extra GUCs.

TRUNCATE of temp tables was not whitelisted as a temp table only DDL. This has now been fixed.

`XClusterProcessUtility` has been added as a ProcessUtility hook, to whitelist DDLs that are not captured by the DDL trigger like CREATE DATABASE, ALTER ROLE. For this purpose, the extension has now been added to `shared_preload_libraries`.

**Upgrade/Rollback safety:**
A new flag `xcluster_target_ddl_bypass` is added to `PgPerformOptionsPB`. This PB is only used by local communication between PG and its host tserver, which get upgraded together.

Fixes #27983
Jira: DB-17597

Test Plan:
XClusterDDLReplicationTest.TempTables
XClusterDDLReplicationTest.MatView
XClusterDDLReplicationTest.DDLsOnTarget

Reviewers: jhe, slingam

Reviewed By: jhe

Subscribers: yql, ybase

Differential Revision: https://phorge.dev.yugabyte.com/D45423
Assets 2
Loading