H2 db 'Chunk no longer exists' error

2.9k Views Asked by At

When I'm trying to add a new row to db "INSERT INTO invited_users VALUES('id', user_name')"

I'm getting this error:

General error: "java.lang.IllegalStateException: Chunk 2089 no longer exists [1.4.181/9]"

Probably it's some problems with db, because when I tried to add the same row to a new db - error disappeared.

Update Nov 20, 2014

Good news! I contacted developers of H2 db and find out that they will fix that bug in the next release. https://groups.google.com/forum/#!topic/h2-database/i_GHXExjotc

Update Dec 6, 2014

A simple workaround is to disable the MVStore by appending ";mv_store=false" to the database URL.

But, this trick will not work, if you need the old db. It creates new database, with .h2.db extension instead of .mv.db

To overcome this you need to create SQL script of your old database ".mv.db" (with Recover tool), and then run this script using "runscript ...".

1

There are 1 best solutions below

7
On

In version 1.4.182, there is probably something wrong with the mechanism that detects when a chunk is no longer referenced. Currently, this is reference counting garbage collection: by counting live pages and live space. If this reaches zero, a chunk can be overwritten after 45 seconds.

A simple workaround is to use the page store storage mechanism instead of mv_store by changing the database connection to use mv_store=false as a mitigation.

MV_STORE option is automatically enabled since version 1.4.177 Beta.

By default, the MV_STORE option is enabled, so it is using the new MVStore storage. The MVCC setting is by default set to the same values as the MV_STORE setting, so it is also enabled by default. For testing, both settings can be disabled by appending ";MV_STORE=FALSE" and/or ";MVCC=FALSE" to the database URL.