提交 9bcb2942 authored 作者: Andrei Tokar's avatar Andrei Tokar

release lock even if on compaction failure

上级 5b87daab
...@@ -943,24 +943,27 @@ public class MVStore { ...@@ -943,24 +943,27 @@ public class MVStore {
closed = true; closed = true;
storeLock.lock(); storeLock.lock();
try { try {
if (fileStore != null && shrinkIfPossible) { try {
shrinkFileIfPossible(0); if (fileStore != null && shrinkIfPossible) {
} shrinkFileIfPossible(0);
// release memory early - this is important when called }
// because of out of memory // release memory early - this is important when called
if (cache != null) { // because of out of memory
cache.clear(); if (cache != null) {
} cache.clear();
if (cacheChunkRef != null) { }
cacheChunkRef.clear(); if (cacheChunkRef != null) {
} cacheChunkRef.clear();
for (MVMap<?, ?> m : new ArrayList<>(maps.values())) { }
m.close(); for (MVMap<?, ?> m : new ArrayList<>(maps.values())) {
} m.close();
chunks.clear(); }
maps.clear(); chunks.clear();
if (fileStore != null && !fileStoreIsProvided) { maps.clear();
fileStore.close(); } finally {
if (fileStore != null && !fileStoreIsProvided) {
fileStore.close();
}
} }
} finally { } finally {
storeLock.unlock(); storeLock.unlock();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论