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

Formatting, documentation

上级 68a0ed13
...@@ -17,7 +17,9 @@ Change Log ...@@ -17,7 +17,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <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 </li><li>With the MVStore option, when using multiple threads
that concurrently create indexes or tables, that concurrently create indexes or tables,
it was relatively easy to get a lock timeout on the "SYS" table. it was relatively easy to get a lock timeout on the "SYS" table.
......
...@@ -9,6 +9,8 @@ import java.sql.DatabaseMetaData; ...@@ -9,6 +9,8 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.engine.SysProperties;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
...@@ -18,21 +20,6 @@ import org.h2.util.StringUtils; ...@@ -18,21 +20,6 @@ import org.h2.util.StringUtils;
*/ */
public class DbSchema { 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. * The schema name.
*/ */
...@@ -132,7 +119,7 @@ public class DbSchema { ...@@ -132,7 +119,7 @@ public class DbSchema {
rs.close(); rs.close();
tables = new DbTableOrView[list.size()]; tables = new DbTableOrView[list.size()];
list.toArray(tables); list.toArray(tables);
if (tables.length < MAX_TABLES_LIST_COLUMNS) { if (tables.length < SysProperties.CONSOLE_MAX_TABLES_LIST_COLUMNS) {
for (DbTableOrView tab : tables) { for (DbTableOrView tab : tables) {
try { try {
tab.readColumns(meta); tab.readColumns(meta);
...@@ -161,7 +148,7 @@ public class DbSchema { ...@@ -161,7 +148,7 @@ public class DbSchema {
rs.close(); rs.close();
procedures = new DbProcedure[list.size()]; procedures = new DbProcedure[list.size()];
list.toArray(procedures); list.toArray(procedures);
if (procedures.length < MAX_PROCEDURES_LIST_COLUMNS) { if (procedures.length < SysProperties.CONSOLE_MAX_PROCEDURES_LIST_COLUMNS) {
for (DbProcedure procedure : procedures) { for (DbProcedure procedure : procedures) {
procedure.readParameters(meta); procedure.readParameters(meta);
} }
......
...@@ -876,7 +876,11 @@ public class Database implements DataHandler { ...@@ -876,7 +876,11 @@ public class Database implements DataHandler {
* @param session the session * @param session the session
* @return whether it was already locked before by this 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) { if (meta == null) {
return true; return true;
} }
......
...@@ -89,8 +89,9 @@ public class DbSettings extends SettingsBase { ...@@ -89,8 +89,9 @@ public class DbSettings extends SettingsBase {
/** /**
* Database setting <code>DEFRAG_ALWAYS</code> (default: false).<br /> * Database setting <code>DEFRAG_ALWAYS</code> (default: false).<br />
* Each time the database is closed, it is fully defragmented (SHUTDOWN * Each time the database is closed normally, it is fully defragmented (the
* DEFRAG). * same as SHUTDOWN DEFRAG). If you execute SHUTDOWN COMPACT, then this
* setting is ignored.
*/ */
public final boolean defragAlways = get("DEFRAG_ALWAYS", false); public final boolean defragAlways = get("DEFRAG_ALWAYS", false);
...@@ -314,7 +315,7 @@ public class DbSettings extends SettingsBase { ...@@ -314,7 +315,7 @@ public class DbSettings extends SettingsBase {
/** /**
* Database setting <code>MV_STORE</code> * 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. * Use the MVStore storage engine.
*/ */
public boolean mvStore = get("MV_STORE", Constants.VERSION_MINOR >= 4); public boolean mvStore = get("MV_STORE", Constants.VERSION_MINOR >= 4);
......
...@@ -774,7 +774,6 @@ public class Session extends SessionWithState { ...@@ -774,7 +774,6 @@ public class Session extends SessionWithState {
} }
} }
if (locks.size() > 0) { if (locks.size() > 0) {
synchronized (database) {
// don't use the enhanced for loop to save memory // don't use the enhanced for loop to save memory
for (int i = 0, size = locks.size(); i < size; i++) { for (int i = 0, size = locks.size(); i < size; i++) {
Table t = locks.get(i); Table t = locks.get(i);
...@@ -782,7 +781,6 @@ public class Session extends SessionWithState { ...@@ -782,7 +781,6 @@ public class Session extends SessionWithState {
} }
locks.clear(); locks.clear();
} }
}
savepoints = null; savepoints = null;
sessionStateChanged = true; sessionStateChanged = true;
} }
......
...@@ -150,6 +150,30 @@ public class SysProperties { ...@@ -150,6 +150,30 @@ public class SysProperties {
public static final int COLLATOR_CACHE_SIZE = public static final int COLLATOR_CACHE_SIZE =
Utils.getProperty("h2.collatorCacheSize", 32000); 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 /> * System property <code>h2.consoleStream</code> (default: true).<br />
* H2 Console: stream query results. * H2 Console: stream query results.
......
...@@ -374,7 +374,7 @@ Sets the collation used for comparing strings." ...@@ -374,7 +374,7 @@ Sets the collation used for comparing strings."
"Commands (Other)","SET COMPRESS_LOB"," "Commands (Other)","SET COMPRESS_LOB","
SET COMPRESS_LOB { NO | LZF | DEFLATE } 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"," "Commands (Other)","SET DATABASE_EVENT_LISTENER","
SET DATABASE_EVENT_LISTENER classNameString SET DATABASE_EVENT_LISTENER classNameString
"," ","
......
...@@ -613,7 +613,7 @@ public class WebApp { ...@@ -613,7 +613,7 @@ public class WebApp {
return treeIndex; return treeIndex;
} }
boolean isOracle = schema.getContents().isOracle(); 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) { for (DbTableOrView table : tables) {
if (table.isView()) { if (table.isView()) {
continue; continue;
......
...@@ -793,7 +793,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -793,7 +793,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestPgServer().runTest(this); new TestPgServer().runTest(this);
new TestReader().runTest(this); new TestReader().runTest(this);
new TestRecovery().runTest(this); new TestRecovery().runTest(this);
new TestSampleApps().runTest(this); new TestWeb().runTest(this);
new TestScriptReader().runTest(this); new TestScriptReader().runTest(this);
runTest("org.h2.test.unit.TestServlet"); runTest("org.h2.test.unit.TestServlet");
new TestSecurity().runTest(this); new TestSecurity().runTest(this);
......
...@@ -3,6 +3,43 @@ ...@@ -3,6 +3,43 @@
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- 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); create table test(a int, b int);
> ok > ok
......
...@@ -764,4 +764,4 @@ operate resized jni yjp ownable starvation reaper biased introduce epoll hangs ...@@ -764,4 +764,4 @@ operate resized jni yjp ownable starvation reaper biased introduce epoll hangs
compaction aggressive powerful traversing pietrzak michi karl rewriting consequences compaction aggressive powerful traversing pietrzak michi karl rewriting consequences
linearly patching perfect hole sip enwiki flooding uniformly recursions happening linearly patching perfect hole sip enwiki flooding uniformly recursions happening
permanently thrusted nucleus forbidden
...@@ -374,7 +374,8 @@ public class ArchiveTool { ...@@ -374,7 +374,8 @@ public class ArchiveTool {
new File(name).createNewFile(); new File(name).createNewFile();
remaining = 4; remaining = 4;
} else { } else {
fileOut = new BufferedOutputStream(new FileOutputStream(name), 1024 * 1024); fileOut = new BufferedOutputStream(
new FileOutputStream(name), 1024 * 1024);
} }
} else { } else {
file.mkdirs(); file.mkdirs();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论