> We recently started getting the "freeCount expected" error after
> upgrading to H2 version 1.0.76.
> If needed I can provide the database files. They are about 260K
> zipped.
Is this problem reproducible always? If yes it would be great if you
could send me the database files.
> In another post here, it is mentioned that "It is not critical at
> runtime if freeCount is incorrect". So, is there a way to configure
> the database, so that this check is not performed (at least for the
> time being).
You can disable the CHECK setting, see
http://www.h2database.com/javadoc/org/h2/constant/SysProperties.html#h2.check
(see also the top of the page on how to disable it).
> Also, is it possible for us to maybe detect this
> condition and somehow repair the database?
There is no need to repair the database really. The space will be
reclaimed when the database is re-opened. It is just an annoying
exception. I will fix this in the next release (next week).
Regards,
Thomas
> Caused by: java.lang.RuntimeException: freeCount expected 0, got: 448
> at org/h2/message/Message.getInternalError (Message.java:179)
> at org/h2/store/Storage.refillFreeList (Storage.java:247)
> at org/h2/store/Storage.allocate (Storage.java:254)
> at org/h2/store/Storage.addRecord (Storage.java:182)
> at org/h2/index/ScanIndex.add (ScanIndex.java:123)
> at org/h2/table/TableData.addRow (TableData.java:108)
> ... 15 more
>
> Our jdbc url is:
> jdbc:h2:rundir\db
> \db;LOG=2;MAX_LOG_SIZE=1;DB_CLOSE_DELAY=-1;TRACE_MAX_FILE_SIZE=1,username=sa,password=
Thanks! Unfortunately I couldn't reproduce this problem - do you have
a simple test case where this problem occurs?
> In another post here, it is mentioned that "It is not critical at
> runtime if freeCount is incorrect". So, is there a way to configure
> the database, so that this check is not performed (at least for the
> time being).
Yes, set the system property h2.check to false: java -Dh2.check=false
... or System.setProperty("h2.check", "false") before loading the
database driver.
> Also, is it possible for us to maybe detect this
> condition and somehow repair the database?
The database is not broken, there is no need to repair. It is
something in the code I like to fix.
Regards,
Thomas
> Has this been fixed already (in 1.077 or 1.0.78)? I cannot see
> anything in the change log.
I forgot to write that in the changelog.
> if (SysProperties.CHECK2 && freeCount > freeList.size()) {
Before 2008-08-02, this was
> if (SysProperties.CHECK && freeCount > freeList.size()) {
> should one not rather disable check2 instead of check?
CHECK2 is disabled by default, except when running the unit tests.
Regards,
Thomas