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

--no commit message

--no commit message
上级 21b02e28
...@@ -1103,14 +1103,16 @@ public class Database implements DataHandler { ...@@ -1103,14 +1103,16 @@ public class Database implements DataHandler {
pageStore.compact(compactFully); pageStore.compact(compactFully);
} }
} catch (DbException e) { } catch (DbException e) {
if (e.getErrorCode() != ErrorCode.DATABASE_IS_CLOSED){ if (e.getErrorCode() != ErrorCode.DATABASE_IS_CLOSED) {
// e.printStackTrace(); if (SysProperties.CHECK2) {
// TODO don't ignore exceptions e.printStackTrace();
}
} }
traceSystem.getTrace(Trace.DATABASE).error("close", e); traceSystem.getTrace(Trace.DATABASE).error("close", e);
} catch (Throwable t){ } catch (Throwable t) {
// e.printStackTrace(); if (SysProperties.CHECK2) {
// TODO don't ignore exceptions t.printStackTrace();
}
traceSystem.getTrace(Trace.DATABASE).error("close", t); traceSystem.getTrace(Trace.DATABASE).error("close", t);
} }
} }
......
...@@ -21,7 +21,11 @@ import org.h2.value.Value; ...@@ -21,7 +21,11 @@ import org.h2.value.Value;
*/ */
public class HashIndex extends BaseIndex { public class HashIndex extends BaseIndex {
/**
* The index of the indexed column.
*/
protected final int indexColumn; protected final int indexColumn;
private final TableData tableData; private final TableData tableData;
private ValueHashMap<Long> rows; private ValueHashMap<Long> rows;
...@@ -85,15 +89,6 @@ public class HashIndex extends BaseIndex { ...@@ -85,15 +89,6 @@ public class HashIndex extends BaseIndex {
// nothing to do // nothing to do
} }
/**
* Generate the search key from a row. Only single column indexes are
* supported (multi-column indexes could be mapped to an value array, but
* that is much slower than using a tree based index).
*
* @param row the row
* @return the value
*/
public double getCost(Session session, int[] masks) { public double getCost(Session session, int[] masks) {
for (Column column : columns) { for (Column column : columns) {
int index = column.getColumnId(); int index = column.getColumnId();
......
...@@ -11,16 +11,15 @@ package org.h2.store; ...@@ -11,16 +11,15 @@ package org.h2.store;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.sql.Date; import java.sql.Date;
import java.sql.SQLException;
import java.sql.Time; import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.util.Utils;
import org.h2.util.DateTimeUtils; import org.h2.util.DateTimeUtils;
import org.h2.util.MathUtils; import org.h2.util.MathUtils;
import org.h2.util.Utils;
import org.h2.value.Value; import org.h2.value.Value;
import org.h2.value.ValueArray; import org.h2.value.ValueArray;
import org.h2.value.ValueBoolean; import org.h2.value.ValueBoolean;
...@@ -53,6 +52,7 @@ public class Data { ...@@ -53,6 +52,7 @@ public class Data {
*/ */
public static final int LENGTH_INT = 4; public static final int LENGTH_INT = 4;
private static final boolean TEST = false;
private static final int TEST_OFFSET = 0; private static final int TEST_OFFSET = 0;
/** /**
...@@ -355,7 +355,7 @@ public class Data { ...@@ -355,7 +355,7 @@ public class Data {
*/ */
public void writeValue(Value v) { public void writeValue(Value v) {
int start = pos; int start = pos;
if (TEST_OFFSET > 0) { if (TEST) {
pos += TEST_OFFSET; pos += TEST_OFFSET;
} }
if (v == ValueNull.INSTANCE) { if (v == ValueNull.INSTANCE) {
...@@ -562,8 +562,8 @@ public class Data { ...@@ -562,8 +562,8 @@ public class Data {
* @return the value * @return the value
*/ */
public Value readValue() { public Value readValue() {
if (TEST_OFFSET > 0) { if (TEST) {
pos+=TEST_OFFSET; pos += TEST_OFFSET;
} }
int type = data[pos++] & 255; int type = data[pos++] & 255;
switch (type) { switch (type) {
......
...@@ -22,10 +22,8 @@ public class ValueHashMap<V> extends HashBase { ...@@ -22,10 +22,8 @@ public class ValueHashMap<V> extends HashBase {
private V[] values; private V[] values;
/** /**
* Create a new value hash map using the given data handler. * Create a new value hash map.
* The data handler is used to compare values.
* *
* @param handler the data handler
* @return the object * @return the object
*/ */
public static <T> ValueHashMap<T> newInstance() { public static <T> ValueHashMap<T> newInstance() {
......
...@@ -291,6 +291,7 @@ java org.h2.test.TestAll timer ...@@ -291,6 +291,7 @@ java org.h2.test.TestAll timer
System.setProperty("h2.check2", "true"); System.setProperty("h2.check2", "true");
/* /*
maybe remove ValueHashMap
test recovery of large pages and transaction log test recovery of large pages and transaction log
test recovery with 'trace' mode (btree data) test recovery with 'trace' mode (btree data)
test runscript with setCheckResults, execute, process, setShowResults test runscript with setCheckResults, execute, process, setShowResults
......
...@@ -42,8 +42,8 @@ public class TestRecovery extends TestBase { ...@@ -42,8 +42,8 @@ public class TestRecovery extends TestBase {
stat.execute("create table test as select * from system_range(1, 100)"); stat.execute("create table test as select * from system_range(1, 100)");
stat.execute("create table a(id int primary key) as select * from system_range(1, 100)"); stat.execute("create table a(id int primary key) as select * from system_range(1, 100)");
stat.execute("create table b(id int references a(id)) as select * from system_range(1, 100)"); stat.execute("create table b(id int references a(id)) as select * from system_range(1, 100)");
stat.execute("create table c(d clob) as select space(10000) || 'end'"); stat.execute("create table c(d clob) as select space(10000) || 'end'");
stat.execute("create table d(d varchar) as select space(10000) || 'end'"); stat.execute("create table d(d varchar) as select space(10000) || 'end'");
stat.execute("alter table a add foreign key(id) references b(id)"); stat.execute("alter table a add foreign key(id) references b(id)");
// all rows have the same value - so that SCRIPT can't re-order the rows // all rows have the same value - so that SCRIPT can't re-order the rows
stat.execute("create table e(id varchar) as select space(10) from system_range(1, 1000)"); stat.execute("create table e(id varchar) as select space(10) from system_range(1, 1000)");
......
...@@ -634,4 +634,4 @@ profiles superinterfaces conventions brace indentations increments ...@@ -634,4 +634,4 @@ profiles superinterfaces conventions brace indentations increments
explicitconstructorcall switchstatements members parens alignment declarations explicitconstructorcall switchstatements members parens alignment declarations
jdt continuation codegen parenthesized tabulation ellipsis imple inits guardian jdt continuation codegen parenthesized tabulation ellipsis imple inits guardian
postfix iconified deiconified deactivated activated worker frequent utilities postfix iconified deiconified deactivated activated worker frequent utilities
workers appender recovers workers appender recovers balanced
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论