File ID mismatch when query is executed

142 views
Skip to first unread message

Chris

unread,
Nov 2, 2009, 1:02:07 PM11/2/09
to H2 Database
I have run into an issue where a query that should be succeeding is
failing and reporting the following error: General error:
java.lang.RuntimeException: File ID mismatch got=0 expected=43 pos=910
true org.h2.store.DiskFile:Z:\users\ChrisK\db\mddb.data.db blockCount:
0; SQL statement:
select type,dir_time,location_id,partition from fs_dirs where
location_id = 1 order by dir_time [50000-112]

Shown below are the messages contained within the trace log file.

I'm currently using version 1.1.112 using the following parameters on
connection:
LOG=2;MAX_LOG_SIZE=1;DB_CLOSE_DELAY=-1;TRACE_MAX_FILE_SIZE=1
I have not upgraded beyond 1.1.112 because we are currently using a
JVM that only supports up to Java 1.4.2. I believe the last version
of h2 that can be used with Java 1.4.2 is the version I am currently
using.

I closed the connection to the database, deleted the index file and
opened the console. The same query ran fine once the index was
deleted. The query I'm attempting to execute contains an order by
columnName. The columnName has an index (which is probably why
deleting the index resolved the issue). If I don't include the order
by part of the query it also works.


Trace information:

11-02 11:53:04 database: error initializing summary for Z:\users\ChrisK
\db1\mddb.data.db size:736 stage:1

java.lang.RuntimeException: Redo failure, block: 384 expected: 124
got: 247

at org.h2.message.Message.throwInternalError(Message.java:187)

at org.h2.store.DiskFile.initFromSummary(DiskFile.java:314)

at org.h2.log.LogFile.redoOrUndo(LogFile.java:316)

at org.h2.log.LogFile.redoAllGoEnd(LogFile.java:375)

at org.h2.log.LogSystem.recover(LogSystem.java:257)

at org.h2.engine.Database.open(Database.java:583)

at org.h2.engine.Database.openDatabase(Database.java:221)

at org.h2.engine.Database.<init>(Database.java:216)

at org.h2.engine.Engine.openSession(Engine.java:57)

at org.h2.engine.Engine.openSession(Engine.java:139)

at org.h2.engine.Engine.getSession(Engine.java:119)

at org.h2.engine.SessionFactoryEmbedded.createSession
(SessionFactoryEmbedded.java:17)

at org.h2.engine.SessionRemote.connectEmbeddedOrServer
(SessionRemote.java:248)

at org.h2.engine.SessionRemote.createSession(SessionRemote.java:226)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:106)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)

at org.h2.Driver.connect(Driver.java:58)

at org.h2.server.web.WebServer.getConnection(WebServer.java:629)

at org.h2.server.web.WebThread$1LoginTask.run(WebThread.java:1175)

at java.lang.Thread.run(Unknown Source)

11-02 11:53:04 database: error initializing summary for Z:\users\ChrisK
\db1\mddb.data.db size:736 stage:1

java.lang.RuntimeException: Redo failure, block: 384 expected: 124
got: 254

at org.h2.message.Message.throwInternalError(Message.java:187)

at org.h2.store.DiskFile.initFromSummary(DiskFile.java:314)

at org.h2.log.LogFile.redoOrUndo(LogFile.java:316)

at org.h2.log.LogFile.redoAllGoEnd(LogFile.java:375)

at org.h2.log.LogSystem.recover(LogSystem.java:257)

at org.h2.engine.Database.open(Database.java:583)

at org.h2.engine.Database.openDatabase(Database.java:221)

at org.h2.engine.Database.<init>(Database.java:216)

at org.h2.engine.Engine.openSession(Engine.java:57)

at org.h2.engine.Engine.openSession(Engine.java:139)

at org.h2.engine.Engine.getSession(Engine.java:119)

at org.h2.engine.SessionFactoryEmbedded.createSession
(SessionFactoryEmbedded.java:17)

at org.h2.engine.SessionRemote.connectEmbeddedOrServer
(SessionRemote.java:248)

at org.h2.engine.SessionRemote.createSession(SessionRemote.java:226)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:106)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)

at org.h2.Driver.connect(Driver.java:58)

at org.h2.server.web.WebServer.getConnection(WebServer.java:629)

at org.h2.server.web.WebThread$1LoginTask.run(WebThread.java:1175)

at java.lang.Thread.run(Unknown Source)

11-02 11:53:04 database: error initializing summary for Z:\users\ChrisK
\db1\mddb.data.db size:672 stage:1

java.lang.RuntimeException: Redo failure, block: 384 expected: 124
got: 255

at org.h2.message.Message.throwInternalError(Message.java:187)

at org.h2.store.DiskFile.initFromSummary(DiskFile.java:314)

at org.h2.log.LogFile.redoOrUndo(LogFile.java:316)

at org.h2.log.LogFile.redoAllGoEnd(LogFile.java:375)

at org.h2.log.LogSystem.recover(LogSystem.java:257)

at org.h2.engine.Database.open(Database.java:583)

at org.h2.engine.Database.openDatabase(Database.java:221)

at org.h2.engine.Database.<init>(Database.java:216)

