I'm having an issue with the export type check in 7007.

I'm upgrading from schema 7003 to 7007, thus I'm executing 7006 & 7007 in one go. All field_groups are exported into features and have export_type = EXPORT_IN_CODE (=2) before 7006. Since ctools_export_load_object is statically cached, the data loaded will be identical for 7006 & 7007. When I run update.php the first time i get a "Integrity constraint violation: 1062 Duplicate entry ..." error, because of the check "if ($row->export_type == EXPORT_IN_CODE) {", that inserts a new record with an identifier that already exists.

Due to the error, ctools_export_load_object's static cache is reset after the update.php.

Now, when I run the update again, It finished sucessfully because the condition doesn't match anymore. After update 7006 all rows have been updated with the optional classes, but this immediately makes the exported data overridden. The new export_type will be EXPORT_IN_CODE|EXPORT_IN_DATABASE (=3). Update 7007 only checks $row->export_type == EXPORT_IN_CODE and will not match anymore and so will update records instead of inserting new ones.

There's a difference in executing 7006 & 7007 in one go or if you execute them separately. It seems to me either ctools' static cache should be reset after 7006 (ctools_export_load_object_reset) or the check in 7007 should be changed to always update or merge?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

interX’s picture

interX’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: field_group-update_7007_error-2295133.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: field_group-update_7007_error-2295133.patch, failed testing.

boyan.borisov’s picture

I had the same issue with upgrdaing from schema 7005 to 7007.
I confirmed that the problem is related with the field group cache but this is not an error in ctools.
Every module should take care for it's own cache :)

To be on the save side I created a patch that affects all updates hooks that are changing the field group data in some way.

boyan.borisov’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: field_group-update_error-2295133-6.patch, failed testing.

boyan.borisov’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Needs work » Needs review

The autaomted tests don't fail because of this patch but because they shoud be updated.

coredumperror’s picture

This patch worked for me! No more integrity error!

nils.destoop’s picture

Status: Needs review » Fixed

Thx for the patch and reviewing it. I committed it to dev.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.