google-code-export / h2database

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

Error 90030 when opening old H2 1.2.147 database #335

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Before submitting a bug, please check the FAQ:
http://www.h2database.com/html/faq.html

What steps will reproduce the problem?
(simple SQL scripts or simple standalone applications are preferred)
1. Open the attached database with JDBC URL 
jdbc:h2:file:path-to-dir/matrix;MVCC=TRUE

What is the expected output? What do you see instead?

I see the following exception:

org.h2.jdbc.JdbcSQLException: Datei fehlerhaft beim Lesen des Datensatzes: "not 
a btree index 4 QRTZ_JOB_DETAILS_DATA". Mögliche Lösung: Recovery Werkzeug 
verwenden
File corrupted while reading record: "not a btree index 4 
QRTZ_JOB_DETAILS_DATA". Possible solution: use the recovery tool; SQL statement:
CREATE CACHED TABLE PUBLIC.QRTZ_JOB_DETAILS(
    JOB_NAME VARCHAR_IGNORECASE(80) NOT NULL SELECTIVITY 100,
    JOB_GROUP VARCHAR_IGNORECASE(80) NOT NULL SELECTIVITY 100,
    DESCRIPTION VARCHAR_IGNORECASE(120) SELECTIVITY 100,
    JOB_CLASS_NAME VARCHAR_IGNORECASE(128) NOT NULL SELECTIVITY 100,
    IS_DURABLE BIT NOT NULL SELECTIVITY 100,
    IS_VOLATILE BIT NOT NULL SELECTIVITY 100,
    IS_STATEFUL BIT NOT NULL SELECTIVITY 100,
    REQUESTS_RECOVERY BIT NOT NULL SELECTIVITY 100,
    JOB_DATA BLOB SELECTIVITY 100
) [90030-158]
    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:225)
    at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:81)
    at org.h2.table.RegularTable.<init>(RegularTable.java:92)
    at org.h2.schema.Schema.createTable(Schema.java:542)
    at org.h2.command.ddl.CreateTable.update(CreateTable.java:130)
    at org.h2.engine.MetaRecord.execute(MetaRecord.java:58)
    at org.h2.engine.Database.open(Database.java:607)
    at org.h2.engine.Database.openDatabase(Database.java:220)
    at org.h2.engine.Database.<init>(Database.java:215)
    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:285)
    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 net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
    ...

What version of the product are you using? On what operating system, file 
system, and virtual machine?

H2 1.3.158, Windows XP Professional 32bit, Sun JDK 1.6.0_26.

Do you know a workaround?

No.

How important/urgent is the problem for you?

Very urgent.

Please provide any additional information below.

The database has been created using H2 1.2.147.

Original issue reported on code.google.com by dmoeb...@gmx.net on 2 Aug 2011 at 9:50

Attachments:

GoogleCodeExporter commented 9 years ago
I don't know if this helps, but prior to the above exception, we got another 
one. Using our own tool called "DBCreate" we tried to drop the database (which 
has been created with 1.2.147) and tried to recreate the database from scratch, 
using 1.3.158.

The very first statement "DROP ALL OBJECTS DELETE FILES" failed with the 
following exception:

INFO  2011-08-02 11:32:00,638 DBCreate - #1: DROP ALL OBJECTS DELETE FILES
INFO  2011-08-02 11:32:00,638 DBCreate - Establishing new database connection...
INFO  2011-08-02 11:32:00,638 DBCreate - Connection parameters:
INFO  2011-08-02 11:32:00,638 DBCreate -   
-Djdbc.url=jdbc:h2:file:C:/dev/temp/h2-matrix-db/matrix;MVCC=TRUE;LOCK_TIMEOUT=3
00000
INFO  2011-08-02 11:32:00,638 DBCreate -   -Djdbc.driver=org.h2.Driver
INFO  2011-08-02 11:32:00,638 DBCreate -   -Duser=sa
FATAL 2011-08-02 11:32:05,997 DBCreate - Error during DBCreate
org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "SYS"; SQL statement:
CREATE INDEX IF NOT EXISTS INFORMATION_SCHEMA.INDEX_LOB_TABLE ON 
INFORMATION_SCHEMA.LOBS(TABLE) [50200-158]
    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.table.RegularTable.doLock(RegularTable.java:506)
    at org.h2.table.RegularTable.lock(RegularTable.java:440)
    at org.h2.engine.Database.addMeta(Database.java:713)
    at org.h2.engine.Database.addSchemaObject(Database.java:802)
    at org.h2.table.RegularTable.addIndex(RegularTable.java:290)
    at org.h2.command.ddl.CreateIndex.update(CreateIndex.java:90)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:212)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:177)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
    at org.h2.store.LobStorage.init(LobStorage.java:100)
    at org.h2.store.LobStorage.removeAllForTable(LobStorage.java:147)
    at org.h2.table.RegularTable.removeChildrenAndResources(RegularTable.java:675)
    at org.h2.engine.Database.removeSchemaObject(Database.java:1563)
    at org.h2.command.ddl.DropDatabase.dropAllObjects(DropDatabase.java:67)
    at org.h2.command.ddl.DropDatabase.update(DropDatabase.java:36)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:212)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:177)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
    at com.dorma.abraham.dbcmd.DBcmd.executeStatement(DBcmd.java:662)
    at com.dorma.abraham.dbcmd.DBcmd.executeStreamInternal(DBcmd.java:441)
    at com.dorma.abraham.dbcmd.DBcmd.executeStream(DBcmd.java:396)
    at com.dorma.abraham.dbcmd.DBcmd.executeFile(DBcmd.java:373)
    at com.dorma.abraham.dbcreate.DBCreate.executeScript(DBCreate.java:215)
    at com.dorma.abraham.dbcreate.DBCreate.executeScripts(DBCreate.java:209)
    at com.dorma.abraham.dbcreate.DBCreate.main(DBCreate.java:154)

Original comment by dmoeb...@gmx.net on 2 Aug 2011 at 10:24

GoogleCodeExporter commented 9 years ago
Hi Thomas,

I know have a _reproducible_ testcase!

The following attached file contains a database (created with 1.2.147) and a 
tiny Java program that simply tries to execute the following statement: DROP 
ALL OBJECTS DELETE FILES

If you try to execute the code using "java -cp .;<path-to>/h2.jar DropTest" 
(with H2 1.3.158) you'll get the following exception:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Zeit³berschreitung 
beim Versuch die Tabelle "SYS" zu sperren
Timeout trying to lock table "SYS"; SQL statement:
CREATE INDEX IF NOT EXISTS INFORMATION_SCHEMA.INDEX_LOB_TABLE ON 
INFORMATION_SCHEMA.LOBS(TABLE) [50200-158]
    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.table.RegularTable.doLock(RegularTable.java:506)
    at org.h2.table.RegularTable.lock(RegularTable.java:440)
    at org.h2.engine.Database.addMeta(Database.java:713)
    at org.h2.engine.Database.addSchemaObject(Database.java:802)
    at org.h2.table.RegularTable.addIndex(RegularTable.java:290)
    at org.h2.command.ddl.CreateIndex.update(CreateIndex.java:90)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:212)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:177)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
    at org.h2.store.LobStorage.init(LobStorage.java:100)
    at org.h2.store.LobStorage.removeAllForTable(LobStorage.java:147)
    at org.h2.table.RegularTable.removeChildrenAndResources(RegularTable.java:675)
    at org.h2.engine.Database.removeSchemaObject(Database.java:1563)
    at org.h2.command.ddl.DropDatabase.dropAllObjects(DropDatabase.java:67)
    at org.h2.command.ddl.DropDatabase.update(DropDatabase.java:36)
    at org.h2.command.CommandContainer.update(CommandContainer.java:71)
    at org.h2.command.Command.executeUpdate(Command.java:212)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:177)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
    at DropTest.main(DropTest.java:12)

OTOH if you open the database manually first using H2 1.3.158 and SQuirrelSQL 
for example, then the database opens normally.

Original comment by dmoeb...@gmx.net on 2 Aug 2011 at 1:22

Attachments:

GoogleCodeExporter commented 9 years ago
Even more confusing: once you've opened and closed the database successfully 
with 1.3.158, then the DropTest executes fine without errors. So the error 
occurs only if the database is opened with 1.3.158 _for the first time_ and the 
statement "DROP ALL OBJECTS DELETE FILES" is the first statement executed. 
Strange.

Original comment by dmoeb...@gmx.net on 2 Aug 2011 at 1:26

GoogleCodeExporter commented 9 years ago
If the database is opened with 1.3.158 for the first time, H2 tries to create 
the new system index "INDEX_LOB_TABLE", which is not existent in 1.2.147. This 
interferes with the command "DROP ALL OBJECTS DELETE FILES" we are trying to 
execute. After the exception occured, the database is corrupt. Any further 
attempt to open the database leads to the exception above "File corrupted while 
reading record: "not a btree index 4 QRTZ_JOB_DETAILS_DATA"".

Original comment by dmoeb...@gmx.net on 2 Aug 2011 at 2:24

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for you test case! I am analyzing the problem now.

Original comment by thomas.t...@gmail.com on 27 Aug 2011 at 8:29