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

backupccl: explicitly parse SHOW BACKUP options #95562

Merged
merged 2 commits into from
Jan 27, 2023

Conversation

msbutler
Copy link
Collaborator

@msbutler msbutler commented Jan 19, 2023

Fixes: #82912

Release note (sql change): Previously, SHOW BACKUP options would get parsed as
kv_options, which meant that a user could not pass multiple values to a show
backup option, causing feature gaps in SHOW BACKUP relative to BACKUP and
RESTORE. This patch rewrites the show backup option parser, closing the
following feature gaps:

  1. A user can now pass and check multiple KMS URIs in
    SHOW BACKUP
  2. A user can pass locality aware incremental_locations, allowing a
    user to also pass the check_files parameter to a locality aware backup chain
    that also specifies the backup incremental location.

Note that while this patch introduces a couple new words to the CRDB SQL
syntax, the same SHOW BACKUP options should remain documented, specifically:

  • [public option] -> value
  • AS_JSON -> N/A
  • CHECK_FILES -> N/A
  • INCREMENTAL_LOCATION -> string, with potentially multiple uris
  • DEBUG_IDS -> N/A
  • KMS -> string, with potentially multiple uris
  • PRIVILEGES -> N/A
  • ENCRYPTION_PASSPHRASE -> string

@blathers-crl
Copy link

blathers-crl bot commented Jan 19, 2023

It looks like your PR touches SQL parser code but doesn't add or edit parser tests. Please make sure you add or edit parser tests if you edit the parser.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@msbutler msbutler self-assigned this Jan 19, 2023
@msbutler msbutler force-pushed the butler-show-inc branch 5 times, most recently from 362b07f to 4d665b9 Compare January 23, 2023 01:17
@msbutler msbutler changed the title Butler show inc backupccl: explicitly parse SHOW BACKUP options Jan 23, 2023
@msbutler msbutler marked this pull request as ready for review January 23, 2023 01:18
@msbutler msbutler requested review from a team as code owners January 23, 2023 01:18
@msbutler msbutler requested review from rhu713, benbardin and dt and removed request for a team January 23, 2023 01:18
@benbardin
Copy link
Collaborator

Oof. I see where this is coming from but adding so many keywords feels off, since this is a sub-option for one query. Why isn't this an issue for the other commands?

@msbutler
Copy link
Collaborator Author

Why isn't this an issue for the other commands?

Like other cockroach sql cmds with an extensive Options list? I'm not sure I follow. I think what I propose is the conventional way to do it? E.g. backup, restore, copy

Copy link
Collaborator

@benbardin benbardin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline: Michael showed me that the base BACKUP and RESTORE commands already use this query structure, e.g. with a bunch of keywords. By adding the keywords here, we're bringing the SHOW BACKUP command to parity with these (both in query data structure, and in user functionality)

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my main question wrt all of the new keywords is whether we definitely want to promote some of these options into documented, supported options.

@@ -15810,6 +15883,7 @@ unreserved_keyword:
| ENCODING
| ENCRYPTED
| ENCRYPTION_PASSPHRASE
| ENCRYPTION_INFO_DIR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add these to the bare_label_keyword list as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, you mentioned in some meeting today that you'd file/ or work on a stability period issue that would create a linter for syntax changes right? I imagine we also need to add a bunch of backup/restore keywords to this list as well.

Comment on lines +144 to +148
IncrementalStorage StringOrPlaceholderOptList
DecryptionKMSURI StringOrPlaceholderOptList
EncryptionPassphrase Expr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting: We don't currently have an implementation of walkableStmt for ShowBackup. If we did, I would say we should probably be updating it to account for these new Exprs. We may want to add one in a follow up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Just added a todo. I don't know enough about this method to understand why one would need it. It seems that no other SHOW cmd in this file implements one either.

@msbutler msbutler force-pushed the butler-show-inc branch 2 times, most recently from 4379e90 to dea9031 Compare January 26, 2023 18:43
Copy link
Collaborator Author

@msbutler msbutler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevendanna on your question on keyword documentation: I tried to describe what needed to be documented in the commit message. Let me know if that satisfied you!

@@ -15810,6 +15883,7 @@ unreserved_keyword:
| ENCODING
| ENCRYPTED
| ENCRYPTION_PASSPHRASE
| ENCRYPTION_INFO_DIR
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines +144 to +148
IncrementalStorage StringOrPlaceholderOptList
DecryptionKMSURI StringOrPlaceholderOptList
EncryptionPassphrase Expr
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Just added a todo. I don't know enough about this method to understand why one would need it. It seems that no other SHOW cmd in this file implements one either.

@msbutler
Copy link
Collaborator Author

unrelated extended CI failure

@msbutler
Copy link
Collaborator Author

unrelated CI flake

@stevendanna
Copy link
Collaborator

I tried to describe what needed to be documented in the commit message.

Heh, I read that, thought it was good, and then forgot it by the time I finished my review. Sorry about that! LGTM

Release note (security update): previously, the ENCRYPTION_PASSPHRASE option
passed to RESTORE would appear as 'redacted', and now it appears as '******'
which is consistent with SHOW BACKUP and BACKUP.

Epic: None
Fixes: cockroachdb#82912

Release note (sql change): Previously, SHOW BACKUP options would get parsed as
`kv_options`, which meant that a user could not pass multiple values to a show
backup option, causing feature gaps in SHOW BACKUP relative to BACKUP and
RESTORE. This patch rewrites the show backup option parser, closing the
following feature gaps: 1. A user can now pass and check multiple KMS URIs in
SHOW BACKUP 2. A user can pass locality aware incremental_locations, allowing a
user to also pass the check_files parameter to a locality aware backup chain
that also specifies the backup incremental location.

Note that while this patch introduces a couple new words to the CRDB SQL
syntax, the same SHOW BACKUP options should remain documented, specifically:
- [public option] -> value
- AS_JSON -> N/A
- CHECK_FILES -> N/A
- INCREMENTAL_LOCATION -> string, with potentially multiple uris
- DEBUG_IDS -> N/A
- KMS -> string, with potentially multiple uris
- PRIVILEGES -> N/A
- ENCRYPTION_PASSPHRASE -> string
@msbutler
Copy link
Collaborator Author

bors r=benbardin

@craig
Copy link
Contributor

craig bot commented Jan 27, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 27, 2023

Build succeeded:

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

Successfully merging this pull request may close these issues.

backupccl: add SHOW BACKUP ... with incremental_location for locality aware backups
4 participants