Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-13870] Support addition of databases in DB scoped DR config
Summary: Allow users to add databases to the DR config after enabled DB scoped replication on YBA. Users can enable this feature by enabling the yb.xcluster.db_scoped.enabled runtime flag. Currently supports addition of databases without bootstrapping. Example of the setDatbases API: ``` curl --location --request PUT 'localhost:9000/api/v1/customers/f33e3c9b-75ab-4c30-80ad-cba85646ea39/dr_configs/a4f7f7cb-0206-4385-82bc-8413f09b1fca/set_dbs' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'X-AUTH-YW-API-TOKEN: XYZ' \ --data '{ "databases": [ "00004004000030008000000000000000", "00004005000030008000000000000000" ] }' ``` The schema of the table `xcluster_namespace_config` is modified to include the replication status: ``` Table "public.xcluster_namespace_config" Column | Type | Collation | Nullable | Default ---------------------+-----------------------+-----------+----------+------------------------------ config_uuid | uuid | | not null | source_namespace_id | character varying(64) | | not null | status | character varying(32) | | not null | 'Running'::character varying Indexes: "pk_xcluster_namespace_config" PRIMARY KEY, btree (config_uuid, source_namespace_id) Check constraints: "ck_xcluster_namespace_config_table_status" CHECK (status::text = ANY (ARRAY['Validated'::character varying, 'Running'::character varying, 'Updating'::character varying, 'Bootstrapping'::character varying, 'Failed'::character varying]::text[])) Foreign-key constraints: "fk_xcluster_namespace_config_config_uuid" FOREIGN KEY (config_uuid) REFERENCES xcluster_config(uuid) ON UPDATE CASCADE ON DELETE CASCADE ``` Test Plan: Added UT Create a source and target universe with db version >= 2.23.0.0-b247. Create database `trial1` and `trial2` on both source and target universe Add the following table to the `trial1` and `trial2` db on both source and target universe without any data in it. ``` CREATE TABLE house( ID INT PRIMARY KEY NOT NULL, LOCATION TEXT NOT NULL ); ``` Make a call to the setDatabases endpoint with dbScoped boolean set as true. Make sure that the task succeeds. Add data to the table on the source and check that it reflects on the target database. Reviewers: #yba-api-review!, cwang, hzare, daniel, amindrov, sanketh Reviewed By: cwang, hzare Subscribers: sanketh, jmak, amindrov, hzare, cwang, yugaware Differential Revision: https://phorge.dev.yugabyte.com/D35498
- Loading branch information