-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
64285: cliccl/debug_backup.go: add `--with-revisions` flag to allow debugging revisions of data r=pbardea a=Elliebababa This patch adds `--with-revisions` on `debug export` to allow users to export revisions of table data. If `--with-revisions` is specified, revisions of data are returned to users, with an extra column displaying the revision time of that record. Note: Schema changes make it hard to maintain correct display of columns at different timestamps in one shot, So this feature: - do not display schema changes across revisions. - display data changes since last schema change only. That is, `--with-revisons` only display *part of* revisions history instead of *all* revision history. We migitate this by giving message saying `DETECTED SCHEMA CHANGE AT t1, ONLY SHOWING UPDATES IN RANGE [t1,t2]`. Then users are able to take exploratory steps to trace back to revision history of data by repeatedly running `cockroach debug backup export <backup_url> --table=<table> --with-revisions --up-to=t1-1` ---------------------------------------- Example usage: ``` $cockroach debug backup export <backup_url> --table=<table> --with-revisions Data changes happened between t1 and t2 : DETECTED SCHEMA CHANGE AT t1, ONLY SHOWING UPDATES IN RANGE [t1,t2] 1,null,2021-04-22 18:12:47.685284 +0000 UTC 2,'3rd update',2021-04-22 18:13:41.27284 +0000 UTC 2,'2nd update',2021-04-22 18:13:34.718665 +0000 UTC 2,'1st update',2021-04-22 18:13:28.966741 +0000 UTC 2,null,2021-04-22 18:12:50.053996 +0000 UTC ``` ``` $cockroach debug backup export <backup_url> --table=<table> --with-revisions --up-to=’2021-04-22 18:13:40’ DETECTED SCHEMA CHANGE AT t1, ONLY SHOWING UPDATES IN RANGE [t1,2021-04-22 18:13:40] 1,null,2021-04-22 18:12:47.685284 +0000 UTC 2,'2nd update',2021-04-22 18:13:34.718665 +0000 UTC 2,'1st update',2021-04-22 18:13:28.966741 +0000 UTC 2,null,2021-04-22 18:12:50.053996 +0000 UTC ``` *t1 is the last schema changes before the time specified by --up-to* *t2 is the endtime of backup* -------------------- Release note (cli change): This is an experimenal/beta feature of backup debug tool to allow users to export revisions of data from backup. We add `--with-revisions` on `debug export` to allow users to export revisions of table data. If `--with-revisions` is specified, revisions of data are returned to users, with an extra column displaying the revision time of that record. Co-authored-by: elliebababa <[email protected]>
- Loading branch information
Showing
6 changed files
with
300 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.