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

Prepare release.

上级 121598c2
...@@ -2930,7 +2930,7 @@ CHAR(65) ...@@ -2930,7 +2930,7 @@ CHAR(65)
CONCAT(string, string [,...]) CONCAT(string, string [,...])
"," ","
Combines strings. Combines strings.
Unlike with the operator ""||"", NULL parameters are ignored, Unlike with the operator ""||"", NULL parameters are ignored,
and do not cause the result to become NULL. and do not cause the result to become NULL.
This method returns a string. This method returns a string.
"," ","
...@@ -2941,7 +2941,7 @@ CONCAT(NAME, '!') ...@@ -2941,7 +2941,7 @@ CONCAT(NAME, '!')
CONCAT_WS(separatorString, string, string [,...]) CONCAT_WS(separatorString, string, string [,...])
"," ","
Combines strings with separator. Combines strings with separator.
Unlike with the operator ""||"", NULL parameters are ignored, Unlike with the operator ""||"", NULL parameters are ignored,
and do not cause the result to become NULL. and do not cause the result to become NULL.
This method returns a string. This method returns a string.
"," ","
......
...@@ -53,15 +53,15 @@ Change Log ...@@ -53,15 +53,15 @@ Change Log
</li><li>Fix a NullPointerException when attempting to add foreign key reference to a view. </li><li>Fix a NullPointerException when attempting to add foreign key reference to a view.
</li><li>Add sufficient ClientInfo support to our javax.sql.Connection implementation to make WebSphere happy. </li><li>Add sufficient ClientInfo support to our javax.sql.Connection implementation to make WebSphere happy.
</li><li>Issue 482: class LobStorageBackend$LobInputStream does not override the method InputStream.available(). </li><li>Issue 482: class LobStorageBackend$LobInputStream does not override the method InputStream.available().
</li><li>Fix corruption resulting from a mix of the "WRITE_DELAY=0" option </li><li>Fix corruption resulting from a mix of the "WRITE_DELAY=0" option
and "SELECT DISTINCT" queries that don't fit in memory. and "SELECT DISTINCT" queries that don't fit in memory.
</li><li>Fix the combination of updating a table which contains an LOB, </li><li>Fix the combination of updating a table which contains an LOB,
and reading from the LOB at the same time. and reading from the LOB at the same time.
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.
......
...@@ -28,7 +28,7 @@ public interface AggregateFunction { ...@@ -28,7 +28,7 @@ public interface AggregateFunction {
* the input data. The method should check here if the number of parameters * the input data. The method should check here if the number of parameters
* passed is correct, and if not it should throw an exception. * passed is correct, and if not it should throw an exception.
* *
* @param inputTypes the SQL type of the parameters, {@link java.sql.Types} * @param inputTypes the SQL type of the parameters, {@link java.sql.Types}
* @return the SQL type of the result * @return the SQL type of the result
*/ */
int getType(int[] inputTypes) throws SQLException; int getType(int[] inputTypes) throws SQLException;
......
...@@ -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();
......
...@@ -280,7 +280,7 @@ public class Database implements DataHandler { ...@@ -280,7 +280,7 @@ public class Database implements DataHandler {
public void exceptionThrown(Exception e) { public void exceptionThrown(Exception e) {
setBackgroundException(DbException.convert(e)); setBackgroundException(DbException.convert(e));
} }
}); });
} }
...@@ -1819,7 +1819,7 @@ public class Database implements DataHandler { ...@@ -1819,7 +1819,7 @@ public class Database implements DataHandler {
} }
session.setAllCommitted(); session.setAllCommitted();
} }
private void throwLastBackgroundException() { private void throwLastBackgroundException() {
if (backgroundException != null) { if (backgroundException != null) {
// we don't care too much about concurrency here, // we don't care too much about concurrency here,
...@@ -1832,7 +1832,7 @@ public class Database implements DataHandler { ...@@ -1832,7 +1832,7 @@ public class Database implements DataHandler {
} }
} }
} }
public void setBackgroundException(DbException e) { public void setBackgroundException(DbException e) {
if (backgroundException == null) { if (backgroundException == null) {
backgroundException = e; backgroundException = e;
......
...@@ -28,48 +28,48 @@ public class DataUtils { ...@@ -28,48 +28,48 @@ public class DataUtils {
* An error occurred while reading from the file. * An error occurred while reading from the file.
*/ */
public static final int ERROR_READING_FAILED = 1; public static final int ERROR_READING_FAILED = 1;
/** /**
* An error occurred when trying to write to the file. * An error occurred when trying to write to the file.
*/ */
public static final int ERROR_WRITING_FAILED = 2; public static final int ERROR_WRITING_FAILED = 2;
/** /**
* An internal error occurred. This could be a bug, or a memory corruption * An internal error occurred. This could be a bug, or a memory corruption
* (for example caused by out of memory). * (for example caused by out of memory).
*/ */
public static final int ERROR_INTERNAL = 3; public static final int ERROR_INTERNAL = 3;
/** /**
* The object is already closed. * The object is already closed.
*/ */
public static final int ERROR_CLOSED = 4; public static final int ERROR_CLOSED = 4;
/** /**
* The file format is not supported. * The file format is not supported.
*/ */
public static final int ERROR_UNSUPPORTED_FORMAT = 5; public static final int ERROR_UNSUPPORTED_FORMAT = 5;
/** /**
* The file is corrupt or (for encrypted files) the encryption key is wrong. * The file is corrupt or (for encrypted files) the encryption key is wrong.
*/ */
public static final int ERROR_FILE_CORRUPT = 6; public static final int ERROR_FILE_CORRUPT = 6;
/** /**
* The file is locked. * The file is locked.
*/ */
public static final int ERROR_FILE_LOCKED = 7; public static final int ERROR_FILE_LOCKED = 7;
/** /**
* An error occurred when serializing or de-serializing. * An error occurred when serializing or de-serializing.
*/ */
public static final int ERROR_SERIALIZATION = 8; public static final int ERROR_SERIALIZATION = 8;
/** /**
* The transaction store is corrupt. * The transaction store is corrupt.
*/ */
public static final int ERROR_TRANSACTION_CORRUPT = 100; public static final int ERROR_TRANSACTION_CORRUPT = 100;
/** /**
* A lock timeout occurred. * A lock timeout occurred.
*/ */
...@@ -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
...@@ -708,7 +709,7 @@ public class DataUtils { ...@@ -708,7 +709,7 @@ public class DataUtils {
} }
return e; return e;
} }
private static String formatMessage(int errorCode, String message, Object... arguments) { private static String formatMessage(int errorCode, String message, Object... arguments) {
// convert arguments to strings, to avoid locale specific formatting // convert arguments to strings, to avoid locale specific formatting
for (int i = 0; i < arguments.length; i++) { for (int i = 0; i < arguments.length; i++) {
...@@ -717,15 +718,15 @@ public class DataUtils { ...@@ -717,15 +718,15 @@ public class DataUtils {
arguments[i] = a == null ? "null" : a.toString(); arguments[i] = a == null ? "null" : a.toString();
} }
} }
return MessageFormat.format(message, arguments) + return MessageFormat.format(message, arguments) +
" [" + Constants.VERSION_MAJOR + "." + " [" + Constants.VERSION_MAJOR + "." +
Constants.VERSION_MINOR + "." + Constants.BUILD_ID + Constants.VERSION_MINOR + "." + Constants.BUILD_ID +
"/" + errorCode + "]"; "/" + errorCode + "]";
} }
/** /**
* Get the error code from an exception message. * Get the error code from an exception message.
* *
* @param m the message * @param m the message
* @return the error code, or 0 if none * @return the error code, or 0 if none
*/ */
......
...@@ -19,20 +19,20 @@ public class FreeSpaceBitSet { ...@@ -19,20 +19,20 @@ public class FreeSpaceBitSet {
* The first usable block. * The first usable block.
*/ */
private final int firstFreeBlock; private final int firstFreeBlock;
/** /**
* The block size in bytes. * The block size in bytes.
*/ */
private final int blockSize; private final int blockSize;
/** /**
* The bit set. * The bit set.
*/ */
private final BitSet set = new BitSet(); private final BitSet set = new BitSet();
/** /**
* Create a new free space map. * Create a new free space map.
* *
* @param firstFreeBlock the first free block * @param firstFreeBlock the first free block
* @param blockSize the block size * @param blockSize the block size
*/ */
...@@ -41,7 +41,7 @@ public class FreeSpaceBitSet { ...@@ -41,7 +41,7 @@ public class FreeSpaceBitSet {
this.blockSize = blockSize; this.blockSize = blockSize;
clear(); clear();
} }
/** /**
* Reset the list. * Reset the list.
*/ */
...@@ -49,10 +49,10 @@ public class FreeSpaceBitSet { ...@@ -49,10 +49,10 @@ public class FreeSpaceBitSet {
set.clear(); set.clear();
set.set(0, firstFreeBlock); set.set(0, firstFreeBlock);
} }
/** /**
* Check whether one of the blocks is in use. * Check whether one of the blocks is in use.
* *
* @param pos the position in bytes * @param pos the position in bytes
* @param length the number of bytes * @param length the number of bytes
* @return true if a block is in use * @return true if a block is in use
...@@ -67,10 +67,10 @@ public class FreeSpaceBitSet { ...@@ -67,10 +67,10 @@ public class FreeSpaceBitSet {
} }
return true; return true;
} }
/** /**
* Check whether one of the blocks is free. * Check whether one of the blocks is free.
* *
* @param pos the position in bytes * @param pos the position in bytes
* @param length the number of bytes * @param length the number of bytes
* @return true if a block is free * @return true if a block is free
...@@ -99,48 +99,48 @@ public class FreeSpaceBitSet { ...@@ -99,48 +99,48 @@ public class FreeSpaceBitSet {
int end = set.nextSetBit(start + 1); int end = set.nextSetBit(start + 1);
if (end < 0 || end - start >= blocks) { if (end < 0 || end - start >= blocks) {
set.set(start, start + blocks); set.set(start, start + blocks);
return getPos(start); return getPos(start);
} }
i = end; i = end;
} }
} }
/** /**
* Mark the space as in use. * Mark the space as in use.
* *
* @param pos the position in bytes * @param pos the position in bytes
* @param length the number of 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);
set.set(start, start + blocks); set.set(start, start + blocks);
} }
/** /**
* Mark the space as free. * Mark the space as free.
* *
* @param pos the position in bytes * @param pos the position in bytes
* @param length the number of 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);
set.clear(start, start + blocks); set.clear(start, start + blocks);
} }
private long getPos(int block) { private long getPos(int block) {
return (long) block * (long) blockSize; return (long) block * (long) blockSize;
} }
private int getBlock(long pos) { private int getBlock(long pos) {
return (int) (pos / blockSize); return (int) (pos / blockSize);
} }
private int getBlockCount(int length) { private int getBlockCount(int length) {
return MathUtils.roundUpInt(length, blockSize) / blockSize; return MathUtils.roundUpInt(length, blockSize) / blockSize;
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder buff = new StringBuilder("["); StringBuilder buff = new StringBuilder("[");
......
...@@ -161,7 +161,7 @@ public class MVStore { ...@@ -161,7 +161,7 @@ public class MVStore {
*/ */
private final ConcurrentHashMap<Integer, Chunk> chunks = private final ConcurrentHashMap<Integer, Chunk> chunks =
new ConcurrentHashMap<Integer, Chunk>(); new ConcurrentHashMap<Integer, Chunk>();
/** /**
* The free spaces between the chunks. The first block to use is block 2 * The free spaces between the chunks. The first block to use is block 2
* (the first two blocks are the file header). * (the first two blocks are the file header).
...@@ -235,7 +235,7 @@ public class MVStore { ...@@ -235,7 +235,7 @@ public class MVStore {
* The delay in milliseconds to automatically store changes. * The delay in milliseconds to automatically store changes.
*/ */
private int writeDelay = 1000; private int writeDelay = 1000;
private ExceptionListener backgroundExceptionListener; private ExceptionListener backgroundExceptionListener;
MVStore(HashMap<String, Object> config) { MVStore(HashMap<String, Object> config) {
...@@ -441,7 +441,7 @@ public class MVStore { ...@@ -441,7 +441,7 @@ public class MVStore {
/** /**
* Open the store. * Open the store.
* *
* @throws IllegalStateException if the file is corrupt, or an exception * @throws IllegalStateException if the file is corrupt, or an exception
* occurred while opening * occurred while opening
* @throws IllegalArgumentException if the directory does not exist * @throws IllegalArgumentException if the directory does not exist
...@@ -932,7 +932,7 @@ public class MVStore { ...@@ -932,7 +932,7 @@ public class MVStore {
int chunkLength = buff.position(); int chunkLength = buff.position();
// round to the next block, // round to the next block,
// and one additional block for the file header // and one additional block for the file header
int length = MathUtils.roundUpInt(chunkLength, BLOCK_SIZE) + BLOCK_SIZE; int length = MathUtils.roundUpInt(chunkLength, BLOCK_SIZE) + BLOCK_SIZE;
if (length > buff.capacity()) { if (length > buff.capacity()) {
...@@ -972,7 +972,7 @@ public class MVStore { ...@@ -972,7 +972,7 @@ public class MVStore {
buff.position(0); buff.position(0);
fileWriteCount++; fileWriteCount++;
DataUtils.writeFully(file, filePos, buff); DataUtils.writeFully(file, filePos, buff);
fileSize = Math.max(fileSize, filePos + buff.position()); fileSize = Math.max(fileSize, filePos + buff.position());
if (buff.capacity() <= 4 * 1024 * 1024) { if (buff.capacity() <= 4 * 1024 * 1024) {
writeBuffer = buff; writeBuffer = buff;
...@@ -1457,10 +1457,11 @@ public class MVStore { ...@@ -1457,10 +1457,11 @@ public class MVStore {
} }
return v; return v;
} }
/** /**
* 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
*/ */
public void setBackgroundExceptionListener( public void setBackgroundExceptionListener(
...@@ -1804,7 +1805,7 @@ public class MVStore { ...@@ -1804,7 +1805,7 @@ public class MVStore {
/** /**
* Set the read cache size in MB. * Set the read cache size in MB.
* *
* @param mb the cache size in MB. * @param mb the cache size in MB.
*/ */
public void setCacheSize(long mb) { public void setCacheSize(long mb) {
......
...@@ -31,10 +31,10 @@ import org.h2.util.New; ...@@ -31,10 +31,10 @@ import org.h2.util.New;
* A table engine that internally uses the MVStore. * A table engine that internally uses the MVStore.
*/ */
public class MVTableEngine implements TableEngine { public class MVTableEngine implements TableEngine {
/** /**
* Initialize the MVStore. * Initialize the MVStore.
* *
* @param db the database * @param db the database
* @return the store * @return the store
*/ */
...@@ -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();
......
...@@ -45,7 +45,7 @@ public class TransactionStore { ...@@ -45,7 +45,7 @@ public class TransactionStore {
/** /**
* The undo log. * The undo log.
* If the first entry for a transaction doesn't have a logId of 0, then * If the first entry for a transaction doesn't have a logId of 0, then
* the transaction is committing (partially committed). * the transaction is committing (partially committed).
* Key: [ transactionId, logId ], value: [ opType, mapId, key, oldValue ]. * Key: [ transactionId, logId ], value: [ opType, mapId, key, oldValue ].
*/ */
final MVMap<long[], Object[]> undoLog; final MVMap<long[], Object[]> undoLog;
...@@ -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
...@@ -483,7 +484,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -483,7 +484,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* A cursor to iterate over a subset of the keys. * A cursor to iterate over a subset of the keys.
*/ */
static class RTreeCursor implements Iterator<SpatialKey> { static class RTreeCursor implements Iterator<SpatialKey> {
private final SpatialKey filter; private final SpatialKey filter;
private CursorPos pos; private CursorPos pos;
private SpatialKey current; private SpatialKey current;
...@@ -494,7 +495,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -494,7 +495,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
this.root = root; this.root = root;
this.filter = filter; this.filter = filter;
} }
@Override @Override
public boolean hasNext() { public boolean hasNext() {
if (!initialized) { if (!initialized) {
...@@ -505,7 +506,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -505,7 +506,13 @@ 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();
...@@ -521,13 +528,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -521,13 +528,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
fetchNext(); fetchNext();
return c; return c;
} }
@Override @Override
public void remove() { public void remove() {
throw DataUtils.newUnsupportedOperationException( throw DataUtils.newUnsupportedOperationException(
"Removing is not supported"); "Removing is not supported");
} }
/** /**
* Fetch the next entry if there is one. * Fetch the next entry if there is one.
*/ */
...@@ -563,7 +570,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -563,7 +570,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
} }
current = null; current = null;
} }
// if(pos==null || pos.page != p) { // if(pos==null || pos.page != p) {
// pos = new CursorPos(p, i + 1, pos); // pos = new CursorPos(p, i + 1, pos);
// } else { // } else {
...@@ -574,8 +581,8 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -574,8 +581,8 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// break; // break;
// } // }
// } // }
// //
// if (pos.index < pos.page.getKeyCount()) { // if (pos.index < pos.page.getKeyCount()) {
// pos.index++; // pos.index++;
// } // }
...@@ -645,13 +652,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -645,13 +652,13 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// } // }
// } // }
// } // }
// } // }
// //
// @Override // @Override
// protected void min(Page p, SpatialKey x) { // protected void min(Page p, SpatialKey x) {
// // x // // x
// } // }
// //
// protected void min3(Page p, SpatialKey x) { // protected void min3(Page p, SpatialKey x) {
// while (true) { // while (true) {
// if (p.isLeaf()) { // if (p.isLeaf()) {
...@@ -698,7 +705,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> { ...@@ -698,7 +705,7 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
// } // }
// current = null; // current = null;
// } // }
} }
@Override @Override
......
...@@ -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) {
......
...@@ -597,7 +597,7 @@ public class PgServerThread implements Runnable { ...@@ -597,7 +597,7 @@ public class PgServerThread implements Runnable {
} }
} }
} }
private static void checkParamLength(int expected, int got) { private static void checkParamLength(int expected, int got) {
if (expected != got) { if (expected != got) {
throw DbException.getInvalidValueException("paramLen", got); throw DbException.getInvalidValueException("paramLen", got);
......
...@@ -61,7 +61,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -61,7 +61,7 @@ public class LobStorageBackend implements LobStorageInterface {
JdbcConnection conn; JdbcConnection conn;
final Database database; final Database database;
private final HashMap<String, PreparedStatement> prepared = New.hashMap(); private final HashMap<String, PreparedStatement> prepared = New.hashMap();
private long nextBlock; private long nextBlock;
private final CompressTool compress = CompressTool.getInstance(); private final CompressTool compress = CompressTool.getInstance();
...@@ -156,7 +156,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -156,7 +156,7 @@ public class LobStorageBackend implements LobStorageInterface {
/** /**
* Remove all LOBs for this table. * Remove all LOBs for this table.
* *
* @param tableId the table id * @param tableId the table id
*/ */
public void removeAllForTable(int tableId) { public void removeAllForTable(int tableId) {
...@@ -185,7 +185,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -185,7 +185,7 @@ public class LobStorageBackend implements LobStorageInterface {
/** /**
* Read a block of data from the given LOB. * Read a block of data from the given LOB.
* *
* @param block the block number * @param block the block number
* @return the block (expanded if stored compressed) * @return the block (expanded if stored compressed)
*/ */
...@@ -217,7 +217,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -217,7 +217,7 @@ public class LobStorageBackend implements LobStorageInterface {
* Retrieve the sequence id and position that is smaller than the requested * Retrieve the sequence id and position that is smaller than the requested
* position. Those values can be used to quickly skip to a given position * position. Those values can be used to quickly skip to a given position
* without having to read all data. * without having to read all data.
* *
* @param lob the lob * @param lob the lob
* @param pos the required position * @param pos the required position
* @return null if the data is not available, or an array of two elements: * @return null if the data is not available, or an array of two elements:
...@@ -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)) {
...@@ -465,7 +477,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -465,7 +477,7 @@ public class LobStorageBackend implements LobStorageInterface {
/** /**
* Store a block in the LOB storage. * Store a block in the LOB storage.
* *
* @param lobId the lob id * @param lobId the lob id
* @param seq the sequence number * @param seq the sequence number
* @param pos the position within the lob * @param pos the position within the lob
...@@ -572,12 +584,12 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -572,12 +584,12 @@ public class LobStorageBackend implements LobStorageInterface {
* to the table that contains the LOB column from changing the data under us. * to the table that contains the LOB column from changing the data under us.
*/ */
private final long[] lobMapBlocks; private final long[] lobMapBlocks;
/** /**
* index into the lobMapBlocks array. * index into the lobMapBlocks array.
*/ */
private int lobMapIndex; private int lobMapIndex;
/** /**
* The remaining bytes in the lob. * The remaining bytes in the lob.
*/ */
...@@ -612,7 +624,7 @@ public class LobStorageBackend implements LobStorageInterface { ...@@ -612,7 +624,7 @@ public class LobStorageBackend implements LobStorageInterface {
reuse(sql, prep); reuse(sql, prep);
} }
this.remainingBytes = byteCount; this.remainingBytes = byteCount;
String sql = "SELECT COUNT(*) FROM " + LOB_MAP + " WHERE LOB = ?"; String sql = "SELECT COUNT(*) FROM " + LOB_MAP + " WHERE LOB = ?";
PreparedStatement prep = prepare(sql); PreparedStatement prep = prepare(sql);
prep.setLong(1, lobId); prep.setLong(1, lobId);
......
...@@ -563,11 +563,14 @@ public class Column { ...@@ -563,11 +563,14 @@ 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;
} }
/** /**
* Get the check constraint expression for this column if set. * Get the check constraint expression for this column if set.
* *
......
...@@ -28,7 +28,7 @@ public abstract class TableBase extends Table { ...@@ -28,7 +28,7 @@ public abstract class TableBase extends Table {
private final String tableEngine; private final String tableEngine;
/** Provided table parameters */ /** Provided table parameters */
private List<String> tableEngineParams = new ArrayList<String>(); private List<String> tableEngineParams = new ArrayList<String>();
private final boolean globalTemporary; private final boolean globalTemporary;
public TableBase(CreateTableData data) { public TableBase(CreateTableData data) {
......
...@@ -211,12 +211,13 @@ public class SourceCompiler { ...@@ -211,12 +211,13 @@ 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);
Process p = builder.start(); Process p = builder.start();
copyInThread(p.getInputStream(), buff); copyInThread(p.getInputStream(), buff);
copyInThread(p.getErrorStream(), buff); copyInThread(p.getErrorStream(), buff);
......
...@@ -40,20 +40,20 @@ import org.h2.util.Utils; ...@@ -40,20 +40,20 @@ import org.h2.util.Utils;
* and can convert between Java objects and Values. * and can convert between Java objects and Values.
*/ */
public class DataType { public class DataType {
/** /**
* This constant is used to represent the type of a ResultSet. There is no * This constant is used to represent the type of a ResultSet. There is no
* equivalent java.sql.Types value, but Oracle uses it to represent a * equivalent java.sql.Types value, but Oracle uses it to represent a
* ResultSet (OracleTypes.CURSOR = -10). * ResultSet (OracleTypes.CURSOR = -10).
*/ */
public static final int TYPE_RESULT_SET = -10; public static final int TYPE_RESULT_SET = -10;
/** /**
* The Geometry class. This object is null if the jts jar file is not in the * The Geometry class. This object is null if the jts jar file is not in the
* classpath. * classpath.
*/ */
public static final Class<?> GEOMETRY_CLASS; public static final Class<?> GEOMETRY_CLASS;
private static final String GEOMETRY_CLASS_NAME = "com.vividsolutions.jts.geom.Geometry"; private static final String GEOMETRY_CLASS_NAME = "com.vividsolutions.jts.geom.Geometry";
/** /**
...@@ -169,7 +169,7 @@ public class DataType { ...@@ -169,7 +169,7 @@ public class DataType {
* The number of bytes required for an object. * The number of bytes required for an object.
*/ */
public int memory; public int memory;
static { static {
Class<?> g; Class<?> g;
try { try {
...@@ -960,7 +960,7 @@ public class DataType { ...@@ -960,7 +960,7 @@ public class DataType {
return ValueJavaObject.getNoCopy(x, null); return ValueJavaObject.getNoCopy(x, null);
} }
} }
private static boolean isGeometry(Object x) { private static boolean isGeometry(Object x) {
if (x == null || GEOMETRY_CLASS == null) { if (x == null || GEOMETRY_CLASS == null) {
return false; return false;
......
...@@ -41,7 +41,7 @@ public class ValueGeometry extends Value { ...@@ -41,7 +41,7 @@ public class ValueGeometry extends Value {
public static ValueGeometry getFromGeometry(Object o) { public static ValueGeometry getFromGeometry(Object o) {
return get((Geometry) o); return get((Geometry) o);
} }
private static ValueGeometry get(Geometry g) { private static ValueGeometry get(Geometry g) {
return (ValueGeometry) Value.cache(new ValueGeometry(g)); return (ValueGeometry) Value.cache(new ValueGeometry(g));
} }
......
...@@ -128,7 +128,7 @@ public class TestAlter extends TestBase { ...@@ -128,7 +128,7 @@ public class TestAlter extends TestBase {
execute("insert into test values(3)"); execute("insert into test values(3)");
stat.execute("drop table test"); stat.execute("drop table test");
} }
private void testAlterTableDropIdentityColumn() throws SQLException { private void testAlterTableDropIdentityColumn() throws SQLException {
stat.execute("create table test(id int auto_increment, name varchar)"); stat.execute("create table test(id int auto_increment, name varchar)");
stat.execute("alter table test drop column id"); stat.execute("alter table test drop column id");
......
...@@ -101,7 +101,7 @@ public class TestCases extends TestBase { ...@@ -101,7 +101,7 @@ public class TestCases extends TestBase {
testBinaryCollation(); testBinaryCollation();
deleteDb("cases"); deleteDb("cases");
} }
private void testEmptyStatements() throws SQLException { private void testEmptyStatements() throws SQLException {
Connection conn = getConnection("cases"); Connection conn = getConnection("cases");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
......
...@@ -272,7 +272,7 @@ public class TestCompatibility extends TestBase { ...@@ -272,7 +272,7 @@ public class TestCompatibility extends TestBase {
// this maps to SET REFERENTIAL_INTEGRITY TRUE/FALSE // this maps to SET REFERENTIAL_INTEGRITY TRUE/FALSE
stat.execute("SET foreign_key_checks = 0"); stat.execute("SET foreign_key_checks = 0");
stat.execute("SET foreign_key_checks = 1"); stat.execute("SET foreign_key_checks = 1");
// Check if mysql comments are supported, ensure clean connection // Check if mysql comments are supported, ensure clean connection
conn.close(); conn.close();
conn = getConnection("compatibility;MODE=MYSQL"); conn = getConnection("compatibility;MODE=MYSQL");
......
...@@ -1473,5 +1473,5 @@ public class TestLob extends TestBase { ...@@ -1473,5 +1473,5 @@ public class TestLob extends TestBase {
r.close(); r.close();
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());
......
...@@ -16,12 +16,12 @@ import org.h2.util.MathUtils; ...@@ -16,12 +16,12 @@ import org.h2.util.MathUtils;
* A list that maintains ranges of free space (in blocks). * A list that maintains ranges of free space (in blocks).
*/ */
public class FreeSpaceList { public class FreeSpaceList {
/** /**
* The first usable block. * The first usable block.
*/ */
private final int firstFreeBlock; private final int firstFreeBlock;
/** /**
* The block size in bytes. * The block size in bytes.
*/ */
...@@ -43,10 +43,10 @@ public class FreeSpaceList { ...@@ -43,10 +43,10 @@ public class FreeSpaceList {
*/ */
public synchronized void clear() { public synchronized void clear() {
freeSpaceList.clear(); freeSpaceList.clear();
freeSpaceList.add(new BlockRange(firstFreeBlock, freeSpaceList.add(new BlockRange(firstFreeBlock,
Integer.MAX_VALUE - firstFreeBlock)); Integer.MAX_VALUE - firstFreeBlock));
} }
/** /**
* Allocate a number of blocks and mark them as used. * Allocate a number of blocks and mark them as used.
* *
...@@ -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);
...@@ -158,7 +170,7 @@ public class FreeSpaceList { ...@@ -158,7 +170,7 @@ public class FreeSpaceList {
BlockRange newRange = new BlockRange(start, required); BlockRange newRange = new BlockRange(start, required);
freeSpaceList.add(i, newRange); freeSpaceList.add(i, newRange);
} }
private int getBlockCount(int length) { private int getBlockCount(int length) {
if (length <= 0) { if (length <= 0) {
throw DataUtils.newIllegalStateException( throw DataUtils.newIllegalStateException(
...@@ -199,7 +211,7 @@ public class FreeSpaceList { ...@@ -199,7 +211,7 @@ public class FreeSpaceList {
} }
return start + "-" + (start + length - 1); return start + "-" + (start + length - 1);
} }
} }
} }
...@@ -15,12 +15,12 @@ import org.h2.util.MathUtils; ...@@ -15,12 +15,12 @@ import org.h2.util.MathUtils;
* A list that maintains ranges of free space (in blocks) in a file. * A list that maintains ranges of free space (in blocks) in a file.
*/ */
public class FreeSpaceTree { public class FreeSpaceTree {
/** /**
* The first usable block. * The first usable block.
*/ */
private final int firstFreeBlock; private final int firstFreeBlock;
/** /**
* The block size in bytes. * The block size in bytes.
*/ */
...@@ -45,7 +45,7 @@ public class FreeSpaceTree { ...@@ -45,7 +45,7 @@ public class FreeSpaceTree {
*/ */
public synchronized void clear() { public synchronized void clear() {
freeSpace.clear(); freeSpace.clear();
freeSpace.add(new BlockRange(firstFreeBlock, freeSpace.add(new BlockRange(firstFreeBlock,
Integer.MAX_VALUE - firstFreeBlock)); Integer.MAX_VALUE - firstFreeBlock));
} }
...@@ -73,7 +73,13 @@ public class FreeSpaceTree { ...@@ -73,7 +73,13 @@ 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);
...@@ -103,7 +109,13 @@ public class FreeSpaceTree { ...@@ -103,7 +109,13 @@ public class FreeSpaceTree {
prev.blocks = start - prev.start; prev.blocks = start - prev.start;
} }
} }
/**
* 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);
...@@ -134,15 +146,15 @@ public class FreeSpaceTree { ...@@ -134,15 +146,15 @@ public class FreeSpaceTree {
} }
freeSpace.add(x); freeSpace.add(x);
} }
private long getPos(int block) { private long getPos(int block) {
return (long) block * (long) blockSize; return (long) block * (long) blockSize;
} }
private int getBlock(long pos) { private int getBlock(long pos) {
return (int) (pos / blockSize); return (int) (pos / blockSize);
} }
private int getBlockCount(int length) { private int getBlockCount(int length) {
if (length <= 0) { if (length <= 0) {
throw DataUtils.newIllegalStateException( throw DataUtils.newIllegalStateException(
...@@ -175,7 +187,7 @@ public class FreeSpaceTree { ...@@ -175,7 +187,7 @@ public class FreeSpaceTree {
this.start = start; this.start = start;
this.blocks = blocks; this.blocks = blocks;
} }
@Override @Override
public int compareTo(BlockRange o) { public int compareTo(BlockRange o) {
return start < o.start ? -1 : start > o.start ? 1 : 0; return start < o.start ? -1 : start > o.start ? 1 : 0;
......
...@@ -81,7 +81,7 @@ public class TestDataUtils extends TestBase { ...@@ -81,7 +81,7 @@ public class TestDataUtils extends TestBase {
assertEquals("1,2", m.get("c")); assertEquals("1,2", m.get("c"));
assertEquals("\"test\"", m.get("d")); assertEquals("\"test\"", m.get("d"));
} }
private void testMapRandomized() { private void testMapRandomized() {
Random r = new Random(1); Random r = new Random(1);
String chars = "a_1,\\\":"; String chars = "a_1,\\\":";
......
...@@ -26,20 +26,20 @@ public class TestFreeSpace extends TestBase { ...@@ -26,20 +26,20 @@ public class TestFreeSpace extends TestBase {
testMemoryUsage(); testMemoryUsage();
testPerformance(); testPerformance();
} }
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testSimple(); testSimple();
testRandomized(); testRandomized();
} }
private static void testPerformance() { private static void testPerformance() {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();
FreeSpaceBitSet f = new FreeSpaceBitSet(0, 4096); FreeSpaceBitSet f = new FreeSpaceBitSet(0, 4096);
// 75 ms // 75 ms
// FreeSpaceList f = new FreeSpaceList(0, 4096); // FreeSpaceList f = new FreeSpaceList(0, 4096);
// 13868 ms // 13868 ms
...@@ -58,18 +58,18 @@ public class TestFreeSpace extends TestBase { ...@@ -58,18 +58,18 @@ public class TestFreeSpace extends TestBase {
System.out.println(System.currentTimeMillis() - t); System.out.println(System.currentTimeMillis() - t);
} }
} }
private static void testMemoryUsage() { private static void testMemoryUsage() {
// 16 GB file size // 16 GB file size
long size = 16L * 1024 * 1024 * 1024; long size = 16L * 1024 * 1024 * 1024;
System.gc(); System.gc();
System.gc(); System.gc();
long first = Utils.getMemoryUsed(); long first = Utils.getMemoryUsed();
FreeSpaceBitSet f = new FreeSpaceBitSet(0, 4096); FreeSpaceBitSet f = new FreeSpaceBitSet(0, 4096);
// 512 KB // 512 KB
// FreeSpaceTree f = new FreeSpaceTree(0, 4096); // FreeSpaceTree f = new FreeSpaceTree(0, 4096);
// 64 MB // 64 MB
...@@ -105,7 +105,7 @@ public class TestFreeSpace extends TestBase { ...@@ -105,7 +105,7 @@ public class TestFreeSpace extends TestBase {
assertEquals(f1.toString(), f2.toString()); assertEquals(f1.toString(), f2.toString());
assertEquals(f1.toString(), f3.toString()); assertEquals(f1.toString(), f3.toString());
} }
private void testRandomized() { private void testRandomized() {
FreeSpaceBitSet f1 = new FreeSpaceBitSet(2, 8); FreeSpaceBitSet f1 = new FreeSpaceBitSet(2, 8);
FreeSpaceList f2 = new FreeSpaceList(2, 8); FreeSpaceList f2 = new FreeSpaceList(2, 8);
......
...@@ -273,7 +273,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -273,7 +273,7 @@ public class TestMVRTree extends TestMVStore {
testRandom(true); testRandom(true);
testRandom(false); testRandom(false);
} }
private void testRandomFind() { private void testRandomFind() {
MVStore s = openStore(null); MVStore s = openStore(null);
MVRTreeMap<Integer> m = s.openMap("data", MVRTreeMap<Integer> m = s.openMap("data",
...@@ -284,7 +284,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -284,7 +284,7 @@ public class TestMVRTree extends TestMVStore {
int id = x * max + y; int id = x * max + y;
SpatialKey k = new SpatialKey(id, x, x, y, y); SpatialKey k = new SpatialKey(id, x, x, y, y);
m.put(k, id); m.put(k, id);
} }
} }
Random rand = new Random(1); Random rand = new Random(1);
int operationCount = 1000; int operationCount = 1000;
...@@ -316,7 +316,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -316,7 +316,7 @@ public class TestMVRTree extends TestMVStore {
count++; count++;
} }
assertEquals(intersecting, count); assertEquals(intersecting, count);
} }
} }
private void testRandom(boolean quadraticSplit) { private void testRandom(boolean quadraticSplit) {
......
...@@ -266,7 +266,7 @@ public class TestMVStore extends TestBase { ...@@ -266,7 +266,7 @@ public class TestMVStore extends TestBase {
encryptionKey(passwordChars).open(); encryptionKey(passwordChars).open();
fail(); fail();
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
assertEquals(DataUtils.ERROR_FILE_CORRUPT, assertEquals(DataUtils.ERROR_FILE_CORRUPT,
DataUtils.getErrorCode(e.getMessage())); DataUtils.getErrorCode(e.getMessage()));
} }
assertEquals(0, passwordChars[0]); assertEquals(0, passwordChars[0]);
......
...@@ -88,7 +88,7 @@ public class TestMVTableEngine extends TestBase { ...@@ -88,7 +88,7 @@ public class TestMVTableEngine extends TestBase {
} }
} }
} }
private void testTwoPhaseCommit() throws Exception { private void testTwoPhaseCommit() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true); FileUtils.deleteRecursive(getBaseDir(), true);
Connection conn; Connection conn;
...@@ -204,7 +204,7 @@ public class TestMVTableEngine extends TestBase { ...@@ -204,7 +204,7 @@ public class TestMVTableEngine extends TestBase {
stat.execute("insert into test values(1)"); stat.execute("insert into test values(1)");
stat.execute("shutdown immediately"); stat.execute("shutdown immediately");
JdbcUtils.closeSilently(conn); JdbcUtils.closeSilently(conn);
conn = getConnection(url); conn = getConnection(url);
stat = conn.createStatement(); stat = conn.createStatement();
ResultSet rs = stat.executeQuery("select row_count_estimate " + ResultSet rs = stat.executeQuery("select row_count_estimate " +
......
...@@ -55,7 +55,7 @@ public class TestTransactionStore extends TestBase { ...@@ -55,7 +55,7 @@ public class TestTransactionStore extends TestBase {
testSingleConnection(); testSingleConnection();
testCompareWithPostgreSQL(); testCompareWithPostgreSQL();
} }
private void testStopWhileCommitting() throws Exception { private void testStopWhileCommitting() throws Exception {
String fileName = getBaseDir() + "/testStopWhileCommitting.h3"; String fileName = getBaseDir() + "/testStopWhileCommitting.h3";
FileUtils.delete(fileName); FileUtils.delete(fileName);
...@@ -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++;
} }
} }
...@@ -116,7 +116,7 @@ public class TestTransactionStore extends TestBase { ...@@ -116,7 +116,7 @@ public class TestTransactionStore extends TestBase {
FileUtils.delete(fileName); FileUtils.delete(fileName);
assertFalse(FileUtils.exists(fileName)); assertFalse(FileUtils.exists(fileName));
s.close(); s.close();
FileUtils.delete(fileName); FileUtils.delete(fileName);
} }
} }
......
...@@ -566,7 +566,7 @@ public class TestFileLockSerialized extends TestBase { ...@@ -566,7 +566,7 @@ public class TestFileLockSerialized extends TestBase {
stat.execute("insert into test values(" + i + ", " + i + ")"); stat.execute("insert into test values(" + i + ", " + i + ")");
} }
importFinishedLatch.countDown(); importFinishedLatch.countDown();
select1FinishedLatch.await(); select1FinishedLatch.await();
stat.execute("update test set id2=999 where id=500"); stat.execute("update test set id2=999 where id=500");
...@@ -601,7 +601,7 @@ public class TestFileLockSerialized extends TestBase { ...@@ -601,7 +601,7 @@ public class TestFileLockSerialized extends TestBase {
} }
}; };
selectTask.execute(); selectTask.execute();
importUpdateTask.get(); importUpdateTask.get();
selectTask.get(); selectTask.get();
deleteDb("fileLockSerialized"); deleteDb("fileLockSerialized");
......
...@@ -46,7 +46,7 @@ public class TestPgServer extends TestBase { ...@@ -46,7 +46,7 @@ public class TestPgServer extends TestBase {
testCancelQuery(); testCancelQuery();
testBinaryTypes(); testBinaryTypes();
} }
private boolean getPgJdbcDriver() { private boolean getPgJdbcDriver() {
try { try {
Class.forName("org.postgresql.Driver"); Class.forName("org.postgresql.Driver");
...@@ -146,7 +146,7 @@ public class TestPgServer extends TestBase { ...@@ -146,7 +146,7 @@ public class TestPgServer extends TestBase {
prep.setNull(1, Types.VARCHAR); prep.setNull(1, Types.VARCHAR);
rs = prep.executeQuery(); rs = prep.executeQuery();
assertFalse(rs.next()); assertFalse(rs.next());
prep = conn.prepareStatement("insert into test values(?, ?)"); prep = conn.prepareStatement("insert into test values(?, ?)");
ParameterMetaData meta = prep.getParameterMetaData(); ParameterMetaData meta = prep.getParameterMetaData();
assertEquals(2, meta.getParameterCount()); assertEquals(2, meta.getParameterCount());
...@@ -314,7 +314,7 @@ public class TestPgServer extends TestBase { ...@@ -314,7 +314,7 @@ public class TestPgServer extends TestBase {
if (!getPgJdbcDriver()) { if (!getPgJdbcDriver()) {
return; return;
} }
Server server = Server.createPgServer("-pgPort", "5535", "-pgDaemon", "-key", "test", "mem:test"); Server server = Server.createPgServer("-pgPort", "5535", "-pgDaemon", "-key", "test", "mem:test");
server.start(); server.start();
try { try {
......
...@@ -524,8 +524,8 @@ public class Build extends BuildBase { ...@@ -524,8 +524,8 @@ public class Build extends BuildBase {
mkdir("docs/javadoc"); mkdir("docs/javadoc");
javadoc("-sourcepath", "src/main", "org.h2.jdbc", "org.h2.jdbcx", javadoc("-sourcepath", "src/main", "org.h2.jdbc", "org.h2.jdbcx",
"org.h2.tools", "org.h2.api", "org.h2.constant", "org.h2.fulltext", "org.h2.tools", "org.h2.api", "org.h2.constant", "org.h2.fulltext",
"-classpath", "-classpath",
"ext/" + getLuceneJar() + "ext/" + getLuceneJar() +
File.pathSeparator + "ext/jts-1.13.jar", File.pathSeparator + "ext/jts-1.13.jar",
"-docletpath", "bin" + File.pathSeparator + "temp", "-docletpath", "bin" + File.pathSeparator + "temp",
"-doclet", "org.h2.build.doclet.Doclet"); "-doclet", "org.h2.build.doclet.Doclet");
......
...@@ -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
...@@ -19,7 +19,7 @@ public class JavaProcessKiller { ...@@ -19,7 +19,7 @@ public class JavaProcessKiller {
/** /**
* Kill a certain Java process. The JDK (jps) needs to be in the path. * Kill a certain Java process. The JDK (jps) needs to be in the path.
* *
* @param args the Java process name as listed by jps -l. If not set the * @param args the Java process name as listed by jps -l. If not set the
* Java processes are listed * Java processes are listed
*/ */
...@@ -27,7 +27,7 @@ public class JavaProcessKiller { ...@@ -27,7 +27,7 @@ public class JavaProcessKiller {
public static void main(String... args) { public static void main(String... args) {
new JavaProcessKiller().run(args); new JavaProcessKiller().run(args);
} }
private void run(String... args) { private void run(String... args) {
TreeMap<Integer, String> map = getProcesses(); TreeMap<Integer, String> map = getProcesses();
System.out.println("Processes:"); System.out.println("Processes:");
...@@ -67,7 +67,7 @@ public class JavaProcessKiller { ...@@ -67,7 +67,7 @@ public class JavaProcessKiller {
System.out.println("Processes now:"); System.out.println("Processes now:");
System.out.println(map); System.out.println(map);
} }
private static TreeMap<Integer, String> getProcesses() { private static TreeMap<Integer, String> getProcesses() {
String processList = exec("jps", "-l"); String processList = exec("jps", "-l");
String[] processes = processList.split("\n"); String[] processes = processList.split("\n");
...@@ -83,7 +83,7 @@ public class JavaProcessKiller { ...@@ -83,7 +83,7 @@ public class JavaProcessKiller {
} }
return map; return map;
} }
private static String exec(String... args) { private static String exec(String... args) {
ByteArrayOutputStream err = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
...@@ -122,5 +122,5 @@ public class JavaProcessKiller { ...@@ -122,5 +122,5 @@ public class JavaProcessKiller {
} }
}.run(); }.run();
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论