Database Corruption 1.4.182

194 views
Skip to first unread message

paul.l....@lmco.com

unread,
Apr 8, 2015, 5:11:50 PM4/8/15
to h2-da...@googlegroups.com
Hello,

I have an application deployed to a number of end users and I'm getting occasional reports of database corruption issues.  I have a sample of a log file from one of the users with the following exception:

Caused by: org.h2.jdbc.JdbcSQLException: File corrupted while reading record: "page[14853] stream trunk key:66 next:15873". Possible solution: use the recovery tool [90030-182]
 at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.message.DbException.get(DbException.java:179) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.message.DbException.get(DbException.java:155) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.index.PageDataIndex.getPage(PageDataIndex.java:241) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.index.PageDataNode.getLastKey(PageDataNode.java:214) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.index.PageDataIndex.<init>(PageDataIndex.java:87) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.table.RegularTable.<init>(RegularTable.java:83) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.store.PageStore.addMeta(PageStore.java:1697) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.store.PageStore.readMetaData(PageStore.java:1628) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.store.PageStore.recover(PageStore.java:1405) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.store.PageStore.openExisting(PageStore.java:367) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.store.PageStore.open(PageStore.java:288) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Database.getPageStore(Database.java:2390) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Database.open(Database.java:666) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Database.openDatabase(Database.java:266) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Database.<init>(Database.java:260) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Engine.openSession(Engine.java:60) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Engine.openSession(Engine.java:167) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Engine.createSessionAndValidate(Engine.java:145) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Engine.createSession(Engine.java:128) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.Engine.createSession(Engine.java:26) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:347) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:108) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:92) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.Driver.connect(Driver.java:72) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:190) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbcx.JdbcDataSource.getXAConnection(JdbcDataSource.java:353) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbcx.JdbcDataSource.getPooledConnection(JdbcDataSource.java:385) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbcx.JdbcConnectionPool.getConnectionNow(JdbcConnectionPool.java:227) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.h2.jdbcx.JdbcConnectionPool.getConnection(JdbcConnectionPool.java:199) ~[h2-1.4.182.jar.pack.gz:1.4.182]
 at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50) ~[flyway-core-3.0.jar.pack.gz:na]
 ... 35 common frames omitted

The application connects to the database with the following connection URL:

jdbc:h2:nio:~/tva/tvadb;MODE=PostgreSQL;MV_STORE=FALSE;EARLY_FILTER=TRUE;QUERY_CACHE_SIZE=16

Do you have any ideas that might help alleviate this issue?  Would using the MV store be more reliable in this regard?  Unfortunately, I don't have a specific scenario identified which causes the problem to occur.

paul.l....@lmco.com

unread,
Apr 9, 2015, 2:00:02 PM4/9/15
to h2-da...@googlegroups.com
In case it helps diagnose, I've attached a trace file from one of the users as well.
tvadb.trace.db

Thomas Mueller

unread,
Apr 10, 2015, 1:41:58 AM4/10/15
to h2-da...@googlegroups.com
Hi,

I'm afraid the trace file does not help much. This looks like a corrupt database. To recover the data, use the tool org.h2.tools.Recover to create the SQL script file, and then re-create the database using this script. Does it work when you do this?

I have a few questions:

- What is your database URL?

- Did you use LOG=0 or LOG=1? Did you read the FAQ about it?

- Did the system ever run out of disk space?

- Could you send the full stack trace of the exception including message text?

- Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS with H2 version 1.3.159 or older?

- How many connections does your application use concurrently?

- Do you use temporary tables?

- With which version of H2 was this database created?
    You can find it out using:
    select * from information_schema.settings where name='CREATE_BUILD'
    or have a look in the SQL script created by the recover tool.

- Did the application run out of memory (once, or multiple times)?

- 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 the application multi-threaded?

- What operating system, file system, and virtual machine
    (java -version) do you use?

- How did you start the Java process (java -Xmx... and so on)?

- Is it (or was it at some point) a networked file system?

- How big is the database (file sizes)?

- How much heap memory does the Java process have?

- Is the database usually closed normally, or is process terminated
    forcefully or the computer switched off?

- Is it possible to reproduce this problem using a fresh database
    (sometimes, or always)?

- Could you send the .h2.db file where this exception occurs?

Regards,
Thomas


On Thursday, April 9, 2015, <paul.l....@lmco.com> wrote:
In case it helps diagnose, I've attached a trace file from one of the users as well.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Moncznik, Paul L

unread,
Apr 13, 2015, 3:38:56 PM4/13/15
to h2-da...@googlegroups.com

Hi Thomas,

 

Answers to some of your questions are inline below.  The application is deployed to a large set of heterogeneous end user machines, so I don’t have answers to some of these questions at this time.  I’ll try to collect more information about the system environment the next time I receive a report of this error.

 

Paul

 

From: h2-da...@googlegroups.com [mailto:h2-da...@googlegroups.com] On Behalf Of Thomas Mueller
Sent: Thursday, April 09, 2015 11:42 PM
To: h2-da...@googlegroups.com
Subject: EXTERNAL: Re: [h2] Database Corruption 1.4.182

 

Hi,

 

I'm afraid the trace file does not help much. This looks like a corrupt database. To recover the data, use the tool org.h2.tools.Recover to create the SQL script file, and then re-create the database using this script. Does it work when you do this?

I have a few questions:

- What is your database URL?

jdbc:h2:nio:~/tva/tvadb;MODE=PostgreSQL;MV_STORE=FALSE;EARLY_FILTER=TRUE;QUERY_CACHE_SIZE=16

- Did you use LOG=0 or LOG=1? Did you read the FAQ about it?

No, I did not use these options

- Did the system ever run out of disk space?

I will try and gather this information

- Could you send the full stack trace of the exception including message text?

Caused by: org.h2.jdbc.JdbcSQLException: File corrupted while reading record: "page[14853] stream trunk key:66 next:15873". Possible solution: use the recovery tool [90030-182]

- Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS with H2 version 1.3.159 or older?

No

- How many connections does your application use concurrently?

The application uses a connection pool with a maximum of 10 active connections. 

- Do you use temporary tables?

No

- With which version of H2 was this database created?
    You can find it out using:
    select * from information_schema.settings where name='CREATE_BUILD'
    or have a look in the SQL script created by the recover tool.

1.4.182

- Did the application run out of memory (once, or multiple times)?

I don’t think so, I’ve never seen any errors in the application log file indicating it ran out of memory

- Do you use any settings or special features (for example cache settings,
    two phase commit, linked tables)?

From the connection URL, the settings I use are:

MODE=PostgreSQL

MV_STORE=FALSE

EARLY_FILTER=TRUE

QUERY_CACHE_SIZE=16

It also uses the nio file system

- Do you use any H2-specific system properties?

No

- Is the application multi-threaded?

Yes, it is a GUI application with background processing threads

- What operating system, file system, and virtual machine
    (java -version) do you use?

I will try and gather this information

- How did you start the Java process (java -Xmx... and so on)?

The application is launched using Java Web Start, so it would a command something like: C:\Windows\SysWOW64\javaws.exe -localfile -J-Djnlp.application.href=http://localhost:8080/workbook/webstart/launch.jnlp "C:\Users\paul\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\58\461678ba-54aa4905"

- Is it (or was it at some point) a networked file system?

I will try and gather this information

- How big is the database (file sizes)?

I will try and gather this information

- How much heap memory does the Java process have?

The application is set to use a max heap size of 1000 megabytes

- Is the database usually closed normally, or is process terminated
    forcefully or the computer switched off?

I will try and gather this information

- Is it possible to reproduce this problem using a fresh database
    (sometimes, or always)?

No, I’ve not been to reproduce the problem

- Could you send the .h2.db file where this exception occurs?

I will try and gather this information

Regards,
Thomas


On Thursday, April 9, 2015, <paul.l....@lmco.com> wrote:

In case it helps diagnose, I've attached a trace file from one of the users as well.

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to h2-database...@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/_tfwvAB39fY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages