提交 134a436d authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

MVStore: disabled the file system cache by default, because it limits concurrency

上级 101bfe4b
......@@ -83,6 +83,10 @@ Change Log
</li>
<li>MVStore / transaction store: opening a store in read-only mode does no longer loop.
</li>
<li>MVStore: disabled the file system cache by default, because it limits concurrency
when using larger databases and many threads.
To re-enable, use the file name prefix "cache:".
</li>
</ul>
<h2>Version 1.4.192 Beta (2016-05-26)</h2>
......
......@@ -129,6 +129,8 @@ public class FileStore {
return;
}
if (fileName != null) {
// ensure the Cache file system is registered
FilePathCache.INSTANCE.getScheme();
FilePath p = FilePath.get(fileName);
// if no explicit scheme was specified, NIO is used
if (p instanceof FilePathDisk &&
......@@ -156,7 +158,6 @@ public class FileStore {
encryptedFile = file;
file = new FilePathEncrypt.FileEncrypt(fileName, key, file);
}
file = FilePathCache.wrap(file);
try {
if (readOnly) {
fileLock = file.tryLock(0, Long.MAX_VALUE, true);
......
......@@ -10,6 +10,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import org.h2.store.fs.FileBase;
import org.h2.store.fs.FilePath;
import org.h2.store.fs.FilePathWrapper;
/**
......@@ -17,6 +18,15 @@ import org.h2.store.fs.FilePathWrapper;
*/
public class FilePathCache extends FilePathWrapper {
public static final FilePathCache INSTANCE = new FilePathCache();
/**
* Register the file system.
*/
static {
FilePath.register(INSTANCE);
}
public static FileChannel wrap(FileChannel f) {
return new FileCache(f);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论