-
Notifications
You must be signed in to change notification settings - Fork 936
feat(coderd/database): add UpsertProvisionerDaemons query #11178
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DROP INDEX IF EXISTS idx_provisioner_daemons_name_owner_key; | ||
|
||
ALTER TABLE ONLY provisioner_daemons | ||
ADD CONSTRAINT provisioner_daemons_name_key UNIQUE (name); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ALTER TABLE ONLY provisioner_daemons | ||
DROP CONSTRAINT IF EXISTS provisioner_daemons_name_key; | ||
|
||
CREATE UNIQUE INDEX IF NOT EXISTS idx_provisioner_daemons_name_owner_key | ||
ON provisioner_daemons | ||
USING btree (name, lower((tags->>'owner')::text)); | ||
|
||
COMMENT ON INDEX idx_provisioner_daemons_name_owner_key | ||
IS 'Relax uniqueness constraint for provisioner daemon names'; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Out of curiosity, do we need an index since Day 1? What was the upper limit of provisioner daemons we hit in scaletests?
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.
We need to at least keep the existing unique index on name.
However, this will allow multiple user-level provisioners to be named "my-provisioner".
Otherwise, each user will have to choose a unique provisioner name.
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.
Gotcha, I ignored the use case with multiple users 👍 Thanks