While running update.php on a migrated site the following messages are returned:
print_pdf module
Update #7000
* Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'seven-print_pdf-print_pdf-top' for key 2: UPDATE {block} SET delta=:db_update_placeholder_0 WHERE (module = :db_condition_placeholder_0) AND (delta = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => print_pdf-top [:db_condition_placeholder_0] => print_pdf [:db_condition_placeholder_1] => 0 ) in update_fix_d7_block_deltas() (Zeile 363 von /var/www/html/cm7/includes/update.inc).
print_mail module
Update #7000
* Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'seven-print_mail-print_mail-top' for key 2: UPDATE {block} SET delta=:db_update_placeholder_0 WHERE (module = :db_condition_placeholder_0) AND (delta = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => print_mail-top [:db_condition_placeholder_0] => print_mail [:db_condition_placeholder_1] => 0 ) in update_fix_d7_block_deltas() (Zeile 363 von /var/www/html/cm7/includes/update.inc).
print module
Update #7000
* Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'seven-print-print-links' for key 2: UPDATE {block} SET delta=:db_update_placeholder_0 WHERE (module = :db_condition_placeholder_0) AND (delta = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => print-links [:db_condition_placeholder_0] => print [:db_condition_placeholder_1] => 0 ) in update_fix_d7_block_deltas() (Zeile 363 von /var/www/html/cm7/includes/update.inc).
After confirming the update messages the site seems not to be really affected.
The site was migrated from Drupal 6.20.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | backup-2011-09-29T08-44-04.sql_.gz | 1.66 MB | strellman |
Comments
Comment #1
shelleyp commentedYes, I also received the following:
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'garland-print-print-links' for key 'tmd': UPDATE {block} SET delta=:db_update_placeholder_0 WHERE (module = :db_condition_placeholder_0) AND (delta = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => print-links [:db_condition_placeholder_0] => print [:db_condition_placeholder_1] => 0 ) in update_fix_d7_block_deltas() (line 363 of /home/frugalalgorithm/public_html/includes/update.inc).
Comment #2
shelleyp commentedmoved this to critical, since the module is not usable as coded with an updated site
Comment #3
GStegemann commentedThe problem occurs on migrated themes which already exists in Drupal 7, like "Seven" or others.
I fixed it by removing the old hardcoded deltas from the "block" table, like records where column "delta" has values like "0", "1", etc., which belong to the modules "print", "print_mail" or "print_pdf" and had already "new" deltas by name. After that update.php completed successfully.
The reported duplicated keys have to be interpreted in the following way, e.g "seven-print-print-links" whereby "seven" is the theme, "print" the effecitive module and "print-links" the block delta.
May be the error is not really related to the module "print" but possibly to the core function "update_fix_d7_block_deltas".
Comment #4
pillarsdotnet commentedComment #5
marcingy commentedThis is not critical
Comment #6
droplet commentedrelated: #1054960: Unable to complete update #7004 in moving from D6.20 to D7.0, complaint about duplicate entry
Comment #7
strellman commentedPlease clarify what is meant by #3.
Is this fixed in 7.x-dev?
Is the workaround to delete all themes or all blocks before upgrading? If so, how?
Comment #8
GStegemann commentedNo, in my opinion nothing is fixed yet.
I've just described a workaround for the print module how to migrate a site from D6 to D7 and what is causing the problem. It may be possible that there is a bug in the core function "update_fix_d7_block_deltas" which used to perform this block delta conversions.
See also #6.
Comment #9
pillarsdotnet commentedComment #10
agileware commentedMarked #1096060: Upgrade to D7 Thowring Error "7000 - Remove hardcoded numeric deltas from all blocks" as duplicate of this issue.
Comment #11
pillarsdotnet commentedComment #12
bfroehle commentedDoes anybody have a D6 database dump which exhibits this error when you upgrade? Otherwise there really isn't enough here to go on...
Comment #13
GStegemann commentedNo, not anymore. But comment #3 maybe of help.
Comment #14
bfroehle commentedI don't think there is anything we can do here until there is at way to reproduce this.
Comment #15
GStegemann commentedI thought I had given enough details why these errors are thrown during a migration of a D6 site.
However, here are dumps of the relevant data from a D6 "blocks" and D7 "block" table:
D6 "blocks" table:
D7 "block" table:
The key information is:
The job of the core function "update_fix_d7_block_deltas" is to convert the data in column 'delta' into a D7 compatible format. But the function fails when the to be migrated "block deltas" do already exist in D7; i.e. when the contributed module is already installed in D7 and both installation have also the same theme installed. Then a clash occurs, since the D6 numerical "block deltas" are about to be converted to D7 "block deltas" with identical names/IDs.
In my opinion "update_fix_d7_block_deltas" should check this and skip any possible duplicates.
I hope this helps.
Comment #16
pillarsdotnet commentedComment #17
bfroehle commentedThanks @GStegemann. So what's happening is that you upgrade to D7, install the new version contributed modules, use the site for a bit (so that the new version's blocks are added to the database), then run upgrade.php but it throws these duplicate key errors.
This means the issue could be avoided in two ways. The first is to immediately run update.php upon installing the new D7 modules. The second, as you suggest, is to make update_fix_d7_block_deltas() succeed in cases where there would otherwise be duplicate key errors.
Comment #18
GStegemann commented@bfroehle, you're welcome.
No, the scenario was a little bit different. I migrated the site as described in the Drupal 7 Upgrade Guide. The Print PDF module was already installed on the D6 site. After installation of Drupal 7 I migrated module by module and ran update.php immediately once a module was enabled. And during the migration of the Print PDF module the reported errors were displayed.
So I see no way to avoid this issue in this context. Maybe one other possible way to avoid this is not to have the same themes installed which have enabled blocks of such a module.
And the third way of course is, just to ignore any possible duplicate keys. And instead of throwing error messages just showing/logging a warning message.
Comment #19
catchtagging.
Comment #20
sun1) Looks like contrib modules' updates need to run after this update. We have hook_update_dependencies() for that.
2) Looks like this could be easily resolved by switching to a merge query.
3) There's a workaround for this issue (see 1)), so demoting to normal.
Comment #21
peterx commentedI upgraded D6.22 to D7.4 and hit the 7004 problem. As per #3, I checked for print module entries in the block table. There were no print module entries in the block table. There was nothing for non core modules because I deleted all the non core modules before the update. I deleted everything for every theme except Garland and still hit the 7004 problem. I then emptied the block table and update 7004 worked.
Comment #22
strellman commentedI am still unable to update this site to D7. I first reported this problem with block update 33 weeks ago.
not sure why this issue is on D8 now.
I tried solution #21, no joy.
Update #7004
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Contact page help' for key 'info': INSERT INTO {block_custom} (body, info, format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => Find us at this place. [:db_insert_placeholder_1] => Contact page help [:db_insert_placeholder_2] => 3 ) in block_update_7004() (line 304 of /home1/mysite/public_html/d7/modules/block/block.install).
Attached is the D6.22 backup I am trying to upgrade to D7.8
Update.php should fail on a clean D7.8 install.
Comment #23
strellman commentedI only had 2 custom blocks, both were simple text. So I went back to Drupal 6.22 and deleted both blocks, redid my backup, disabled all modules (even some of the core optional), then ran update.php and it worked. Complained about my marinelli theme, guess I should have made something else the default, but that is easy.
I can leave the backup there for a week or two in case someone wants to use that as a test case that causes the block update to fail.
Comment #24
catchIt's at least major if the upgrade path fails. I don't see a workaround in #1. Also moving back to D7.
Comment #25
catchHmm I might have mis-read #20 - hook_update_dependencies() is probably enough of a workaround.
Since this hasn't been reported since over a year ago, demoting the issue - however if you're following this issue and it's still a problem for you, please bump back to major.