提交 108cd6a1 authored 作者: Thomas Mueller's avatar Thomas Mueller

Prepare for version 1.3.x beta

上级 db3c045e
......@@ -24,27 +24,28 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
<h2>Version 1.3.x: Planned Changes</h2>
<ul><li>Enable h2.lobInDatabase (store CLOB and BLOB in the database file).
</li><li>Set AUTO_ANALYZE to 2000 (automatic ANALYZE).
</li><li>Enable h2.functionsInSchema (allow to store functions in a schema).
</li><li>Enable h2.selectForUpdateMvcc (MVCC and SELECT FOR UPDATE).
</li><li>Enable h2.largeTransactions (support for very large transactions).
</li><li>Set ANALYZE_AUTO to 2000 (automatic ANALYZE).
</li><li>Enable FUNCTIONS_IN_SCHEMA (allow to store functions in a schema).
</li><li>Enable SELECT_FOR_UPDATE_MVCC (MVCC and SELECT FOR UPDATE).
</li><li>Enable LARGE_TRANSACTIONS (support for very large transactions).
Change documentation for MAX_MEMORY_UNDO in help.csv, because
now changes to tables without a primary key can be buffered to disk.
Later, change MAX_MEMORY_UNDO to reflect number of bytes instead of record
(also remove Constants.UNDO_BLOCK_SIZE).
Later, change undo log file format (fillAligned no longer required; var int).
</li><li>Enable h2.nestedJoins (nested joins and right outer joins).
</li><li>Enable h2.optimizeOr (convert OR conditions to IN(..) if possible).
</li><li>Disable h2.databaseToUpper (database short names are converted to uppercase).
</li><li>Enable h2.dropRestrict (default action for DROP is RESTRICT).
</li><li>Enable NESTED_JOINS (nested joins and right outer joins).
</li><li>Enable OPTIMIZE_OR (convert OR conditions to IN(..) if possible).
</li><li>Disable DATABASE_TO_UPPER (database short names are converted to uppercase).
</li><li>Enable DROP_RESTRICT (default action for DROP is RESTRICT).
Change documentation.
</li><li>Set MAX_MEMORY_ROWS_DISTINCT to a lower value.
</li><li>Enable OPTIMIZE_INSERT_FROM_SELECT (speed up CREATE TABLE ... AS SELECT).
</li><li>Possibly enable QUERY_CACHE_SIZE.
</li><li>Disable DB_CLOSE_ON_EXIT (the shutdown hook) by default.
</li><li>For RUNSCRIPT and SCRIPT (commands and tools), use UTF-8 by default
(ScriptCommand.charset).
</li><li>Use Lucene 3 by default.
</li><li>For RUNSCRIPT and SCRIPT (commands and tools), use UTF-8 by default.
</li><li>Set h2.maxMemoryRowsDistinct to a lower value.
</li><li>Enable h2.optimizeInsertFromSelect (speed up CREATE TABLE ... AS SELECT).
</li><li>Possibly enable h2.queryCacheSize.
</li><li>Possibly enable h2.databaseToUpper.
</li><li>Disable the shutdown hook by default.
</li></ul>
<h2>Priority 1</h2>
......
......@@ -62,7 +62,7 @@ import org.h2.value.ValueString;
*/
public class ScriptCommand extends ScriptBase {
private String charset = SysProperties.FILE_ENCODING;
private String charset = Constants.VERSION_MINOR < 3 ? SysProperties.FILE_ENCODING : Constants.UTF8;
private boolean passwords;
private boolean data;
private boolean settings;
......
......@@ -7,6 +7,7 @@
package org.h2.constant;
import java.util.HashMap;
import org.h2.engine.Constants;
import org.h2.engine.SettingsBase;
/**
......@@ -47,7 +48,7 @@ public class DbSettings extends SettingsBase {
* starting the database. It is not run on local temporary tables, and
* tables that have a trigger on SELECT.
*/
public final int analyzeAuto = get("ANALYZE_AUTO", 0);
public final int analyzeAuto = get("ANALYZE_AUTO", Constants.VERSION_MINOR >= 3 ? 2000 : 0);
/**
* Database setting <code>ANALYZE_SAMPLE</code> (default: 10000).<br />
......@@ -56,13 +57,20 @@ public class DbSettings extends SettingsBase {
public final int analyzeSample = get("ANALYZE_SAMPLE", 10000);
/**
* Database setting <code>databaseToUpper</code> (default: true).<br />
* Database setting <code>DATABASE_TO_UPPER</code> (default: true).<br />
* Database short names are converted to uppercase for the DATABASE()
* function, and in the CATALOG column of all database meta data methods.
* Setting this to "false" is experimental.
*/
// public final boolean databaseToUpper = get("DATABASE_TO_UPPER", Constants.VERSION_MINOR < 3);
public final boolean databaseToUpper = get("DATABASE_TO_UPPER", true);
/**
* Database setting <code>DB_CLOSE_ON_EXIT</code> (default: true).<br />
* Close the database when the virtual machine exits normally, using a shutdown hook.
*/
public final boolean dbCloseOnExit = get("DB_CLOSE_ON_EXIT", Constants.VERSION_MINOR < 3);
/**
* Database setting <code>DEFAULT_ESCAPE</code> (default: \).<br />
* The default escape character for LIKE comparisons. To select no escape
......@@ -83,7 +91,7 @@ public class DbSettings extends SettingsBase {
* with older versions of H2 the default action is currently CASCADE. This will
* change in a future version of H2.
*/
public final boolean dropRestrict = get("DROP_RESTRICT", false);
public final boolean dropRestrict = get("DROP_RESTRICT", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>ESTIMATED_FUNCTION_TABLE_ROWS</code> (default:
......@@ -100,7 +108,7 @@ public class DbSettings extends SettingsBase {
* will always include the schema name in the CREATE ALIAS statement.
* This is not backward compatible with H2 versions 1.2.134 and older.
*/
public final boolean functionsInSchema = get("FUNCTIONS_IN_SCHEMA", false);
public final boolean functionsInSchema = get("FUNCTIONS_IN_SCHEMA", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>LARGE_RESULT_BUFFER_SIZE</code> (default: 4096).<br />
......@@ -113,7 +121,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>LARGE_TRANSACTIONS</code> (default: false).<br />
* Support very large transactions
*/
public final boolean largeTransactions = get("LARGE_TRANSACTIONS", false);
public final boolean largeTransactions = get("LARGE_TRANSACTIONS", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>MAX_COMPACT_COUNT</code>
......@@ -135,7 +143,7 @@ public class DbSettings extends SettingsBase {
* more than this number of rows are in a result set, a temporary table is
* used.
*/
public final int maxMemoryRowsDistinct = get("MAX_MEMORY_ROWS_DISTINCT", Integer.MAX_VALUE);
public final int maxMemoryRowsDistinct = get("MAX_MEMORY_ROWS_DISTINCT", Constants.VERSION_MINOR >= 3 ? 10000 : Integer.MAX_VALUE);
/**
* Database setting <code>MAX_QUERY_TIMEOUT</code> (default: 0).<br />
......@@ -146,10 +154,10 @@ public class DbSettings extends SettingsBase {
public int maxQueryTimeout = get("MAX_QUERY_TIMEOUT", 0);
/**
* Database setting <code>h2.nestedJoins</code> (default: false).<br />
* Database setting <code>NESTED_JOINS</code> (default: false).<br />
* Whether nested joins should be supported.
*/
public final boolean nestedJoins = get("NESTED_JOINS", false);
public final boolean nestedJoins = get("NESTED_JOINS", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>OPTIMIZE_DISTINCT</code> (default: true).<br />
......@@ -178,7 +186,7 @@ public class DbSettings extends SettingsBase {
* Insert into table from query directly bypassing temporary disk storage.
* This also applies to create table as select.
*/
public final boolean optimizeInsertFromSelect = get("OPTIMIZE_INSERT_FROM_SELECT", false);
public final boolean optimizeInsertFromSelect = get("OPTIMIZE_INSERT_FROM_SELECT", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>OPTIMIZE_IN_LIST</code> (default: true).<br />
......@@ -197,7 +205,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>OPTIMIZE_OR</code> (default: false).<br />
* Convert (C=? OR C=?) to (C IN(?, ?)).
*/
public final boolean optimizeOr = get("OPTIMIZE_OR", false);
public final boolean optimizeOr = get("OPTIMIZE_OR", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>OPTIMIZE_SUBQUERY_CACHE</code> (default: true).<br />
......@@ -239,7 +247,7 @@ public class DbSettings extends SettingsBase {
* SELECT statements are cached (excluding UNION and FOR UPDATE statements).
* This works for both statements and prepared statement.
*/
public final int queryCacheSize = get("QUERY_CACHE_SIZE", 0);
public final int queryCacheSize = get("QUERY_CACHE_SIZE", Constants.VERSION_MINOR >= 3 ? 8 : 0);
/**
* Database setting <code>RECOMPILE_ALWAYS</code> (default: false).<br />
......@@ -260,7 +268,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>SELECT_FOR_UPDATE_MVCC</code> (default: false).<br />
* If set, SELECT .. FOR UPDATE queries lock only the selected rows when using MVCC.
*/
public final boolean selectForUpdateMvcc = get("SELECT_FOR_UPDATE_MVCC", false);
public final boolean selectForUpdateMvcc = get("SELECT_FOR_UPDATE_MVCC", Constants.VERSION_MINOR >= 3);
/**
* Database setting <code>SHARE_LINKED_CONNECTIONS</code>
......
......@@ -199,7 +199,7 @@ public class SysProperties {
* System property <code>h2.lobInDatabase</code> (default: false).<br />
* Store LOB files in the database.
*/
public static final boolean LOB_IN_DATABASE = getBooleanSetting("h2.lobInDatabase", Constants.VERSION_MINOR < 3 ? false : true);
public static final boolean LOB_IN_DATABASE = getBooleanSetting("h2.lobInDatabase", Constants.VERSION_MINOR >= 3);
/**
* System property <code>h2.lobClientMaxSizeMemory</code> (default: 65536).<br />
......
......@@ -65,6 +65,7 @@ public class Constants {
* The minor version of this database.
*/
public static final int VERSION_MINOR = 2;
// Build.getLuceneVersion() uses an ugly hack to read this value
/**
* The lock mode that means no locking is used at all.
......
......@@ -200,7 +200,7 @@ public class Database implements DataHandler {
setEventListenerClass(listener);
}
this.multiVersion = ci.getProperty("MVCC", false);
boolean closeAtVmShutdown = ci.getProperty("DB_CLOSE_ON_EXIT", true);
boolean closeAtVmShutdown = dbSettings.dbCloseOnExit;
int traceLevelFile = ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE, TraceSystem.DEFAULT_TRACE_LEVEL_FILE);
int traceLevelSystemOut = ci.getIntProperty(SetTypes.TRACE_LEVEL_SYSTEM_OUT,
TraceSystem.DEFAULT_TRACE_LEVEL_SYSTEM_OUT);
......
......@@ -39,11 +39,11 @@ import org.h2.util.New;
import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils;
//## Java 1.4 end ##
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
import org.apache.lucene.index.IndexModifier;
import org.apache.lucene.search.Hits;
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
import java.io.File;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TopDocs;
......@@ -51,7 +51,7 @@ import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Version;
import org.apache.lucene.index.IndexWriter;
//## LUCENE3 end ##*/
////## LUCENE3 end ##
/**
* This class implements the full text search based on Apache Lucene.
......@@ -268,13 +268,13 @@ public class FullTextLucene extends FullText {
IndexAccess access = INDEX_ACCESS.get(path);
if (access == null) {
try {
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
boolean recreate = !IndexReader.indexExists(path);
Analyzer analyzer = new StandardAnalyzer();
access = new IndexAccess();
access.modifier = new IndexModifier(path, analyzer, recreate);
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
File f = new File(path);
Directory indexDir = FSDirectory.open(f);
boolean recreate = !IndexReader.indexExists(indexDir);
......@@ -286,7 +286,7 @@ public class FullTextLucene extends FullText {
access = new IndexAccess();
access.writer = writer;
access.searcher = new IndexSearcher(reader);
//## LUCENE3 end ##*/
////## LUCENE3 end ##
} catch (IOException e) {
throw convertException(e);
}
......@@ -360,14 +360,14 @@ public class FullTextLucene extends FullText {
synchronized (INDEX_ACCESS) {
try {
INDEX_ACCESS.remove(indexPath);
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
access.modifier.flush();
access.modifier.close();
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
access.searcher.close();
access.writer.close();
//## LUCENE3 end ##*/
////## LUCENE3 end ##
} catch (Exception e) {
throw convertException(e);
}
......@@ -395,7 +395,7 @@ public class FullTextLucene extends FullText {
}
try {
IndexAccess access = getIndexAccess(conn);
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
access.modifier.flush();
String path = getIndexPath(conn);
IndexReader reader = IndexReader.open(path);
......@@ -411,8 +411,8 @@ public class FullTextLucene extends FullText {
for (int i = 0; i < limit && i + offset < max; i++) {
Document doc = hits.doc(i + offset);
float score = hits.score(i + offset);
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
// take a reference as the searcher may change
Searcher searcher = access.searcher;
// reuse the same analyzer; it's thread-safe;
......@@ -436,7 +436,7 @@ public class FullTextLucene extends FullText {
ScoreDoc sd = docs.scoreDocs[i + offset];
Document doc = searcher.doc(sd.doc);
float score = sd.score;
//## LUCENE3 end ##*/
////## LUCENE3 end ##
String q = doc.get(LUCENE_FIELD_QUERY);
if (data) {
int idx = q.indexOf(" WHERE ");
......@@ -459,10 +459,10 @@ public class FullTextLucene extends FullText {
result.addRow(q, score);
}
}
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
// TODO keep it open if possible
reader.close();
//## LUCENE2 end ##
## LUCENE2 end ##*/
} catch (Exception e) {
throw convertException(e);
}
......@@ -605,7 +605,7 @@ public class FullTextLucene extends FullText {
* @param row the row
*/
protected void insert(Object[] row) throws SQLException {
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
String query = getQuery(row);
Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query,
......@@ -637,8 +637,8 @@ public class FullTextLucene extends FullText {
} catch (IOException e) {
throw convertException(e);
}
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
String query = getQuery(row);
Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query,
......@@ -675,7 +675,7 @@ public class FullTextLucene extends FullText {
} catch (IOException e) {
throw convertException(e);
}
//## LUCENE3 end ##*/
////## LUCENE3 end ##
}
/**
......@@ -687,12 +687,12 @@ public class FullTextLucene extends FullText {
String query = getQuery(row);
try {
Term term = new Term(LUCENE_FIELD_QUERY, query);
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
indexAccess.modifier.deleteDocuments(term);
//## LUCENE2 end ##
/*## LUCENE3 begin ##
## LUCENE2 end ##*/
//## LUCENE3 begin ##
indexAccess.writer.deleteDocuments(term);
//## LUCENE3 end ##*/
////## LUCENE3 end ##
} catch (IOException e) {
throw convertException(e);
}
......@@ -726,23 +726,23 @@ public class FullTextLucene extends FullText {
/**
* The index modified.
*/
//## LUCENE2 begin ##
/*## LUCENE2 begin ##
IndexModifier modifier;
//## LUCENE2 end ##
## LUCENE2 end ##*/
/**
* The index writer.
*/
/*## LUCENE3 begin ##
//## LUCENE3 begin ##
IndexWriter writer;
//## LUCENE3 end ##*/
////## LUCENE3 end ##
/**
* The index searcher.
*/
/*## LUCENE3 begin ##
//## LUCENE3 begin ##
Searcher searcher;
//## LUCENE3 end ##*/
////## LUCENE3 end ##
}
}
......@@ -325,7 +325,7 @@ java org.h2.test.TestAll timer
int initialTest;
// System.setProperty("h2.lobInDatabase", "true");
test.nestedJoins = true;
// test.nestedJoins = true;
// System.setProperty("h2.largeTransactions", "true");
// System.setProperty("h2.analyzeAuto", "100");
// System.setProperty("h2.optimizeOr", "true");
......
......@@ -133,9 +133,7 @@ public class Build extends BuildBase {
} else {
SwitchSource.main("-dir", "src", "-version", version, check, noCheck);
}
if (System.getProperty("lucene") != null) {
SwitchSource.main("-dir", "src", "-LUCENE2", "-LUCENE3", "+LUCENE" + getLuceneVersion());
}
SwitchSource.main("-dir", "src", "-LUCENE2", "-LUCENE3", "+LUCENE" + getLuceneVersion());
} catch (IOException e) {
throw new RuntimeException(e);
}
......@@ -260,7 +258,11 @@ public class Build extends BuildBase {
}
private int getLuceneVersion() {
return Integer.parseInt(System.getProperty("lucene", "2"));
// use Lucene 2 for H2 1.2.x, and Lucene 3 for H2 1.3.x.
String s = new String(readFile(new File("src/main/org/h2/engine/Constants.java")));
int idx = s.indexOf("VERSION_MINOR") + "VERSION_MINOR".length() + 3;
int version = Integer.parseInt(s.substring(idx, idx + 1));
return Integer.parseInt(System.getProperty("lucene", "" + version));
}
private String getJarSuffix() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论