Skip to content
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

sql: add user_id column to system.database_role_settings table #97251

Merged

Conversation

andyyang890
Copy link
Collaborator

@andyyang890 andyyang890 commented Feb 16, 2023

This patch adds a new role_id column to the system.database_role_settings
table, which corresponds to the existing role_name column. Migrations are
also added to alter and backfill the table in older clusters.

Part of #87079

Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Feb 16, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@andyyang890 andyyang890 force-pushed the migrate_database_role_settings branch 4 times, most recently from ee13301 to 2325aff Compare February 22, 2023 01:38
@andyyang890 andyyang890 marked this pull request as ready for review February 22, 2023 01:44
@andyyang890 andyyang890 requested review from a team and rafiss February 22, 2023 01:44
@andyyang890 andyyang890 force-pushed the migrate_database_role_settings branch from 2325aff to e7da559 Compare February 22, 2023 03:46
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall! i just had one comment about using a STORING index

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890)


pkg/upgrade/upgrades/database_role_settings_table_user_id_migration.go line 31 at r1 (raw file):

const createUniqueIndexOnDatabaseIDAndRoleIDOnDatabaseRoleSettingsTableStmt = `
CREATE UNIQUE INDEX IF NOT EXISTS database_role_settings_database_id_role_id_key
ON system.database_role_settings (database_id, role_id)

similar to system.privileges, i think this would benefit from having STORING (settings) on it. (if you look at the query where the table is accessed, it always needs to fetch the settings column)

@andyyang890 andyyang890 force-pushed the migrate_database_role_settings branch from e7da559 to ce3b560 Compare February 23, 2023 23:28
Copy link
Collaborator Author

@andyyang890 andyyang890 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


pkg/upgrade/upgrades/database_role_settings_table_user_id_migration.go line 31 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

similar to system.privileges, i think this would benefit from having STORING (settings) on it. (if you look at the query where the table is accessed, it always needs to fetch the settings column)

Done.

@andyyang890 andyyang890 requested a review from rafiss February 23, 2023 23:36
This patch adds a new `role_id` column to the `system.database_role_settings`
table, which corresponds to the existing `role_name` column. Migrations are
also added to alter and backfill the table in older clusters.

Release note: None
@andyyang890 andyyang890 force-pushed the migrate_database_role_settings branch from ce3b560 to 5225a32 Compare February 24, 2023 15:52
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@andyyang890
Copy link
Collaborator Author

TFTR!

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Feb 24, 2023

Build succeeded:

@craig craig bot merged commit 4eb5451 into cockroachdb:master Feb 24, 2023
@andyyang890 andyyang890 deleted the migrate_database_role_settings branch February 24, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants