-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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, restoreccl: include system.privileges in full cluster restore #86830
Merged
craig
merged 1 commit into
cockroachdb:master
from
RichardJCai:include_system_privileges_in_restore
Aug 27, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
49 changes: 49 additions & 0 deletions
49
pkg/ccl/backupccl/testdata/backup-restore/system-privileges-table
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
new-server name=s1 | ||
---- | ||
|
||
exec-sql | ||
CREATE USER testuser; | ||
CREATE USER testuser2; | ||
GRANT SYSTEM MODIFYCLUSTERSETTING, VIEWACTIVITY TO testuser; | ||
GRANT SELECT ON crdb_internal.tables TO testuser; | ||
CREATE EXTERNAL CONNECTION foo AS 'nodelocal://0/foo'; | ||
GRANT USAGE ON EXTERNAL CONNECTION foo TO testuser2; | ||
GRANT SYSTEM VIEWACTIVITYREDACTED TO testuser2; | ||
GRANT SELECT ON crdb_internal.databases, crdb_internal.tables TO testuser2; | ||
GRANT ALL ON EXTERNAL CONNECTION foo TO testuser2; | ||
---- | ||
|
||
query-sql | ||
SELECT * FROM system.privileges | ||
---- | ||
root /externalconn/foo {ALL} {} | ||
testuser /global/ {MODIFYCLUSTERSETTING,VIEWACTIVITY} {} | ||
testuser /vtable/crdb_internal/tables {SELECT} {} | ||
testuser2 /externalconn/foo {ALL} {} | ||
testuser2 /global/ {VIEWACTIVITYREDACTED} {} | ||
testuser2 /vtable/crdb_internal/databases {SELECT} {} | ||
testuser2 /vtable/crdb_internal/tables {SELECT} {} | ||
|
||
exec-sql | ||
BACKUP INTO 'nodelocal://0/test/' | ||
---- | ||
|
||
# Start a new cluster with the same IO dir. | ||
new-server name=s2 share-io-dir=s1 | ||
---- | ||
|
||
# Restore into the new cluster. | ||
exec-sql server=s2 | ||
RESTORE FROM LATEST IN 'nodelocal://0/test/' | ||
---- | ||
|
||
query-sql server=s2 | ||
SELECT * FROM system.privileges | ||
---- | ||
root /externalconn/foo {ALL} {} | ||
testuser /global/ {MODIFYCLUSTERSETTING,VIEWACTIVITY} {} | ||
testuser /vtable/crdb_internal/tables {SELECT} {} | ||
testuser2 /externalconn/foo {ALL} {} | ||
testuser2 /global/ {VIEWACTIVITYREDACTED} {} | ||
testuser2 /vtable/crdb_internal/databases {SELECT} {} | ||
testuser2 /vtable/crdb_internal/tables {SELECT} {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
✅ Double checked that it looks like the format for the
path
element in the table also doesn't use any IDs that need rewritting.