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,6 +485,12 @@ public class MVStoreTool {
fileName(sourceFileName).
readOnly().
open();
// 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);
......@@ -492,10 +498,15 @@ public class MVStoreTool {
b.compress();
}
MVStore target = b.open();
try{
compact(source, target);
}finally{
target.close();
}
}finally{
source.close();
}
}
/**
* Copy all live pages from the source store to the target store.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论