gbenmansour
gbenmansour

Reputation: 95

DB migration issue when upgrading Artifactory from 6.10.9 to 7.7.3

We cannot start Artifactory after upgrade from 6.10.9 to 7.7.3. We are using the embedded derby database and the artifactory-service.log shows the following error:

2020-08-27T08:11:49.605Z [jfrt ] [ERROR] [68fd8bcbbe66783b] [d.c.m.ConverterManagerImpl:249] [ocalhost-startStop-1] - Conversion failed. You should analyze the error and retry launching Artifactory. Error is: Could not convert DB using v217_create_jobs_table converter : Table/View 'JOBS' already exists in Schema 'APP'. 2020-08-27T08:11:49.606Z [jfrt ] [ERROR] [68fd8bcbbe66783b] [tifactoryHomeConfigListener:62] [ocalhost-startStop-1] - Failed initializing Home. Caught exception: java.lang.IllegalStateException: Could not convert DB using v217_create_jobs_table converter : Table/View 'JOBS' already exists in Schema 'APP'. at org.artifactory.storage.db.converter.markers.ConverterManagerImpl.handleException(ConverterManagerImpl.java:252) at org.artifactory.storage.db.converter.markers.ConverterManagerImpl.serviceConvert(ConverterManagerImpl.java:210) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658) at org.artifactory.storage.db.converter.markers.ConverterManagerImpl.convertDatabase(ConverterManagerImpl.java:150) at org.artifactory.lifecycle.storage.db.init.PostDbSchemaInitializationManager.convertAndInit(PostDbSchemaInitializationManager.java:61) at org.artifactory.lifecycle.storage.db.init.HaInitLock.runInsideInitLockIfNeeded(HaInitLock.java:87) at org.artifactory.lifecycle.storage.db.init.PostDbSchemaInitializationManager.init(PostDbSchemaInitializationManager.java:50) at org.artifactory.lifecycle.webapp.servlet.BasicConfigurationManager.initArtifactoryInstallation(BasicConfigurationManager.java:141) at org.artifactory.lifecycle.webapp.servlet.BasicConfigurationManager.initialize(BasicConfigurationManager.java:125) at org.artifactory.lifecycle.webapp.servlet.ArtifactoryHomeConfigListener.contextInitialized(ArtifactoryHomeConfigListener.java:57) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:614) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1822) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.RuntimeException: Could not convert DB using v217_create_jobs_table converter at org.artifactory.storage.db.version.converter.DbSqlConverterUtil.convert(DbSqlConverterUtil.java:95) at org.artifactory.storage.db.version.converter.DBSqlConverter.lambda$convert$0(DBSqlConverter.java:49) at org.jfrog.storage.util.DbUtils.doWithConnection(DbUtils.java:516) at org.artifactory.storage.db.version.converter.DBSqlConverter.convert(DBSqlConverter.java:49) at org.artifactory.storage.db.DatabaseConverterAdapter.convert(DatabaseConverterAdapter.java:58) at org.artifactory.storage.db.converter.markers.ConverterManagerImpl.serviceConvert(ConverterManagerImpl.java:206) ... 22 common frames omitted Caused by: java.sql.SQLException: Table/View 'JOBS' already exists in Schema 'APP'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source) at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:120) at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java) at org.jfrog.storage.util.DbStatementUtils.executeSqlStream(DbStatementUtils.java:61) at org.artifactory.storage.db.version.converter.DbSqlConverterUtil.doConvert(DbSqlConverterUtil.java:102) at org.artifactory.storage.db.version.converter.DbSqlConverterUtil.convert(DbSqlConverterUtil.java:90) ... 27 common frames omitted Caused by: org.apache.derby.iapi.error.StandardException: Table/View 'JOBS' already exists in Schema 'APP'. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.duplicateDescriptorException(Unknown Source) at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptor(Unknown Source) at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(Unknown Source) at org.apache.derby.impl.sql.execute.MiscResultSet.open(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) ... 36 common frames omitted 2020-08-27T08:11:49.607Z [jfrt ] [ERROR] [68fd8bcbbe66783b] [actoryContextConfigListener:91] [ocalhost-startStop-1] - Failed initializing Artifactory context: Artifactory home not initialized.

Is it safe to connect to the db and just drop the table "JOBS" ?

Upvotes: 0

Views: 1335

Answers (1)

Lakshmi Prasad
Lakshmi Prasad

Reputation: 426

The above issues seem to be due to the earlier upgrade the database migration stopped in middle and when you try to upgrade again, the migration script failing to trigger again from the beginning and throwing the error.

Option1, try clearing the JOBS table and see if it helps.

Option2: If you have the snapshot of the database for Artifactory version 6.10 (Before triggering the Artifactory upgrade and the derby database is stored under &Artifactory_home/data directory), then can you revert back the database to Artifactory version 6.10 DB and then try to upgrade. This migration process should start again.

Upvotes: 1

Related Questions