-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Conversation
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. |
9a42507
to
bd7412d
Compare
362b07f
to
4d665b9
Compare
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? |
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 |
There was a problem hiding this 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)
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
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.
IncrementalStorage StringOrPlaceholderOptList | ||
DecryptionKMSURI StringOrPlaceholderOptList | ||
EncryptionPassphrase Expr |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
4379e90
to
dea9031
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
IncrementalStorage StringOrPlaceholderOptList | ||
DecryptionKMSURI StringOrPlaceholderOptList | ||
EncryptionPassphrase Expr |
There was a problem hiding this comment.
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.
unrelated extended CI failure |
dea9031
to
fef1dde
Compare
unrelated CI flake |
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
fef1dde
to
e6f47a0
Compare
bors r=benbardin |
Build failed (retrying...): |
Build succeeded: |
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 showbackup 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:
SHOW BACKUP
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: