Skip to content

Commit f27fa9d

Browse files
craig[bot]maryliagadityamaruMarius Postaaliher1911
committed
95461: ui: remove reset sql stats for non-admin r=maryliag a=maryliag Continuation from #95303 The previous PR missed the reset on the Transactions tab. This PR removes the reset sql stats for non-admin users. Fixes #95213 Release note (ui change): Remove `reset sql stats` from Transactions page for non-admins. 95466: ingesting: fixup privileges granted during database restore r=rafiss a=adityamaru Previously, all schemas and tables that were ingested as part of a database restore would "inherit" the privileges of the database. The database would be granted `CONNECT` for the `public` role and `ALL` to `admin` and `root`, and so all ingested schemas would have `ALL` for `admin` and `root`. Since 21.2 we have moved away from tables/schemas inheriting privileges from the parent database and so this logic is stale and partly incorrect. It is incorrect because the restored `public` schema does not have `CREATE` and `USAGE` granted to the `public` role. These privileges are always granted to `public` schemas of a database and so there is a discrepancy in restore's behaviour. This change simplifies the logic to grant schemas and tables their default set of privileges if ingested via a database restore. It leaves the logic for cluster and table restores unchanged. Release note (bug fix): fixes a bug where a database restore would not grant `CREATE` and `USAGE` on the public schema to the public role Fixes: #95456 95467: schemachanger: a bunch of small fixes r=postamar a=postamar Informs #88294. Release note: None 95504: schemachangerccl: rename generated tests r=postamar a=postamar This commit adds an underscore in the generated tests' name where there previously was one missing. Informs #88294. Release note: None 95512: kvserver: fix flaky TestLearnerReplicateQueueRace test r=tbg a=aliher1911 Test was not expecting raft snapshots and injected failure at wrong moments. Fixes #94993 Release note: None Co-authored-by: maryliag <marylia@cockroachlabs.com> Co-authored-by: adityamaru <adityamaru@gmail.com> Co-authored-by: Marius Posta <marius@cockroachlabs.com> Co-authored-by: Oleg Afanasyev <oleg@cockroachlabs.com>
6 parents 38407a0 + 4b6d9d8 + 05cfdac + fc10b6d + eff5075 + 41b07fa commit f27fa9d

File tree

74 files changed

+857
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+857
-559
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
explainable_stmt ::=
22
preparable_stmt
3+
| comment_stmt
34
| execute_stmt

docs/generated/sql/bnf/stmt_block.bnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ drop_tenant_stmt ::=
642642

643643
explainable_stmt ::=
644644
preparable_stmt
645+
| comment_stmt
645646
| execute_stmt
646647

647648
explain_option_list ::=

pkg/ccl/backupccl/testdata/backup-restore/restore-grants

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ query-sql
463463
SHOW GRANTS ON SCHEMA testdb.public
464464
----
465465
testdb public admin ALL true
466+
testdb public public CREATE false
467+
testdb public public USAGE false
466468
testdb public root ALL true
467469

468470
query-sql
@@ -554,8 +556,9 @@ query-sql
554556
SHOW GRANTS ON SCHEMA testdb.public
555557
----
556558
testdb public admin ALL true
559+
testdb public public CREATE false
560+
testdb public public USAGE false
557561
testdb public root ALL true
558-
testdb public testuser ALL true
559562

560563
query-sql
561564
SHOW GRANTS ON testdb.sc.othertable
@@ -603,10 +606,13 @@ SELECT owner FROM [SHOW SCHEMAS] WHERE schema_name = 'sc'
603606
----
604607
testuser
605608

609+
# In postgres, the user "postgres" is the owner of the public schema in a
610+
# newly created db. In CockroachDB, admin is our substitute for the postgres
611+
# user.
606612
query-sql
607613
SELECT owner FROM [SHOW SCHEMAS] WHERE schema_name = 'public'
608614
----
609-
testuser
615+
admin
610616

611617
# Ensure that testuser is the owner of the type.
612618
query-sql

pkg/ccl/schemachangerccl/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ sctest_gen(
5151
ccl = True,
5252
new_cluster_func = "newCluster",
5353
package = "schemachangerccl",
54-
suffix = "base",
54+
suffix = "_base",
5555
test_data = [
5656
"//pkg/sql/schemachanger:end_to_end_testdata",
5757
],
@@ -68,7 +68,7 @@ sctest_gen(
6868
ccl = True,
6969
new_cluster_func = "newCluster",
7070
package = "schemachangerccl",
71-
suffix = "ccl",
71+
suffix = "_ccl",
7272
test_data = glob(["testdata/end_to_end/**"]),
7373
tests = [
7474
"Backup",

pkg/ccl/schemachangerccl/backup_base_generated_test.go

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/schemachangerccl/ccl_generated_test.go

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ccl/schemachangerccl/testdata/end_to_end/drop_database_multiregion_primary_region

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ add synthetic descriptor #108:
9090
version: "1"
9191
# end StatementPhase
9292
# begin PreCommitPhase
93-
## PreCommitPhase stage 1 of 1 with 23 MutationType ops
94-
delete all comments for table descriptor 108
93+
## PreCommitPhase stage 1 of 1 with 22 MutationType ops
9594
delete database namespace entry {0 0 multi_region_test_db} -> 104
9695
delete schema namespace entry {104 0 public} -> 105
9796
delete object namespace entry {104 105 crdb_internal_region} -> 106

pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ add synthetic descriptor #108:
3636
version: "1"
3737
# end StatementPhase
3838
# begin PreCommitPhase
39-
## PreCommitPhase stage 1 of 1 with 15 MutationType ops
40-
delete all comments for table descriptor 108
39+
## PreCommitPhase stage 1 of 1 with 14 MutationType ops
4140
delete object namespace entry {104 105 table_regional_by_row} -> 108
4241
upsert descriptor #106
4342
type:

pkg/ccl/schemachangerccl/testdata/end_to_end/drop_table_multiregion_primary_region

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ add synthetic descriptor #108:
3636
version: "1"
3737
# end StatementPhase
3838
# begin PreCommitPhase
39-
## PreCommitPhase stage 1 of 1 with 10 MutationType ops
40-
delete all comments for table descriptor 108
39+
## PreCommitPhase stage 1 of 1 with 9 MutationType ops
4140
delete object namespace entry {104 105 table_regional_by_table} -> 108
4241
upsert descriptor #106
4342
type:

pkg/ccl/schemachangerccl/testdata/explain/drop_database_multiregion_primary_region

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,14 @@ Schema change plan for DROP DATABASE ‹multi_region_test_db› CASCADE;
8181
│ │ ├── PUBLIC → ABSENT IndexColumn:{DescID: 108, ColumnID: 1, IndexID: 1}
8282
│ │ ├── VALIDATED → ABSENT PrimaryIndex:{DescID: 108, IndexID: 1, ConstraintID: 1}
8383
│ │ └── PUBLIC → ABSENT IndexName:{DescID: 108, Name: table_regional_by_table_pkey, IndexID: 1}
84-
│ └── 23 Mutation operations
84+
│ └── 22 Mutation operations
8585
│ ├── MarkDescriptorAsDropped {"DescriptorID":104}
8686
│ ├── RemoveDatabaseRoleSettings {"DatabaseID":104}
8787
│ ├── MarkDescriptorAsDropped {"DescriptorID":105}
8888
│ ├── RemoveSchemaParent {"Parent":{"ParentDatabaseID":104,"SchemaID":105}}
8989
│ ├── MarkDescriptorAsDropped {"DescriptorID":106}
9090
│ ├── MarkDescriptorAsDropped {"DescriptorID":107}
9191
│ ├── MarkDescriptorAsDropped {"DescriptorID":108}
92-
│ ├── RemoveAllTableComments {"TableID":108}
9392
│ ├── RemoveBackReferenceInTypes {"BackReferencedDescriptorID":108}
9493
│ ├── DrainDescriptorName {"Namespace":{"DescriptorID":104,"Name":"multi_region_tes..."}}
9594
│ ├── DrainDescriptorName {"Namespace":{"DatabaseID":104,"DescriptorID":105,"Name":"public"}}

0 commit comments

Comments
 (0)