It's on drupal 7.25, and this is what happens when I try to update.
The following updates returned messages
metatag module
Update #7018Fixed the revision_id values for 71 {metatag} records.
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-929-5058-en' for key 'PRIMARY': UPDATE {metatag} SET revision_id=:db_update_placeholder_0 WHERE (entity_type = :db_condition_placeholder_0) AND (entity_id = :db_condition_placeholder_1) AND (revision_id = :db_condition_placeholder_2) AND (language = :db_condition_placeholder_3) ; Array ( [:db_update_placeholder_0] => 5058 [:db_condition_placeholder_0] => node [:db_condition_placeholder_1] => 929 [:db_condition_placeholder_2] => 0 [:db_condition_placeholder_3] => en ) in metatag_update_7018() (line 1126 of /srv/www/htdocs/drupal/sites/all/modules/metatag/metatag.install).
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | metatag-n2174363-15.patch | 3.45 KB | damienmckenna |
Comments
Comment #1
damienmckennaWhat version did you have prior to updating?
(bumping to Major as I want to release the new beta today, without any update bugs)
Comment #2
smudos commented7.24
Comment #3
damienmckennaSorry, what version of *Metatag* did you have before you upgraded to the latest -dev release?
Comment #4
smudos commentedAnd, yeah, it was latest dev version of the module.
Comment #5
damienmckennaDo you remember when you downloaded that version? The dev versions are rebuilt every 12 hours (or so), so it's hard to gauge anything based on this.
Was 7018 the only update that was listed when you ran the database updates?
Comment #6
smudos commentedwell, I am getting thiss error for some time now. Let's say for about a week or two.
Here's what should be updated:
metatag module
7018 - Update the revision ID for each record. This may take some time.
7019 - Clear the entity_cache bins.
7020 - Clear the Metatag cache.
7021 - Clear the existing Metatag cache so all unwanted 403404 paths can be purged.
7022 - A minor bit of tidy-up after update 7015.
Comment #7
damienmckennaThis should do it. The update wasn't verifying that there wasn't already a record for the nid/vid/langcode combination before creating the record. This should do it.
Comment #8
damienmckennaCommitted.
Comment #9
troybthompson commentedI'm having the same issue and I'm using the dev version with the above patch. I was using the previous beta version before upgrading, tried beta 8 and got the error and now dev.
Comment #10
smudos commentedNope. I still get the same error.
This is what I get when I try to run update via drush, maybe that can help:
Comment #11
grahamshepherd commentedOne of my sites updated from beta 7 to beta 8 OK. On another site I got this message:
"The update process was aborted prematurely while running update #7018 in metatag.module. All errors have been logged. You may need to check the watchdog database table manually."
In the report log the message was Info: "Update 7018: 31 records to update."
I tried the Update process again and it appeared that 3 updates had proceeded but 5 remained. Again it aborted with the same message on the update page as above but no message in the reports log.
Comment #12
damienmckennaAh… Hrm. I think I might know what the problem is. Would you mind checking your {metatag} table and see if there are multiple records for the node that's causing the error?
Comment #13
troybthompson commentedYes, I have 12 rows for the node I got the error on, all different revision_id's.
Comment #14
damienmckenna@troybthompson: Do you have a record with a revision_id "0"?
Comment #15
troybthompson commentedYes.
node 529 und 0
node 529 und 5524
node 529 und 5525
node 529 und 5527
node 529 und 5528
node 529 und 5533
node 529 und 5534
node 529 und 5544
node 529 und 5545
node 529 und 5562
node 529 und 5563
node 529 und 5565
Comment #16
damienmckennaThis should, hopefully, resolve the problem.
The problem boils down to the fact that sites which were running the dev releases of Metatag for the past few months may have ended up with {metatag} records with a revision_id 0 and other records for the correct revision_id values. The update script was not written to handle that scenario so it borked. What this update does is first verifies that the new record doesn't exist, and if it does it deletes the older revision_id=0 one, the idea being that the record with a proper revision_id would have been newer.
Please test this on a copy of your site, just in case.
Comment #17
smudos commentedthat's it. well done!
Comment #18
damienmckennaOk, I've committed this but I've added an extended note for update 7018:
I'll also create a change record to note this problem.
Comment #19
troybthompson commentedPerfect beta9 solved the problem for me.