Skip to content

Commit

Permalink
[#23325][#23326] yugabyted: Support for adding new databases for xClu…
Browse files Browse the repository at this point in the history
…ster replication (Phase 2)

Summary:
Add/Remove new databases to/from xCluster replication using yugabyted.

Commit for Phase 1: a137121 / D34956

Modifications to existing yugabyted xcluster commands:

`yugabyted xcluster checkpoint` -> `yugabyted xcluster create_checkpoint`

- Functionality is same
- Flags are same

`yugabyted xcluster set_up` (Unchanged name)

- `--bootstrap_done` is now a mandatory flag.
- Need to complete backup/restore in case data is present on source. Need to apply the schema of the database(s) to target in case of no data.

`yugabyted xcluster status` (Unchanged completely)

`yugabyted xcluster delete` -> `yugabyted xcluster delete_replication`

- Functionality is same
- Flags are same

New commands added to yugabyted:

`yugabyted xcluster add_to_checkpoint`

- Checkpoints new database(s) to be added to an existing replication.
- Needs to be run on source cluster.
- Displays the databases for which bootstrapping is required.
- Gives out the backup/restore commands if bootstrapping is required.

Flags:
```
--databases (Mandatory Flag): Comma separated list of databases to be added to existing replication.

--replication_id (Mandatory Flag): Replication id of the xcluster replication to which database(s) is to be added.
```

`yugabyted xcluster add_to_replication`

- Add database(s) to xcluster replication.
- Needs to be run on source cluster.
- Need to complete bootstrap (backup/restore or schema apply on target) before running this command.
- `--bootstrap_done` needs to be given.

Flags:
```
--target_address (Mandatory Flag): IP of any 1 of the target cluster nodes.

--replication_id (Mandatory Flag): replication_id for which replication is to be set-up.

--databases (Mandatory Flag): Comma separated list of databases that needs to be added to the replication.

--bootstrap_done (Mandatory Flag): This flag indicates that the user has completed the required bootstrapping step.
```

`yugabyted xcluster remove_database_from_replication`

- Deletes database from xcluster replication.
- Needs to be run on source.
- If target is not available, the database will be removed from replication on source only.

Flags
```
--target_address (Mandatory Flag): IP of any 1 of the target cluster nodes.

--databases (Mandatory Flag): Database(s) that needs to be removed from the replication.

--replication_id (Mandatory Flag): replication_id of the replication which is to be deleted.
```

* Deprecating the use of `/xcluster` page parsing to get databases names for source cluster.
* Using saved masters from the config file instead of getting them from API in most of the places.
Jira: DB-12250, DB-12251

Test Plan: ./yb_build.sh --java-test 'org.yb.yugabyted.*'

Reviewers: nikhil

Reviewed By: nikhil

Subscribers: sgarg-yb

Differential Revision: https://phorge.dev.yugabyte.com/D37902
  • Loading branch information
gargsans-yb committed Sep 26, 2024
1 parent 9009d11 commit 11acca7
Showing 1 changed file with 754 additions and 188 deletions.
Loading

0 comments on commit 11acca7

Please sign in to comment.