#680  1dev upgrade problem
Closed
Artur opened 2 years ago

I am trying to upgrade my 1dev docker instance from version 5.0.0 to most recent. Upgrade from 5.0.0 directly to 7.0.3 failed, so I tried to do it in small steps. Upgrade to 5.1.0 was successful, however I cannot get any further. Any attempt to upgrade to 5.2.0 or higher fails with the error attached below.

I am trying to cleanup DB and manualy restore it:

/opt/onedev/bin/restore-db.sh /opt/onedev/site/db-backup/2022-04-14_07-16-03.zip

And this is successful. However, when running a docker with the new version, the same for which restore was successful, I get this:

INFO  - >>> INFO  - Validating data file 'IssueComments.xml.3'...
INFO  - >>> INFO  - Validating data file 'IssueComments.xml.4'...
INFO  - >>> INFO  - Validating data file 'IssueComments.xml.5'...
INFO  - >>> INFO  - Validating data file 'SshKeys.xml'...
INFO  - >>> INFO  - Validating data file 'ModelVersions.xml'...
INFO  - >>> INFO  - Validating data file 'Settings.xml'...
INFO  - >>> INFO  - Validating data file 'IssueChanges.xml'...
INFO  - >>> INFO  - Validating data file 'PullRequestWatchs.xml'...
INFO  - >>> INFO  - Validating data file 'IssueWatchs.xml'...
INFO  - >>> INFO  - Validating data file 'PullRequestUpdates.xml'...
INFO  - >>> INFO  - Validating data file 'PullRequestChanges.xml'...
INFO  - >>> INFO  - Validating data file 'UserAuthorizations.xml'...
INFO  - >>> INFO  - Validating data file 'GroupAuthorizations.xml'...
INFO  - >>> INFO  - Creating tables...
INFO  - >>> INFO  - Importing data into database...
INFO  - >>> INFO  - Importing from data file 'Roles.xml'...
INFO  - >>> INFO  - Importing from data file 'Projects.xml'...
INFO  - >>> INFO  - Importing from data file 'Users.xml'...
INFO  - >>> INFO  - Importing from data file 'PullRequests.xml'...
INFO  - >>> INFO  - Importing from data file 'Builds.xml'...
INFO  - >>> INFO  - Importing from data file 'PullRequestReviews.xml'...
INFO  - >>> INFO  - Importing from data file 'BuildDependences.xml'...
INFO  - >>> INFO  - Importing from data file 'Groups.xml'...
INFO  - >>> INFO  - Importing from data file 'Memberships.xml'...
INFO  - >>> INFO  - Importing from data file 'Issues.xml'...
INFO  - >>> INFO  - Importing from data file 'Issues.xml.2'...
INFO  - >>> ERROR - data exception: string data, right truncation;  table: O_ISSUE column: O_DESCRIPTION
INFO  - >>> ERROR - Error booting application
INFO  - >>> javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute statement
INFO  - >>> 	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
INFO  - >>> 	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
INFO  - >>> 	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
INFO  - >>> 	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1348)
INFO  - >>> 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1331)
INFO  - >>> 	at io.onedev.server.persistence.DefaultPersistManager.importData(DefaultPersistManager.java:475)
INFO  - >>> 	at io.onedev.server.persistence.SessionInterceptor$1.call(SessionInterceptor.java:23)
INFO  - >>> 	at io.onedev.server.persistence.DefaultSessionManager.call(DefaultSessionManager.java:79)
INFO  - >>> 	at io.onedev.server.persistence.SessionInterceptor.invoke(SessionInterceptor.java:18)
INFO  - >>> 	at io.onedev.server.maintenance.RestoreDatabase.doRestore(RestoreDatabase.java:105)
INFO  - >>> 	at io.onedev.server.maintenance.RestoreDatabase.start(RestoreDatabase.java:68)
INFO  - >>> 	at io.onedev.server.OneDev.start(OneDev.java:109)
INFO  - >>> 	at io.onedev.commons.loader.DefaultPluginManager.start(DefaultPluginManager.java:44)
INFO  - >>> 	at io.onedev.commons.loader.AppLoader.start(AppLoader.java:74)
INFO  - >>> 	at io.onedev.commons.bootstrap.Bootstrap.main(Bootstrap.java:189)
INFO  - >>> Caused by: org.hibernate.exception.DataException: could not execute statement
INFO  - >>> 	at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:52)
INFO  - >>> 	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
INFO  - >>> 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
INFO  - >>> 	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
INFO  - >>> 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200)
INFO  - >>> 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3208)
INFO  - >>> 	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3722)
INFO  - >>> 	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:91)
INFO  - >>> 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
INFO  - >>> 	at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
INFO  - >>> 	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
INFO  - >>> 	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
INFO  - >>> 	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:348)
INFO  - >>> 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
INFO  - >>> 	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:108)
INFO  - >>> 	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1344)
INFO  - >>> 	... 11 common frames omitted
INFO  - >>> Caused by: java.sql.SQLDataException: data exception: string data, right truncation;  table: O_ISSUE column: O_DESCRIPTION
INFO  - >>> 	at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
INFO  - >>> 	at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
INFO  - >>> 	at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source)
INFO  - >>> 	at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source)
INFO  - >>> 	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
INFO  - >>> 	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
INFO  - >>> 	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
INFO  - >>> 	... 22 common frames omitted
INFO  - >>> Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation;  table: O_ISSUE column: O_DESCRIPTION
INFO  - >>> 	at org.hsqldb.error.Error.error(Unknown Source)
INFO  - >>> 	at org.hsqldb.Table.enforceTypeLimits(Unknown Source)
INFO  - >>> 	at org.hsqldb.Table.generateAndCheckData(Unknown Source)
INFO  - >>> 	at org.hsqldb.Table.insertSingleRow(Unknown Source)
INFO  - >>> 	at org.hsqldb.StatementDML.insertSingleRow(Unknown Source)
INFO  - >>> 	at org.hsqldb.StatementInsert.getResult(Unknown Source)
INFO  - >>> 	at org.hsqldb.StatementDMQL.execute(Unknown Source)
INFO  - >>> 	at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
INFO  - >>> 	at org.hsqldb.Session.execute(Unknown Source)
INFO  - >>> 	... 27 common frames omitted
INFO  - >>> Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
INFO  - >>> 	at org.hsqldb.error.Error.error(Unknown Source)
INFO  - >>> 	at org.hsqldb.error.Error.error(Unknown Source)
INFO  - >>> 	at org.hsqldb.types.CharacterType.convertToTypeLimits(Unknown Source)
INFO  - >>> 	... 35 common frames omitted
ERROR - Failed to upgrade /opt/onedev
INFO  - Restoring old program files due to upgrade failure...
INFO  - Old program files restored
WARN  - The database might be in inconsistent state due to upgrade failure. In that case, you need to restore the database by first cleaning it, and then running below command:
INFO  - /opt/onedev/bin/restore-db.sh /opt/onedev/site/db-backup/2022-04-14_07-18-49.zip
<-- Wrapper Stopped
--> Wrapper Started as Console
]0;OneDevJava Service Wrapper Standard Edition 64-bit 3.5.44
  Copyright (C) 1999-2020 Tanuki Software, Ltd. All Rights Reserved.
    http://wrapper.tanukisoftware.com
  Licensed to OneDev for Service Wrapping

Launching a JVM...
Robin Shen commented 2 years ago

You have some issues with very long description. Versions after 5.1 reduced issue description length to make it work on all supported databases.

To workaround the problem, reduce the description or put some of them in comment, and try again.

Artur commented 2 years ago

O my... I have over 1,300 issues on my server now. How am I going to find the one which is causing a problem?

Robin Shen commented 2 years ago

You may select from the database for those issues with very long description. For instance with MySQL:

select o_project_id, o_number from o_Issue where CHAR_LENGTH(o_description)>13000;

Then modify each of these issues from OneDev web ui to move part of description to comment.

Robin Shen changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
Robin Shen commented 2 years ago

Please upgrade to 7.0.4 instead which will truncate too long description during upgrade. It also prints issues in question so that you can fix them manually and redo the upgrade.

Artur commented 2 years ago

Thanks a lot!

issue 1 of 1
Type
Question
Priority
Critical
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#680
Please wait...
Page is in error, reload to recover