Skip to content

Commit

Permalink
feat: add back index on credential lowercase name
Browse files Browse the repository at this point in the history
- context: the performance improvement brought by indexing (#803)
was reverted (#815) due to migration error (issue #813) for some users.
This commit brings back that index, but doing so safely to avoid issues
like #813 (#813 happened to some users due to migration file numbering conflict,
this commit uses a fresh migration number (v59) to avoid that).

- Unfortunately, for the users who happened to have installed
credhub v2.12.94 successfully (aka did not encounter #813),
their mysql DB would already have an index called
"credential_name_lowercase". So in order for the migration in this
commit to work for both those who have installed credhub v2.12.94
and those who have not, this commit's migration instead creates
the index under a different name: "credential_name_lowercase_index"
(mysql does not support the "CREATE INDEX...IF NOT EXIST" syntax).
This would create some DB inefficiency (due to the presence of two
functionally identical indexes) for those who have installed credhub v2.12.94
(which we think is a smaller subset of users), but the system
would still work and likely a net improvement compared to before
due to the presence of indexing. And we would instruct these users
to manually drop the old, duplicate index ("credential_name_lowercase").
  • Loading branch information
peterhaochen47 committed Nov 12, 2024
1 parent 34815e3 commit 063baf7
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INDEX credential_name_lowercase_index ON credential(name_lowercase);

0 comments on commit 063baf7

Please sign in to comment.