提交 8e8786dc authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 51813804
......@@ -18,13 +18,20 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Row level locking for MVCC is now enabled. The exception
'Concurrent update in table ...' is still thrown, but only after the lock timeout.
<ul><li>Multiple UNION queries could not be used in derived tables.
</li><li>Linked tables can now be read-only.
</li><li>Temporary linked tables are now supported.
</li><li>The optimization for IN(...) is now enabled by default. Use -Dh2.optimizeInJoin=false to disable it.
</li><li>It was possible to create tables in read-only databases.
</li><li>SET SCHEMA_SEARCH_PATH is now documented.
</li><li>SET SCHEMA did not work for views.
</li><li>Row level locking for MVCC is now enabled. The exception
'Concurrent update in table ...' is still thrown, but only after the lock timeout.
</li><li>The maximum log file size setting was ignored for large databases.
</li><li>Multi-Version Concurrency (MVCC) may no longer be used when using
the multi-threaded kernel feature (MULTI_THREADED). An exception is thrown
when trying to connect with both settings. Additional synchronization
is required before those features can be used together.
the multi-threaded kernel feature (MULTI_THREADED). An exception is thrown
when trying to connect with both settings. Additional synchronization
is required before those features can be used together.
</li><li>The data type JAVA_OBJECT could not be used in updatable result sets.
</li><li>The system property h2.optimizeInJoin did not work correctly.
</li><li>Conditions such as ID=? AND ID>? were slow.
......
......@@ -100,7 +100,8 @@ spread the word and have translated this project. Also many thanks to the donors
via PayPal:
</p>
<ul>
<li>Ashwin Jayaprakash, USA
<li>Frank Berger, Germany
</li><li>Ashwin Jayaprakash, USA
</li><li>Florent Ramiere, France
</li><li>Jun Iyama, Japan
</li><li>Antonio Casqueiro, Portugal
......
......@@ -42,7 +42,6 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>Test with Spatial DB in a box / JTS (http://docs.codehaus.org/display/GEOS/SpatialDBBox)
</li><li>Optimization: result set caching (like MySQL)
</li><li>Server side cursors
</li><li>Long running queries / errors / trace system table
</li><li>Migrate database tool (also from other database engines)
</li><li>Shutdown compact
</li></ul>
......@@ -58,9 +57,11 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>Linked tables should support a schema name: CREATE LINKED TABLE ... (... [schemaName, ] originalTableString) - DB2: SET SCHEMA after connecting
</li><li>Option to shutdown all the running servers (on the same VM).
</li><li>Support OSGi: http://oscar-osgi.sourceforge.net, http://incubator.apache.org/felix/index.html
</li><li>Optimize ID=? OR ID=?: convert to IN(...)
</li><li>Optimize .. OR .. to UNION if the cost is lower
</li><li>H2 Console: new option 'Open a browser when starting the H2 Console'.
</li><li>Better space re-use in the files after deleting data: shrink the data file without closing the database (if the end of the file is empty)
</li><li>Optimize ID=? OR ID=?: convert to IN(...)
</li><li>Support large updates (use the transaction log to undo).
</li><li>Full outer joins
</li><li>Support trigger on the tables information_schema.tables and ...columns
</li><li>Test very large databases and LOBs (up to 256 GB)
......@@ -386,6 +387,12 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>Support Oracle ROWID (unique identifier for each row).
</li><li>Server mode: Improve performance for batch updates.
</li><li>Applets: Support read-only databases in a zip file (accessed as a resource).
</li><li>Long running queries / errors / trace system table.
</li><li>H2 Console should support JaQu directly.
</li><li>Option to copy the old version of each changed page once after a checkpoint.
</li><li>H2 Console: support single file upload and directory download (optional).
</li><li>Document FTL_SEARCH, FTL_SEARCH_DATA.
</li><li>Support DatabaseMetaData.insertsAreDetected: updatable result sets should detect inserts.
</li></ul>
<h2>Not Planned</h2>
......
......@@ -136,8 +136,6 @@ public class ConditionAndOr extends Condition {
left = right;
right = t;
}
// TODO optimization: convert ((A=1 AND B=2) OR (A=1 AND B=3)) to
// (A=1 AND (B=2 OR B=3))
// this optimization does not work in the following case,
// but NOT is optimized before:
// CREATE TABLE TEST(A INT, B INT);
......@@ -157,6 +155,9 @@ public class ConditionAndOr extends Condition {
}
}
}
// TODO optimization: convert ((A=1 AND B=2) OR (A=1 AND B=3)) to
// (A=1 AND (B=2 OR B=3))
// TODO optimization: convert .. OR .. to UNION if the cost is lower
Value l = left.isConstant() ? left.getValue(session) : null;
Value r = right.isConstant() ? right.getValue(session) : null;
if (l == null && r == null) {
......
......@@ -402,10 +402,10 @@ CREATE INDEX IDXNAME ON TEST(NAME)
"
"Commands (DDL)","CREATE LINKED TABLE","
CREATE LINKED TABLE [IF NOT EXISTS]
CREATE [[GLOBAL | LOCAL] TEMPORARY] LINKED TABLE [IF NOT EXISTS]
name(driverString, urlString,
userString, passwordString, originalTableString)
[EMIT UPDATES]
[EMIT UPDATES | READONLY]
","
Creates a table link to an external table.
The driver name may be empty if the driver is already loaded.
......@@ -1110,6 +1110,18 @@ This setting can be appended to the database URL: jdbc:h2:test;SCHEMA=ABC
SET SCHEMA INFORMATION_SCHEMA
"
"Commands (Other)","SET SCHEMA_SEARCH_PATH","
SET SCHEMA_SEARCH_PATH schemaName [,...]
","
Changes the schema search path of the current connection.
The default schema is used in statements where no schema is set explicitly.
The default schema for new connections is PUBLIC.
This command does not commit a transaction, and rollback does not affect it.
This setting can be appended to the database URL: jdbc:h2:test;SCHEMA_SEARCH_PATH=ABC,DEF
","
SET SCHEMA_SEARCH_PATH INFORMATION_SCHEMA, PUBLIC
"
"Commands (Other)","SET THROTTLE","
SET THROTTLE int
","
......
......@@ -273,47 +273,33 @@ java org.h2.test.TestAll timer
/*
row level locking for mvcc
main methods for the tests and make that work
H2 Console: don't display very large blobs; instead show first view bytes and length
MVCC:
Concurrent update in table test: another transaction has updated or
deleted the same row when exactly does it occur in other databases
(PostgreSQL, Oracle)?
Run benchmark with the newest versions of other databases.
documentation: use 'server mode' not 'remote mode'.
CREATE LINKED TABLE ... READONLY
CREATE FUNCTION? Function interface
main methods for the tests and make that work
Support large updates (use the transaction log to undo).
H2 Console: support single file upload and directory download (optional)
document FTL_SEARCH, FTL_SEARCH_DATA
find quote:
You can't make a system that will not lose data, you can only make
a system that knows the last save point of 100% integrity. There are
too many variables and too much randomness on a cold hard power failure.
JaQu
H2 Console should support Java Queries
row level locking
not tested:
PreparedProcedure PREPARE <name>(column,...) AS ...
Procedure
DeallocateProcedure DEALLOCATE [PLAN] <name>
ExecuteProcedure EXECUTE <name>[([p[,...])]
Concurrent update in table test: another transaction has updated or
deleted the same row when exactly does it occur in other databases
(PostgreSQL, Oracle)?
in help.csv, use complete examples for functions; add a test case
option to write complete page right after checkpoint
test case for out of memory (try to corrupt the database using out of memory)
analyzer configuration option for the fulltext search
optimize where x not in (select):
......
......@@ -24,6 +24,7 @@ public class TestLinkedTable extends TestBase {
public void test() throws Exception {
// testLinkAutoAdd();
testReadOnlyLinkedTable();
testLinkOtherSchema();
testLinkDrop();
testLinkSchema();
......@@ -51,6 +52,40 @@ public class TestLinkedTable extends TestBase {
// ca.close();
// cb.close();
// }
private void testReadOnlyLinkedTable() throws Exception {
Class.forName("org.h2.Driver");
Connection ca = DriverManager.getConnection("jdbc:h2:mem:one", "sa", "sa");
Connection cb = DriverManager.getConnection("jdbc:h2:mem:two", "sa", "sa");
Statement sa = ca.createStatement();
Statement sb = cb.createStatement();
sa.execute("CREATE TABLE TEST(ID INT)");
sa.execute("INSERT INTO TEST VALUES(1)");
String[] suffix = new String[]{"", "READONLY", "EMIT UPDATES"};
for (int i = 0; i < suffix.length; i++) {
String sql = "CREATE LINKED TABLE T(NULL, 'jdbc:h2:mem:one', 'sa', 'sa', 'TEST')" + suffix[i];
sb.execute(sql);
sb.executeQuery("SELECT * FROM T");
String[] update = new String[]{"DELETE FROM T", "INSERT INTO T VALUES(2)", "UPDATE T SET ID = 3"};
for (int j = 0; j < update.length; j++) {
try {
sb.execute(update[j]);
if (i == 1) {
fail();
}
} catch (SQLException e) {
if (i == 1) {
assertKnownException(e);
} else {
throw e;
}
}
}
sb.execute("DROP TABLE T");
}
ca.close();
cb.close();
}
private void testLinkOtherSchema() throws Exception {
Class.forName("org.h2.Driver");
......
......@@ -210,8 +210,11 @@ public class TestOptimizations extends TestBase {
deleteDb("optimizations");
Connection conn = getConnection("optimizations");
Statement stat = conn.createStatement();
testQuerySpeed(stat,
"select sum(x) from system_range(1, 10000) a where a.x in (select b.x from system_range(1, 30) b)");
// if h2.optimizeInJoin is enabled, the following query can not be improved
if (!SysProperties.optimizeInJoin) {
testQuerySpeed(stat,
"select sum(x) from system_range(1, 10000) a where a.x in (select b.x from system_range(1, 30) b)");
}
testQuerySpeed(stat,
"select sum(a.n), sum(b.x) from system_range(1, 100) b, (select sum(x) n from system_range(1, 4000)) a");
conn.close();
......
......@@ -9,6 +9,7 @@ package org.h2.test.db;
import java.io.File;
import java.io.RandomAccessFile;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
......@@ -26,14 +27,41 @@ public class TestReadOnly extends TestBase {
if (config.memory) {
return;
}
testReadOnlyDbCreate();
testReadOnlyFiles(true);
if (!config.deleteIndex) {
testReadOnlyFiles(false);
}
}
private void testReadOnlyDbCreate() throws Exception {
if (config.deleteIndex) {
return;
}
deleteDb("readonly");
Connection conn = getConnection("readonly");
conn.close();
conn = getConnection("readonly;ACCESS_MODE_LOG=r;ACCESS_MODE_DATA=r");
Statement stat = conn.createStatement();
try {
stat.execute("CREATE TABLE TEST(ID INT)");
fail();
} catch (SQLException e) {
assertKnownException(e);
}
try {
stat.execute("SELECT * FROM TEST");
fail();
} catch (SQLException e) {
assertKnownException(e);
}
stat.execute("create local temporary linked table test(null, 'jdbc:h2:mem:test3', 'sa', 'sa', 'INFORMATION_SCHEMA.TABLES')");
ResultSet rs = stat.executeQuery("select * from test");
assertTrue(rs.next());
conn.close();
}
private void testReadOnlyFiles(boolean setReadOnly) throws Exception {
File f = File.createTempFile("test", "temp");
assertTrue(f.canWrite());
f.setReadOnly();
......
......@@ -19,6 +19,9 @@ import org.h2.test.TestBase;
public class TestSessionsLocks extends TestBase {
public void test() throws Exception {
if (config.mvcc) {
return;
}
testCancelStatement();
testLocks();
}
......
......@@ -18,6 +18,36 @@ import org.h2.test.TestBase;
public class TestView extends TestBase {
public void test() throws Exception {
testUnionReconnect();
testManyViews();
}
private void testUnionReconnect() throws Exception {
if (config.memory) {
return;
}
deleteDb("view");
Connection conn = getConnection("view");
Statement stat = conn.createStatement();
stat.execute("create table t1(k smallint, ts timestamp(6))");
stat.execute("create table t2(k smallint, ts timestamp(6))");
stat.execute("create table t3(k smallint, ts timestamp(6))");
stat.execute("create view v_max_ts as select " +
"max(ts) from (select max(ts) as ts from t1 " +
"union select max(ts) as ts from t2 " +
"union select max(ts) as ts from t3)");
stat.execute("create view v_test as select max(ts) as ts from t1 " +
"union select max(ts) as ts from t2 " +
"union select max(ts) as ts from t3");
conn.close();
conn = getConnection("view");
stat = conn.createStatement();
stat.execute("select * from v_max_ts");
conn.close();
deleteDb("view");
}
private void testManyViews() throws Exception {
deleteDb("view");
Connection conn = getConnection("view");
Statement s = conn.createStatement();
......
......@@ -17,12 +17,12 @@ import org.h2.util.BitField;
*/
public class TestBitField extends TestBase {
public void test() throws Exception {
public void test() {
testRandom();
testGetSet();
}
private void testRandom() throws Exception {
private void testRandom() {
BitField bits = new BitField();
BitSet set = new BitSet();
int max = 300;
......@@ -46,26 +46,26 @@ public class TestBitField extends TestBase {
}
}
private void testGetSet() throws Exception {
private void testGetSet() {
BitField bits = new BitField();
for (int i = 0; i < 10000; i++) {
bits.set(i);
if (!bits.get(i)) {
throw new Exception("not set: " + i);
fail("not set: " + i);
}
if (bits.get(i + 1)) {
throw new Exception("set: " + i);
fail("set: " + i);
}
}
for (int i = 0; i < 10000; i++) {
if (!bits.get(i)) {
throw new Exception("not set: " + i);
fail("not set: " + i);
}
}
for (int i = 0; i < 1000; i++) {
int k = bits.nextClearBit(0);
if (k != 10000) {
throw new Exception("" + k);
fail("" + k);
}
}
}
......
......@@ -8,6 +8,7 @@ package org.h2.test.unit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Random;
......@@ -18,7 +19,7 @@ import org.h2.test.TestBase;
*/
public class TestCache extends TestBase {
public void test() throws Exception {
public void test() throws SQLException {
if (config.memory) {
return;
}
......
......@@ -6,6 +6,7 @@
*/
package org.h2.test.unit;
import java.sql.SQLException;
import java.util.Random;
import org.h2.test.TestBase;
......@@ -16,7 +17,7 @@ import org.h2.tools.CompressTool;
*/
public class TestCompress extends TestBase {
public void test() throws Exception {
public void test() throws SQLException {
if (config.big) {
for (int i = 0; i < 100; i++) {
test(i);
......@@ -33,7 +34,7 @@ public class TestCompress extends TestBase {
}
}
private void test(int len) throws Exception {
private void test(int len) throws SQLException {
Random r = new Random(len);
for (int pattern = 0; pattern < 4; pattern++) {
byte[] buff = new byte[len];
......
......@@ -28,13 +28,13 @@ public class TestDataPage extends TestBase implements DataHandler {
boolean text;
public void test() throws Exception {
public void test() throws SQLException {
testAll();
text = true;
testAll();
}
private void testAll() throws Exception {
private void testAll() throws SQLException {
DataPage page = DataPage.create(this, 128);
char[] data = new char[0x10000];
......
......@@ -21,7 +21,7 @@ import org.h2.value.Value;
*/
public class TestDate extends TestBase {
public void test() throws Exception {
public void test() throws SQLException {
for (int year = 1970; year < 2070; year++) {
for (int month = 1; month <= 12; month++) {
for (int day = 1; day < 29; day++) {
......
......@@ -16,11 +16,11 @@ import org.h2.util.IntArray;
*/
public class TestIntArray extends TestBase {
public void test() throws Exception {
public void test() {
testRandom();
}
private void testRandom() throws Exception {
private void testRandom() {
IntArray array = new IntArray();
int[] test = new int[0];
Random random = new Random(1);
......
......@@ -18,13 +18,13 @@ public class TestIntIntHashMap extends TestBase {
private Random rand = new Random();
public void test() throws Exception {
public void test() {
rand.setSeed(10);
test(true);
test(false);
}
private void test(boolean random) throws Exception {
private void test(boolean random) {
int len = 2000;
int[] x = new int[len];
for (int i = 0; i < len; i++) {
......
......@@ -24,7 +24,7 @@ public class TestMultiThreadedKernel extends TestBase implements Runnable {
private volatile boolean stop;
public void test() throws Exception {
if (config.networked) {
if (config.networked || config.mvcc) {
return;
}
deleteDb("multiThreadedKernel");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论