Affects Version/s: 7.2.X, Master
Component/s: WCM > Fragments
This problem is reproducible when importing a large .lar file which includes a lot of Layouts referencing LayoutPageTemplateStructures. Therefore the attached (and adapted) customer's .lar files should be used to get the errors in master:
- Import, from Control Panel - Configuration - Custom Fields - Import/Export, custom_fields.lar
- Import, from Global site's Publishing - Import option, Global.lar (ignore all journal article's template related exceptions that may be thrown).
- Create a blank site and import new_site.lar file
Expected result: the new site .lar gets imported without problems.
Current result: duplicated entries for index IX_87B60D9 errors are thrown and the process fails with an exception (see attached full_log_error.txt):
The following is the workflow of a Layout import process*:*
- A Layout with a LayoutPageTemplateStructure ** reference is to be imported.
- The imported layout is generated with a new plid and imported.].
- Layout's references are imported, in this case we will focus on the LayoutPageTemplateStructure ** ones. For each one:
- If any with the same (uuid, groupid) exists, it is added to the database with its original classPK (the one indicated in its corresponding xml).
- After being persisted, the entry is updated changing its classPK (to the Layout.plid) and classnameId.
Having a large number of Layouts and LayoutPageTemplateStructures, we may get a 'Duplicate Entry' error in step 2.1:
- LayoutPageTemplateStructure table contains, a unique index named IX_87B60D9 consisting on (groupid, classnameid, classPK).
- In step 2.2 entries are assigned with a new classPK which does not have into account point 2.1, where entries and their 'old' classPKs are initially imported. that may conflict.
In manifest.xml of the explorted .lar (fagor) we find, for example a Layout (96.xml) referencing a LayoutPageTemplateStructure:
We also find the referenced LayoutPageTemplateStructure staged-model :
63130.xml shows the LayoutPageTemplateStructure has classPk = 96. According to step 2.1 the following data will be imported:
However we can see the next error in the log:
Because there is already one entry (see data below)in LayoutPageTemplateStructure table which was previously imported and makes the new one duplicate the index:
Which we can find also in the manifest.xml (by its uuid) and see its original classPK was 23, but then updated to 96 in step 2.2.