Summary:
This change enables CREATE TABLE ... AS SELECT ... (CTAS) to be used in an xCluster replication setup. The diff itself is straightforward, since the existing CREATE TABLE logic already handles most of the CTAS flow.
On the Source: The CTAS statement is executed normally. The new table is created, and load the data from original table. Then we send the query along with table name and refilenode id to target.
On the Target: When the CTAS command arrives, we excute the query and SKIP the data loading part(empty table), and reply on replication to replicate the date.
Jira: DB-18419
Test Plan:
./yb_build.sh --cxx-test xcluster_ddl_replication_pgregress-test --gtest_filter XClusterPgRegressDDLReplicationTest.PgRegressCreateTableAs
./yb_build.sh --cxx-test xcluster_ddl_replication-test --gtest_filter XClusterDDLReplicationTest.CreateTableAs
Reviewers: jhe, hsunder, xCluster
Reviewed By: jhe
Subscribers: ybase, yql
Differential Revision: https://phorge.dev.yugabyte.com/D46877