Skip to content

2.23.0.0-b503

Summary:
Allow users to delete 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 deletion 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"
  ]
}'
```

Any database that is not in the list of databases in the payload above will be removed from
replication.

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 passing both the
databases `trial1` and `trial2`.
Make sure that the task succeeds.

Add data to the table on the source and check that it reflects on the target in both the databases
`trial1` and `trial2`.

Now, make a call to the setDatabases endpoint with dbScoped boolean set as true passing only the
database `trial1`. This will remove replication for the database `trial2`. Now, add some data to the
table on the source in the database `trial2` and verify that the data won't be replicated. However,
it will be replicated in the database `trial1`.

Reviewers: #yba-api-review!, cwang, hzare, daniel, amindrov, sanketh

Reviewed By: cwang

Subscribers: hsunder, yugaware, cwang, hzare, amindrov, jmak, sanketh

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