google-code-export / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

Apparently corrupt database - "File ID mismatch" when executing a particular query #258

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Product version 1.1.118 (2009-09-04)
JDBC URL jdbc:h2:<path>/vipdesigner (replace <path> with actual location)
Windows XP, H2 data on local NTFS file system

Steps to reproduce:
Unzip attached database files
Start Database in embedded mode
Perform the following SQL Query:

select count(*) as y0_ 
from SNAPSHOT this_ inner join CONTAINED containeds1_ 
on this_.ID=containeds1_.CONTAINING_ID 

Result:
Error: General error: java.lang.RuntimeException: File ID mismatch got=0 
expected=25 pos=16384 true org.h2.store.DiskFile:<path>\vipdesigner.data.db 
blockCount:0; SQL statement:
select count(*) as y0_ 
from SNAPSHOT this_ inner join CONTAINED containeds1_ 
on this_.ID=containeds1_.CONTAINING_ID [50000-118]
SQLState:  HY000
ErrorCode: 50000

Stacktrace (from tracefile):
11-24 17:53:14 jdbc[2]: SQLException
org.h2.jdbc.JdbcSQLException: General error: java.lang.RuntimeException: File 
ID mismatch got=0 expected=25 pos=16384 true 
org.h2.store.DiskFile:D:\Temp\Debug\H2-Data\hs\vipdesigner.data.db 
blockCount:0; SQL statement:
select count(*) as y0_ 
from SNAPSHOT this_ inner join CONTAINED containeds1_ 
on this_.ID=containeds1_.CONTAINING_ID [50000-118]
    at org.h2.message.Message.getSQLException(Message.java:105)
    at org.h2.message.Message.convert(Message.java:274)
    at org.h2.message.Message.convert(Message.java:243)
    at org.h2.command.Command.executeQueryLocal(Command.java:144)
    at org.h2.command.Command.executeQuery(Command.java:123)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
    at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.processQuery(SQLExecuterTask.java:366)
    at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.run(SQLExecuterTask.java:210)
    at net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: File ID mismatch got=0 expected=25 
pos=16384 true 
org.h2.store.DiskFile:D:\Temp\Debug\H2-Data\hs\vipdesigner.data.db blockCount:0
    at org.h2.message.Message.throwInternalError(Message.java:185)
    at org.h2.store.DiskFile.getRecord(DiskFile.java:571)
    at org.h2.store.Storage.getRecord(Storage.java:94)
    at org.h2.index.ScanIndex.getNextRow(ScanIndex.java:259)
    at org.h2.index.ScanCursor.next(ScanCursor.java:71)
    at org.h2.index.IndexCursor.next(IndexCursor.java:166)
    at org.h2.table.TableFilter.next(TableFilter.java:273)
    at org.h2.command.dml.Select.queryGroup(Select.java:307)
    at org.h2.command.dml.Select.queryWithoutCache(Select.java:552)
    at org.h2.command.dml.Query.query(Query.java:236)
    at org.h2.command.CommandContainer.query(CommandContainer.java:82)
    at org.h2.command.Command.executeQueryLocal(Command.java:142)
    ... 6 more

Original issue reported on code.google.com by googleco...@spamgourmet.com on 24 Nov 2010 at 5:02

GoogleCodeExporter commented 9 years ago
Wasn't able to upload attachment. Trying again...

Original comment by googleco...@spamgourmet.com on 24 Nov 2010 at 5:07

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I'm sorry to say this, but the database is corrupt. I can't say what the exact 
problem was, all I can say is you can recover the data using the Recover tool:

java -cp <old h2 jar file> org.h2.tools.Recover -dir .

With the migration jar file:
java -cp h2mig_pagestore_addon.jar org.h2.upgrade.v1_1.tools.Recover -dir .

And then create a new database from script using
runscript from 'vipdesigner.data.sql'

see also http://h2database.com/html/advanced.html#using_recover_tool

Unfortunately, there is nothing I can do about this problem, so I set the bug 
to won't fix.

Original comment by thomas.t...@gmail.com on 27 Nov 2010 at 1:55