Motivation
BR (Backup & Restore) is an independent command-line tool for distributed backup and restoration of the TiDB cluster data.
We would like to put BR code into TiDB repo due to these reasons:
- currently BR and TiDB depend each other, It’s not easy to maintain the interdependence golang repo. see details at https://github.com/pingcap/br/issues/345.
- BR is a tool only use for TiDB, so put the code together is intuitive, just like other database products.
Steps
Steps below migrates minimal BR codebase to TiDB, which allow BR build and release from the TiDB repository. (Even not the latest version.)
-
git checkout -b clone-br && git subtree add -D br https://github.com/pingcap/br.git
-
git checkout -b merge-br (to create a diff branch, so the PR would be easier to review…)
-
Do necessary merging.
- merge go.mod, go.sum
- update Makefile,
- update the import path for both TiDB and BR.
- merge CI scripts.
-
Create a PR from merge-br targeting clone-br for reviewing.
-
After reviewing, merge it to master.
Risks
The change in TiDB is add a new directory br
and change the import path in executor/brie.go, so the risk is under control.