Not able to connect to Jira H2 Database. Error in log "The transaction log might be corrupt for key"
Asked by Smitha Menon:

After a restart of my server in which Jira is hosted, now getting an error

Log says

2019-03-12 13:08:29,278 JIRA-Bootstrap INFO \[c.a.j.config.database.SystemDatabaseConfigurationLoader\] Reading database configuration from /var/atlassian/application-data/jira/dbconfig.xml  
2019-03-12 13:08:30,408 JIRA-Bootstrap ERROR \[c.a.config.bootstrap.DefaultAtlassianBootstrapManager\] Could not successfully test your database:  
org.h2.jdbc.JdbcSQLException: General error: "java.lang.IllegalStateException: The transaction log might be corrupt for key 1254727 \[1.4.185/100\]" \[50000-185\]  
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)  
at org.h2.message.DbException.get(DbException.java:168)  
at org.h2.message.DbException.convert(DbException.java:295)  
at org.h2.engine.Database.openDatabase(Database.java:297)  
at org.h2.engine.Database.\<init\>(Database.java:260)  
at org.h2.engine.Engine.openSession(Engine.java:60)  
at org.h2.engine.Engine.openSession(Engine.java:167)  
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:145)  
at org.h2.engine.Engine.createSession(Engine.java:128)  
at org.h2.engine.Engine.createSession(Engine.java:26)  
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347)  
at org.h2.jdbc.JdbcConnection.\<init\>(JdbcConnection.java:108)  
at org.h2.jdbc.JdbcConnection.\<init\>(JdbcConnection.java:92)  
at org.h2.Driver.connect(Driver.java:72)  
at java.sql.DriverManager.getConnection(DriverManager.java:664)  
at java.sql.DriverManager.getConnection(DriverManager.java:247)  
at com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager.getTestDatabaseConnection(DefaultAtlassianBootstrapManager.java:347)  
at com.atlassian.jira.config.database.JdbcDatasource.getConnection(JdbcDatasource.java:211)  
at com.atlassian.jira.config.database.DatabaseConfig.testConnection(DatabaseConfig.java:88)  
at com.atlassian.jira.health.checks.DbConfigurationAndConnectionCheck.doPerform(DbConfigurationAndConnectionCheck.java:60)  
at com.atlassian.jira.health.HealthCheckTemplate.perform(HealthCheckTemplate.java:23)  
at com.atlassian.jira.health.DefaultHealthCheckExecutor.runCheck(DefaultHealthCheckExecutor.java:74)  
at com.atlassian.jira.health.DefaultHealthCheckExecutor.lambda$applyAndCollectExceptions$1(DefaultHealthCheckExecutor.java:53)  
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)  
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)  
at java.util.Iterator.forEachRemaining(Iterator.java:116)  
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)  
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)  
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)  
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)  
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)  
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)  
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)  
at com.atlassian.jira.health.DefaultHealthCheckExecutor.applyAndCollectExceptions(DefaultHealthCheckExecutor.java:53)  
at com.atlassian.jira.health.DefaultHealthCheckExecutor.performHealthChecks(DefaultHealthCheckExecutor.java:42)  
at com.atlassian.jira.health.HealthChecks.executeChecksAndRecordResults(HealthChecks.java:164)  
at com.atlassian.jira.health.HealthChecks.runHealthChecks(HealthChecks.java:154)  
at com.atlassian.jira.health.HealthChecks.runHealthChecks(HealthChecks.java:66)  
at com.atlassian.jira.startup.BootstrapContainerLauncher.start(BootstrapContainerLauncher.java:48)  
at com.atlassian.jira.startup.DefaultJiraLauncher.preDbLaunch(DefaultJiraLauncher.java:115)  
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:101)  
at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)  
at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:100)  
at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:154)  
at java.lang.Thread.run(Thread.java:748)  
Caused by: java.lang.IllegalStateException: The transaction log might be corrupt for key 1254727 \[1.4.185/100\]  
at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:773)  
at org.h2.mvstore.db.TransactionStore$TransactionMap.getValue(TransactionStore.java:1224)  
at org.h2.mvstore.db.TransactionStore$TransactionMap.getValue(TransactionStore.java:1184)  
at org.h2.mvstore.db.TransactionStore$TransactionMap.get(TransactionStore.java:1161)  
at org.h2.mvstore.db.TransactionStore$TransactionMap.get(TransactionStore.java:1129)  
at org.h2.mvstore.db.MVPrimaryIndex.\<init\>(MVPrimaryIndex.java:79)  
at org.h2.mvstore.db.MVTable.init(MVTable.java:90)  
at org.h2.mvstore.db.MVTableEngine.createTable(MVTableEngine.java:130)  
at org.h2.mvstore.db.MVTableEngine.createTable(MVTableEngine.java:41)  
at org.h2.schema.Schema.createTable(Schema.java:582)  
at org.h2.command.ddl.CreateTable.update(CreateTable.java:137)  
at org.h2.engine.MetaRecord.execute(MetaRecord.java:58)  
at org.h2.engine.Database.open(Database.java:732)  
at org.h2.engine.Database.openDatabase(Database.java:266)  
... 41 more  
2019-03-12 13:08:30,433 JIRA-Bootstrap ERROR \[c.a.jira.health.HealthChecks\] JIRA couldn't connect to your database  
2019-03-12 13:08:30,433 JIRA-Bootstrap ERROR \[c.a.jira.health.HealthChecks\] JIRA failed to establish a connection to your database.  
This could be because:  
- Your database isn't running  
- The configuration of your dbconfig.xml file is incorrect (user, password, or database URL etc.)  
- There is a network issue between JIRA and your database (e.g. firewall, database doesn't allow remote access etc.)

Please help.


Answers:
author: Petr Van??ek
body: Hi,

I hope you are not using it as production. HSQL is only for testing purposes so probably you have currupted DB files. Did you stop Jira before restart?

So probably there is no other option than start with clear DB and with normal DBMS like PostgreSQL.

comments: author: Smitha Menon
body: Thank you for the fast reply. Fortunately, it is the dev server and wont be very difficult to loose the data.

Thanks again.


author: Petr Van??ek
body: Perfect, but still is better is to use DBMS instead of text file "DB". ;-)


author: Smitha Menon
body: Will not repeat the mistake again. Will use PostgreSQL or MySQL this time. :-)


Tags: confluence-server

server