调整文件系统大小后HSQLDB损坏

时间:2018-07-26 09:29:36

标签: database filesystems hsqldb ext4

我有一群运行Debian 7,OpenJDK 7和HSQLDB 2.3.4的服务器。我正在收缩他们的ext4文件系统,以便为根磁盘上的第二个分区腾出空间。简而言之,这是通过重新引导到临时的RAM磁盘来完成的,该磁盘将对文件系统进行脱机调整大小并创建新的分区布局。

在几乎所有服务器上,这都可以正常工作。但是,在很小的系统子集上,数据库最终会遭受某种破坏,从而导致应用程序引发以下异常:

2018-07-25 19:44:16 ERROR h.d..ENGINE user:<uid> company:<cid> remotehost:<ip> <appdir>/appdb/app.db.data getFromFile failed 49485172
org.hsqldb.HsqlException: IO error: RowInputBinary
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.rowio.RowInputBinary.readInt(Unknown Source)
    at org.hsqldb.index.NodeAVLDisk.<init>(Unknown Source)
    at org.hsqldb.RowAVLDisk.<init>(Unknown Source)
    at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source)
    at org.hsqldb.persist.DataFileCache.getFromFile(Unknown Source)
    at org.hsqldb.persist.DataFileCache.get(Unknown Source)
    at org.hsqldb.persist.RowStoreAVLDisk.get(Unknown Source)
    at org.hsqldb.index.NodeAVLDisk.findNode(Unknown Source)
    at org.hsqldb.index.NodeAVLDisk.getRight(Unknown Source)
    at org.hsqldb.index.IndexAVL.next(Unknown Source)
    at org.hsqldb.index.IndexAVL.searchCost(Unknown Source)
    at org.hsqldb.persist.RowStoreAVL.searchCost(Unknown Source)
    at org.hsqldb.RangeVariableResolver.setEqualityConditions(Unknown Source)
    at org.hsqldb.RangeVariableResolver.setIndexConditions(Unknown Source)
    at org.hsqldb.RangeVariableResolver.assignToRangeVariable(Unknown Source)
    at org.hsqldb.RangeVariableResolver.assignToRangeVariables(Unknown Source)
    at org.hsqldb.RangeVariableResolver.processConditions(Unknown Source)
    at org.hsqldb.QuerySpecification.setRangeVariableConditions(Unknown Source)
    at org.hsqldb.QuerySpecification.resolveTypesPartThree(Unknown Source)
    at org.hsqldb.QueryExpression.resolve(Unknown Source)
    at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
    at org.hsqldb.ParserCommand.compilePart(Unknown Source)
    at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
    at org.hsqldb.Session.compileStatement(Unknown Source)
    at org.hsqldb.StatementManager.compile(Unknown Source)
    at org.hsqldb.Session.execute(Unknown Source)
    at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
    at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
    at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:308)
    at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
    at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.bull.javamelody.JdbcWrapper$ConnectionInvocationHandler.invoke(JdbcWrapper.java:215)
    at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:317)
    at com.sun.proxy.$Proxy72.prepareStatement(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:240)

AFAIK,文件系统调整大小期间发生错误可能会导致整个文件系统损坏,或者会导致看似随机的数据位损坏。由于系统及其使用的可变性,驱动器上的碎片将不一致。

两个问题: 1.有人知道此过程如何导致HSQLDB损坏吗? 2.有人知道解决上述错误的干净方法吗?

1 个答案:

答案 0 :(得分:0)

就HSQLDB而言,在打开数据库时不应执行此类操作。如果数据库已关闭,并且复制操作将文件中的所有数据位(应保留)保留下来,那么应该没有问题。