Jira not working after DB restore.

Tayyab Bashir Community Champion Feb 17, 2016

Hi,
I restored my SQL backup on JIRA, and after the db restore, JIRA has stopped working; giving the following error on main page.

Exception thrown during upgrade: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ReindexRequest][requestTime,2016-02-17 16:26:15.934][completionTime,null][startTime,null][executionNodeId,null][id,10000][type,DELAYED][status,PENDING] (SQL Exception while executing the following:INSERT INTO reindex_request (ID, TYPE, REQUEST_TIME, START_TIME, COMPLETION_TIME, STATUS, EXECUTION_NODE_ID, QUERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '10000' for key 'PRIMARY'))
com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ReindexRequest][requestTime,2016-02-17 16:26:15.934][completionTime,null][startTime,null][executionNodeId,null][id,10000][type,DELAYED][status,PENDING] (SQL Exception while executing the following:INSERT INTO reindex_request (ID, TYPE, REQUEST_TIME, START_TIME, COMPLETION_TIME, STATUS, EXECUTION_NODE_ID, QUERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '10000' for key 'PRIMARY'))
	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
	at com.atlassian.jira.entity.EntityEngineImpl.createValue(EntityEngineImpl.java:29)
	at com.atlassian.jira.index.request.ReindexRequestDaoImpl.writeRequest(ReindexRequestDaoImpl.java:37)
	at com.atlassian.jira.index.request.DefaultReindexRequestManager.requestReindex(DefaultReindexRequestManager.java:358)
	at com.atlassian.jira.index.request.DefaultReindexRequestService.requestReindex(DefaultReindexRequestService.java:64)
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6136.doUpgrade(UpgradeTask_Build6136.java:28)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:718)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:609)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:493)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:435)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:379)
	at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:90)
	at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:47)
	at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:49)
	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$518(DefaultJiraLauncher.java:134)
	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$16/2023461095.run(Unknown Source)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194)
	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:121)
	at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$516(DefaultJiraLauncher.java:90)
	at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$2/833463136.run(Unknown Source)
	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:88)
	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4710)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ReindexRequest][requestTime,2016-02-17 16:26:15.934][completionTime,null][startTime,null][executionNodeId,null][id,10000][type,DELAYED][status,PENDING] (SQL Exception while executing the following:INSERT INTO reindex_request (ID, TYPE, REQUEST_TIME, START_TIME, COMPLETION_TIME, STATUS, EXECUTION_NODE_ID, QUERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '10000' for key 'PRIMARY'))
	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213)
	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178)
	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542)
	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97)
	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
	... 33 more
Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO reindex_request (ID, TYPE, REQUEST_TIME, START_TIME, COMPLETION_TIME, STATUS, EXECUTION_NODE_ID, QUERY) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '10000' for key 'PRIMARY')
	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683)
	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205)
	... 39 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10000' for key 'PRIMARY'
	at sun.reflect.GeneratedConstructorAccessor162.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
	at com.mysql.jdbc.Util.getInstance(Util.java:384)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673)
	... 40 more

2 answers

1 accepted

This widget could not be displayed.
Vasiliy Zverev Community Champion Feb 17, 2016

Have you updated JIRA version? See this one: https://answers.atlassian.com/questions/31686169

Tayyab Bashir Community Champion Feb 17, 2016

Hi,
The JIRA version is: 7.0.10
However the database backup I am restoring on it is from 6.0.0

But I think that couldn't be the reason for this problem, could it? 

And besides, I tried to restore a XML backup earlier (backup was of 6.0 server), that didn't result in any problems. 

But when I try to restore the whole mysql db, JIRA doesn't open.  

This is not the right route to take for upgrading - you should do a proper upgrade on the data - get a 6.0.0 system up and running, then upgrade it to 7.10 as per documentation, then you can safely backup and restore the database to another system.

Tayyab Bashir Community Champion Feb 17, 2016

Yeah, that's what I'm going to do now.
Get a 6.0 and upgrade it to 7.0.10
And then restore the db.

 

Thanks. 

This widget could not be displayed.
Chris Fuller Atlassian Team Feb 17, 2016

 

ID numbers are generated based on the values stored in the sequencevalueitem table.  If the sequence is not yet started, then it starts at 10000.  If you already have a value with that ID in the database, then you hit a unique constraint because you can't have 2 rows with the same ID.

In short, this error means that your database has been manually altered in unexpected/incorrect ways.  You need to go back and do things the right way.  While it is usually acceptable to take a database dump and restore it (with JIRA shut down) and let it upgrade itself during a normal start-up, this requires that you correctly configured the database with the same settings that you were using before and that you import with the same user that JIRA will connect with (or otherwise grant the appropriate access to all of the tables).

If you have an XML backup available, using that is definitely a safer path.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

139 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you