Hi,
I have been using H2 for some time now, with great pleasure!
Unfortunately, today I ran into my first database corruption issue. It was
during a debugging session, so I had been closing and opening the
application quite a lot, which I guess was the cause of the problem.
However, I should add that the Exception was thrown after the application
had been running for a while during that particular session. The first
query that failed was a sum across an entire table so I guess that this
caused the corruption to get detected.
The stack-trace looks like this:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException:
page[8305] data leaf table:247 TEMP_RESULT_SET_247 entries:0 parent:0
keys:[] offsets:[] parent 0 expected 8139"; SQL statement:
SELECT SUM(DataBlockSize) as TotalSpaceUsed FROM (SELECT avg(dataBlockSize)
as DataBlockSize FROM FileDataBlocks WHERE FileVersionIsObsolete = false
GROUP BY DataBlockID) [50000-165]
at
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
~[h2-1.3.165.jar:1.3.165]
at org.h2.message.DbException.get(DbException.java:158)
~[h2-1.3.165.jar:1.3.165]
at org.h2.message.DbException.convert(DbException.java:281)
~[h2-1.3.165.jar:1.3.165]
at org.h2.command.Command.executeQuery(Command.java:191)
~[h2-1.3.165.jar:1.3.165]
at
org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:96)
~[h2-1.3.165.jar:1.3.165]
I get the following error message when I restart the application:
org.h2.jdbc.JdbcSQLException: File corrupted while reading record: "index
not found 249". Possible solution: use the recovery tool [90030-165]
at
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.store.PageStore.getPage(PageStore.java:765)
at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:226)
at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:208)
at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:208)
at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:83)
at org.h2.table.RegularTable.<init>(RegularTable.java:83)
at org.h2.store.PageStore.addMeta(PageStore.java:1656)
at org.h2.store.PageStore.readMetaData(PageStore.java:1587)
at org.h2.store.PageStore.recover(PageStore.java:1360)
at org.h2.store.PageStore.openExisting(PageStore.java:357)
at org.h2.store.PageStore.open(PageStore.java:281)
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:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
The start parameters looked like this:
"C:\Program Files (x86)\Java\jdk1.7.0\bin\java"
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60036,suspend=y,server=n
-server -Xms16m -Xmx1024m -Djavax.net.debug=off
-XX:-OmitStackTraceInFastThrow -XX:GCTimeRatio=1
-XX:AdaptiveSizeDecrementScaleFactor=1 -XX:+AggressiveOpts
-Dfile.encoding=windows-1252 -classpath [lots of dependencies]
The connection was created with these options: MVCC=TRUE;TRACE_LEVEL_FILE=4;
I have two questions.
1. Do you have any idea on what might have caused this and how I can reduce
the probability of it occurring again? I understand that it is hard to say
just based on this info.
2. What is the best way to detect and handle database corruption problems
like this?
If you need a copy of the database I will gladly provide it.
Kind Regards
Carl Hasselskog
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/Lb5bYx3lSbsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.