-
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
upgrades: update system.web_sessions migration to handle orphaned rows #100017
Conversation
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.
just one comment, and everything else lgtm!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andyyang890)
pkg/upgrade/upgrades/web_sessions_table_user_id_migration.go
line 48 at r1 (raw file):
} const deleteRowsForDroppedUsersWebSessionsTableStmt = `
i'm more in favor of doing this after the backfill, and changing this query to
DELETE FROM system.web_sessions
WHERE user_id IS NULL
(it seems less expensive)
This patch updates the system.web_sessions user ID migration to delete orphaned rows (i.e. rows corresponding to users that have been dropped) after backfilling user IDs. They need to be deleted since they block the addition of the NOT NULL constraint on the column. Release note: None
39f0435
to
1229975
Compare
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/upgrade/upgrades/web_sessions_table_user_id_migration.go
line 48 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
i'm more in favor of doing this after the backfill, and changing this query to
DELETE FROM system.web_sessions WHERE user_id IS NULL
(it seems less expensive)
Done.
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.
lgtm!
const deleteRowsForDroppedUsersWebSessionsTableStmt = ` | ||
DELETE FROM system.web_sessions | ||
WHERE user_id IS NULL | ||
LIMIT 1000 |
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.
oh nice, i forgot that we could have a limit here.
TFTR! bors r=rafiss |
This PR was included in a batch that was canceled, it will be automatically retried |
Build failed (retrying...): |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error setting reviewers, but backport branch blathers/backport-release-23.1-100017 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/100244/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. [] Backport to branch 23.1.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
This patch updates the system.web_sessions user ID migration to delete
orphaned rows (i.e. rows corresponding to users that have been dropped)
after backfilling user IDs. They need to be deleted since they block
the addition of the NOT NULL constraint on the column.
Part of #87079
Release note: None