-
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.
65010: sql: fix Usage privilege on Tables/DBs after upgrading from 20.1 r=RichardJCai a=RichardJCai In 20.2, I made a mistake when introducing USAGE privilege by adding it before ZONECONFIG privilege in the bitfield. Due to this, when updating from 20.1 to 20.2, ZONECONFIG privilege will be interpretted as USAGE. Fortunately, ZONECONFIG was only a valid privilege on tables and databases while USAGE is invalid on both those objects. Due to this, whenever we encounter USAGE on a privilege descriptor versioned 20.1 (InitialVersion) we can fix this by removing the bit for USAGE and adding the bit for ZONECONFIG on the privilege descriptor. Release note: None Co-authored-by: richardjcai <[email protected]>
- Loading branch information
Showing
18 changed files
with
360 additions
and
0 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
20 changes: 20 additions & 0 deletions
20
pkg/ccl/backupccl/testdata/restore_old_versions/create_with_privileges.sql
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,20 @@ | ||
-- The below SQL is used to create the data that is then exported with BACKUP. | ||
-- This should be run on a v20.1 cluster, the ZONECONFIG bit is incorrectly | ||
-- updated to be interpreted as USAGE in versions of 20.2 and onward. | ||
-- The restore test should ensure that ZONECONFIG stays as ZONECONFIG. | ||
|
||
CREATE DATABASE test; | ||
|
||
SET database = test; | ||
|
||
CREATE USER testuser; | ||
|
||
CREATE TABLE test_table(); | ||
|
||
CREATE TABLE test_table2(); | ||
|
||
GRANT ZONECONFIG ON DATABASE test TO testuser; | ||
|
||
GRANT ZONECONFIG ON test_table TO testuser; | ||
|
||
GRANT ALL ON test_table2 TO testuser; |
Binary file added
BIN
+1.09 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117481816066.sst
Binary file not shown.
Binary file added
BIN
+938 Bytes
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117481848836.sst
Binary file not shown.
Binary file added
BIN
+952 Bytes
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117481881604.sst
Binary file not shown.
Binary file added
BIN
+1.04 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117481914372.sst
Binary file not shown.
Binary file added
BIN
+968 Bytes
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117482045442.sst
Binary file not shown.
Binary file added
BIN
+2.42 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117482078210.sst
Binary file not shown.
Binary file added
BIN
+1.11 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117485420546.sst
Binary file not shown.
Binary file added
BIN
+1.32 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117485879300.sst
Binary file not shown.
Binary file added
BIN
+938 Bytes
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117486469124.sst
Binary file not shown.
Binary file added
BIN
+1.04 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/657900117486829572.sst
Binary file not shown.
Binary file added
BIN
+6.07 KB
pkg/ccl/backupccl/testdata/restore_old_versions/privileges/v20.1.6/BACKUP
Binary file not shown.
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.