提交 a0e2fc46 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting, documentation

上级 68a0ed13
......@@ -17,7 +17,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>OSGi: the MVStore packages are now exported.
<ul><li>MVStore: improved error messages and logging;
improved behavior if there is an error when serializing objects.
</li><li>OSGi: the MVStore packages are now exported.
</li><li>With the MVStore option, when using multiple threads
that concurrently create indexes or tables,
it was relatively easy to get a lock timeout on the "SYS" table.
......
......@@ -9,6 +9,8 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.h2.engine.SysProperties;
import org.h2.util.New;
import org.h2.util.StringUtils;
......@@ -18,21 +20,6 @@ import org.h2.util.StringUtils;
*/
public class DbSchema {
/**
* Up to this many tables, the column type and indexes are listed.
*/
public static final int MAX_TABLES_LIST_INDEXES = 100;
/**
* Up to this many tables, the column names are listed.
*/
public static final int MAX_TABLES_LIST_COLUMNS = 500;
/**
* Up to this many tables, the column names are listed.
*/
public static final int MAX_PROCEDURES_LIST_COLUMNS = 500;
/**
* The schema name.
*/
......@@ -132,7 +119,7 @@ public class DbSchema {
rs.close();
tables = new DbTableOrView[list.size()];
list.toArray(tables);
if (tables.length < MAX_TABLES_LIST_COLUMNS) {
if (tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_COLUMNS) {
for (DbTableOrView tab : tables) {
try {
tab.readColumns(meta);
......@@ -161,7 +148,7 @@ public class DbSchema {
rs.close();
procedures = new DbProcedure[list.size()];
list.toArray(procedures);
if (procedures.length < MAX_PROCEDURES_LIST_COLUMNS) {
if (procedures.length < SysProperties.CONSOLE_MAX_PROCEDURES_LIST_COLUMNS) {
for (DbProcedure procedure : procedures) {
procedure.readParameters(meta);
}
......
......@@ -876,7 +876,11 @@ public class Database implements DataHandler {
* @param session the session
* @return whether it was already locked before by this session
*/
public synchronized boolean lockMeta(Session session) {
public boolean lockMeta(Session session) {
// this method can not be synchronized on the database object,
// as unlocking is also synchronized on the database object -
// so if locking starts just before unlocking, locking could
// never be successful
if (meta == null) {
return true;
}
......
......@@ -89,8 +89,9 @@ public class DbSettings extends SettingsBase {
/**
* Database setting <code>DEFRAG_ALWAYS</code> (default: false).<br />
* Each time the database is closed, it is fully defragmented (SHUTDOWN
* DEFRAG).
* Each time the database is closed normally, it is fully defragmented (the
* same as SHUTDOWN DEFRAG). If you execute SHUTDOWN COMPACT, then this
* setting is ignored.
*/
public final boolean defragAlways = get("DEFRAG_ALWAYS", false);
......@@ -314,7 +315,7 @@ public class DbSettings extends SettingsBase {
/**
* Database setting <code>MV_STORE</code>
* (default: false).<br />
* (default: false for version 1.3, true for version 1.4).<br />
* Use the MVStore storage engine.
*/
public boolean mvStore = get("MV_STORE", Constants.VERSION_MINOR >= 4);
......
......@@ -774,14 +774,12 @@ public class Session extends SessionWithState {
}
}
if (locks.size() > 0) {
synchronized (database) {
// don't use the enhanced for loop to save memory
for (int i = 0, size = locks.size(); i < size; i++) {
Table t = locks.get(i);
t.unlock(this);
}
locks.clear();
// don't use the enhanced for loop to save memory
for (int i = 0, size = locks.size(); i < size; i++) {
Table t = locks.get(i);
t.unlock(this);
}
locks.clear();
}
savepoints = null;
sessionStateChanged = true;
......
......@@ -150,6 +150,30 @@ public class SysProperties {
public static final int COLLATOR_CACHE_SIZE =
Utils.getProperty("h2.collatorCacheSize", 32000);
/**
* System property <code>h2.consoleTableIndexes</code>
* (default: 100).<br />
* Up to this many tables, the column type and indexes are listed.
*/
public static final int CONSOLE_MAX_TABLES_LIST_INDEXES =
Utils.getProperty("h2.consoleTableIndexes", 100);
/**
* System property <code>h2.consoleTableColumns</code>
* (default: 500).<br />
* Up to this many tables, the column names are listed.
*/
public static final int CONSOLE_MAX_TABLES_LIST_COLUMNS =
Utils.getProperty("h2.consoleTableColumns", 300);
/**
* System property <code>h2.consoleProcedureColumns</code>
* (default: 500).<br />
* Up to this many procedures, the column names are listed.
*/
public static final int CONSOLE_MAX_PROCEDURES_LIST_COLUMNS =
Utils.getProperty("h2.consoleProcedureColumns", 300);
/**
* System property <code>h2.consoleStream</code> (default: true).<br />
* H2 Console: stream query results.
......
......@@ -374,7 +374,7 @@ Sets the collation used for comparing strings."
"Commands (Other)","SET COMPRESS_LOB","
SET COMPRESS_LOB { NO | LZF | DEFLATE }
","
Sets the compression algorithm for BLOB and CLOB data."
This feature is only available for the PageStore storage engine."
"Commands (Other)","SET DATABASE_EVENT_LISTENER","
SET DATABASE_EVENT_LISTENER classNameString
","
......
......@@ -613,7 +613,7 @@ public class WebApp {
return treeIndex;
}
boolean isOracle = schema.getContents().isOracle();
boolean notManyTables = tables.length < DbSchema.MAX_TABLES_LIST_INDEXES;
boolean notManyTables = tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_INDEXES;
for (DbTableOrView table : tables) {
if (table.isView()) {
continue;
......
......@@ -761,7 +761,7 @@ public class Transfer {
public void verifyLobMac(byte[] hmac, long lobId) {
byte[] result = calculateLobMac(lobId);
if (!Utils.compareSecure(hmac, result)) {
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1,
throw DbException.get(ErrorCode.CONNECTION_BROKEN_1,
"Invalid lob hmac; possibly the connection was re-opened internally");
}
}
......
......@@ -793,7 +793,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestPgServer().runTest(this);
new TestReader().runTest(this);
new TestRecovery().runTest(this);
new TestSampleApps().runTest(this);
new TestWeb().runTest(this);
new TestScriptReader().runTest(this);
runTest("org.h2.test.unit.TestServlet");
new TestSecurity().runTest(this);
......
......@@ -60,7 +60,7 @@ public class TestConcurrent extends TestMVStore {
testConcurrentWrite();
testConcurrentRead();
}
private void testConcurrentAutoCommitAndChange() throws InterruptedException {
String fileName = "memFS:testConcurrentChangeAndBackgroundCompact";
FileUtils.delete(fileName);
......
......@@ -3,6 +3,43 @@
-- Initial Developer: H2 Group
--
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table results(eventId int, points int, studentId int);
> ok
insert into results values(1, 10, 1), (2, 20, 1), (3, 5, 1);
> update count: 3
insert into results values(1, 10, 2), (2, 20, 2), (3, 5, 2);
> update count: 3
insert into results values(1, 10, 3), (2, 20, 3), (3, 5, 3);
> update count: 3
SELECT SUM(points) FROM RESULTS
WHERE eventID IN
(SELECT eventID FROM RESULTS
WHERE studentID = 2
ORDER BY points DESC
LIMIT 2 )
AND studentID = 2;
SELECT eventID FROM RESULTS
WHERE studentID = 2
ORDER BY points DESC
LIMIT 2;
SELECT SUM(r.points) FROM RESULTS r,
(SELECT eventID FROM RESULTS
WHERE studentID = 2
ORDER BY points DESC
LIMIT 2 ) r2
WHERE r2.eventID = r.eventId
AND studentID = 2;
drop table results;
> ok
create table test(a int, b int);
> ok
......
......@@ -764,4 +764,4 @@ operate resized jni yjp ownable starvation reaper biased introduce epoll hangs
compaction aggressive powerful traversing pietrzak michi karl rewriting consequences
linearly patching perfect hole sip enwiki flooding uniformly recursions happening
permanently thrusted nucleus forbidden
......@@ -374,7 +374,8 @@ public class ArchiveTool {
new File(name).createNewFile();
remaining = 4;
} else {
fileOut = new BufferedOutputStream(new FileOutputStream(name), 1024 * 1024);
fileOut = new BufferedOutputStream(
new FileOutputStream(name), 1024 * 1024);
}
} else {
file.mkdirs();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论