Database with old version (ASYNC and HOT-FOLDER modes)
Problem description
After updating the proxy image and then starting the proxy in ASYNC or HOT-FOLDER mode, the database may have an old version not supported by the proxy image, and the following error appears.
Exception in thread "main" org.h2.jdbc.JdbcSQLNonTransientException: General error: "The write format 1 is smaller than the supported format 2 [2.0.202/5]" [50000-202]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:554)
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:166)
at org.h2.mvstore.db.Store.<init>(Store.java:140)
at org.h2.engine.Database.<init>(Database.java:325)
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:342)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:117)
at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:287)
at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:270)
at org.h2.tools.RunScript.process(RunScript.java:320)
at org.h2.tools.RunScript.runTool(RunScript.java:144)
at org.h2.tools.RunScript.main(RunScript.java:71)
Caused by: org.h2.mvstore.MVStoreException: The write format 1 is smaller than the supported format 2 [2.0.202/5]
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
at org.h2.mvstore.MVStore.getUnsupportedWriteFormatException(MVStore.java:1059)
at org.h2.mvstore.MVStore.readStoreHeader(MVStore.java:878)
at org.h2.mvstore.MVStore.<init>(MVStore.java:455)
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4052)
at org.h2.mvstore.db.Store.<init>(Store.java:129)
... 11 more
>> Database has an older version (1.4.197). Will validate if exist operations pending execution...
There are operations pending execution with the following external references:
Ext_Ref_710ae8b4-3607-4246-86ed-0800fe96fb30
Ext_Ref_8704dc7f-94fa-4745-83c1-473a7e367c41
Ext_Ref_cd4cc5cc-2ffd-4a08-a856-bce31ee5f715
Ext_Ref_9c8824e5-23f7-4e6f-b70f-69db4725ca68
Ext_Ref_a8b8df05-7250-41e6-9e2b-c2b47aab3555
If exist operations in pending execution status, its external references will be printed as shown in the log above.
However, if no pending operations exist, the proxy will automatically delete the current database file and recreate a new one with the latest version.
Solution
To solve this error and update the database version, you can follow one of the following approaches.
Wait until the proxy instance with the old docker image finishes the pending operations and then start the proxy with the new docker image. Since no operations will be pending, the proxy can recreate successfully the database with the new version.
Force deleting the old database file (with or without pending data) using the parameter force.database.recreate on the docker run container. Then, you can run again without this parameter and request new operations with the documents not processed.
Note, you can use the new image version for this step.
It is only necessary to run the docker container with this parameter one single time for database recreation to take effect. For the next subsequent executions, you must remove the parameter.