提交 065aa507 authored 作者: Thomas Mueller's avatar Thomas Mueller

Prepare release.

上级 121598c2
...@@ -60,8 +60,8 @@ Change Log ...@@ -60,8 +60,8 @@ Change Log
Previously it would throw an exception, now it works. Previously it would throw an exception, now it works.
</li><li>Issue 484: In the H2 Console tool, all schemas starting with "INFO" where hidden. </li><li>Issue 484: In the H2 Console tool, all schemas starting with "INFO" where hidden.
Now they are hidden only if the database is not H2. Patch from "mgcodeact"/"cumer d" Now they are hidden only if the database is not H2. Patch from "mgcodeact"/"cumer d"
</li><li>MySQL compatibiltity, support the "AUTO_INCREMENT=3" part of the CREATE TABLE statement. </li><li>MySQL compatibility, support the "AUTO_INCREMENT=3" part of the CREATE TABLE statement.
</li><li>Issue 486: MySQL compatibiltity, support the "DEFAULT CHARSET" part of the CREATE TABLE statement. </li><li>Issue 486: MySQL compatibility, support the "DEFAULT CHARSET" part of the CREATE TABLE statement.
</li><li>Issue 487: support the MySQL "SET foreign_key_checks = 0" command </li><li>Issue 487: support the MySQL "SET foreign_key_checks = 0" command
</li><li>Issue 490: support MySQL "USING BTREE" index declaration </li><li>Issue 490: support MySQL "USING BTREE" index declaration
</li><li>Issue 485: Database get corrupted when column is renamed for which check constraint was defined inside create table statement. </li><li>Issue 485: Database get corrupted when column is renamed for which check constraint was defined inside create table statement.
......
...@@ -47,7 +47,8 @@ public class AlterTableRenameColumn extends DefineCommand { ...@@ -47,7 +47,8 @@ public class AlterTableRenameColumn extends DefineCommand {
Database db = session.getDatabase(); Database db = session.getDatabase();
session.getUser().checkRight(table, Right.ALL); session.getUser().checkRight(table, Right.ALL);
table.checkSupportAlter(); table.checkSupportAlter();
// we need to update CHECK constraint since it might reference the name of the column // we need to update CHECK constraint
// since it might reference the name of the column
Expression newCheckExpr = column.getCheckConstraint(session, newName); Expression newCheckExpr = column.getCheckConstraint(session, newName);
table.renameColumn(column, newName); table.renameColumn(column, newName);
column.removeCheckConstraint(); column.removeCheckConstraint();
......
...@@ -687,6 +687,7 @@ public class DataUtils { ...@@ -687,6 +687,7 @@ public class DataUtils {
/** /**
* Create a new IllegalStateException. * Create a new IllegalStateException.
* *
* @param errorCode the error code
* @param message the message * @param message the message
* @param arguments the arguments * @param arguments the arguments
* @return the exception * @return the exception
......
...@@ -1459,7 +1459,8 @@ public class MVStore { ...@@ -1459,7 +1459,8 @@ public class MVStore {
} }
/** /**
* Set the listener to be used for exceptions that occur in the background thread. * Set the listener to be used for exceptions that occur in the background
* thread.
* *
* @param backgroundExceptionListener the listener * @param backgroundExceptionListener the listener
*/ */
......
...@@ -197,7 +197,7 @@ public class MVTableEngine implements TableEngine { ...@@ -197,7 +197,7 @@ public class MVTableEngine implements TableEngine {
public void initTransactions() { public void initTransactions() {
List<Transaction> list = transactionStore.getOpenTransactions(); List<Transaction> list = transactionStore.getOpenTransactions();
for (Transaction t : list) { for (Transaction t : list) {
if (t.getStatus() == Transaction.STATUS_COMITTING) { if (t.getStatus() == Transaction.STATUS_COMMITTING) {
t.commit(); t.commit();
} else if (t.getStatus() != Transaction.STATUS_PREPARED) { } else if (t.getStatus() != Transaction.STATUS_PREPARED) {
t.rollback(); t.rollback();
......
...@@ -147,7 +147,7 @@ public class TransactionStore { ...@@ -147,7 +147,7 @@ public class TransactionStore {
if (undoLog.containsKey(key)) { if (undoLog.containsKey(key)) {
status = Transaction.STATUS_OPEN; status = Transaction.STATUS_OPEN;
} else { } else {
status = Transaction.STATUS_COMITTING; status = Transaction.STATUS_COMMITTING;
} }
name = null; name = null;
} else { } else {
...@@ -239,7 +239,7 @@ public class TransactionStore { ...@@ -239,7 +239,7 @@ public class TransactionStore {
return; return;
} }
synchronized (undoLog) { synchronized (undoLog) {
t.setStatus(Transaction.STATUS_COMITTING); t.setStatus(Transaction.STATUS_COMMITTING);
for (long logId = 0; logId < maxLogId; logId++) { for (long logId = 0; logId < maxLogId; logId++) {
commitIfNeeded(); commitIfNeeded();
long[] undoKey = new long[] { t.getId(), logId }; long[] undoKey = new long[] { t.getId(), logId };
...@@ -504,7 +504,7 @@ public class TransactionStore { ...@@ -504,7 +504,7 @@ public class TransactionStore {
* closed while the transaction is committing. When opening a store, * closed while the transaction is committing. When opening a store,
* such transactions should be committed. * such transactions should be committed.
*/ */
public static final int STATUS_COMITTING = 3; public static final int STATUS_COMMITTING = 3;
/** /**
* The operation type for changes in a map. * The operation type for changes in a map.
......
...@@ -8,6 +8,7 @@ package org.h2.mvstore.rtree; ...@@ -8,6 +8,7 @@ package org.h2.mvstore.rtree;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.h2.mvstore.CursorPos; import org.h2.mvstore.CursorPos;
import org.h2.mvstore.DataUtils; import org.h2.mvstore.DataUtils;
import org.h2.mvstore.MVMap; import org.h2.mvstore.MVMap;
...@@ -61,7 +62,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -61,7 +62,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param x the rectangle * @param x the rectangle
* @return the iterator * @return the iterator
*/ */
public Iterator<SpatialKey> findIntersectingKeys(SpatialKey x) { public RTreeCursor findIntersectingKeys(SpatialKey x) {
checkOpen(); checkOpen();
return new RTreeCursor(root, x) { return new RTreeCursor(root, x) {
@Override @Override
...@@ -77,7 +78,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -77,7 +78,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param x the rectangle * @param x the rectangle
* @return the iterator * @return the iterator
*/ */
public Iterator<SpatialKey> findContainedKeys(SpatialKey x) { public RTreeCursor findContainedKeys(SpatialKey x) {
checkOpen(); checkOpen();
return new RTreeCursor(root, x) { return new RTreeCursor(root, x) {
@Override @Override
...@@ -506,6 +507,12 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -506,6 +507,12 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
return current != null; return current != null;
} }
/**
* Skip over that many entries. This method is relatively fast (for this map
* implementation) even if many entries need to be skipped.
*
* @param n the number of entries to skip
*/
public void skip(long n) { public void skip(long n) {
while (hasNext() && n-- > 0) { while (hasNext() && n-- > 0) {
fetchNext(); fetchNext();
......
...@@ -153,7 +153,8 @@ public class ResultTempTable implements ResultExternal { ...@@ -153,7 +153,8 @@ public class ResultTempTable implements ResultExternal {
} }
try { try {
Database database = session.getDatabase(); Database database = session.getDatabase();
// Need to lock because not all of the code-paths that reach here have already taken this lock, // Need to lock because not all of the code-paths
// that reach here have already taken this lock,
// notably via the close() paths. // notably via the close() paths.
synchronized (session) { synchronized (session) {
synchronized (database) { synchronized (database) {
......
...@@ -244,6 +244,12 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -244,6 +244,12 @@ public class LobStorageBackend implements LobStorageInterface {
} }
} }
/**
* Create a prepared statement, or re-use an existing one.
*
* @param sql the SQL statement
* @return the prepared statement
*/
PreparedStatement prepare(String sql) throws SQLException { PreparedStatement prepare(String sql) throws SQLException {
if (SysProperties.CHECK2) { if (SysProperties.CHECK2) {
if (!Thread.holdsLock(database)) { if (!Thread.holdsLock(database)) {
...@@ -257,6 +263,12 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -257,6 +263,12 @@ public class LobStorageBackend implements LobStorageInterface {
return prep; return prep;
} }
/**
* Allow to re-use the prepared statement.
*
* @param sql the SQL statement
* @param prep the prepared statement
*/
void reuse(String sql, PreparedStatement prep) { void reuse(String sql, PreparedStatement prep) {
if (SysProperties.CHECK2) { if (SysProperties.CHECK2) {
if (!Thread.holdsLock(database)) { if (!Thread.holdsLock(database)) {
......
...@@ -563,6 +563,9 @@ public class Column { ...@@ -563,6 +563,9 @@ public class Column {
checkConstraintSQL = getCheckConstraintSQL(session, name); checkConstraintSQL = getCheckConstraintSQL(session, name);
} }
/**
* Remove the check constraint if there is one.
*/
public void removeCheckConstraint() { public void removeCheckConstraint() {
checkConstraint = null; checkConstraint = null;
checkConstraintSQL = null; checkConstraintSQL = null;
......
...@@ -211,9 +211,10 @@ public class SourceCompiler { ...@@ -211,9 +211,10 @@ public class SourceCompiler {
ByteArrayOutputStream buff = new ByteArrayOutputStream(); ByteArrayOutputStream buff = new ByteArrayOutputStream();
try { try {
ProcessBuilder builder = new ProcessBuilder(); ProcessBuilder builder = new ProcessBuilder();
// The javac executable allows some of it's flags to be smuggled in via environment variables. // The javac executable allows some of it's flags
// But if it sees those flags, it will write out a message to stderr, which messes up our // to be smuggled in via environment variables.
// parsing of the output. // But if it sees those flags, it will write out a message
// to stderr, which messes up our parsing of the output.
builder.environment().remove("JAVA_TOOL_OPTIONS"); builder.environment().remove("JAVA_TOOL_OPTIONS");
builder.command(args); builder.command(args);
......
...@@ -1474,4 +1474,4 @@ public class TestLob extends TestBase { ...@@ -1474,4 +1474,4 @@ public class TestLob extends TestBase {
conn.close(); conn.close();
} }
} }
...@@ -83,7 +83,7 @@ public class TestTableEngines extends TestBase { ...@@ -83,7 +83,7 @@ public class TestTableEngines extends TestBase {
assertEquals("param2", EndlessTableEngine.createTableData.tableEngineParams.get(1)); assertEquals("param2", EndlessTableEngine.createTableData.tableEngineParams.get(1));
conn.close(); conn.close();
if (!config.memory) { if (!config.memory) {
// Test serialisation of table parameters // Test serialization of table parameters
EndlessTableEngine.createTableData.tableEngineParams.clear(); EndlessTableEngine.createTableData.tableEngineParams.clear();
conn = getConnection("tableEngine"); conn = getConnection("tableEngine");
assertEquals(2, EndlessTableEngine.createTableData.tableEngineParams.size()); assertEquals(2, EndlessTableEngine.createTableData.tableEngineParams.size());
......
...@@ -67,6 +67,12 @@ public class FreeSpaceList { ...@@ -67,6 +67,12 @@ public class FreeSpaceList {
"Could not find a free page to allocate"); "Could not find a free page to allocate");
} }
/**
* Mark the space as in use.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public synchronized void markUsed(long pos, int length) { public synchronized void markUsed(long pos, int length) {
int start = (int) (pos / blockSize); int start = (int) (pos / blockSize);
int required = getBlockCount(length); int required = getBlockCount(length);
...@@ -112,6 +118,12 @@ public class FreeSpaceList { ...@@ -112,6 +118,12 @@ public class FreeSpaceList {
} }
} }
/**
* Mark the space as free.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public synchronized void free(long pos, int length) { public synchronized void free(long pos, int length) {
int start = (int) (pos / blockSize); int start = (int) (pos / blockSize);
int required = getBlockCount(length); int required = getBlockCount(length);
......
...@@ -74,6 +74,12 @@ public class FreeSpaceTree { ...@@ -74,6 +74,12 @@ public class FreeSpaceTree {
return pos; return pos;
} }
/**
* Mark the space as in use.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public synchronized void markUsed(long pos, int length) { public synchronized void markUsed(long pos, int length) {
int start = getBlock(pos); int start = getBlock(pos);
int blocks = getBlockCount(length); int blocks = getBlockCount(length);
...@@ -104,6 +110,12 @@ public class FreeSpaceTree { ...@@ -104,6 +110,12 @@ public class FreeSpaceTree {
} }
} }
/**
* Mark the space as free.
*
* @param pos the position in bytes
* @param length the number of bytes
*/
public synchronized void free(long pos, int length) { public synchronized void free(long pos, int length) {
int start = getBlock(pos); int start = getBlock(pos);
int blocks = getBlockCount(length); int blocks = getBlockCount(length);
......
...@@ -106,7 +106,7 @@ public class TestTransactionStore extends TestBase { ...@@ -106,7 +106,7 @@ public class TestTransactionStore extends TestBase {
List<Transaction> list = ts.getOpenTransactions(); List<Transaction> list = ts.getOpenTransactions();
if (list.size() != 0) { if (list.size() != 0) {
tx = list.get(0); tx = list.get(0);
if (tx.getStatus() == Transaction.STATUS_COMITTING) { if (tx.getStatus() == Transaction.STATUS_COMMITTING) {
i++; i++;
} }
} }
......
...@@ -730,7 +730,6 @@ customizers retains scalability assuming gili cancelled departments juerg ...@@ -730,7 +730,6 @@ customizers retains scalability assuming gili cancelled departments juerg
franklin indicated offending unimplemented executors dumping variants franklin indicated offending unimplemented executors dumping variants
presence spiess azeckoski aaron cowwoc decompiles canceling vividsolutions presence spiess azeckoski aaron cowwoc decompiles canceling vividsolutions
quadtree envelope geometry polygon typname intersects wkt intersects wkb quadtree envelope geometry polygon typname intersects wkt intersects wkb
coordinate geometric rates cope attempting sphere hyde clinton coordinate geometric rates cope attempting sphere hyde clinton taskkill
mgcodeact cumer reach notably computation varies smuggled stderr sees messes
computation varies nico devel
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论