diff --git a/pkg/ccl/backupccl/restore_old_versions_test.go b/pkg/ccl/backupccl/restore_old_versions_test.go index cd893abe06bf..00c52be2ab69 100644 --- a/pkg/ccl/backupccl/restore_old_versions_test.go +++ b/pkg/ccl/backupccl/restore_old_versions_test.go @@ -366,6 +366,7 @@ func fullClusterRestoreSystemPrivilegesWithoutIDs(exportDir string) func(t *test sqlDB.Exec(t, fmt.Sprintf("RESTORE FROM '%s' WITH UNSAFE_RESTORE_INCOMPATIBLE_VERSION", localFoo)) sqlDB.CheckQueryResults(t, "SELECT * FROM system.privileges", [][]string{ + {"public", "/vtable/crdb_internal/tables", "{}", "{}", "4"}, {"testuser1", "/global/", "{VIEWACTIVITY}", "{}", "100"}, {"testuser2", "/global/", "{MODIFYCLUSTERSETTING}", "{}", "101"}, }) diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/create-system-privileges.sql b/pkg/ccl/backupccl/testdata/restore_old_versions/create-system-privileges.sql index 7859591ac733..1959ba9bf781 100644 --- a/pkg/ccl/backupccl/testdata/restore_old_versions/create-system-privileges.sql +++ b/pkg/ccl/backupccl/testdata/restore_old_versions/create-system-privileges.sql @@ -14,3 +14,5 @@ CREATE USER testuser2; GRANT SYSTEM VIEWACTIVITY TO testuser1; GRANT SYSTEM MODIFYCLUSTERSETTING TO testuser2; + +REVOKE SELECT ON crdb_internal.tables FROM public; diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-LOCK-849140163936059393 b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-LOCK-850743482728284161 similarity index 100% rename from pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-LOCK-849140163936059393 rename to pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-LOCK-850743482728284161 diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-STATISTICS b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-STATISTICS index 01a9f53c9703..3d9bbfe25409 100644 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-STATISTICS and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP-STATISTICS differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST index 1960b54d9b68..0391fb7cf30c 100644 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST-CHECKSUM b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST-CHECKSUM index 23204aa4b53d..2edeef319287 100644 --- a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST-CHECKSUM +++ b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/BACKUP_MANIFEST-CHECKSUM @@ -1 +1 @@ -UIS \ No newline at end of file + \ No newline at end of file diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140167931461633.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140167931461633.sst deleted file mode 100644 index 95e19945871c..000000000000 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140167931461633.sst and /dev/null differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168228208642.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168228208642.sst deleted file mode 100644 index 33e640245fe3..000000000000 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168228208642.sst and /dev/null differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168235778051.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168235778051.sst deleted file mode 100644 index c74467daa9a7..000000000000 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/849140168235778051.sst and /dev/null differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743486781980673.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743486781980673.sst new file mode 100644 index 000000000000..f3ba542b86bb Binary files /dev/null and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743486781980673.sst differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487039143939.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487039143939.sst new file mode 100644 index 000000000000..7f03a8fc0082 Binary files /dev/null and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487039143939.sst differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487047237634.sst b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487047237634.sst new file mode 100644 index 000000000000..39ad36acd1c3 Binary files /dev/null and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/data/850743487047237634.sst differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe new file mode 100644 index 000000000000..cefc7ff5172a Binary files /dev/null and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe-CHECKSUM b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe-CHECKSUM new file mode 100644 index 000000000000..c99aa077d4f3 --- /dev/null +++ b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc7d1cdc8c9cdcac6dfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c7c6c7c6cec6c8cecffffe-CHECKSUM @@ -0,0 +1 @@ +B:| \ No newline at end of file diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe new file mode 100644 index 000000000000..a5b9a8c3ce17 Binary files /dev/null and b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe-CHECKSUM b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe-CHECKSUM new file mode 100644 index 000000000000..ad1fd3872906 --- /dev/null +++ b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cdcbdfcdcdc5cdcac5cfc8d1c6c7cfcbc7cedfd4cfcfcfcfdfaaabbcdf92c2d4c6c6d1c9cfcccecbcdcccccafffe-CHECKSUM @@ -0,0 +1 @@ +w \ No newline at end of file diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe deleted file mode 100644 index f50d55fe0981..000000000000 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe and /dev/null differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe-CHECKSUM b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe-CHECKSUM deleted file mode 100644 index 73a9cf3a075e..000000000000 --- a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5cecbd1cdcdc7cbcbcbdfd4cfcfcfcfdfaaabbcdf92c2d4cccecbd1cccfcccbcbccc7c8c9fffe-CHECKSUM +++ /dev/null @@ -1 +0,0 @@ -^X \ No newline at end of file diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe deleted file mode 100644 index 0ae37bb69d51..000000000000 Binary files a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe and /dev/null differ diff --git a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe-CHECKSUM b/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe-CHECKSUM deleted file mode 100644 index 98cac927d12f..000000000000 --- a/pkg/ccl/backupccl/testdata/restore_old_versions/system-privileges-restore/v22.2.6/progress/BACKUP-CHECKPOINT-13cdcfcdccd2cfccd2cec6dfcfc9c5cccfc5ceccd1c6cfcbcbc9cddfd4cfcfcfcfdfaaabbcdf92c2d4ccceccd1c6c8c6cbcac7c9cdc9fffe-CHECKSUM +++ /dev/null @@ -1 +0,0 @@ -o{ \ No newline at end of file diff --git a/pkg/sql/logictest/testdata/logic_test/mixed_version_database_role_settings_role_id b/pkg/sql/logictest/testdata/logic_test/mixed_version_database_role_settings_role_id new file mode 100644 index 000000000000..fed783d3fe65 --- /dev/null +++ b/pkg/sql/logictest/testdata/logic_test/mixed_version_database_role_settings_role_id @@ -0,0 +1,27 @@ +# LogicTest: cockroach-go-testserver-upgrade-to-master + +# Set default session variables in a mixed version cluster. + +statement ok +CREATE USER testuser1 + +upgrade 1 + +user root nodeidx=1 + +statement ok +ALTER ROLE ALL SET timezone = 'America/New_York' + +statement ok +ALTER ROLE testuser1 SET application_name = 'my app' + +user root nodeidx=2 + +statement ok +ALTER ROLE testuser1 SET index_recommendations_enabled = false + +query TT +SELECT role_name, settings FROM system.database_role_settings +---- +· {timezone=America/New_York} +testuser1 {"application_name=my app",index_recommendations_enabled=false} diff --git a/pkg/sql/logictest/testdata/logic_test/mixed_version_system_privileges_user_id b/pkg/sql/logictest/testdata/logic_test/mixed_version_system_privileges_user_id new file mode 100644 index 000000000000..00676b9724e1 --- /dev/null +++ b/pkg/sql/logictest/testdata/logic_test/mixed_version_system_privileges_user_id @@ -0,0 +1,27 @@ +# LogicTest: cockroach-go-testserver-upgrade-to-master + +# Grant system privileges in a mixed version cluster. + +statement ok +CREATE USER testuser1 + +upgrade 1 + +user root nodeidx=1 + +statement ok +REVOKE SELECT ON crdb_internal.tables FROM public + +statement ok +GRANT SYSTEM MODIFYCLUSTERSETTING TO testuser1 + +user root nodeidx=2 + +statement ok +GRANT SYSTEM CANCELQUERY TO testuser1 + +query TTTT +SELECT username, path, privileges, grant_options FROM system.privileges +---- +public /vtable/crdb_internal/tables {} {} +testuser1 /global/ {CANCELQUERY,MODIFYCLUSTERSETTING} {} diff --git a/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/BUILD.bazel b/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/BUILD.bazel index 89a8eb52fbc5..423f7e7b1745 100644 --- a/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/BUILD.bazel +++ b/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/BUILD.bazel @@ -11,7 +11,7 @@ go_test( "//pkg/cmd/cockroach-short", # keep "//pkg/sql/logictest:testdata", # keep ], - shard_count = 4, + shard_count = 6, tags = [ "cpu:2", ], diff --git a/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/generated_test.go b/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/generated_test.go index 257083c4a40f..48b3a2c8d7c9 100644 --- a/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/generated_test.go +++ b/pkg/sql/logictest/tests/cockroach-go-testserver-upgrade-to-master/generated_test.go @@ -79,6 +79,13 @@ func TestLogic_mixed_version_can_login( runLogicTest(t, "mixed_version_can_login") } +func TestLogic_mixed_version_database_role_settings_role_id( + t *testing.T, +) { + defer leaktest.AfterTest(t)() + runLogicTest(t, "mixed_version_database_role_settings_role_id") +} + func TestLogic_mixed_version_external_connections_owner_id( t *testing.T, ) { @@ -99,3 +106,10 @@ func TestLogic_mixed_version_role_members_user_ids( defer leaktest.AfterTest(t)() runLogicTest(t, "mixed_version_role_members_user_ids") } + +func TestLogic_mixed_version_system_privileges_user_id( + t *testing.T, +) { + defer leaktest.AfterTest(t)() + runLogicTest(t, "mixed_version_system_privileges_user_id") +}