'Derby migration fail during Artifactory upgrade from 6 to 7

I am upgrading Artifactory from 5.5.1 to latest 7.35 using manual. Until 6.x major it went well, but after trying to migrate from 6.12.2 or 6.23.21 to different 7.x majors it always ends up in bad state. I tried migrating it from different 6.x versions to different 7.x versions, nothing helped.

migration.sh always shows success, but after starting Artifactory it stucks in broken state with no UI accessible. However localhost:8081 still redirects to localhost:8082/ui.

This can be seen in derby.log. Looks like database migration problem.

# cat derby.log
----------------------------------------------------------------
Fri Mar 11 14:30:23 UTC 2022:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.14.2.0 - (1828579): instance a816c00e-017f-7963-434f-00001e025fc0
on database directory /var/opt/jfrog/artifactory/data/derby with class loader java.net.URLClassLoader@4f970963
Loaded from file:/opt/jfrog/artifactory/app/artifactory/tomcat/lib/derby-10.14.2.0.jar
java.vendor=AdoptOpenJDK
java.runtime.version=11.0.2+9
user.dir=/
os.name=Linux
os.arch=amd64
os.version=3.10.0-1160.49.1.el7.x86_64
derby.system.home=null
derby.stream.error.file=/opt/jfrog/artifactory/var/log/derby.log
Database Class Loader started - derby.database.classpath=''
Fri Mar 11 14:30:41 UTC 2022 Thread[localhost-startStop-1,5,main] (XID = 176494570), (SESSIONID = 3), (DATABASE = /opt/jfrog/artifactory/var/data/artifactory/derby), (DRDAID = null), Cleanu
p action starting
Fri Mar 11 14:30:41 UTC 2022 Thread[localhost-startStop-1,5,main] (XID = 176494570), (SESSIONID = 3), (DATABASE = /opt/jfrog/artifactory/var/data/artifactory/derby), (DRDAID = null), Failed
Statement is: INSERT INTO access_configs (config_name, modified, data) VALUES (?, ?, ?) with 3 parameters begin parameter #1: shared.security.joinKey :end parameter begin parameter #2: 164
7009041746 :end parameter begin parameter #3: BLOB:Length=93 :end parameter
ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'ACCESS_CONFIGS_PK' defined on
'ACCESS_CONFIGS'.
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.execute.IndexChanger.insertAndCheckDups(Unknown Source)
at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source)
at org.apache.derby.impl.sql.execute.IndexChanger.insert(Unknown Source)
at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(Unknown Source)
at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(Unknown Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeLargeUpdate(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)
at jdk.internal.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy81.executeUpdate(Unknown Source)
at org.jfrog.storage.JdbcHelper.executeUpdate(JdbcHelper.java:229)
at org.jfrog.access.server.db.util.AccessJdbcHelperImpl.executeUpdate(AccessJdbcHelperImpl.java:104)

Any ideas for debugging this? Thank you kindly for your help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source