简体   繁体   English

HSQLDB在检查点期间在db.script.new文件上引发资产失败异常和文件io错误

[英]HSQLDB throws Asset failed exception and file io error on db.script.new file during Checkpoint

Our application is a Java based desktop application which will download the binary data from the source, parses it and add it to HSQLDB database. 我们的应用程序是一个基于Java的桌面应用程序,它将从源代码下载二进制数据,进行解析并将其添加到HSQLDB数据库中。 When downloading from the sources individually, application works perfectly. 从来源单独下载时,应用程序可以完美运行。 But when doing the same from multiple sources simultaneously with each source in an individual thread, I am getting an error of 但是,当从多个源同时在单个线程中对每个源执行相同操作时,出现了以下错误

java.sql.SQLException: Assert failed: java.lang.ArrayIndexOutOfBoundsException: 23 in statement [CHECKPOINT]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.execute(Unknown Source)

or sometimes, 有时

java.sql.SQLException: Assert failed: java.lang.ArrayIndexOutOfBoundsException: 1016 in statement [CHECKPOINT] 

followed by 其次是

java.sql.SQLException: File input/output error: C:\ProgramData\test\data\database\db.script.new in statement [CHECKPOINT]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.execute(Unknown Source)

Java: 1.8; Java:1.8; HSQL version: 1.8.10 HSQL版本:1.8.10

We are not in the position to migrate the HSQLDB to latest version because of various reasons. 由于各种原因,我们无法将HSQLDB迁移到最新版本。

HSQL Properties: HSQL属性:

hsqldb.script_format=0
runtime.gc_interval=0
sql.enforce_strict_size=false
hsqldb.cache_size_scale=8
readonly=false
hsqldb.nio_data_file=true
hsqldb.cache_scale=14
version=1.8.0
hsqldb.default_table_type=memory
hsqldb.cache_file_scale=1
hsqldb.log_size=200
modified=yes
hsqldb.cache_version=1.7.0
hsqldb.original_version=1.8.0
hsqldb.compatible_version=1.8.0

Any help or hint will be appreciated. 任何帮助或提示,将不胜感激。

This is an 7 year old version which is not ideal for multi-threaded usage. 这是7年的版本,不适合多线程使用。

The simple solution is to perform the database updates with a single thread. 简单的解决方案是使用单个线程执行数据库更新。 You can retrofit your multi-threaded application with a synchronized block over a singleton object around the code that performs the database update. 您可以在执行数据库更新的代码周围的单例对象上使用synchronized块来改进多线程应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM