Update #6162
* ALTER TABLE {nodewords} DROP INDEX nodewords_type_id
* ALTER TABLE {nodewords} DROP KEY nodewords_type_id_name
* ALTER TABLE {nodewords} CHANGE `type` `type` SMALLINT unsigned NOT NULL DEFAULT 0
* ALTER TABLE {nodewords} CHANGE `id` `id` SMALLINT unsigned NOT NULL DEFAULT 0
* ALTER TABLE {nodewords} ADD INDEX nodewords_type_id (type, id)
* Failed: ALTER TABLE {nodewords} ADD UNIQUE KEY nodewords_type_id_name (type, id, name)
user warning: Duplicate entry '5-65535-keywords' for key 2 query:
ALTER TABLE nodewords ADD UNIQUE KEY nodewords_type_id_name (type, id, name)
in /home/user/public_html/includes/database.mysql-common.inc on line 403.
How do I fix this? I'm coming in behind a previous vendor to whom the concept of "routine maintenance" was entirely foreign.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | nodewords-n681490-13.patch | 2.01 KB | damienmckenna |
| #12 | nodewords-n681490-12.patch | 2.57 KB | damienmckenna |
| #10 | nodewords_smallint.patch | 2.11 KB | quicksketch |
| #7 | nodewords_smallint.patch | 1.48 KB | quicksketch |
Comments
Comment #1
avpadernoSee #681080: Update function changes the field id into a smallint.
Comment #2
Zombie777 commentedI have the same problem, it has to do with one node type where the key is duplicate but the description is referring to different pages.
Any solutions? Or ideas as to a module that is incompatible or update that makes something incompatible?
I upgraded from 6.x-1.2 to 6.x-1.11.
Nothing seems to be broken but the "ALTER TABLE nodewords ADD UNIQUE KEY nodewords_type_id_name (type, id, name)" index was not created.
Thanks for any suggestions or should I back out of it?
Comment #3
avpadernoComment #4
abaddon commentedthis is not the same as the other issue, theres a different failure because of duplicates that get created.. well the ID before the update is string, like "providers", its probably a SEO path.. after the update it gets converted to an integer and its 0, it happens when updating from .8 to .9
ive checked the url_alias table for a dst parameter == to that id column and i got 0 results, so i guess this is why duplicates get created
to fix it, i update manually (with drush actually) to .8, remove those problematic entries, then do the rest of the upgrades.. and i get no errors and the index gets created.. i guess you can create it manually to recover from a broken upgrade, but delete those conflicting IDs before
also, the duplicates the poster got, '5-65535-keywords', mine were more like '10-0-something'.. i think there might be something to this
Comment #5
damienmckennaTag.
Comment #6
dave reidDoes anyone happen to have a backup or .sql file of their metatag tables from before you updated? If they don't contain any sensitive data, please attach them to this issue so we can test.
Comment #7
quicksketchI don't think a backup is really necessary to see what went wrong here. That update sets the size of the "id" column to a smallint. So if you have more than 65535 nodes, all NIDs higher than 65535 (the maximum for a smallint) were converted to that number, causing duplicate IDs (and data loss).
There's nothing we can do to un-damage any sites that ran that update, but we can prevent this problem in the future and ensure database consistency by removing the offending size property (thus preventing the data loss) and adding another update just like it to ensure database consistency (converting people back from the "small" size to normal).
Comment #8
quicksketchThis was also "fixed" in #681080: Update function changes the field id into a smallint, but I definitely think my approach is more sane than that issue. There's no reason why we need to convert the field to a varchar and then back to an integer to change its size.
Comment #10
quicksketchHere's a new version of the patch that takes into account AlexisWilke's suggestion in #888042: Update 6162 potentially destroys data. In addition to converting the "id" column into a smallint, the "id" column also had an issue of not being able to caste an empty string into a zero in PostGRES. So one more additional fix is needed in that update to simply update empty strings to a "0" string before doing the type conversion.
Comment #12
damienmckennaRe-applied the patch, added a CHANGELOG line, changed to the 6.x-1.x-dev version. Should work.
Comment #13
damienmckennaRerolled.
Comment #14
damienmckennaThe 6162 update no longer exists in the current 6.x-1.x codebase and both nodewords_update_6164() & nodewords_update_6168() are wildly different to what's referenced here - anyone want to have another look through this?
Comment #15
patricksettle commentedCould someone remove the 1.11 release or at least post a big warning on the project page about the 65535 limit as this causes data corruption resulting in loss of data when upgrading large sites.
Comment #16
damienmckennaI added a note about the issue, doing anything with the existing releases will just cause untold problems.
Comment #17
patrickroma commentedDoes this patch apply to 1.11 solving the critical smallint issue?
Comment #18
damienmckennaI've reviewed this error. The problem has been completely resolved in the current 6.x-1.x-dev codebase. Unfortunately, due to the database structures that were changed, this could have definitely caused data loss with IDs (nid, tid, uid) higher than 65,536 and there is no way to recover the lost data, it has to be manually restored & fixed from a backup.