pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.41k stars 5.85k forks source link

Allow BR restore to a different schema or table name #51711

Open bolt-leandro opened 8 months ago

bolt-leandro commented 8 months ago

Feature Request

Is your feature request related to a problem? Please describe: While BR restore allows to restore only specific schemas and/or tables, it doesn't allow to restore to a different schema/table name. This is useful when you want to restore a copy of a dataset but want to leave the existing schema alone (it is being used).

Describe the feature you'd like: Ability to rename restored schemas/tables into different name. original_schema -> (tiup br restore db --db original_schema --target_db new_schema) -> new_schema

Could also be something similar to: https://docs.pingcap.com/tidb/stable/tidb-lightning-data-source#rename-databases-and-tables

Describe alternatives you've considered: Alternative is using dumpling/lightning but this is very slow when dataset is multiple TB.

Teachability, Documentation, Adoption, Migration Strategy:

BornChanger commented 8 months ago

@dveeden can you please help to open an internal frm to track this requirement.

YuJuncen commented 8 months ago

cc https://github.com/pingcap/br/issues/252

kennytm commented 5 months ago

Regarding pingcap/br#252 I still prefer the MySQL --replicate-rewrite-db syntax a->b over the Docker syntax a:b. The arrow makes it very clear which one is the original name and which is the new name, while the colon does not.

The Docker syntax is always in the order host_stuff:container_stuff for both volume mount -v and publish port -p. But when we are talking about "original source" and "renamed target", the -v and -p flags ascribe totally opposite meaning (considering a container typically host a server). So I don't think a:b is intuitive enough for users.