-
Bug
-
Resolution: Fixed
-
Low (View bug fix roadmap)
-
6.3.12, 6.4.1, 6.4.3, 6.4.6, 6.4.10, 6.4.12, 6.4.13, 7.0.10, 7.1.0, 7.1.1
-
6.03
-
NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.
While importing a project from a JIRA backup the import fails with the following error.
The import was aborted because there were too many errors. Some errors are listed below. For full details about the errors please see your logs. Please note that some elements have been created. You may want to consult your logs to see what caused the errors, delete the project, and perform the import again.
A few of the following errors can be found in the JIRA logs
2015-01-17 15:01:50,542 ProjectImport: CreateIssueRelatedData-10 ERROR admin 901x156x1 4bmvmr 127.0.0.1 /secure/admin/ProjectImportSummary.jspa [jira.imports.project.DefaultProjectImportPersister] DataAccessException occured while trying to create Entity type 'EntityProperty' . {id=10031, entityName=IssueProperty, entityId=10115, propertyKey=request.channel.type, value="Portal", created=2015-01-08 18:51:44.178, updated=2015-01-08 18:51:44.178} com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property" Detail: Key (id)=(10031) already exists.)) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:397) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:219) at com.atlassian.jira.imports.project.DefaultProjectImportPersister.createEntity(DefaultProjectImportPersister.java:192) at com.atlassian.jira.imports.project.handler.EntityPropertiesPersisterHandler$1.run(EntityPropertiesPersisterHandler.java:63) at com.atlassian.jira.util.concurrent.BoundedExecutor$1.run(BoundedExecutor.java:50) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property" Detail: Key (id)=(10031) already exists.)) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:200) at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:165) at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:554) at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:540) at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:98) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:392) ... 7 more
Steps to reproduce
- Get a JIRA backup from an instance with at least 20 Issue entities for a single project. e.g. create 10 issues with JIRA Service Desk. Each will add 3 issue entities
- You can verify that with the following SQL query
select * from entity_property where entity_name = 'IssueProperty'
- You can verify that with the following SQL query
- Import the project into another JIRA instance already containing data in the entity_property for the same IDs displayed in the query above
Expected results
JIRA Should import the project without any problems, using the next ID available for the entity_property table
Actual results
JIRA aborts the import as it tries to use the same IDs to add the respective Issue properties to the entity_properties table
Workaround
As a workaround you can change the EntityProperty IDs directly in the entities.xml file of the backup.
- Find entity IDs to change for the project. Run this at source JIRA Insert your project key into this query:
SELECT EP.id FROM entity_property EP, jiraissue I, project P WHERE EP.entity_name = 'IssueProperty' AND I.id = EP.entity_id AND P.id = I.project AND P.pkey = 'YOUR_PROJECT_KEY' ORDER BY EP.id;
- Determine the current MAX(id), run this at target JIRA:
SELECT MAX(id) FROM entity_property
- Modify the XML backup file, replacing the entity_property IDs with sequential numbers higher than MAX(id) from the entity_property table.
- Make sure you only modify XML nodes that begin with "<EntityProperty id=". If the entities.xml file is large you may need to use vi or another editor that can handle really big files.
- Complete the import
- Shut down the target instance
- Reset the sequence_value_item table for EntityProperty types, run this at target JIRA:
UPDATE sequence_value_item SET seq_id = (SELECT MAX(id)+100 FROM entity_property) WHERE seq_name = 'EntityProperty';
- Restart the target instance
See KB for more detailed steps and simplified option to modify the XML backup file: Project Import fails due to too many errors
- relates to
-
JRACLOUD-41681 Project import aborted due to too many errors
-
- Closed
-
-
RUM-255 You do not have permission to view this issue
- is related to
-
JSP-214745 You do not have permission to view this issue
-
JSP-215523 You do not have permission to view this issue
-
JSP-216560 You do not have permission to view this issue
-
JSP-216568 Loading...
-
JSP-216812 Loading...
-
SDS-2671 Loading...
- was cloned as
-
JDEV-36805 Loading...
The workaround works great!
I also used this for Bitbucket entries when doing a Project Import. They did not show up for existing issues, however the application link to the Bitbucket server worked. Setting the IDs higher, made them show up.
The log showed something like:
// 2016-12-25 22:02:20,944 http-nio-8080-exec-16 WARN amavg 1322x155824x3 lcom8q 10.233.36.194 /rest/dev-status/1.0/issue/summary [c.a.j.p.devstatus.provider.DefaultCoordinator] Bitbucket (com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][propertyKey,99095652-723d-389f-bc35-6ba4dd9d2a69][entityName,fusion.caches.issue][created,2016-12-25 22:02:20.928][entityId,229658][id,23317][value,{"value":{"targets":{"INK-1450":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2016-10-12T09:05:22.000-0400","count":13,"commits":["a875695a0b59e5b0e4485c2dc8f9f95c6296456c","b188dc8b71e5c7f48d35f5a800b33543c7d081a0","944364cc4655bbe8375011a758b4cc5b83cb414d","89df92b58374b9ece54cf542e388ad22f4fbc47b","019a8e374734fe5040ee239231e9fbc8c8e41ec5","4506449c98fb4f2adbc5cd329e1d911abcd0108c","b42ffe037b1a59f6fe76b8f833f726c327e36f66","bdb548658ac70181a005635a43fb4a9d98f573f5","baeff782dbcc06f6fd3f6dabd836249a8c720997","a7d00a0d9dd5c45b6fe42bd2f8030b560b49bc30","5f91cf5f9cf58336abd8b342b8b13668c2100e3a","5df6621de5935020df56171b37d7810089104a16","b2c87ccf99568d0aab9172b16ca3d85a5557e71f"],"type":"git"}]},{"type":{"id":"branch"},"objects":[]},{"type":{"id":"pullrequest"},"objects":[{"lastUpdated":"2016-10-11T13:59:39.797-0400","state":"MERGED"},{"lastUpdated":"2016-09-26T11:47:42.456-0400","state":"MERGED"}]}]}}}][updated,2016-12-25 22:02:20.928] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property" Detail: Key (id)=(23317) already exists.)))