Hi,
I have been previously having issues with database corruptions using the
embedded H2 database in our software. I was unable to find any precise
reason for these but last week I was able to replicate a corruption when
running updates on multiple rows within multiple tables. The issue appears
to be when updating a specific table and was caused if I closed the
application unexpectedly, without closing the database connection first,
within my IDE after the updates on the tables were run. The error I receive
when I next attempt to open the database is:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException:
rowCount expected 16192 got 16503 T155.I179" [50000-169]
at
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:281)
at org.h2.table.RegularTable.removeRow(RegularTable.java:379)
at org.h2.store.PageStore.redo(PageStore.java:1533)
at org.h2.store.PageStore.redoDelete(PageStore.java:1506)
at org.h2.store.PageLog.recover(PageLog.java:335)
at org.h2.store.PageStore.recover(PageStore.java:1365)
at org.h2.store.PageStore.openExisting(PageStore.java:361)
at org.h2.store.PageStore.open(PageStore.java:285)
at org.h2.engine.Database.getPageStore(Database.java:2118)
at org.h2.engine.Database.open(Database.java:577)
at org.h2.engine.Database.openDatabase(Database.java:222)
at org.h2.engine.Database.<init>(Database.java:217)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.engine.Engine.createSession(Engine.java:28)
at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:305)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:109)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:93)
...
If I close the db connection after I run these updates the database is able
to open again fine, so I thought that maybe there was something like a
transaction that was still open in my code which might be causing this, but
I tried the process again with a different database and this did not cause
the RunTimeException next time I opened the application. I also tried
Recovering the database and restoring the content to a new database. This
also seemed to fix my issue, so it left me back at square one trying to
locate the reason for the corruptions. Does anyone know what might be
causing this issue to occur? I assume it is something that has already
occurred with the database and running this update on the table is
triggering it.
The connection string we use to the database is:
"jdbc:h2:split:31:" + DBFILE +
";PAGE_SIZE=8192;CACHE_SIZE=524288;database_event_listener='" +
eventlistener + "';USER=" + dbusername + ";PASSWORD=" + dbpassword;
We are currently using the H2 1-3-169.jar after unsuccessfully moving over
to the 1.3.175.jar.
Any help would be greatly appreciated.
Thanks,
David
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.