Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
system_update_7007() failed, it didn't finish. drush updatedb is constantly spawning the thing until it gives up, the most important part of the error: "Integrity constraint violation: 1062 Duplicate entry"
After inspection I found out a permission was occurring twice in the D6 permission table.
I'm not sure if this can happen a lot, but I don't recall doing anything weird on this D6 site.
It seems to help to add array_unique() as such:
foreach (array_unique(explode(', ', $role->perm)) as $perm) {
If these double permissions are more common it could be nice to patch this - especially as more people will want to upgrade their D6 to D7.
Comment | File | Size | Author |
---|---|---|---|
#9 | d7-system_update_7007-1475342-9_testonly.patch | 2.07 KB | iamEAP |
#9 | d7-system_update_7007-1475342-9.patch | 2.68 KB | iamEAP |
#4 | core-system_update_7007-1475342-4.patch | 630 bytes | iamEAP |
Comments
Comment #1
okokokok CreditAttribution: okokokok commentedWorking on another site and encountering the exact same issue, with the exact same fix.
Here's the thing as a patch:
Comment #2
moskito CreditAttribution: moskito commentedSolution #1 solve it.
Comment #3
webchickWe need a real patch so we can run it through testbot. There are instructions for creating those at http://drupal.org/node/707484. We should also add duplicate permission to the upgrade test DB dumps to show this error occurring, and to show that the proposed fix fixes it.
Comment #4
iamEAP CreditAttribution: iamEAP commentedI actually just ran into this myself on a very large upgrade.
Attaching #1 as a patch to see what testbot thinks of it. I will simultaneously be re-running my upgrade to see if it fixes it for me.
Comment #5
iamEAP CreditAttribution: iamEAP commentedCan confirm this worked on my personal upgrade as well. Never written a test before, but willing to give it a shot.
Comment #6
okokokok CreditAttribution: okokokok commentedSame thing happening on another upgrade from 6 to 7.
The patch fixed it again.
Comment #7
aspilicious CreditAttribution: aspilicious commentedI don't see anything wrong with this patch and if it helps people upgrading I'm not against it...
Comment #8
webchickHm. IMO we should have some test coverage for this condition, unless there's a really compelling reason not to.
Comment #9
iamEAP CreditAttribution: iamEAP commentedPatch with test only should fail. Patch with both test and the array_unique() fix should pass.
Comment #10
iamEAP CreditAttribution: iamEAP commentedTagging D7 upgrade path for wider visibility.
Comment #11
iamEAP CreditAttribution: iamEAP commentedEdit: double-post.
Comment #12
okokokok CreditAttribution: okokokok commentedI keep on losing time on this. The very descriptive error I got doing drush updatedb was this:
"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3-opt-in or out of tracking' for key 'PRIMARY'"
Finally gave this patch a try and... it worked.
Please apply the patch.
Comment #13
rsbecker CreditAttribution: rsbecker commentedI hate to revive this, but why has the patch not been included in 7.16?
Comment #14
iamEAP CreditAttribution: iamEAP commented#9: d7-system_update_7007-1475342-9.patch queued for re-testing.
Comment #15
Leo Pitt CreditAttribution: Leo Pitt commentedRan into this problem upgrading to 7.20 - and the patch in #1 seems to have solved it. Please apply
Comment #16
David_Rothstein CreditAttribution: David_Rothstein commentedComment #17
iamEAP CreditAttribution: iamEAP commented#9: d7-system_update_7007-1475342-9.patch queued for re-testing.
Comment #18
pandaski CreditAttribution: pandaski commentedFixed my issue while upgrade from 6.x to 7.20
Comment #19
iamEAP CreditAttribution: iamEAP commentedI'm counting 4 thumbs up on this. Marking RTBC in hopes of getting it in to the next bugfix release.
Comment #20
David_Rothstein CreditAttribution: David_Rothstein commentedYup, looks good. Committed to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/851bcf1