提交 101d72e0 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: rename pageSize to pageSplitSize

上级 5d9a00a9
...@@ -174,7 +174,7 @@ public class TestConcurrent extends TestMVStore { ...@@ -174,7 +174,7 @@ public class TestConcurrent extends TestMVStore {
} }
private void testConcurrentIterate() { private void testConcurrentIterate() {
MVStore s = new MVStore.Builder().pageSize(3).open(); MVStore s = new MVStore.Builder().pageSplitSize(3).open();
final MVMap<Integer, Integer> map = s.openMap("test"); final MVMap<Integer, Integer> map = s.openMap("test");
final int len = 10; final int len = 10;
final Random r = new Random(); final Random r = new Random();
......
...@@ -47,7 +47,8 @@ public class TestMVStore extends TestBase { ...@@ -47,7 +47,8 @@ public class TestMVStore extends TestBase {
public void test() throws Exception { public void test() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true); FileUtils.deleteRecursive(getBaseDir(), true);
FileUtils.createDirectories(getBaseDir()); FileUtils.createDirectories(getBaseDir());
testPerformanceCompareWithTreeMapHashMap();
testMemoryUsage();
testBackgroundExceptionListener(); testBackgroundExceptionListener();
testOldVersion(); testOldVersion();
testAtomicOperations(); testAtomicOperations();
...@@ -68,6 +69,7 @@ public class TestMVStore extends TestBase { ...@@ -68,6 +69,7 @@ public class TestMVStore extends TestBase {
testIterateOldVersion(); testIterateOldVersion();
testObjects(); testObjects();
testExample(); testExample();
testExampleMvcc();
testOpenStoreCloseLoop(); testOpenStoreCloseLoop();
testVersion(); testVersion();
testTruncateFile(); testTruncateFile();
...@@ -91,6 +93,14 @@ public class TestMVStore extends TestBase { ...@@ -91,6 +93,14 @@ public class TestMVStore extends TestBase {
testLargerThan2G(); testLargerThan2G();
} }
private void testPerformanceCompareWithTreeMapHashMap() {
int todo;
}
private void testMemoryUsage() {
int todo;
}
private void testBackgroundExceptionListener() throws Exception { private void testBackgroundExceptionListener() throws Exception {
String fileName = getBaseDir() + "/testBackgroundExceptionListener.h3"; String fileName = getBaseDir() + "/testBackgroundExceptionListener.h3";
FileUtils.delete(fileName); FileUtils.delete(fileName);
...@@ -722,6 +732,27 @@ public class TestMVStore extends TestBase { ...@@ -722,6 +732,27 @@ public class TestMVStore extends TestBase {
// create/get the map named "data" // create/get the map named "data"
MVMap<Integer, String> map = s.openMap("data"); MVMap<Integer, String> map = s.openMap("data");
// add and read some data
map.put(1, "Hello World");
// System.out.println(map.get(1));
// mark the changes as committed
s.commit();
// close the store
s.close();
}
private void testExampleMvcc() {
String fileName = getBaseDir() + "/testExampleMvcc.h3";
FileUtils.delete(fileName);
// open the store (in-memory if fileName is null)
MVStore s = MVStore.open(fileName);
// create/get the map named "data"
MVMap<Integer, String> map = s.openMap("data");
// add some data // add some data
map.put(1, "Hello"); map.put(1, "Hello");
map.put(2, "World"); map.put(2, "World");
...@@ -742,9 +773,6 @@ public class TestMVStore extends TestBase { ...@@ -742,9 +773,6 @@ public class TestMVStore extends TestBase {
MVMap<Integer, String> oldMap = MVMap<Integer, String> oldMap =
map.openVersion(oldVersion); map.openVersion(oldVersion);
// mark the changes as committed
s.commit();
// print the old version (can be done // print the old version (can be done
// concurrently with further modifications) // concurrently with further modifications)
// this will print "Hello" and "World": // this will print "Hello" and "World":
...@@ -758,7 +786,7 @@ public class TestMVStore extends TestBase { ...@@ -758,7 +786,7 @@ public class TestMVStore extends TestBase {
// System.out.println(map.get(1)); // System.out.println(map.get(1));
assertEquals("Hi", map.get(1)); assertEquals("Hi", map.get(1));
// close the store - this doesn't write to disk // close the store
s.close(); s.close();
} }
...@@ -1482,12 +1510,12 @@ public class TestMVStore extends TestBase { ...@@ -1482,12 +1510,12 @@ public class TestMVStore extends TestBase {
* Open a store for the given file name, using a small page size. * Open a store for the given file name, using a small page size.
* *
* @param fileName the file name (null for in-memory) * @param fileName the file name (null for in-memory)
* @param pageSize the page size * @param pageSplitSize the page split size
* @return the store * @return the store
*/ */
protected static MVStore openStore(String fileName, int pageSize) { protected static MVStore openStore(String fileName, int pageSplitSize) {
MVStore store = new MVStore.Builder(). MVStore store = new MVStore.Builder().
fileName(fileName).pageSize(pageSize).open(); fileName(fileName).pageSplitSize(pageSplitSize).open();
return store; return store;
} }
......
...@@ -46,6 +46,7 @@ public class TestMVTableEngine extends TestBase { ...@@ -46,6 +46,7 @@ public class TestMVTableEngine extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
// testShrinkDatabaseFile(); // testShrinkDatabaseFile();
testTransactionLogUsuallyNotStored();
testTwoPhaseCommit(); testTwoPhaseCommit();
testRecover(); testRecover();
testSeparateKey(); testSeparateKey();
...@@ -91,6 +92,10 @@ public class TestMVTableEngine extends TestBase { ...@@ -91,6 +92,10 @@ public class TestMVTableEngine extends TestBase {
} }
} }
private void testTransactionLogUsuallyNotStored() {
int todo;
}
private void testTwoPhaseCommit() throws Exception { private void testTwoPhaseCommit() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true); FileUtils.deleteRecursive(getBaseDir(), true);
Connection conn; Connection conn;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论