Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General error: "The write format 1 is smaller than the supported format 2 [2.0.202/5]" [50000-202] HY000/50000 #3214

Closed
PedroExpedito opened this issue Nov 28, 2021 · 10 comments

Comments

@PedroExpedito
Copy link

When I click caused By I get github error 404 about this error.

Log:

General error: "The write format 1 is smaller than the supported format 2 [2.0.202/5]" [50000-202] HY000/50000 (Help)
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.server.web.WebServer.getConnection(WebServer.java:785)
    at org.h2.server.web.WebApp.test(WebApp.java:968)
    at org.h2.server.web.WebApp.process(WebApp.java:241)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:176)
    at org.h2.server.web.WebThread.process(WebThread.java:139)
    at org.h2.server.web.WebThread.run(WebThread.java:94)
    at java.base/java.lang.Thread.run(Thread.java:829)
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)
    ... 14 more

How to reproduce:

try open this database: link

I think it could be the corrupted file, but in spring application it works fine.

spring version 2.6.0

aplication.propertiers

#spring.datasource.url=jdbc:h2:mem:TEST;DB_CLOSE_DELAY=-1;
spring.datasource.url=jdbc:h2:file:/home/casimir/h2/vaca;MV_STORE=true
spring.datasource.username=sa
spring.datasource.password=senha
spring.datasource.driver-class-name=org.h2.Driver
#spring.datasource.platform=h2
#spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
@andreitokar
Copy link
Contributor

It looks like you are trying to open 1.4.200 database file with 2.0202 jar. Please re-create your database from SQL script using latest version. Springe app is using in-memory database, therefore works fine

@wulianghu
Copy link

wulianghu commented Nov 29, 2021

Maybe you create a database by h2 V1.4, and open it by h2 V2.0, you can try delete the db file in your disk。

@gitsnaf
Copy link

gitsnaf commented Nov 30, 2021

I have the same problem. What is the best way to migrate an existing 1.4-database to the new version? I want to keep all my data of course.

@andreitokar
Copy link
Contributor

The best, in fact the only way, is to export your database into a SQL script using version 1.4.200 (or whatever version you were using), then create a new database using version 2.0.202 and run that SQL script in there.

@katzyn
Copy link
Contributor

katzyn commented Nov 30, 2021

The only supported way was always the same:
https://h2database.com/html/tutorial.html#upgrade_backup_restore

H2 2.0 also has a helper method that downloads an old version and performs all operations by itself.
org.h2.tools.Upgrade.upgrade().

But due to large amount of incompatible changes between 1.4.200 and 2.0.202 the intermediate script may need to be edited.

@gitsnaf
Copy link

gitsnaf commented Nov 30, 2021

"org.h2.tools.Upgrade.upgrade()" did not work. There were several errors. But backup and restore worked.
Thanks a lot!

@ashitpatel
Copy link

I have a similar issue for my in-memory H2 database when I try to upgrade from 1.4.200 to 2.0.202. So, the issue is unlikely due to old data format. I use spring jdbc to connect to in-memory H2. Here is the error:
Sql error: Cannot create PoolableConnectionFactory (General error: "The write format 1 is smaller than the supported format 2 [2.0.202/5]" [50000-202])

Here is a snippet from my Spring config file:
... class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close" scope="singleton"> <property name="driverClassName" value="org.h2.Driver" /> <property name="url" value="jdbc:h2:file:~/target/h2"/> ...

@katzyn
Copy link
Contributor

katzyn commented Dec 1, 2021

jdbc:h2:file:~/target/h2

It is a regular persistent database.

@ashitpatel
Copy link

I apologize, the original entry in the config file was:
jdbc:h2:~/target/h2

Does it still imply it is a persistent DB?

@ashitpatel
Copy link

ashitpatel commented Dec 1, 2021

Thank you @katzyn . I discovered "target" directory in my home directory (I did not realize that ~ would map to $HOME till your comment). So, I deleted ~/target, updated the H2 version in my pom.xml, and re-ran. That worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants