Cant't connect the database: "File corrupted while reading record"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cant't connect the database: "File corrupted while reading record"

Simon S.
Hi,

our application throws the following error on connecting the database:

org.h2.jdbc.JdbcSQLException: Datei fehlerhaft beim Lesen des
Datensatzes: "84358 of 84156". Mögliche Lösung: Recovery Werkzeug
verwenden
File corrupted while reading record: "84358 of 84156". Possible
solution: use the recovery tool [90030-154]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.store.PageStore.readPage(PageStore.java:1240)
at org.h2.store.PageStore.getPage(PageStore.java:701)
at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:222)
at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:208)
at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:81)
at org.h2.table.RegularTable.<init>(RegularTable.java:92)
at org.h2.store.PageStore.addMeta(PageStore.java:1583)
at org.h2.store.PageStore.readMetaData(PageStore.java:1515)
at org.h2.store.PageStore.recover(PageStore.java:1319)
at org.h2.store.PageStore.openExisting(PageStore.java:349)
at org.h2.store.PageStore.open(PageStore.java:273)
at org.h2.engine.Database.getPageStore(Database.java:2022)
at org.h2.engine.Database.open(Database.java:547)
at org.h2.engine.Database.openDatabase(Database.java:218)
at org.h2.engine.Database.<init>(Database.java:213)
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:114)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:98)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
...

Some informations about the client pc:
- database version is 1.3.154
- database was created with version 1.3.154
- connection url: jdbc:h2:c:\lm\\data_h2db
\lm;DATABASE_EVENT_LISTENER='lm.db.H2EventListenerImpl';TRACE_LEVEL_SYSTEM_OUT=1;TRACE_LEVEL_FILE=1
- System: Windows XP, 5.1, x86
- java.version: 1.6.0_01
- there is no trace.db file, there is only the lm.h2.db file
- in our applications logfile i see that the database connection has
been closed successfully the day before
- the application starts with -Xmx256M
- the lm.h2.db file has a size of about 170MB
- the application did no run out of memory
- i think LOG is 2
- no temporary tables
- it is a java swing application. On application start the application
tries to connect to the embedded h2 database. If the application can't
connect (e.g. there is already a active database connection because
application is already running) the application exits.
- i can't reproduce the problem with a fresh database on my
development pc

Recovering the database is not the problem, because our application
synchronizes the data from the central erp software.

Our application is installed on 100 or more client PCs/notebooks. We
have some other clients with similar errors and somtiems older
database version.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Cant't connect the database: "File corrupted while reading record"

Thomas Mueller Graf
Hi,

This looks like a corrupt database. I am very interested in analyzing and solving this problem. Corruption problems have top priority for me. I have a few questions:

- What does the database event listener do?
- Did the system ever run out of disk space?
- Did you (ever) use LOG=0 or LOG=1? (that's quite important)
- Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS with H2 version 1.3.159 or older?
- Do you use any settings or special features (for example cache settings,
    two phase commit, linked tables)?
- Do you use any H2-specific system properties?
- 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?
- Could you send the .h2.db file where this exception occurs?

Regards,
Thomas


On Monday, November 7, 2011, Simon S. wrote:
Hi,

our application throws the following error on connecting the database:

org.h2.jdbc.JdbcSQLException: Datei fehlerhaft beim Lesen des
Datensatzes: "84358 of 84156". Mögliche Lösung: Recovery Werkzeug
verwenden
File corrupted while reading record: "84358 of 84156". Possible
solution: use the recovery tool [90030-154]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:
327)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.store.PageStore.readPage(PageStore.java:1240)
at org.h2.store.PageStore.getPage(PageStore.java:701)
at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:222)
at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:208)
at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:81)
at org.h2.table.RegularTable.<init>(RegularTable.java:92)
at org.h2.store.PageStore.addMeta(PageStore.java:1583)
at org.h2.store.PageStore.readMetaData(PageStore.java:1515)
at org.h2.store.PageStore.recover(PageStore.java:1319)
at org.h2.store.PageStore.openExisting(PageStore.java:349)
at org.h2.store.PageStore.open(PageStore.java:273)
at org.h2.engine.Database.getPageStore(Database.java:2022)
at org.h2.engine.Database.open(Database.java:547)
at org.h2.engine.Database.openDatabase(Database.java:218)
at org.h2.engine.Database.<init>(Database.java:213)
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:114)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:98)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
...

Some informations about the client pc:
- database version is 1.3.154
- database was created with version 1.3.154
- connection url: jdbc:h2:c:\lm\\data_h2db
\lm;DATABASE_EVENT_LISTENER='lm.db.H2EventListenerImpl';TRACE_LEVEL_SYSTEM_OUT=1;TRACE_LEVEL_FILE=1
- System: Windows XP, 5.1, x86
- java.version: 1.6.0_01
- there is no trace.db file, there is only the lm.h2.db file
- in our applications logfile i see that the database connection has
been closed successfully the day before
- the application starts with -Xmx256M
- the lm.h2.db file has a size of about 170MB
- the application did no run out of memory
- i think LOG is 2
- no temporary tables
- it is a java swing application. On application start the application
tries to connect to the embedded h2 database. If the application can't
connect (e.g. there is already a active database connection because
application is already running) the application exits.
- i can't reproduce the problem with a fresh database on my
development pc

Recovering the database is not the problem, because our application
synchronizes the data from the central erp software.

Our application is installed on 100 or more client PCs/notebooks. We
have some other clients with similar errors and somtiems older
database version.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;h2-database@googlegroups.com&#39;)">h2-database@....
To unsubscribe from this group, send email to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;h2-database+unsubscribe@googlegroups.com&#39;)">h2-database+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Cant't connect the database: "File corrupted while reading record"

Simon S.
- What does the database event listener do? - The event listener logs
some informations via log4j. And on application start there is a
splash with a progress bar to show the current state of the
application/database. Therefore the event listener sets the text of a
JLabel several times. E.g. On adding a new database column, h2
rebuilts the db index. This process may takes some minutes (if there
are some hundred thousand datasets in the table). And the splash
screen tells the user, what currently happens.

