Upgrade 16.6.1 → 16.9.x on MariaDB leaves database empty: `MySQL5InnoDBDialect` no longer exists (Hibernate 7), but bundled `hibernate.properties` still recommends it #3203
Dominik Breu opened 1 week ago

Summary

Upgrading a Docker installation that uses MariaDB from 16.6.1 to 16.9.7 fails at the "Restoring database with new program" step. The cause is that org.hibernate.dialect.MySQL5InnoDBDialect cannot be loaded. The new release ships hibernate-core-7.4.8.Final, and that class no longer exists there. The dialect is still the one recommended for MySQL and MariaDB in the conf/hibernate.properties template shipped with 16.9.7.

By the time the failure happens, the old program has already cleaned the database. The rollback ("Error cleaning database") then fails as well. The result is an empty database and a container that refuses to start onevery later restart with Unable to upgrade specified installation as database is not populated yet.

On my instance this happened twice. The first time (on 2026-10-19, with the image I pulled then) it went unnoticed, and the server was down for 6 days with an empty database. The logs from that attempt are gone because the container was removed. The pre-upgrade backup it left behind and the identical symptoms point to the same cause.

Environment

  • Deployment: Docker Compose (compose 2.39.4), image 1dev/server:latest
    • digest sha256:114926cff102b98e54138093e57c2de24b7e9b783b99e8834634fdec1e218a50
    • release.properties: version=16.9.7, commit=bad54da1
  • Upgraded from: 16.6.1 (commit 7238d4d7), data version 243
  • Database: MariaDB 11.8.9 (Debian), on the host, reached through host.docker.internal
  • Hibernate in old install: hibernate-core-5.4.24.Final. Hibernate in new image: hibernate-core-7.4.8.Final
  • JDBC driver: org.mariadb.jdbc.Driver (bundled mariadb-java-client-2.3.0.jar)

Relevant compose environment (as it had been running since 2026-05 without problems):

environment:
  - hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  - hibernate_connection_driver_class=org.mariadb.jdbc.Driver
  - hibernate_connection_url=jdbc:mariadb://host.docker.internal:3306/<db>
  - hibernate_connection_username=<user>
  - hibernate_connection_password=<password>

These values are what the MariaDB section of the shipped conf/hibernate.properties says to use. The 16.9.7 template still contains this:

# To use MariaDB database, please follow below steps:
...
#hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
#hibernate.connection.driver_class=org.mariadb.jdbc.Driver
#hibernate.connection.url=jdbc:mariadb://localhost:3306/onedev

The MySQL section of the template also names MySQL5InnoDBDialect.

Dialect classes present in hibernate-core-7.4.8.Final.jar (MySQL/MariaDB family):

org/hibernate/dialect/MariaDBDialect.class
org/hibernate/dialect/MySQLDialect.class

Steps to reproduce

  1. Run OneDev 16.6.1 in Docker with MariaDB and hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect, as the template recommends.
  2. docker compose stop && docker rm onedev && docker pull 1dev/server && docker compose up -d

Actual result

The upgrade log (trimmed; "Exporting table …" lines removed):

Upgrading /opt/onedev...
Backing up old program files as /opt/onedev/site/program-backup/2026-10-25_09-05-47...
Backing up database as /opt/onedev/site/db-backup/2026-10-25_09-05-47.zip...
>>> Database is successfully backed up to /opt/onedev/site/db-backup/2026-10-25_09-05-47.zip
Cleaning database with old program...
>>> Database is cleaned successfully
Updating program files...
Removing obsolete workspace logs...
Moving published sites into the public site directory...
Restoring database with new program...
>>> Restoring database from /opt/onedev/site/db-backup/2026-10-25_09-05-47.zip...
>>> WARN  - HHH100046: Could not obtain connection to query JDBC database metadata
>>> org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect]
>>> Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.MySQL5InnoDBDialect]
>>> Caused by: java.lang.ClassNotFoundException: Could not load requested class: org.hibernate.dialect.MySQL5InnoDBDialect
>>> ERROR - Error booting application
>>> org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBDialect] as strategy [org.hibernate.dialect.Dialect]
ERROR - Error cleaning database
io.onedev.commons.utils.ExplicitException: Command execution failed (command: ... io.onedev.commons.bootstrap.Bootstrap clean-db, exit code: 1)
    at io.onedev.server.commandhandler.Upgrade$3.call(Upgrade.java:448)
    at io.onedev.server.commandhandler.Upgrade.lambda$start$0(Upgrade.java:532)
    ...
