Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cliccl/debug_backup.go: refactor backup inspection tool #63309

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

Elliebababa
Copy link
Contributor

@Elliebababa Elliebababa commented Apr 8, 2021

Previously, cli backup inspection tool was incorporated
in cliccl/load.go. Both the command and syntax are
confusing in terms of backup inspection.

This patch refactors the naming and syntax of the tool
and hang the tool under cockroach debug, so that
it makes more sense when using it to debug backups.

Release note (cli change): Backup inspection used to be done via
cockroach load show .., which was confusing to users with
ambiguous verbs in the command chain. We refactor the syntax of
tool and make the syntax more clear and indicative for users to
debug backups. The changes are:
load show summary <backup_url> ->
debug backup show <backup_url>

$ ./cockroach debug backup show $AWS_BACKUP_PATH
{
	"StartTime": "1970-01-01T00:00:00Z",
	"EndTime": "2021-04-05T22:02:25Z",
	"DataSize": "110 KiB",
	"Rows": 224,
	"IndexEntries": 324,
	"FormatVersion": 1,
	"ClusterID": "7c1b9ceb-d05a-4879-b4a4-886ace456953",
	"NodeID": 0,
	"BuildInfo": "CockroachDB CCL v21.1.0-alpha.3-1790-g25dc628337-dirty (x86_64-apple-darwin19.6.0, built 2021/03/29 18:50:47, go1.15.7)",
	"Files": [
		{
			"Path": "647462079350243329.sst",
			"Span": "/Table/4/{1-2}",
			"DataSize": "99 B",
			"IndexEntries": 0,
			"Rows": 2
		},
	],
	"Spans": "[/Table/4/{1-2}]",
	"DatabaseDescriptors": {
		"1": "system"
	},
	"TableDescriptors": {
		"53": "demodb.public.demo",
		"54": "demodb.public.foo"
	},
	"TypeDescriptors": {},
	"SchemaDescriptors": {
		"29": "public"
	}
}

load show incremental <backup_url> ->
debug backup list-incremental <backup_url>

$ ./cockroach debug backup list-incremental $AWS_BACKUP_PATH
              path             |      start time      |       end time
-------------------------------+----------------------+-----------------------
  /mybackup                    | -                    | 2021-04-09T20:22:59Z
  /mybackup/20210409/202303.20 | 2021-04-09T20:22:59Z | 2021-04-09T20:23:03Z
  /mybackup/20210409/202305.97 | 2021-04-09T20:23:03Z | 2021-04-09T20:23:05Z
(3 rows)

load show backups <collection_url> ->
debug backup list-backups <collection_url>

$ ./cockroach debug backup list-backups $AWS_COLLECTION_PATH
           path
--------------------------
  ./2021/04/09-202455.98
  ./2021/04/09-202522.59
  ./2021/04/09-202526.93
(3 rows)

load show data <table_name> <backup_url> ->
debug backup export <backup_url> --table=<table_name> [--destination=</path/to/export>]

$ ./cockroach debug backup export $AWS_BACKUP_PATH --table=demodb.public.demo
1,null,true
2,'ellie',null

@Elliebababa Elliebababa requested review from pbardea and a team April 8, 2021 14:47
@Elliebababa Elliebababa requested a review from a team as a code owner April 8, 2021 14:47
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Elliebababa Elliebababa force-pushed the refactor_backup_cli_tool branch 3 times, most recently from 0c95fd6 to 58a0f63 Compare April 8, 2021 20:22
pkg/ccl/cliccl/debug_backup.go Outdated Show resolved Hide resolved
@Elliebababa Elliebababa force-pushed the refactor_backup_cli_tool branch 3 times, most recently from 3e92e36 to 593dc5c Compare April 12, 2021 14:11
pkg/ccl/backupccl/targets.go Outdated Show resolved Hide resolved
pkg/sql/row/kv_fetcher.go Outdated Show resolved Hide resolved
@Elliebababa Elliebababa force-pushed the refactor_backup_cli_tool branch 5 times, most recently from f2efdfa to 5073a93 Compare April 21, 2021 18:56
Previously, cli backup inspection tool was incorporated
in cliccl/load.go. Both the command and syntax are
confusing in terms of backup inspection.

This patch refactors the naming and syntax of the tool
and hand the tool under `cockroach debug`, so that
it makes more sense when using it to debug backups.

Release note (cli change): Backup inspection used to be done via
`cockroach load show ..`, which was confusing to users with
ambiguous verbs in the command chain. We refactor the syntax of
tool and make the syntax  more clear and indicative for users to
debug backups. The changes are:
`load show summary <backup_url>` ->
`debug backup show <backup_url>`

`load show incremental <backup_url>` ->
`debug backup list-incremental <backup_url>`

`load show backups <collection_url>` ->
`debug backup list-backups <collection_url>`

`load show data <table_name> <backup_url> ->
`debug backup export <backup_url> --table=<table_name>`
@Elliebababa
Copy link
Contributor Author

bors r=pbardea

@craig
Copy link
Contributor

craig bot commented Apr 22, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants