-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Convert Unique to PK for compatibility with Percona XtraDB #20934
Convert Unique to PK for compatibility with Percona XtraDB #20934
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.
The indentation is off in the migration files. We use tabs - could you check to unify them in those files? Except that it seems to be fine to run those migrations. They might be expensive, but should be okay. Or do we just want to drop them during the migration and then add them to the "add-missing-indices" command? cc @nickvergessen @rullzer
eaf0d1d
to
52b2266
Compare
Whitespace issues addressed, thanks for the feedback |
This PR makes two changes: 1. Modifies an old migration changing a unique ID on the `collres_accesscache` table to a Primary key 2. Creates a new migration for installations which have already run the previous migration to sync them up I realize that it is an unusual step to modify an old migration, but in this case it is necessary. [NextCloud upgrades are failing with Percona XtraDB](nextcloud#16311) due to a missing primary key on this table. Because the breakage occurs in an existing migration, the fix must also occur in the existing migration. To ensure that we do not cause any existing installations to diverge, this commit also introduces a new migration that looks for the non-PK version of the table and updates those as well. See nextcloud#16311 for additional details. Signed-off-by: Ben Klang <bklang@powerhrg.com>
52b2266
to
8bafd22
Compare
Yeah well we can't really add them lazy, as requiring the uniqueness is an important part |
Just found this issue after looking into a stock 18.0.4 install with the following apps installed:
Here are the tables without primary key: mysql> select tab.table_schema as database_name, tab.table_name from information_schema.tables tab left join information_schema.table_constraints tco on tab.table_schema = tco.table_schema and tab.table_name = tco.table_name and tco.constraint_type = 'PRIMARY KEY' where tco.constraint_type is null and tab.table_schema not in('mysql', 'information_schema', 'performance_schema', 'sys') and tab.table_type = 'BASE TABLE' order by tab.table_schema, tab.table_name; |
This will be done as part of 838b02c Thanks for your contribution anyways and sorry that we didn't picked it up earlier. |
This PR makes two changes:
collres_accesscache
table to a Primary keyI realize that it is an unusual step to modify an old migration, but in this case it is necessary. NextCloud upgrades are failing with Percona XtraDB due to a missing primary key on this table. Because the breakage occurs in an existing migration, the fix must also occur in the existing migration. To ensure that we do not cause any existing installations to diverge, this commit also introduces a new pair of migrations that looks for the non-PK version of the table and updates those as well. See #16311 for additional details. I did attempt to do the unique -> primary key conversion in a single step, but I kept running into errors. I was able to test the 2-step migration successfully to convert a NextCloud 18 database.