提交 ab51dbf6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Allow all tests to use the split file system (but not enabled currently).

上级 d04b47e9
...@@ -22,7 +22,10 @@ import org.h2.util.New; ...@@ -22,7 +22,10 @@ import org.h2.util.New;
*/ */
public class FileSystemSplit extends FileSystem { public class FileSystemSplit extends FileSystem {
private static final String PREFIX = "split:"; /**
* The prefix to use for this file system.
*/
public static final String PREFIX = "split:";
private static final String PART_SUFFIX = ".part"; private static final String PART_SUFFIX = ".part";
......
...@@ -245,6 +245,11 @@ java org.h2.test.TestAll timer ...@@ -245,6 +245,11 @@ java org.h2.test.TestAll timer
*/ */
public boolean record; public boolean record;
/**
* Test the split file system.
*/
public boolean splitFileSystem;
/** /**
* If the transaction log should be kept small (that is, the log should be * If the transaction log should be kept small (that is, the log should be
* switched early). * switched early).
...@@ -448,11 +453,13 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -448,11 +453,13 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
defrag = false; defrag = false;
traceLevelFile = throttle = 0; traceLevelFile = throttle = 0;
cipher = null; cipher = null;
// splitFileSystem = true;
test(); test();
testUnit(); testUnit();
networked = true; networked = true;
memory = true; memory = true;
splitFileSystem = false;
test(); test();
memory = false; memory = false;
...@@ -748,6 +755,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -748,6 +755,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
appendIf(buff, traceTest, "traceTest"); appendIf(buff, traceTest, "traceTest");
appendIf(buff, stopOnError, "stopOnError"); appendIf(buff, stopOnError, "stopOnError");
appendIf(buff, defrag, "defrag"); appendIf(buff, defrag, "defrag");
appendIf(buff, splitFileSystem, "split");
return buff.toString(); return buff.toString();
} }
......
...@@ -27,6 +27,7 @@ import org.h2.jdbc.JdbcConnection; ...@@ -27,6 +27,7 @@ import org.h2.jdbc.JdbcConnection;
import org.h2.message.TraceSystem; import org.h2.message.TraceSystem;
import org.h2.store.FileLock; import org.h2.store.FileLock;
import org.h2.store.fs.FileSystem; import org.h2.store.fs.FileSystem;
import org.h2.store.fs.FileSystemSplit;
import org.h2.test.utils.RecordingFileSystem; import org.h2.test.utils.RecordingFileSystem;
import org.h2.tools.DeleteDbFiles; import org.h2.tools.DeleteDbFiles;
...@@ -213,11 +214,17 @@ public abstract class TestBase { ...@@ -213,11 +214,17 @@ public abstract class TestBase {
* @return the directory, possibly including file system prefix * @return the directory, possibly including file system prefix
*/ */
protected String getBaseDir() { protected String getBaseDir() {
if (config != null && config.record) { String dir = baseDir;
return RecordingFileSystem.PREFIX + "memFS:" + baseDir; if (config != null) {
if (config.record) {
dir = RecordingFileSystem.PREFIX + "memFS:" + dir;
}
if (config.splitFileSystem) {
dir = FileSystemSplit.PREFIX + "16:" + dir;
}
} }
// return "split:nioMapped:" + baseDir; // return "split:nioMapped:" + baseDir;
return baseDir; return dir;
} }
/** /**
......
...@@ -44,9 +44,11 @@ public class TestFileSystem extends TestBase { ...@@ -44,9 +44,11 @@ public class TestFileSystem extends TestBase {
testDatabaseInJar(); testDatabaseInJar();
// set default part size to 1 << 10 // set default part size to 1 << 10
FileSystem.getInstance("split:10:" + getBaseDir() + "/fs"); FileSystem.getInstance("split:10:" + getBaseDir() + "/fs");
testFileSystem("nioMapped:" + getBaseDir() + "/fs"); if (!config.splitFileSystem) {
testFileSystem("split:nioMapped:" + getBaseDir() + "/fs"); testFileSystem("nioMapped:" + getBaseDir() + "/fs");
testFileSystem("split:" + getBaseDir() + "/fs"); testFileSystem("split:nioMapped:" + getBaseDir() + "/fs");
testFileSystem("split:" + getBaseDir() + "/fs");
}
testFileSystem(getBaseDir() + "/fs"); testFileSystem(getBaseDir() + "/fs");
testFileSystem(FileSystemMemory.PREFIX); testFileSystem(FileSystemMemory.PREFIX);
FileSystemDatabase fs = FileSystemDatabase.register("jdbc:h2:mem:fs"); FileSystemDatabase fs = FileSystemDatabase.register("jdbc:h2:mem:fs");
......
...@@ -76,7 +76,9 @@ public class TestTools extends TestBase { ...@@ -76,7 +76,9 @@ public class TestTools extends TestBase {
testConvertTraceFile(); testConvertTraceFile();
testManagementDb(); testManagementDb();
testChangeFileEncryption(false); testChangeFileEncryption(false);
testChangeFileEncryption(true); if (!config.splitFileSystem) {
testChangeFileEncryption(true);
}
testServer(); testServer();
testScriptRunscript(); testScriptRunscript();
testBackupRestore(); testBackupRestore();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论