During a workflow scheme migration we got error messages for two of the issues. The root cause is:
ERROR: duplicate key value violates unique constraint "pk_os_historystep")
Now the issues cannot be closed. A similar error occurs:
Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,myuser][startDate,2010-05-17 20:44:50.207][status,Not Done][owner,][finishDate,2011-12-21 14:19:25.9][actionId,231][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
The database driver is PostgreSQL 8.4 JDBC4 managed by pgpool. Full trace during migration:
2011-12-21 10:17:42,007 JiraTaskExectionThread-17 ERROR myuser 617x43760x1 145jeni 10.10.0.249,192.168.1.3 /secure/project/SelectProjectWorkflowSchemeStep2.jspa [workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper] Error occurred while migrating issue to a new workflow for project '...'.
com.atlassian.jira.workflow.WorkflowException: com.opensymphony.workflow.StoreException: Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
at com.atlassian.jira.workflow.OSWorkflowManager.migrateIssueToWorkflow(OSWorkflowManager.java:498)
at com.atlassian.jira.workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper.migrateIssues(EnterpriseWorkflowMigrationHelper.java:455)
at com.atlassian.jira.workflow.migration.enterprise.EnterpriseWorkflowMigrationHelper.migrate(EnterpriseWorkflowMigrationHelper.java:358)
at com.atlassian.jira.workflow.migration.WorkflowAsynchMigrator.call(WorkflowAsynchMigrator.java:33)
at com.atlassian.jira.workflow.migration.WorkflowAsynchMigrator.call(WorkflowAsynchMigrator.java:18)
at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:359)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.opensymphony.workflow.StoreException: Could not move to history step for #17061: root cause: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
at com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore.moveToHistory(OfbizWorkflowStore.java:289)
at com.atlassian.jira.workflow.OSWorkflowManager.migrateIssueToWorkflow(OSWorkflowManager.java:480)
... 14 more
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:OSHistoryStep][id,10001][caller,null][startDate,2010-05-17 20:44:50.207][status,open][owner,][actionId,0][stepId,1][dueDate,null][entryId,17061] (SQL Exception while executing the following:INSERT INTO public.OS_HISTORYSTEP (ID, ENTRY_ID, STEP_ID, ACTION_ID, OWNER, START_DATE, DUE_DATE, FINISH_DATE, STATUS, CALLER) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_os_historystep"))
at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:156)
at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:121)
at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:63)
at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:489)
at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:461)
at com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore.moveToHistory(OfbizWorkflowStore.java:273)
... 15 more
Any ideas how to cope with that problem? Is it possible to increase some sequence or so?