at org.h2.engine.Engine.openSession(Engine.java:57)

at org.h2.engine.Engine.openSession(Engine.java:139)

at org.h2.engine.Engine.getSession(Engine.java:119)

at org.h2.engine.SessionFactoryEmbedded.createSession
(SessionFactoryEmbedded.java:17)

at org.h2.engine.SessionRemote.connectEmbeddedOrServer
(SessionRemote.java:248)

at org.h2.engine.SessionRemote.createSession(SessionRemote.java:226)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:106)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)

at org.h2.Driver.connect(Driver.java:58)

at org.h2.server.web.WebServer.getConnection(WebServer.java:629)

at org.h2.server.web.WebThread$1LoginTask.run(WebThread.java:1175)

at java.lang.Thread.run(Unknown Source)

11-02 12:18:28 jdbc[2]: SQLException

org.h2.jdbc.JdbcSQLException: General error:
java.lang.RuntimeException: File ID mismatch got=0 expected=43 pos=910
true org.h2.store.DiskFile:Z:\users\ChrisK\db1\mddb.data.db blockCount:
0; SQL statement:
select top 30 type,dir_time,location_id,partition from fs_dirs where
location_id = 1 order by dir_time [50000-112]

at org.h2.message.Message.getSQLException(Message.java:107)

at org.h2.message.Message.convert(Message.java:279)

at org.h2.message.Message.convert(Message.java:248)

at org.h2.command.Command.executeQueryLocal(Command.java:143)

at org.h2.command.Command.executeQuery(Command.java:122)

at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:160)

at org.h2.server.web.WebThread.getResult(WebThread.java:1716)

at org.h2.server.web.WebThread.query(WebThread.java:1286)

at org.h2.server.web.WebThread.process(WebThread.java:444)

at org.h2.server.web.WebThread.processRequest(WebThread.java:186)

at org.h2.server.web.WebThread.process(WebThread.java:241)

at org.h2.server.web.WebThread.run(WebThread.java:196)

Caused by: java.lang.RuntimeException: File ID mismatch got=0
expected=43 pos=910 true org.h2.store.DiskFile:Z:\users\ChrisK
\db1\mddb.data.db blockCount:0

at org.h2.message.Message.throwInternalError(Message.java:187)

at org.h2.store.DiskFile.getRecord(DiskFile.java:579)

at org.h2.store.Storage.getRecord(Storage.java:94)

at org.h2.index.ScanIndex.getRow(ScanIndex.java:99)

at org.h2.table.TableData.getRow(TableData.java:107)

at org.h2.index.BtreeIndex.getRow(BtreeIndex.java:346)

at org.h2.index.BtreeCursor.get(BtreeCursor.java:79)

at org.h2.table.TableFilter.getValue(TableFilter.java:716)

at org.h2.expression.ExpressionColumn.getValue(ExpressionColumn.java:
170)

at org.h2.expression.Comparison.getValue(Comparison.java:202)

at org.h2.expression.Expression.getBooleanValue(Expression.java:188)

at org.h2.command.dml.Select.queryFlat(Select.java:496)

at org.h2.command.dml.Select.queryWithoutCache(Select.java:561)

at org.h2.command.dml.Query.query(Query.java:233)

at org.h2.command.CommandContainer.query(CommandContainer.java:81)

at org.h2.command.Command.executeQueryLocal(Command.java:141)

... 8 more

Thomas Mueller

unread,
Nov 4, 2009, 3:28:21 PM11/4/09
to h2-da...@googlegroups.com
Hi,

> I have not upgraded beyond 1.1.112 because we are currently using a
> JVM that only supports up to Java 1.4.2.

Did you try using Retrotranslator to convert the H2 jar file to Java
1.4? That should work.
http://retrotranslator.sourceforge.net

Regards,
Thomas

Chris

unread,
Nov 4, 2009, 3:57:17 PM11/4/09
to H2 Database
I haven't heard of that project before, I can try it.

However, I don't think this issue is resolved in the later builds. If
I take this database and use the 1.1.118 build opening the console I
receive the same error message when performing the query.

The error message I receive when using the 1.1.118 build is:
General error: java.lang.RuntimeException: File ID mismatch got=0
expected=43 pos=910 true org.h2.store.DiskFile:Z:\users\ChrisK
\corrupt_database_index\db\mddb.data.db blockCount:0; SQL statement:
SELECT * FROM FS_DIRS where locatION_ID = 1 order by dir_time
[50000-118]



On Nov 4, 3:28 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:

Thomas Mueller

unread,
Nov 8, 2009, 7:14:33 AM11/8/09
to h2-da...@googlegroups.com
Hi,

> However, I don't think this issue is resolved in the later builds.

There were quite many changes since version 1.1.112, but I'm not sure.
I'm afraid it will be quite hard to find out what the root cause is,
unless you have an application that can re-created such a corrupt
database... If you want, we can try to find out what could be the
problem. I have a few questions:

- What is your database URL?
- Did you use multiple connections?
- 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?
- What operating system, file system, and virtual machine
(java -version) do you use?
- Is it (or was it at some point) a networked file system?
- Is the database usually closed normally, or is process terminated
forcefully or the computer switched off?

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages