提交 3905753d authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 98442f5d
......@@ -94,13 +94,14 @@ public class Update extends Prepared {
count++;
}
}
// TODO performance: loop only if required
// TODO self referencing referential integrity constraints don't work if update is multi-row and 'inversed' the condition!
// probably need multi-row triggers with 'deleted' and 'inserted' at the same time. anyway good for sql compatibility
// TODO update in-place (but if the position changes, we need to update all indexes)
// before row triggers
// TODO update in-place (but if the position changes, we need to update all indexes) before row triggers
// the cached row is already updated - we need the old values
table.updateRows(this, session, rows);
if (table.fireRow()) {
rows.invalidateCache();
for (rows.reset(); rows.hasNext();) {
checkCancelled();
Row o = rows.next();
......
......@@ -61,10 +61,7 @@ public class SysProperties {
public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting("h2.lobFilesInDirectories", false);
public static final int LOB_FILES_PER_DIRECTORY = getIntSetting("h2.lobFilesPerDirectory", 256);
public static final boolean NEW_DISPLAY_SIZE = getBooleanSetting("h2.newDisplaySize", true);
private int test;
public static final int DEFAULT_MAX_OPERERATION_MEMORY = getIntSetting("h2.defaultMaxOperationMemory", 0);
// public static final int DEFAULT_MAX_OPERERATION_MEMORY = getIntSetting("h2.defaultMaxOperationMemory", 100000);
// public static final int DEFAULT_MAX_OPERERATION_MEMORY = getIntSetting("h2.defaultMaxOperationMemory", 1);
public static final int DEFAULT_MAX_OPERATION_MEMORY = getIntSetting("h2.defaultMaxOperationMemory", 100000);
private static boolean getBooleanSetting(String name, boolean defaultValue) {
String s = System.getProperty(name);
......
......@@ -145,7 +145,7 @@ public class Database implements DataHandler {
private DatabaseCloser closeOnExit;
private Mode mode = Mode.getInstance(Mode.REGULAR);
private boolean multiThreaded;
private int maxOperationMemory = SysProperties.DEFAULT_MAX_OPERERATION_MEMORY;
private int maxOperationMemory = SysProperties.DEFAULT_MAX_OPERATION_MEMORY;
public Database(String name, ConnectionInfo ci, String cipher) throws SQLException {
this.compareMode = new CompareMode(null, null);
......
......@@ -79,16 +79,22 @@ public class UndoLog {
file.autoDelete();
file.seek(FileStore.HEADER_LENGTH);
rowBuff = DataPage.create(database, Constants.DEFAULT_DATA_PAGE_SIZE);
}
DataPage buff = rowBuff;
for (int i = 0; i < records.size(); i++) {
UndoLogRecord r = (UndoLogRecord) records.get(i);
if (!r.isStored() && r.canStore()) {
r.save(buff, file);
memoryUndo--;
DataPage buff = rowBuff;
for (int i = 0; i < records.size(); i++) {
UndoLogRecord r = (UndoLogRecord) records.get(i);
saveIfPossible(r, buff);
}
} else {
saveIfPossible(entry, rowBuff);
}
}
}
private void saveIfPossible(UndoLogRecord r, DataPage buff) throws SQLException {
if (!r.isStored() && r.canStore()) {
r.save(buff, file);
memoryUndo--;
}
}
}
......@@ -198,7 +198,9 @@ public class Message {
}
}
IOException io = new IOException(e.toString());
io.fillInStackTrace();
//#ifdef JDK14
io.initCause(e);
//#endif
return io;
}
......
......@@ -944,11 +944,12 @@ SET MAX_MEMORY_UNDO 1000
"Commands (Other)","SET MAX_OPERATION_MEMORY","
SET MAX_OPERATION_MEMORY int
","
Sets the maximum memory size used for large operations (delete and insert).
Sets the maximum memory used for large operations (delete and insert), in bytes.
Operations that use more memory are buffered to disk, slowing down the operation.
The default max size is 100000. 0 means no limit.
This setting is not persistent.
Admin rights are required to execute this command.
This setting can be appended to the database URL: jdbc:h2:test;MAX_OPERATION_MEMORY=10000
","
SET MAX_OPERATION_MEMORY 0
"
......
......@@ -18,6 +18,9 @@ import org.h2.util.ObjectArray;
import org.h2.value.Value;
import org.h2.value.ValueLob;
/**
* A list of rows. If the list grows too large, it is buffered to disk automatically.
*/
public class RowList {
private final Session session;
private ObjectArray list = new ObjectArray();
......@@ -29,10 +32,11 @@ public class RowList {
private ObjectArray lobs;
private int memory, maxMemory;
private boolean written;
private boolean readUncached;
public RowList(Session session) {
this.session = session;
if (SysProperties.DEFAULT_MAX_OPERERATION_MEMORY > 0 && session.getDatabase().isPersistent()) {
if (SysProperties.DEFAULT_MAX_OPERATION_MEMORY > 0 && session.getDatabase().isPersistent()) {
maxMemory = session.getDatabase().getMaxOperationMemory();
}
}
......@@ -105,8 +109,6 @@ public class RowList {
}
public void add(Row r) throws SQLException {
int test;
//print(" add " + r);
list.add(r);
memory += r.getMemorySize();
if (maxMemory > 0 && memory > maxMemory) {
......@@ -116,8 +118,6 @@ int test;
}
public void reset() throws SQLException {
int test;
//print(" reset");
index = 0;
if (file != null) {
listIndex = 0;
......@@ -131,8 +131,6 @@ int test;
}
public boolean hasNext() {
int test;
//print(" hasNext " + (index < size) + " index:" + index + " size:" + size);
return index < size;
}
......@@ -143,6 +141,9 @@ int test;
int memory = buff.readInt();
int columnCount = buff.readInt();
int pos = buff.readInt();
if (readUncached) {
pos = 0;
}
boolean deleted = buff.readInt() == 1;
int sessionId = buff.readInt();
int storageId = buff.readInt();
......@@ -163,7 +164,7 @@ int test;
row.setStorageId(storageId);
return row;
}
public Row next() throws SQLException {
Row r;
if (file == null) {
......@@ -193,8 +194,6 @@ int test;
index++;
r = (Row) list.get(listIndex++);
}
int test;
//print(" get " + r + " index:" + index + " listIndex:" + listIndex);
return r;
}
......@@ -202,6 +201,10 @@ int test;
return size;
}
public void invalidateCache() {
readUncached = true;
}
public void close() {
if (file != null) {
file.closeAndDeleteSilently();
......@@ -209,9 +212,5 @@ int test;
rowBuff = null;
}
}
// private void print(String s) {
// int test;
// System.out.println(this + s);
// }
}
......@@ -49,12 +49,6 @@ public class ReaderInputStream extends InputStream {
if (remaining < 0) {
return;
}
// String s = new String(chars, 0, remaining);
// try {
// buffer = StringUtils.asBytes(s);
// } catch(SQLException e) {
// throw new IOException(e.toString());
// }
writer.write(chars, 0, remaining);
writer.flush();
buffer = out.toByteArray();
......
......@@ -150,20 +150,12 @@ java org.h2.test.TestAll timer
/*
support large updates/deletes
Known Problems:
link to history page, bug page
Add a link to the google code bug page
History:
MVCC: now an exception is thrown when an application tries to change the MVCC setting while the database is already open.
Referential integrity checks didn't lock the referenced table, and thus could read uncommitted rows of other connections. In that way the referential contraints could get violated (except when using MVCC).
Renaming or dropping a user with a schema, or removing the admin property of that user made the schema inaccessible after re-opening the database. Fixed.
The H2 Console now also support the command line option -ifExists when started from the Server tool, but only when connecting to H2 databases.
Duplicate column names were not detected when renaming columns. Fixed.
The console did not display multiple embedded spaces in text correctly. Fixed.
Google Android support: use 'ant codeswitchAndroid' to switch the source code to Android.
implement & test: checkpoint commits running transactions
......
......@@ -134,6 +134,10 @@ public abstract class TestBase {
if (config.diskUndo && admin) {
url += ";MAX_MEMORY_UNDO=3";
}
if (config.big && admin) {
// force operations to disk
url += ";MAX_OPERATION_MEMORY=1";
}
if (config.mvcc) {
url += ";MVCC=TRUE";
}
......
......@@ -29,6 +29,7 @@ public class TestBigResult extends TestBase {
Connection conn = getConnection("bigResult");
Statement stat = conn.createStatement();
int len = getSize(10000, 100000);
stat.execute("SET MAX_OPERATION_MEMORY 4096");
stat.execute("CREATE TABLE TEST AS SELECT * FROM SYSTEM_RANGE(1, " + len + ")");
stat.execute("UPDATE TEST SET X=X+1");
stat.execute("DELETE FROM TEST");
......
/*
* Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.tools.i18n;
public class AutoTranslate {
}
......@@ -47,7 +47,7 @@ public class PrepareTranslation {
// create the translated documentation
buildHtml("src/docsrc/text", "docs/html", "en");
// buildHtml("src/docsrc/text", "docs/html", "de");
buildHtml("src/docsrc/text", "docs/html", "de");
buildHtml("src/docsrc/text", "docs/html", "ja");
// convert the properties files back to utf8 text files, including the
......@@ -388,6 +388,8 @@ public class PrepareTranslation {
PropertiesToUTF8.storeProperties(p, main.getAbsolutePath());
for (int i = 0; i < translations.size(); i++) {
File trans = (File) translations.get(i);
String language = trans.getName();
// language = language.substring(language.lastIndexOf('_'), language.lastIndexOf('.'));
prepare(p, base, trans);
}
PropertiesToUTF8.storeProperties(p, baseDir + "/" + main.getName());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论