I exported the database from MySQL using 'backup-db' and tried to restore it using 'restore-db', but it has been more than 20 minutes since I began the operation.
The console printed like this:
Launching a JVM...
WrapperManager: Initializing...
default THREAD FACTORY
INFO - Launching application from '/app'...
INFO - Starting application...
INFO - Restoring database from /backup.zip...
INFO - Waiting for server to stop...
Then it stuck. I wonder if it will take more time to restore the database to a newer version instance or move to another type of database, which I attempt to move from MySQL to PostgreSQL.
pgAdmin shows like this
Robin Shen commented 3 months ago
Please stop OneDev before running this script.
Jeb Feng commented 3 months ago
I use a podman container to run it. When I try to stop OneDev using ./server.sh stop, it shows that the server has already stopped.
/app/bin# ./server.sh stop
OneDev is not running.
Then I run ./restore-db.sh backup.zip, and it shows this
Running OneDev Restore Database...
--> Wrapper Started as Console
Java Service Wrapper Standard Edition 64-bit 3.5.51
Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
http://wrapper.tanukisoftware.com
Licensed to OneDev for Service Wrapping
Launching a JVM...
WrapperManager: Initializing...
default THREAD FACTORY
INFO - Launching application from '/app'...
INFO - Starting application...
INFO - Restoring database from ./backup.zip...
INFO - Waiting for server to stop...
and stuck again.
However, meanwhile, the server isn't stopped, I can still access it via browser.
Jeb Feng commented 3 months ago
I then tested database restoration on my desktop computer without container.
It works, I guess it is a container cannot stop the server, because as the server exits, the container itself will stop.
Jeb Feng commented 3 months ago
Then it comes to
org.postgresql.util.PSQLException: ERROR: relation "o_databaselock" does not exist
Position: 15
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:311)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:225)
at io.onedev.server.persistence.PersistenceUtils.lambda$callWithLock$1(PersistenceUtils.java:109)
at io.onedev.server.persistence.PersistenceUtils.callWithTransaction(PersistenceUtils.java:47)
at io.onedev.server.persistence.PersistenceUtils.callWithLock(PersistenceUtils.java:106)
at io.onedev.server.commandhandler.Upgrade.start(Upgrade.java:513)
at io.onedev.commons.loader.DefaultPluginManager.start(DefaultPluginManager.java:44)
at io.onedev.commons.loader.AppLoader.start(AppLoader.java:60)
at io.onedev.commons.bootstrap.Bootstrap.main(Bootstrap.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349)
at java.base/java.lang.Thread.run(Thread.java:829)
WARN - Unable to get database lock, will retry
org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2497)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2233)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:446)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:370)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:311)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:297)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:274)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:225)
at io.onedev.server.persistence.PersistenceUtils.lambda$callWithLock$1(PersistenceUtils.java:109)
at io.onedev.server.persistence.PersistenceUtils.callWithTransaction(PersistenceUtils.java:47)
at io.onedev.server.persistence.PersistenceUtils.callWithLock(PersistenceUtils.java:106)
at io.onedev.server.commandhandler.Upgrade.start(Upgrade.java:513)
at io.onedev.commons.loader.DefaultPluginManager.start(DefaultPluginManager.java:44)
at io.onedev.commons.loader.AppLoader.start(AppLoader.java:60)
at io.onedev.commons.bootstrap.Bootstrap.main(Bootstrap.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
This only happens in a container. May I open a new issue?
Robin Shen commented 3 months ago
You are doing restore from wrong place. Please run from /opt/onedev/bin instead of /app/bin as mentioned in document. While doing restore, please keep the container running. OneDev will stop/start server automatically.
I exported the database from MySQL using 'backup-db' and tried to restore it using 'restore-db', but it has been more than 20 minutes since I began the operation. The console printed like this:
Then it stuck. I wonder if it will take more time to restore the database to a newer version instance or move to another type of database, which I attempt to move from MySQL to PostgreSQL.
pgAdmin shows like this