Upgrading Sonar from 6.7.6 to 7.3 fails with db migration error

sonarqube

(Sageer) #1

Upgrading Sonarqube from LTS community edition v6.7.6 to community edition v7.3

Backend DB - mySQL version 5.6.39

The upgrade is failing after running the /setup for the DB migration . It is throwing the following exception .

2018.12.13 01:39:11 INFO web[DbMigrations] #1907 ‘Populate table live_measures’: success | time=1714901ms
2018.12.13 01:39:11 INFO web[DbMigrations] #1908 ‘Delete person and file measures’…
2018.12.13 01:40:11 INFO web[o.s.s.p.d.m.s.MassUpdate] 65 snapshots processed (1 items/sec)
2018.12.13 01:41:11 INFO web[o.s.s.p.d.m.s.MassUpdate] 132 snapshots processed (1 items/sec)



2018.12.13 02:22:16 INFO web[o.s.s.p.d.m.s.MassUpdate] 18321 snapshots processed (0 items/sec)
2018.12.13 02:22:16 ERROR web[DbMigrations] #1908 ‘Delete person and file measures’: failure | time=2584709ms
2018.12.13 02:22:16 ERROR web[DbMigrations] Executed DB migrations: failure | time=4300295ms
2018.12.13 02:22:16 ERROR web[o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=4300358ms
2018.12.13 02:22:16 ERROR web[o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #1908 ‘Delete person and file measures’ failed
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:68)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:105)
at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:80)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Already closed.
at org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:114)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:191)
at org.sonar.server.platform.db.migration.step.DataChange.execute(DataChange.java:45)
at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
… 9 common frames omitted

Could someone advice how to resolve this?


(Julien Lancelot) #2

Hi,

Have you tried again to execute the migrations ?
It seems that the connection to the database was lost for some reasons…

Regards,
Julien Lancelot


(Sageer) #3

Hi Julien

I was able to restart the migration but now it fails for a different reason

2018.12.13 16:51:47 INFO  web[][DbMigrations] #2104 'Create ALM_APP_INSTALLS table': success | time=42ms
2018.12.13 16:51:47 INFO  web[][DbMigrations] #2105 'Add LINE_HASHES_VERSION to table FILE_SOURCES'...
2018.12.13 16:52:47 ERROR web[][DbMigrations] #2105 'Add LINE_HASHES_VERSION to table FILE_SOURCES': failure | time=60166ms
2018.12.13 16:52:47 ERROR web[][DbMigrations] Executed DB migrations: failure | time=433604ms
2018.12.13 16:52:47 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration failed | time=433665ms
2018.12.13 16:52:47 ERROR web[][o.s.s.p.d.m.DatabaseMigrationImpl] DB migration ended with an exception
org.sonar.server.platform.db.migration.step.MigrationStepExecutionException: Execution of migration step #2105 'Add LINE_HASHES_VERSION to table FILE_SOURCES' failed
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:79)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:67)
	at java.lang.Iterable.forEach(Iterable.java:75)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:52)
	at org.sonar.server.platform.db.migration.engine.MigrationEngineImpl.execute(MigrationEngineImpl.java:68)
	at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doUpgradeDb(DatabaseMigrationImpl.java:105)
	at org.sonar.server.platform.db.migration.DatabaseMigrationImpl.doDatabaseMigration(DatabaseMigrationImpl.java:80)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Fail to execute ALTER TABLE file_sources ADD (line_hashes_version INTEGER NULL)
	at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:97)
	at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:77)
	at org.sonar.server.platform.db.migration.version.v72.AddLineHashesVersionToFileSources.execute(AddLineHashesVersionToFileSources.java:36)
	at org.sonar.server.platform.db.migration.step.DdlChange.execute(DdlChange.java:45)
	at org.sonar.server.platform.db.migration.step.MigrationStepsExecutorImpl.execute(MigrationStepsExecutorImpl.java:75)
	... 9 common frames omitted
Caused by: java.sql.SQLException: Temporary file write failure.
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2482)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2440)
	at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:845)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:745)
	at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
	at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
	at org.sonar.server.platform.db.migration.step.DdlChange$Context.execute(DdlChange.java:82)
	... 13 common frames omitted

Thanks
Sageer


(Sébastien Lesaint) #5

Hello,

Try googling the root cause of the error java.sql.SQLException: Temporary file write failure.

You’ll find you are probably lacking free disk on the database side to perform the migration operations.

Cheers,


(Sageer) #6

Hi Sebastien

Thanks for pointing that out . You are right it had to do with insufficient disk space

Sageer