提交 2c35d8c3 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore bugfixes / tests

上级 b5f469e3
...@@ -18,13 +18,15 @@ Change Log ...@@ -18,13 +18,15 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The profiler tool can now process files with full thread dumps. <ul><li>Issue 545: Unnecessary duplicate code was removed.
</li><li>The profiler tool can now process files with full thread dumps.
</li><li>MVStore mode: the CLOB and BLOB storage was re-implemented and is </li><li>MVStore mode: the CLOB and BLOB storage was re-implemented and is
now much faster than with the PageStore (which is still the default storage). now much faster than with the PageStore (which is still the default storage).
</li><li>MVStore mode: creating indexes is now much faster </li><li>MVStore mode: creating indexes is now much faster
(in many cases faster than with the default PageStore). (in many cases faster than with the default PageStore).
</li><li>Various bugs in the MVStore storage and have been fixed, </li><li>Various bugs in the MVStore storage and have been fixed,
including a bug in the R-tree implementation. including a bug in the R-tree implementation.
The database could get corrupt if there were transient IO exceptions while storing.
</li><li>The method org.h2.expression.Function.getCost could throw a NullPointException. </li><li>The method org.h2.expression.Function.getCost could throw a NullPointException.
</li><li>Storing LOBs in separate files (outside of the main database file) </li><li>Storing LOBs in separate files (outside of the main database file)
is no longer supported for new databases. is no longer supported for new databases.
......
...@@ -41,6 +41,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -41,6 +41,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Remove support for the old-style outer join syntax using "(+)" because it is buggy. </li><li>Remove support for the old-style outer join syntax using "(+)" because it is buggy.
</li><li>Change license to MPL 2.0. </li><li>Change license to MPL 2.0.
</li><li>Not allow relative database URLs like jdbc:h2:test; instead, require using jdbc:h2:./test. </li><li>Not allow relative database URLs like jdbc:h2:test; instead, require using jdbc:h2:./test.
</li><li>Document that FILE_LOCK=SERIALIZED is not supported with the MVStore mode.
</li></ul> </li></ul>
<h2>Priority 1</h2> <h2>Priority 1</h2>
......
...@@ -660,7 +660,16 @@ public class MVStore { ...@@ -660,7 +660,16 @@ public class MVStore {
header.position(BLOCK_SIZE); header.position(BLOCK_SIZE);
header.put(bytes); header.put(bytes);
header.rewind(); header.rewind();
fileStore.writeFully(0, header); write(0, header);
}
private void write(long pos, ByteBuffer buffer) {
try {
fileStore.writeFully(pos, buffer);
} catch (IllegalStateException e) {
close();
throw e;
}
} }
/** /**
...@@ -945,8 +954,7 @@ public class MVStore { ...@@ -945,8 +954,7 @@ public class MVStore {
buff.put(new byte[BLOCK_SIZE - header.length]); buff.put(new byte[BLOCK_SIZE - header.length]);
buff.position(0); buff.position(0);
fileStore.writeFully(filePos, buff.getBuffer()); write(filePos, buff.getBuffer());
releaseWriteBuffer(buff); releaseWriteBuffer(buff);
// overwrite the header if required // overwrite the header if required
...@@ -1214,7 +1222,7 @@ public class MVStore { ...@@ -1214,7 +1222,7 @@ public class MVStore {
// fill the header with zeroes // fill the header with zeroes
buff.put(new byte[BLOCK_SIZE - header.length]); buff.put(new byte[BLOCK_SIZE - header.length]);
buff.position(0); buff.position(0);
fileStore.writeFully(end, buff.getBuffer()); write(end, buff.getBuffer());
releaseWriteBuffer(buff); releaseWriteBuffer(buff);
markMetaChanged(); markMetaChanged();
meta.put("chunk." + c.id, c.asString()); meta.put("chunk." + c.id, c.asString());
...@@ -1252,7 +1260,7 @@ public class MVStore { ...@@ -1252,7 +1260,7 @@ public class MVStore {
// fill the header with zeroes // fill the header with zeroes
buff.put(new byte[BLOCK_SIZE - header.length]); buff.put(new byte[BLOCK_SIZE - header.length]);
buff.position(0); buff.position(0);
fileStore.writeFully(pos, buff.getBuffer()); write(pos, buff.getBuffer());
releaseWriteBuffer(buff); releaseWriteBuffer(buff);
markMetaChanged(); markMetaChanged();
meta.put("chunk." + c.id, c.asString()); meta.put("chunk." + c.id, c.asString());
...@@ -1772,7 +1780,7 @@ public class MVStore { ...@@ -1772,7 +1780,7 @@ public class MVStore {
ByteBuffer header = ByteBuffer.allocate(BLOCK_SIZE); ByteBuffer header = ByteBuffer.allocate(BLOCK_SIZE);
header.put(bytes); header.put(bytes);
header.rewind(); header.rewind();
fileStore.writeFully(fileStore.size(), header); write(fileStore.size(), header);
readStoreHeader(); readStoreHeader();
readMeta(); readMeta();
} }
......
...@@ -99,7 +99,9 @@ public class FilePathCache extends FilePathWrapper { ...@@ -99,7 +99,9 @@ public class FilePathCache extends FilePathWrapper {
} }
} }
dst.put(buff.array(), off, len); dst.put(buff.array(), off, len);
return len; ; // add test to TestFileSystem
// return len;
return len == 0 ? -1 : len;
} }
private static long getCachePos(long pos) { private static long getCachePos(long pos) {
......
...@@ -306,6 +306,7 @@ public class MVTableEngine implements TableEngine { ...@@ -306,6 +306,7 @@ public class MVTableEngine implements TableEngine {
* @param maxCompactTime the maximum time in milliseconds to compact * @param maxCompactTime the maximum time in milliseconds to compact
*/ */
public void close(long maxCompactTime) { public void close(long maxCompactTime) {
try {
if (!store.isClosed() && store.getFileStore() != null) { if (!store.isClosed() && store.getFileStore() != null) {
if (!store.getFileStore().isReadOnly()) { if (!store.getFileStore().isReadOnly()) {
transactionStore.close(); transactionStore.close();
...@@ -319,6 +320,9 @@ public class MVTableEngine implements TableEngine { ...@@ -319,6 +320,9 @@ public class MVTableEngine implements TableEngine {
} }
store.close(); store.close();
} }
} catch (IllegalStateException e) {
throw DbException.get(ErrorCode.IO_EXCEPTION_1, e, "Closing");
}
} }
/** /**
......
...@@ -6,13 +6,16 @@ ...@@ -6,13 +6,16 @@
*/ */
package org.h2.store; package org.h2.store;
import java.nio.channels.FileChannel;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.message.TraceSystem; import org.h2.message.TraceSystem;
import org.h2.store.fs.FilePath;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.h2.util.New; import org.h2.util.New;
...@@ -44,6 +47,15 @@ public class FileLister { ...@@ -44,6 +47,15 @@ public class FileLister {
throw DbException.get( throw DbException.get(
ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException(); ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, message).getSQLException();
} }
} else if (fileName.endsWith(Constants.SUFFIX_MV_FILE)) {
try {
FileChannel f = FilePath.get(fileName).open("r");
java.nio.channels.FileLock lock = f.tryLock(0, Long.MAX_VALUE, true);
lock.release();
} catch (Exception e) {
throw DbException.get(
ErrorCode.CANNOT_CHANGE_SETTING_WHEN_OPEN_1, e, message).getSQLException();
}
} }
} }
} }
......
...@@ -729,7 +729,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -729,7 +729,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestBtreeIndex().runTest(this); new TestBtreeIndex().runTest(this);
new TestDiskFull().runTest(this); new TestDiskFull().runTest(this);
new TestCrashAPI().runTest(this); new TestCrashAPI().runTest(this);
new TestFuzzOptimizations().runTest(this); new TestFuzzOptimizations().runTest(this);
new TestLimit().runTest(this); new TestLimit().runTest(this);
new TestRandomSQL().runTest(this); new TestRandomSQL().runTest(this);
......
...@@ -95,7 +95,7 @@ public class TestIndex extends TestBase { ...@@ -95,7 +95,7 @@ public class TestIndex extends TestBase {
} }
private void testIndexTypes() throws SQLException { private void testIndexTypes() throws SQLException {
Connection conn = getConnection("index;MV_STORE=false"); Connection conn = getConnection("index");
stat = conn.createStatement(); stat = conn.createStatement();
for (String type : new String[] { "unique", "hash", "unique hash" }) { for (String type : new String[] { "unique", "hash", "unique hash" }) {
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
......
...@@ -54,17 +54,10 @@ public class TestSpatial extends TestBase { ...@@ -54,17 +54,10 @@ public class TestSpatial extends TestBase {
return; return;
} }
if (DataType.GEOMETRY_CLASS != null) { if (DataType.GEOMETRY_CLASS != null) {
deleteDb("spatial"); deleteDb("spatial");
url = "spatial"; url = "spatial";
testSpatial(); testSpatial();
deleteDb("spatial"); deleteDb("spatial");
if (!config.mvcc) {
url = "spatial;MV_STORE=false";
testSpatial();
deleteDb("spatial");
}
} }
} }
......
...@@ -55,6 +55,7 @@ public class TestDiskFull extends TestBase { ...@@ -55,6 +55,7 @@ public class TestDiskFull extends TestBase {
String url = "jdbc:h2:unstable:memFS:diskFull" + x + String url = "jdbc:h2:unstable:memFS:diskFull" + x +
";FILE_LOCK=NO;TRACE_LEVEL_FILE=0;WRITE_DELAY=10;" + ";FILE_LOCK=NO;TRACE_LEVEL_FILE=0;WRITE_DELAY=10;" +
"LOCK_TIMEOUT=100;CACHE_SIZE=4096"; "LOCK_TIMEOUT=100;CACHE_SIZE=4096";
url = getURL(url, true);
Connection conn = null; Connection conn = null;
Statement stat = null; Statement stat = null;
boolean opened = false; boolean opened = false;
...@@ -90,7 +91,8 @@ public class TestDiskFull extends TestBase { ...@@ -90,7 +91,8 @@ public class TestDiskFull extends TestBase {
conn.close(); conn.close();
} catch (SQLException e2) { } catch (SQLException e2) {
if (e2.getErrorCode() != ErrorCode.IO_EXCEPTION_1 if (e2.getErrorCode() != ErrorCode.IO_EXCEPTION_1
&& e2.getErrorCode() != ErrorCode.IO_EXCEPTION_2) { && e2.getErrorCode() != ErrorCode.IO_EXCEPTION_2
&& e2.getErrorCode() != ErrorCode.DATABASE_IS_CLOSED) {
throw e2; throw e2;
} }
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package org.h2.test.unit; package org.h2.test.unit;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
...@@ -44,7 +43,7 @@ public class TestAutoReconnect extends TestBase { ...@@ -44,7 +43,7 @@ public class TestAutoReconnect extends TestBase {
connServer.close(); connServer.close();
} }
org.h2.Driver.load(); org.h2.Driver.load();
connServer = DriverManager.getConnection(url); connServer = getConnection(url);
} else { } else {
server.stop(); server.stop();
server.start(); server.start();
...@@ -95,12 +94,12 @@ public class TestAutoReconnect extends TestBase { ...@@ -95,12 +94,12 @@ public class TestAutoReconnect extends TestBase {
} }
// test the database event listener // test the database event listener
conn = DriverManager.getConnection(url + ";DATABASE_EVENT_LISTENER='" + MyDatabaseEventListener.class.getName() + "'"); conn = getConnection(url + ";DATABASE_EVENT_LISTENER='" + MyDatabaseEventListener.class.getName() + "'");
conn.close(); conn.close();
Statement stat; Statement stat;
conn = DriverManager.getConnection(url); conn = getConnection(url);
restart(); restart();
stat = conn.createStatement(); stat = conn.createStatement();
restart(); restart();
......
...@@ -35,10 +35,11 @@ public class TestExit extends TestBase { ...@@ -35,10 +35,11 @@ public class TestExit extends TestBase {
return; return;
} }
deleteDb("exit"); deleteDb("exit");
String url = getURL(OPEN_WITH_CLOSE_ON_EXIT);
String selfDestruct = SelfDestructor.getPropertyString(60); String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = { "java", selfDestruct, String[] procDef = { "java", selfDestruct,
"-cp", getClassPath(), "-cp", getClassPath(),
getClass().getName(), "" + OPEN_WITH_CLOSE_ON_EXIT }; getClass().getName(), url };
Process proc = Runtime.getRuntime().exec(procDef); Process proc = Runtime.getRuntime().exec(procDef);
while (true) { while (true) {
int ch = proc.getErrorStream().read(); int ch = proc.getErrorStream().read();
...@@ -59,9 +60,10 @@ public class TestExit extends TestBase { ...@@ -59,9 +60,10 @@ public class TestExit extends TestBase {
if (!getClosedFile().exists()) { if (!getClosedFile().exists()) {
fail("did not close database"); fail("did not close database");
} }
url = getURL(OPEN_WITHOUT_CLOSE_ON_EXIT);
procDef = new String[] { "java", procDef = new String[] { "java",
"-cp", getClassPath(), getClass().getName(), "-cp", getClassPath(), getClass().getName(),
"" + OPEN_WITHOUT_CLOSE_ON_EXIT }; url };
proc = Runtime.getRuntime().exec(procDef); proc = Runtime.getRuntime().exec(procDef);
proc.waitFor(); proc.waitFor();
Thread.sleep(100); Thread.sleep(100);
...@@ -71,6 +73,23 @@ public class TestExit extends TestBase { ...@@ -71,6 +73,23 @@ public class TestExit extends TestBase {
deleteDb("exit"); deleteDb("exit");
} }
private String getURL(int action) {
String url = "";
switch (action) {
case OPEN_WITH_CLOSE_ON_EXIT:
url = "jdbc:h2:" + getBaseDir() + "/exit;database_event_listener='" + MyDatabaseEventListener.class.getName()
+ "';db_close_on_exit=true";
break;
case OPEN_WITHOUT_CLOSE_ON_EXIT:
url = "jdbc:h2:" + getBaseDir() + "/exit;database_event_listener='" + MyDatabaseEventListener.class.getName()
+ "';db_close_on_exit=false";
break;
default:
}
url = getURL(url, true);
return url;
}
/** /**
* This method is called when executing this application from the command * This method is called when executing this application from the command
* line. * line.
...@@ -82,25 +101,12 @@ public class TestExit extends TestBase { ...@@ -82,25 +101,12 @@ public class TestExit extends TestBase {
if (args.length == 0) { if (args.length == 0) {
System.exit(1); System.exit(1);
} }
int action = Integer.parseInt(args[0]); String url = args[0];
TestExit app = new TestExit(); TestExit.execute(url);
app.execute(action);
} }
private void execute(int action) throws SQLException { private static void execute(String url) throws SQLException {
org.h2.Driver.load(); org.h2.Driver.load();
String url = "";
switch (action) {
case OPEN_WITH_CLOSE_ON_EXIT:
url = "jdbc:h2:" + getBaseDir() + "/exit;database_event_listener='" + MyDatabaseEventListener.class.getName()
+ "';db_close_on_exit=true";
break;
case OPEN_WITHOUT_CLOSE_ON_EXIT:
url = "jdbc:h2:" + getBaseDir() + "/exit;database_event_listener='" + MyDatabaseEventListener.class.getName()
+ "';db_close_on_exit=false";
break;
default:
}
conn = open(url); conn = open(url);
Connection conn2 = open(url); Connection conn2 = open(url);
conn2.close(); conn2.close();
......
...@@ -71,7 +71,8 @@ public class TestFileLockProcess extends TestBase { ...@@ -71,7 +71,8 @@ public class TestFileLockProcess extends TestBase {
} }
private void test(int count, String url) throws Exception { private void test(int count, String url) throws Exception {
Connection conn = DriverManager.getConnection(url); url = getURL(url, true);
Connection conn = getConnection(url);
String selfDestruct = SelfDestructor.getPropertyString(60); String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = { "java", selfDestruct, String[] procDef = { "java", selfDestruct,
"-cp", getClassPath(), "-cp", getClassPath(),
......
...@@ -16,7 +16,6 @@ import java.nio.channels.FileChannel; ...@@ -16,7 +16,6 @@ import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode; import java.nio.channels.FileChannel.MapMode;
import java.nio.channels.FileLock; import java.nio.channels.FileLock;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
...@@ -251,7 +250,7 @@ public class TestFileSystem extends TestBase { ...@@ -251,7 +250,7 @@ public class TestFileSystem extends TestBase {
FileUtils.deleteRecursive(dir, false); FileUtils.deleteRecursive(dir, false);
Connection conn; Connection conn;
Statement stat; Statement stat;
conn = DriverManager.getConnection("jdbc:h2:split:18:"+dir+"/test"); conn = getConnection("jdbc:h2:split:18:"+dir+"/test");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute( stat.execute(
"create table test(id int primary key, name varchar) " + "create table test(id int primary key, name varchar) " +
...@@ -260,7 +259,7 @@ public class TestFileSystem extends TestBase { ...@@ -260,7 +259,7 @@ public class TestFileSystem extends TestBase {
conn.close(); conn.close();
Backup.execute(dir + "/test.zip", dir, "", true); Backup.execute(dir + "/test.zip", dir, "", true);
DeleteDbFiles.execute("split:" + dir, "test", true); DeleteDbFiles.execute("split:" + dir, "test", true);
conn = DriverManager.getConnection( conn = getConnection(
"jdbc:h2:split:zip:"+dir+"/test.zip!/test"); "jdbc:h2:split:zip:"+dir+"/test.zip!/test");
conn.createStatement().execute("select * from test where id=1"); conn.createStatement().execute("select * from test where id=1");
conn.close(); conn.close();
...@@ -271,12 +270,12 @@ public class TestFileSystem extends TestBase { ...@@ -271,12 +270,12 @@ public class TestFileSystem extends TestBase {
org.h2.Driver.load(); org.h2.Driver.load();
deleteDb("fsMem"); deleteDb("fsMem");
String url = "jdbc:h2:" + getBaseDir() + "/fsMem"; String url = "jdbc:h2:" + getBaseDir() + "/fsMem";
Connection conn = DriverManager.getConnection(url, "sa", "sa"); Connection conn = getConnection(url, "sa", "sa");
conn.createStatement().execute("CREATE TABLE TEST AS SELECT * FROM DUAL"); conn.createStatement().execute("CREATE TABLE TEST AS SELECT * FROM DUAL");
conn.createStatement().execute("BACKUP TO '" + getBaseDir() + "/fsMem.zip'"); conn.createStatement().execute("BACKUP TO '" + getBaseDir() + "/fsMem.zip'");
conn.close(); conn.close();
org.h2.tools.Restore.main("-file", getBaseDir() + "/fsMem.zip", "-dir", "memFS:"); org.h2.tools.Restore.main("-file", getBaseDir() + "/fsMem.zip", "-dir", "memFS:");
conn = DriverManager.getConnection("jdbc:h2:memFS:fsMem", "sa", "sa"); conn = getConnection("jdbc:h2:memFS:fsMem", "sa", "sa");
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST"); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST");
rs.close(); rs.close();
conn.close(); conn.close();
...@@ -293,7 +292,7 @@ public class TestFileSystem extends TestBase { ...@@ -293,7 +292,7 @@ public class TestFileSystem extends TestBase {
} }
org.h2.Driver.load(); org.h2.Driver.load();
String url = "jdbc:h2:" + getBaseDir() + "/fsJar"; String url = "jdbc:h2:" + getBaseDir() + "/fsJar";
Connection conn = DriverManager.getConnection(url, "sa", "sa"); Connection conn = getConnection(url, "sa", "sa");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar, b blob, c clob)"); stat.execute("create table test(id int primary key, name varchar, b blob, c clob)");
stat.execute("insert into test values(1, 'Hello', SECURE_RAND(2000), space(2000))"); stat.execute("insert into test values(1, 'Hello', SECURE_RAND(2000), space(2000))");
...@@ -303,7 +302,7 @@ public class TestFileSystem extends TestBase { ...@@ -303,7 +302,7 @@ public class TestFileSystem extends TestBase {
byte[] b1 = rs.getBytes(3); byte[] b1 = rs.getBytes(3);
String s1 = rs.getString(4); String s1 = rs.getString(4);
conn.close(); conn.close();
conn = DriverManager.getConnection(url, "sa", "sa"); conn = getConnection(url, "sa", "sa");
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("backup to '" + getBaseDir() + "/fsJar.zip'"); stat.execute("backup to '" + getBaseDir() + "/fsJar.zip'");
conn.close(); conn.close();
...@@ -326,7 +325,7 @@ public class TestFileSystem extends TestBase { ...@@ -326,7 +325,7 @@ public class TestFileSystem extends TestBase {
testReadOnly(f); testReadOnly(f);
} }
String urlJar = "jdbc:h2:zip:" + getBaseDir() + "/fsJar.zip!/fsJar"; String urlJar = "jdbc:h2:zip:" + getBaseDir() + "/fsJar.zip!/fsJar";
conn = DriverManager.getConnection(urlJar, "sa", "sa"); conn = getConnection(urlJar, "sa", "sa");
stat = conn.createStatement(); stat = conn.createStatement();
rs = stat.executeQuery("select * from test"); rs = stat.executeQuery("select * from test");
rs.next(); rs.next();
......
...@@ -41,6 +41,9 @@ public class TestOldVersion extends TestBase { ...@@ -41,6 +41,9 @@ public class TestOldVersion extends TestBase {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
if (config.mvStore) {
return;
}
cl = getClassLoader("file:ext/h2-1.2.127.jar"); cl = getClassLoader("file:ext/h2-1.2.127.jar");
driver = getDriver(cl); driver = getDriver(cl);
if (driver == null) { if (driver == null) {
......
...@@ -70,7 +70,6 @@ public class TestPageStore extends TestBase { ...@@ -70,7 +70,6 @@ public class TestPageStore extends TestBase {
testLargeInserts(); testLargeInserts();
testLargeDatabaseFastOpen(); testLargeDatabaseFastOpen();
testUniqueIndexReopen(); testUniqueIndexReopen();
testExistingOld();
testLargeRows(); testLargeRows();
testRecoverDropIndex(); testRecoverDropIndex();
testDropPk(); testDropPk();
...@@ -526,26 +525,6 @@ public class TestPageStore extends TestBase { ...@@ -526,26 +525,6 @@ public class TestPageStore extends TestBase {
conn.close(); conn.close();
} }
private void testExistingOld() throws SQLException {
if (config.memory) {
return;
}
Connection conn;
deleteDb("pageStoreExistingOld");
String url;
url = "jdbc:h2:" + getBaseDir() + "/pageStoreExistingOld";
conn = DriverManager.getConnection(url);
conn.createStatement().execute("create table test(id int) as select 1");
conn.close();
conn = DriverManager.getConnection(url);
conn.createStatement().execute("select * from test");
conn.close();
// the database is automatically converted
conn = DriverManager.getConnection(url);
assertResult("1", conn.createStatement(), "select * from test");
conn.close();
}
private void testLargeRows() throws Exception { private void testLargeRows() throws Exception {
if (config.memory) { if (config.memory) {
return; return;
......
...@@ -96,9 +96,12 @@ public class TestRecovery extends TestBase { ...@@ -96,9 +96,12 @@ public class TestRecovery extends TestBase {
} }
private void testRedoTransactions() throws Exception { private void testRedoTransactions() throws Exception {
DeleteDbFiles.execute(getBaseDir(), "recovery", true); if (config.mvStore) {
// not needed for MV_STORE=TRUE // not needed for MV_STORE=TRUE
Connection conn = getConnection("recovery;MV_STORE=false"); return;
}
DeleteDbFiles.execute(getBaseDir(), "recovery", true);
Connection conn = getConnection("recovery");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("set write_delay 0"); stat.execute("set write_delay 0");
stat.execute("create table test(id int primary key, name varchar)"); stat.execute("create table test(id int primary key, name varchar)");
...@@ -136,9 +139,12 @@ public class TestRecovery extends TestBase { ...@@ -136,9 +139,12 @@ public class TestRecovery extends TestBase {
} }
private void testCorrupt() throws Exception { private void testCorrupt() throws Exception {
DeleteDbFiles.execute(getBaseDir(), "recovery", true); if (config.mvStore) {
// not needed for MV_STORE=TRUE // not needed for MV_STORE=TRUE
Connection conn = getConnection("recovery;MV_STORE=false"); return;
}
DeleteDbFiles.execute(getBaseDir(), "recovery", true);
Connection conn = getConnection("recovery");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table test(id int, name varchar) as select 1, 'Hello World1'"); stat.execute("create table test(id int, name varchar) as select 1, 'Hello World1'");
conn.close(); conn.close();
...@@ -163,9 +169,12 @@ public class TestRecovery extends TestBase { ...@@ -163,9 +169,12 @@ public class TestRecovery extends TestBase {
} }
private void testWithTransactionLog() throws SQLException { private void testWithTransactionLog() throws SQLException {
DeleteDbFiles.execute(getBaseDir(), "recovery", true); if (config.mvStore) {
// not needed for MV_STORE=TRUE // not needed for MV_STORE=TRUE
Connection conn = getConnection("recovery;MV_STORE=false"); return;
}
DeleteDbFiles.execute(getBaseDir(), "recovery", true);
Connection conn = getConnection("recovery");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table truncate(id int primary key) as select x from system_range(1, 1000)"); stat.execute("create table truncate(id int primary key) as select x from system_range(1, 1000)");
stat.execute("create table test(id int primary key, data int, text varchar)"); stat.execute("create table test(id int primary key, data int, text varchar)");
...@@ -198,10 +207,10 @@ public class TestRecovery extends TestBase { ...@@ -198,10 +207,10 @@ public class TestRecovery extends TestBase {
// expected // expected
} }
Recover.main("-dir", getBaseDir(), "-db", "recovery"); Recover.main("-dir", getBaseDir(), "-db", "recovery");
conn = getConnection("recovery;MV_STORE=false"); conn = getConnection("recovery");
conn.close(); conn.close();
Recover.main("-dir", getBaseDir(), "-db", "recovery", "-removePassword"); Recover.main("-dir", getBaseDir(), "-db", "recovery", "-removePassword");
conn = getConnection("recovery;MV_STORE=false", getUser(), ""); conn = getConnection("recovery", getUser(), "");
conn.close(); conn.close();
DeleteDbFiles.execute(getBaseDir(), "recovery", true); DeleteDbFiles.execute(getBaseDir(), "recovery", true);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论