Hi Team,
We are getting a DB corruption issue intermittently with H2DB 2.2.224 version and following are the error details:
=================================================ERROR START====================================================================
Exception while CRUD field mappings getNimMdrFieldMappingsByMdr
org.h2.jdbc.JdbcSQLNonTransientConnectionException: File corrupted while reading record: "/opt/cloakware/cspmserver_thirdparty/tomcat/webapps/ca-nim-sm/WEB-INF/data/nim-sm-customizations.mv.db". Possible solution: use the recovery tool [90030-224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:690) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.get(DbException.java:212) ~[h2-2.2.224.jar:2.2.224]
at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:163) ~[h2-2.2.224.jar:2.2.224]
at org.h2.mvstore.db.Store.<init>(Store.java:142) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Database.<init>(Database.java:326) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.openSession(Engine.java:92) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.openSession(Engine.java:222) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.Engine.createSession(Engine.java:201) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) ~[h2-2.2.224.jar:2.2.224]
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:125) ~[h2-2.2.224.jar:2.2.224]
at org.h2.Driver.connect(Driver.java:59) ~[h2-2.2.224.jar:1.3.176]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[?:1.8.0_432]
at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[?:1.8.0_432]
at com.j256.ormlite.jdbc.JdbcConnectionSource.makeConnection(JdbcConnectionSource.java:252) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadWriteConnection(JdbcConnectionSource.java:184) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadOnlyConnection(JdbcConnectionSource.java:170) ~[ormlite-jdbc-4.48.jar:?]
at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:243) ~[ormlite-core-4.48.jar:?]
at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:196) ~[ormlite-core-4.48.jar:?]
at com.j256.ormlite.dao.BaseDaoImpl.query(BaseDaoImpl.java:265) ~[ormlite-core-4.48.jar:?]
at com.ca.integration.normalization.common.persistence.FieldMappingsDbPersistenceImpl.getNimMdrFieldMappingsByMdr(FieldMappingsDbPersistenceImpl.java:139) ~[ca-nim-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at com.ca.integration.normalization.common.SMFieldMappingHandler.cloneMappings(SMFieldMappingHandler.java:1437) ~[ca-nim-sm-core-3.2.0-SNAPSHOT.jar:3.2.0-SNAPSHOT]
=================================================ERROR END====================================================================
The DB is getting corrupted when we are reading a table which contains only 225 records in it. It is not a huge DB or we don't have more than 20 small tables init. The issue is occurring intermittently and not able to understand the pattern but it is failing with the same error message "org.h2.jdbc.JdbcSQLNonTransientConnectionException: File corrupted while reading record:", This is occurring on the fly when the application is running and we cannot use the recovery tool here as suggested in the error message "Possible solution: use the recovery tool [90030-224]"
The getNimMdrFieldMappingsByMdr function is just reading 225 records(key value pair data) from a H2DB table but it is not successful sometimes with no reason other than reporting the DB corruption issue.
Following are the details:
===================
H2 DB version - 2.2.224
Java version : OpenJDK8
Application Server : Tomcat 9.x
Can any one help here to understand the issue and suggest on how to address this issue? Let me know if we have a quick call to check the same.
Thanks,
Balamurali