- Did the system ever run out of disk space? - I don't think so.
- Did you (ever) use LOG=0 or LOG=1? (that's quite important) - I
don't think so, because i never changed this setting.
- Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS
with H2 version 1.3.159 or older? - No.
- Do you use any settings or special features (for example cache
settings, two phase commit, linked tables)? - No. Only switch off the
auto commit for the synchronization. The synchronization in our
application loads data from the central erp system and persist the
data in the h2 db.
- Do you use any H2-specific system properties? - I don't think so.
- Is it (or was it at some point) a networked file system? - Windows
XP, so i think ntfs or fat32.
- Is the database _usually_ closed normally, or is process terminated
forcefully or the computer switched off? - The database closed
normally. But I don't know if the user switched off the Notebook
normally, after closing the application.
- Could you send the .h2.db file where this exception occurs? - No
sorry, because the database stores customer data etc.

Is there any chance to find the problem without sendig the database?
I hope, because this is not the first time, that an error occured.

Thank you for your help

On Nov 9, 8:11 am, Thomas Mueller <[hidden email]>
wrote:

> Hi,
>
> This looks like a corrupt database. I am very interested in analyzing and
> solving this problem. Corruption problems have top priority for me. I have
> a few questions:
>
> - What does the database event listener do?
> - Did the system ever run out of disk space?
> - Did you (ever) use LOG=0 or LOG=1? (that's quite important)
> - Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS with H2
> version 1.3.159 or older?
> - Do you use any settings or special features (for example cache settings,
>     two phase commit, linked tables)?
> - Do you use any H2-specific system properties?
> - 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?
> - Could you send the .h2.db file where this exception occurs?
>
> Regards,
> Thomas
>
>
>
>
>
>
>
> On Monday, November 7, 2011, Simon S. wrote:
> > Hi,
>
> > our application throws the following error on connecting the database:
>
> > org.h2.jdbc.JdbcSQLException: Datei fehlerhaft beim Lesen des
> > Datensatzes: "84358 of 84156". Mögliche Lösung: Recovery Werkzeug
> > verwenden
> > File corrupted while reading record: "84358 of 84156". Possible
> > solution: use the recovery tool [90030-154]
> > at org.h2.message.DbException.getJdbcSQLException(DbException.java:
> > 327)
> > at org.h2.message.DbException.get(DbException.java:167)
> > at org.h2.message.DbException.get(DbException.java:144)
> > at org.h2.store.PageStore.readPage(PageStore.java:1240)
> > at org.h2.store.PageStore.getPage(PageStore.java:701)
> > at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:222)
> > at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:208)
> > at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:81)
> > at org.h2.table.RegularTable.<init>(RegularTable.java:92)
> > at org.h2.store.PageStore.addMeta(PageStore.java:1583)
> > at org.h2.store.PageStore.readMetaData(PageStore.java:1515)
> > at org.h2.store.PageStore.recover(PageStore.java:1319)
> > at org.h2.store.PageStore.openExisting(PageStore.java:349)
> > at org.h2.store.PageStore.open(PageStore.java:273)
> > at org.h2.engine.Database.getPageStore(Database.java:2022)
> > at org.h2.engine.Database.open(Database.java:547)
> > at org.h2.engine.Database.openDatabase(Database.java:218)
> > at org.h2.engine.Database.<init>(Database.java:213)
> > 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:114)
> > at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:98)
> > at org.h2.Driver.connect(Driver.java:72)
> > at java.sql.DriverManager.getConnection(Unknown Source)
> > at java.sql.DriverManager.getConnection(Unknown Source)
> > ...
>
> > Some informations about the client pc:
> > - database version is 1.3.154
> > - database was created with version 1.3.154
> > - connection url: jdbc:h2:c:\lm\\data_h2db
>
> > \lm;DATABASE_EVENT_LISTENER='lm.db.H2EventListenerImpl';TRACE_LEVEL_SYSTEM_OUT=1;TRACE_LEVEL_FILE=1
> > - System: Windows XP, 5.1, x86
> > - java.version: 1.6.0_01
> > - there is no trace.db file, there is only the lm.h2.db file
> > - in our applications logfile i see that the database connection has
> > been closed successfully the day before
> > - the application starts with -Xmx256M
> > - the lm.h2.db file has a size of about 170MB
> > - the application did no run out of memory
> > - i think LOG is 2
> > - no temporary tables
> > - it is a java swing application. On application start the application
> > tries to connect to the embedded h2 database. If the application can't
> > connect (e.g. there is already a active database connection because
> > application is already running) the application exits.
> > - i can't reproduce the problem with a fresh database on my
> > development pc
>
> > Recovering the database is not the problem, because our application
> > synchronizes the data from the central erp software.
>
> > Our application is installed on 100 or more client PCs/notebooks. We
> > have some other clients with similar errors and somtiems older
> > database version.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "H2 Database" group.
> > To post to this group, send email to [hidden email]<javascript:;>
> > .
> > To unsubscribe from this group, send email to
> > [hidden email] <javascript:;>.
> > For more options, visit this group at
> >http://groups.google.com/group/h2-database?hl=en.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Cant't connect the database: "File corrupted while reading record"

Thomas Mueller Graf
Hi,

Is there any chance to find the problem without sendig the database?
I hope, because this is not the first time, that an error occured.

I'm afraid it will be very hard without having a reproducible test case.

However, there might be a way: you can run your application using the recovery-test option: To test recovery, append ;RECOVER_TEST=64 to the database URL. This will simulate an application crash after each 64 writes to the database file. A log file named databaseName.h2.db.log is created that lists the operations. The recovery is tested using an in-memory file system, that means it may require a larger heap setting.

If you find problems when using this setting, please tell me.

Regards,
Thomas

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.