Unverified 提交 e6b7b9aa authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1442 from little-pan/master-fixbug-dbclose

Bugfix - Release MVStore lock and file resources rightly even if errors when compacting database
......@@ -485,16 +485,27 @@ public class MVStoreTool {
fileName(sourceFileName).
readOnly().
open();
FileUtils.delete(targetFileName);
MVStore.Builder b = new MVStore.Builder().
// Bugfix - Add double "try-finally" statements to close source and target stores for
//releasing lock and file resources in these stores even if OOM occurs.
// Fix issues such as "Cannot delete file "/h2/data/test.mv.db.tempFile" [90025-197]"
//when client connects to this server and reopens this store database in this process.
// @since 2018-09-13 little-pan
try{
FileUtils.delete(targetFileName);
MVStore.Builder b = new MVStore.Builder().
fileName(targetFileName);
if (compress) {
b.compress();
if (compress) {
b.compress();
}
MVStore target = b.open();
try{
compact(source, target);
}finally{
target.close();
}
}finally{
source.close();
}
MVStore target = b.open();
compact(source, target);
target.close();
source.close();
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论