INFO  - Restoring old program files...
INFO  - Old program files restored
ERROR - !! Failed to upgrade /opt/onedev
OneDev is unable to restore old database, please do it manually by first resetting it (delete and create), and then exec into the container to run below command:
/opt/onedev/bin/restore-db.sh /opt/onedev/site/db-backup/2026-10-25_09-05-47.zip

After this, the database contains only o_ClusterServer and o_DatabaseLock. Every later start of the container fails like this:

Upgrading /opt/onedev...
ERROR - Unable to upgrade specified installation as database is not populated yet
*** After solving the problem, please restart container with correct image ***

That message gives no hint that an earlier upgrade attempt emptied the database, or that a backup can be restored from site/db-backup/.

Expected result

  • The shipped template recommends a dialect that exists in the bundled Hibernate.
  • If the configured dialect cannot be loaded by the new program, the upgrade aborts before the database is cleaned. Ideally it also explains which setting to change.
  • Failing that, the "database is not populated yet" message should point to the most recent backup in site/db-backup/.

Workaround (confirmed working)

  1. Change the environment to hibernate_dialect=org.hibernate.dialect.MariaDBDialect. This class exists in both Hibernate 5.4 (old program) and Hibernate 7.4 (new program).
  2. Restore the backup with the old program while keeping the old dialect for that one step, so the tables are created as InnoDB:
    docker compose run --rm --no-deps -e hibernate_dialect=org.hibernate.dialect.MySQL5InnoDBDialect \
      --entrypoint /opt/onedev/bin/restore-db.sh onedev /opt/onedev/site/db-backup/<backup>.zip
    
  3. docker compose up -d. The upgrade then completes ("Successfully upgraded /opt/onedev"), and 16.9.7 runs with all data present.

Suggested fixes

  1. Update conf/hibernate.properties (MySQL and MariaDB sections) to org.hibernate.dialect.MySQLDialect / org.hibernate.dialect.MariaDBDialect.
  2. Add an entry to incompatibilities.md for the release that moved to Hibernate 6/7. Currently there is no mention of dialect changes.
  3. In Upgrade, verify that the new program can boot Hibernate with the effective configuration (or map legacy dialect names to their replacements) before running clean-db with the old program.

Existing issues I checked before filing

I searched the issue tracker on 2026-10-25 and found no existing report of this. Searches performed:

QueryResult
"dialect"3 results (OD-3135, OD-554, OD-1647), none about this
~MySQL5InnoDBDialect~No records found
~upgrade~232 results. I went through page 1 (most recent): nothing about Hibernate/dialect or 16.7–16.9 database upgrades
~hibernate~51 results. I went through page 1: only OD-2510 (query plan cache), nothing about Hibernate 6/7 or dialects
~dialect~ or ~MariaDB~ or ~MySQL~ or "database is not populated"188 results. I went through page 1: all closed, none about this
Issues submitted in the last 30 daysPage 1 checked: nothing related to upgrade/database/dialect
Web search: OneDev MySQL5InnoDBDialect upgrade failed Hibernate "Unable to resolve name" dialectNo matching OneDev report

Related but different:

  • OD-3135: MariaDB JDBC parameter binding error on 16.7.2. Its reporter already uses MariaDBDialect, and it doesn't involve upgrades.
  • OD-727: an older MariaDB upgrade failure with MySQL5InnoDBDialect, caused by a missing table rather than a missing dialect class.

Apologies if this duplicates an issue I missed. Some search pages showed "Connection lost or session expired" while loading.

1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
16.9.7
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-3203
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover