Database upgrade from v4.3 to v5.8 fails with exception

Yechiel cohena year ago

Hi,

I have old Hikari H2 database files that were generated long time ago with server version v4.3 and now I want to use them with the latest server version (v5.3).
So, I was expecting the changelog* files to do that database upgrade automatically during the new server's first-time boot...

However, I got the following exception right at the begining:

$  cd NEW-SRV/traccar ; /usr/bin/env /usr/java/oracle/jdk-18.0.2.1/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:36167 @/tmp/cp_bwq3ka3cukit2w83q8bqjwf5r.argfile org.traccar.Main 
2023-06-25 19:09:07  INFO: Operating system name: Linux version: 5.15.0-75-generic architecture: amd64
2023-06-25 19:09:07  INFO: Java runtime name: Java HotSpot(TM) 64-Bit Server VM vendor: Oracle Corporation version: 18.0.2.1+1-1
2023-06-25 19:09:07  INFO: Memory limit heap: 7964mb non-heap: 0mb
2023-06-25 19:09:07  INFO: Character encoding: UTF-8 charset: UTF-8
2023-06-25 19:09:07  INFO: Version: null
2023-06-25 19:09:07  INFO: Starting server...
2023-06-25 19:09:07  INFO: HikariPool-1 - Starting...
2023-06-25 19:09:09 ERROR: HikariPool-1 - Exception during pool initialization. - The write format 1 is smaller than the supported format 2 [2.1.214/5] - MVStoreException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:124 < ...)
2023-06-25 19:09:09 ERROR: Main method error - The write format 1 is smaller than the supported format 2 [2.1.214/5] - MVStoreException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:124 < ...)
Exception in thread "main" java.lang.RuntimeException: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: HikariPool$PoolInitializationException: Failed to initialize pool: Unsupported database file version or invalid file header in file "/home/byc013/data/AdvanceTec/GIT/NEW-SRV/traccar/target/database.mv.db" [90048-214]
  at DatabaseModule.provideDataSource(DatabaseModule.java:46)
  at DatabaseStorage.<init>(DatabaseStorage.java:48)
      \_ for 2nd parameter
  while locating DatabaseStorage
  at MainModule.provideStorage(MainModule.java:121)
  while locating Storage

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
DatabaseModule:                         "org.traccar.storage.DatabaseModule"
DatabaseStorage:                        "org.traccar.storage.DatabaseStorage"
HikariPool$PoolInitializationException: "com.zaxxer.hikari.pool.HikariPool$PoolInitializationException"
MainModule:                             "org.traccar.MainModule"
Storage:                                "org.traccar.storage.Storage"
========================
End of classname legend:
========================

        at org.traccar.Main.run(Main.java:154)
        at org.traccar.Main.main(Main.java:114)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: HikariPool$PoolInitializationException: Failed to initialize pool: Unsupported database file version or invalid file header in file "/home/byc013/data/AdvanceTec/GIT/NEW-SRV/traccar/target/database.mv.db" [90048-214]
  at DatabaseModule.provideDataSource(DatabaseModule.java:46)
  at DatabaseStorage.<init>(DatabaseStorage.java:48)
      \_ for 2nd parameter
  while locating DatabaseStorage
  at MainModule.provideStorage(MainModule.java:121)
  while locating Storage

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
DatabaseModule:                         "org.traccar.storage.DatabaseModule"
DatabaseStorage:                        "org.traccar.storage.DatabaseStorage"
HikariPool$PoolInitializationException: "com.zaxxer.hikari.pool.HikariPool$PoolInitializationException"
MainModule:                             "org.traccar.MainModule"
Storage:                                "org.traccar.storage.Storage"
========================
End of classname legend:
========================

        at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1151)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
        at org.traccar.Main.run(Main.java:126)
        ... 1 more
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Unsupported database file version or invalid file header in file "/home/byc013/data/AdvanceTec/GIT/NEW-SRV/traccar/target/database.mv.db" [90048-214]
        at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
        at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at org.traccar.storage.DatabaseModule.provideDataSource(DatabaseModule.java:79)
        at org.traccar.storage.DatabaseModule$$FastClassByGuice$$193788.GUICE$TRAMPOLINE(<generated>)
        at org.traccar.storage.DatabaseModule$$FastClassByGuice$$193788.apply(<generated>)
        at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260)
        at com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171)
        at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185)
        at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
        at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
        at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
        at org.traccar.MainModule.provideStorage(MainModule.java:124)
        at org.traccar.MainModule$$FastClassByGuice$$a8622.GUICE$TRAMPOLINE(<generated>)
        at org.traccar.MainModule$$FastClassByGuice$$a8622.apply(<generated>)
        at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260)
        at com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171)
        at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185)
        at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
        at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
        ... 3 more
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Unsupported database file version or invalid file header in file "/home/byc013/data/AdvanceTec/GIT/NEW-SRV/traccar/target/database.mv.db" [90048-214]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:678)
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
        at org.h2.message.DbException.get(DbException.java:212)
        at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:161)
        at org.h2.mvstore.db.Store.<init>(Store.java:145)
        at org.h2.engine.Database.<init>(Database.java:324)
        at org.h2.engine.Engine.openSession(Engine.java:92)
        at org.h2.engine.Engine.openSession(Engine.java:222)
        at org.h2.engine.Engine.createSession(Engine.java:201)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
        at org.h2.Driver.connect(Driver.java:59)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
        ... 33 more
Caused by: org.h2.mvstore.MVStoreException: The write format 1 is smaller than the supported format 2 [2.1.214/5]
        at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
        at org.h2.mvstore.MVStore.getUnsupportedWriteFormatException(MVStore.java:1066)
        at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:886)
        at org.h2.mvstore.MVStore.<init>(MVStore.java:463)
        at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4082)
        at org.h2.mvstore.db.Store.<init>(Store.java:136)
        ... 45 more

Please advise what could be the problem?

Anton Tananaeva year ago
Yechiel cohena year ago

Thanks a lot! That worked!