The most usual case that causes a bad checksum error is a hardware problem on the data disk. I have also seen OS I/O issues where for some reason other data has been written into the derby file. Have you checked the OS log to see if any errors are being generated? Could you attach the complete derby.log if it is not too big? Or if not could you at least attach the complete error from this particular error - most of the time the page dump won't help much but sometimes it is interesting if there is something like all 0's in the end of the page.
It sounds like this problem on the disk and not a runtime error from your description. The current error is reporting an error on page 10031, are all the errors you are seeing on the same page? Running the following will check your table, and should report the same error as encountered below if the problem is a persistent on disk error: http://db.apache.org/derby/docs/10.1/ref/rrefsyscschecktablefunc.html http://db.apache.org/derby/docs/10.1/adminguide/cadminconsist01.html The only supported way to recover from this error to apply a backup if you have one, and if it was a roll forward backup it will bring the database up to the current state. [EMAIL PROTECTED] wrote:
Hi, I have apache derby 10.0 running on a MontaVista Linux system (3.1 Professional with Linux/i686 2.4.20) in embedded mode using the EmbeddedConnectionPoolDataSource. The java level is Sun's jre 1.4.2_04. There are around 3.5 million records in a table in the DB. While adding the records I had one thread inserting rows into this table at a rate of around 50 msecs. Another thread is periodically doing selects on this table and some deletes. When the record count was building up to 3.5 million , no deletes were being done on the table. I have the transaction log and db temp space in a different directory. When a thread attempts to delete a record from the table , it catches a SQLException with the following error message SQLError:0 SQLState:XJ001 SQLErrMsg:Java exception: ': java.lang.NullPointerException'. The derby.log file (at the end of this posting ) indicates an invalid checksum on a page . I have only included the first few lines. This may have occurred when i was selecting data from the database. If I restart the application, I sometimes get the same SQLException on the thread that is inserting data , after a few succesful inserts. When I run the command line client (ij), I am able to select and delete records from this database. What would typically cause a checksum error to occur ? Is there a way to recover from it without losing data ? ==================== Begin derby.log ======================================================================== ------------ BEGIN SHUTDOWN ERROR STACK ------------- ERROR XSDG2: Invalid checksum on Page Page(10031,Container(0, 800)), expected=3, 558,849,496, on-disk version=772,832,532, page dump follows: Hex dump: 00000000: 0075 0000 0001 0000 0000 0000 003d 003c .u.............. 00000010: 0000 0042 0000 0000 0000 0000 0000 0000 ...B............ The trailing stack trace is as follows: at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.store.raw.data.StoredPage.validateChecksum(Unknown Source) at org.apache.derby.impl.store.raw.data.StoredPage.initFromData(UnknownSource) at org.apache.derby.impl.store.raw.data.CachedPage.setIdentity(Unknown Source) at org.apache.derby.impl.services.cache.CachedItem.takeOnIdentity(Unknown Source) at org.apache.derby.impl.services.cache.Clock.addEntry(Unknown Source) at org.apache.derby.impl.services.cache.Clock.find(Unknown Source) at org.apache.derby.impl.store.raw.data.FileContainer.getUserPage(Unknown Source) at org.apache.derby.impl.store.raw.data.FileContainer.getPage(Unknown Source) at org.apache.derby.impl.store.raw.data.BaseContainerHandle.getPage(Unknown Source) at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.latchPage(Unknown Source) at org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController.fetch(Unknown Source) at org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet.getNextRowCore(Unknown Source) at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown Source) at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source) at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) ...... ------------ END SHUTDOWN ERROR STACK ------------- 2005-09-07 13:54:01.041 GMT Thread[Thread-2,5,main] (XID = 2985973), (SESSIONID= 1), (DATABASE = /xqjava/db/SAF), (DRDAID = null), Cleanup action starting 2005-09-07 13:54:01.042 GMT Thread[Thread-2,5,main] (XID = 2985973), (SESSIONID= 1), (DATABASE = /xqjava/db/SAF), (DRDAID = null), Failed Statement is: INSERT INTO messages_1 ( msg_id, msg_timestamp, msg) VALUES (?,?,?) java.lang.NullPointerException at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source) at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.openContainer(Unknown Source) at org.apache.derby.impl.store.raw.xact.Xact.openContainer(Unknown Source) at org.apache.derby.impl.store.access.conglomerate.OpenConglomerate.init(Unknown Source) at org.apache.derby.impl.store.access.heap.Heap.open(Unknown Source) at org.apache.derby.impl.store.access.RAMTransaction.openConglomerate(Unknown Source) at org.apache.derby.impl.store.access.RAMTransaction.openCompiledConglomerate(Unknown Source) at org.apache.derby.impl.sql.execute.RowChangerImpl.openForUpdate(Unknown Source) at org.apache.derby.impl.sql.execute.RowChangerImpl.open(Unknown Source) at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(Unknown Source) at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedCallableStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source) ........ Cleanup action completed ==================== derby.log ======================================================================== Thanks in advance. Sunil.