I'm using a recent version of H2 (1.0.66 or 1.0.67) and I'm getting
this error again, which I thought was fixed:
File ID mismatch got=1819240287 expected=21 pos=163226 true
org.h2.store.DiskFile:/persistent/cff997169b1fa385fcf428d9a4e36825.data.db
blockCount:1795832418 java.lang.Error: File ID mismatch got=1819240287
expected=21 pos=163226 true
org.h2.store.DiskFile:/persistent/cff997169b1fa385fcf428d9a4e36825.data.db
blockCount:1795832418 at
org.h2.message.Message.getInternalError(Message.java:126) at
org.h2.store.DiskFile.getRecord(DiskFile.java:504) at
org.h2.store.Storage.getRecord(Storage.java:65)
I have the db files online if someone wants to look at it:
<http://netservices.sapo.pt/debug/h2_snafu.zip>
Thanks!
--
Luis Neves
Yes you are using version 1.0.67. I also thought the problem is fixed.
There are a few 'connection not closed' stack traces in the .trace.db
file, it looks like you didn't close the connection but let the
garbage collector close it. This shouldn't be a problem however.
The problem is, the file allocation table say a record belongs to the
table id 21, but the record is in fact empty. You can open the
database by appending ;RECOVER=1 to the database URL. No data is lost.
The question remains, why is there a bug the file allocation table. I
will try to find out by using a similar table structure than you did:
two table, one large varchar column (this column is 40 KB on average
per row).
I have a few more questions:
- Did you use multiple connections?
- Is the application multi-threaded?
- Do you use any settings or special features (for example, the
setting LOG=0, or two phase commit, linked tables, cache settings)?
(it doesn't look like, but just to make sure)
- On what operating system, file system, and virtual machine (java -version)?
- Is the database usually closed normally, or is process terminated
forcefully or the computer switched off?
- Is it possible to reproduce this problem using a fresh database
(sometimes, or always)?
Thanks a lot for your help!
Thomas
To eportfel: Corruption problems have top priority for me. I have a
few question:
- Could you send the full stack trace of the exception?
- What is your database URL?
- What version H2 are you using?
- Did you use multiple connections?
- The first workarounds is: append ;RECOVER=1 to the database URL.
Does it work when you do this?
- The second workarounds is: delete the index.db file (it is
re-created automatically) and try again. Does it work when you do
this?
- The third workarounds is: use the tool org.h2.tools.Recover to
create the SQL script file, and then re-create the database using this
script. Does it work when you do this?
- Do you use any settings or special features (for example, the
setting LOG=0, or two phase commit, linked tables, cache settings)?
- Is the application multi-threaded?
- On what operating system, file system, and virtual machine (java -version)?
- How big is the database?
- Is the database usually closed normally, or is process terminated
forcefully or the computer switched off?
- Is it possible to reproduce this problem using a fresh database
(sometimes, or always)?
- Are there any other exceptions (maybe in the .trace.db file)? Could
you send them to me please?
- Was the database originally created with an older version of H2?
- Do you still have any .trace.db files, and if yes could you send them?
Regards,
Thomas
> The problem is, the file allocation table say a record belongs to the
> table id 21, but the record is in fact empty. You can open the
> database by appending ;RECOVER=1 to the database URL. No data is lost.
> The question remains, why is there a bug the file allocation table. I
> will try to find out by using a similar table structure than you did:
> two table, one large varchar column (this column is 40 KB on average
> per row).
>
> I have a few more questions:
> - Did you use multiple connections?
No, I use only one connection.
> - Is the application multi-threaded?
Yes.
> - Do you use any settings or special features (for example, the
> setting LOG=0, or two phase commit, linked tables, cache settings)?
> (it doesn't look like, but just to make sure)
These are the connection string parameters:
"LOG=0;MAX_MEMORY_UNDO=1000;MAX_MEMORY_ROWS=1000;WRITE_DELAY=500;CACHE_TYPE=TQ"
> - On what operating system, file system, and virtual machine (java
> -version)?
OS -> Linux version 2.6.18-5-686 (Debian 2.6.18.dfsg.1-13etch4)
FS -> ext3 (rw,errors=remount-ro)
JVM -> Sun JVM, version "1.6.0_04"
> - Is the database usually closed normally, or is process terminated
> forcefully or the computer switched off?
The database process is not forcefully terminated.
> - Is it possible to reproduce this problem using a fresh database
> (sometimes, or always)?
Sorry, I can't reproduce it.... but last time this happen the sequence
of events went something like this:
- select a large number of rows, which requires an external sort
- loop trough the resultset only to break the loop halfway due to an
application logic detail.
- immediately execute the previously select statement do have another
go at the data.
- *kaboom*
Thanks for your help.
--
Luis Neves
I forgot to mention one important fact... while looping through the
resultset the rows are processed
by another thread and deleted after being successfully processed.
> - immediately execute the previously select statement do have another
> go at the data.
> - *kaboom*
--
Luis Neves
"LOG=0;MAX_MEMORY_UNDO=1000;MAX_MEMORY_ROWS=1000;WRITE_DELAY=500;CACHE_TYPE=TQ"
The documentation for LOG 0 is:
" Logging can be disabled to improve the performance when durability
is not important, for example while running tests or when loading the
database. Warning: It may not be possible to recover the database if
logging is disabled and the application terminates abnormally. If
logging of index changes is enabled, opening a database that was
crashed becomes faster because the indexes don't need to be rebuilt. "
I suggest not to use LOG=0.
You wrote "The database process is not forcefully terminated.";
however the application didn't always close the connection, so I'm not
sure...
I will still try to reproduce this problem.
Is CACHE_TYPE=TQ faster than the default cache setting for you?
Regards,
Thomas
On Sat, 8 Mar 2008 11:49:02 +0100
"Thomas Mueller" <thomas.to...@gmail.com> wrote:
>
> Hi,
>
> "LOG=0;MAX_MEMORY_UNDO=1000;MAX_MEMORY_ROWS=1000;WRITE_DELAY=500;CACHE_TYPE=TQ"
>
> The documentation for LOG 0 is:
>
> " Logging can be disabled to improve the performance when durability
> is not important, for example while running tests or when loading the
> database. Warning: It may not be possible to recover the database if
> logging is disabled and the application terminates abnormally. If
> logging of index changes is enabled, opening a database that was
> crashed becomes faster because the indexes don't need to be rebuilt. "
>
> I suggest not to use LOG=0.
Ok, I will change it.
> You wrote "The database process is not forcefully terminated.";
> however the application didn't always close the connection, so I'm not
> sure...
What I meant was that I didn't "kill -9" the process, however we use
"supervise" (from daemontools) for service control and monitoring and
"supervise" restarts services by sending then a TERM signal... but as
far as I can see, all shutdown hooks run and it all ends smoothly.
> I will still try to reproduce this problem.
>
> Is CACHE_TYPE=TQ faster than the default cache setting for you?
It's not faster but it seems to be more consistent and It gives me fewer issues.
Thanks!
--
Luis Neves
> Did you perform full testing on H2 on Vista machine?
No, I don't have Windows Vista. I don't think this is the problem, but
probably we should verify this is not the problem. Could you run the
unit tests on such a machine and post the result please? Use 'ant
test' to run the tests (so you need to install Java, and Ant).
Regards,
Thomas
Could you send me the test application you have used? If not, I would
maybe create such a test application, but I would need the complete
.trace.db file that includes creating the database, tables, and so on.
Also great would be a SQL script file.
Thanks for your help!
Thomas
Thanks for your help! I will try to reproduce this problem. I have a
question: did you already try with version 1.0.69?
Regards,
Thomas
I am sorry, it seems the base database is already corrupted. I have
run the following statement:
script to 'test.sql' and the result was an exception. Did you try
using the recovery tool?
Regards,
Thomas
Thanks a lot for your test case! Too bad I made a release yesterday...
I can reproduce the problem now: empty space is re-used too early if
large records (8 KB or larger) are updated or deleted, when not using
BLOBs or CLOBs, or when using many columns. I made my own test case
that inserts and deletes very large records.
A workaround is to use CLOB / BLOB, another workaround is to set the
system property 'h2.reuseSpaceQuickly' to 'false' before loading the
H2 driver (System.setProperty("h2.reuseSpaceQuickly", "false");
I will fix this problem and release a new version earlier than usual
(maybe at the end of this week).
Regards,
Thomas
> setting that property as a workaround, h2.reuseSpaceQuickly, works
> since which H2 version? 1.0.63 included?
No, it is supported since version 1.0.68 (2008-03-18).
I will release a new version later this week (probably on Friday)
where this problem is fixed.
Regards,
Thomas
> We're seeing this problem but upgrading from 1.0.69 to 1.0.71 isn't
> currently feasible since we have local H2 modifications and are going
> into production soon. We'd like to just apply the changes required for
> this bug fix... do you have a listing of the revision/files fixed this
> bug?
Sorry, I'm afraid doing a 'bugfix only' release will be very hard or
impossible. The problem is that I work a lot without internet
connection, and therefore can't commit the changes with meaningful
comments. Also, there have been other bug fixed which may or may not
be related (I don't remember fully). I think it makes more sense to
integrate your changes to the newest version.
> we have local H2 modifications and are going
> into production soon.
According to the license of H2, you need to publish the source code of
those changes if you want to distribute your product. See also the
License FAQ at http://www.h2database.com/html/license.html
* You can use H2 for free. You can integrate it into your
application (including commercial applications), and you can
distribute it.
* Files containing only your code are not covered by this license
(it is 'commercial friendly').
* Modifications to the H2 source code must be published.
* You don't need to provide the source code of H2 if you did not
modify anything.
Even if you don't plan to distribute your product, I think it is in
your interest to publish your changes (sending them to me is enough),
so that I can integrate them. This will also reduce the work you have
when upgrading to a new version.
Regards,
Thomas