Upgrading Retain causes Schema Update Failure

  • 7023047
  • 04-Jun-2018
  • 25-Jun-2018

Environment

Retain Unified Archiving 4.1
Retain Unified Archiving 3.5.1

Situation

If you upgrade Retain and the Schema update looks like it finishes but everytime you restart Tomcat, it will continue to ask for the schema update again.  If you check the logs, you may notice something like this:

12:48:57, 578[UpdatingSchemaThread] [INFO ] HibernateUtil: SCHEMA UPDATE: Updating DB Schema...
12:48:57, 706[UpdatingSchemaThread] [INFO ] AbstractPoolBackedDataSource: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@40b83632 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@eea378ca [ acquireIncrement -> 5, acquireRetryAttempts -> 10, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> connection_test, breakAfterAcquireFailure -> false, checkoutTimeout -> 30000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> true, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bqozn09v1gad30erdtj60|44648c90, idleConnectionTestPeriod -> 0, initialPoolSize -> 5, maxAdministrativeTaskTime -> 90, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 40, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@95a46994 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1bqozn09v1gad30erdtj60|49e8e43b, jdbcUrl -> jdbc:mysql://wpgjrslmysql01.jrsl.ca/retain?useUnicode=yes&characterEncoding=UTF-8, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 1, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 600, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1bqozn09v1gad30erdtj60|41c14a88, numHelperThreads -> 6 ]
12:49:24, 732[UpdatingSchemaThread] [ERROR] SchemaUpdate: HHH000388: Unsuccessful: alter table t_document add column keyAlias varchar(128)
12:49:24, 732[UpdatingSchemaThread] [ERROR] SchemaUpdate: Incorrect key file for table 't_document'; try to repair it
12:49:24, 733[UpdatingSchemaThread] [ERROR] HibernateUtil: SCHEMA UPDATE FAILURE: Something went wrong during Schema Update - contact tech support immediately
12:49:24, 733[UpdatingSchemaThread] [ERROR] ServerErrorHandlerStrategy: reportError: SchemaUpdate :: com.gwava.hibernate.HibernateUtil.checkAndUpdateSchema:208 :: EXCEPTION : java.sql.SQLException: Incorrect key file for table 't_document'; try to repair it java.sql.SQLException: Incorrect key file for table 't_document'; try to repair it
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1794)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1712)
at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:208)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:252)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:203)
at com.gwava.hibernate.HibernateUtil.updateSchema(HibernateUtil.java:257)
at com.gwava.hibernate.HibernateUtil.checkAndUpdateSchema(HibernateUtil.java:203)
at com.gwava.exceptions.StartupError.fixSchema(StartupError.java:357)
at com.gwava.exceptions.StartupError.access$200(StartupError.java:30)
at com.gwava.exceptions.StartupError$1.run(StartupError.java:253)

12:49:24, 733[UpdatingSchemaThread] [WARN ] ServerErrorHandlerStrategy: reportError.internal: Can't write to DB right now (maintain mode)
12:49:24, 749[UpdatingSchemaThread] [ERROR] ServerErrorHandlerStrategy: reportError: fixSchema :: com.gwava.exceptions.StartupError.fixSchema:375 :: EXCEPTION : com.gwava.cfg.dao.RetainMessageDataAccessException: Cannot obtain SessionFactory - bad schema com.gwava.cfg.dao.RetainMessageDataAccessException: Cannot obtain SessionFactory - bad schema
at com.gwava.hibernate.HibernateUtil.checkAndUpdateSchema(HibernateUtil.java:210)
at com.gwava.exceptions.StartupError.fixSchema(StartupError.java:357)
at com.gwava.exceptions.StartupError.access$200(StartupError.java:30)
at com.gwava.exceptions.StartupError$1.run(StartupError.java:253)

12:49:24, 750[UpdatingSchemaThread] [WARN ] ServerErrorHandlerStrategy: reportError.internal: Can't write to DB right now (maintain mode)

Resolution

If you notice these or similar errors, you will want to check your database for issues.  
First, you will want to check the tmp folder of the database and make sure you are not running out of disk space.
Second, try restarting the database server.
Third, is the diskspace on the DB server looks good and restart didn't fix it, you will want to run a database check to make sure there are no errors going on with the database or tables themselves.

Cause

This is most likely caused by something going wrong with the database itself and not because Retain is doing anything incorrectly.   

Feedback service temporarily unavailable. For content questions or problems, please contact Support.