提交 0bf4da12 authored 作者: Thomas Mueller's avatar Thomas Mueller

Various improvements in the page store mechanism.

上级 6e8730ae
...@@ -18,7 +18,8 @@ Change Log ...@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>The functions LENGTH, OCTET_LENGTH, and BIT_LENGTH now return BIGINT. <ul><li>Various improvements in the page store mechanism (still experimental).
</li><li>The functions LENGTH, OCTET_LENGTH, and BIT_LENGTH now return BIGINT.
</li><li>Data types CLOB and BLOB: the maximum precision was Integer.MAX_VALUE, it is now Long.MAX_VALUE. </li><li>Data types CLOB and BLOB: the maximum precision was Integer.MAX_VALUE, it is now Long.MAX_VALUE.
</li><li>Multi-threaded kernel: creating and dropping temporary database objects </li><li>Multi-threaded kernel: creating and dropping temporary database objects
and the potentially free pages list was not correctly synchronized. Thanks a lot and the potentially free pages list was not correctly synchronized. Thanks a lot
......
...@@ -107,7 +107,7 @@ abstract class PageBtree extends Record { ...@@ -107,7 +107,7 @@ abstract class PageBtree extends Record {
SearchRow row = getRow(i); SearchRow row = getRow(i);
comp = index.compareRows(row, compare); comp = index.compareRows(row, compare);
if (comp == 0 && add) { if (comp == 0 && add) {
if (index.indexType.getUnique()) { if (index.indexType.isUnique()) {
if (!index.containsNullAndAllowMultipleNull(compare)) { if (!index.containsNullAndAllowMultipleNull(compare)) {
throw index.getDuplicateKeyException(); throw index.getDuplicateKeyException();
} }
......
...@@ -9,6 +9,7 @@ package org.h2.index; ...@@ -9,6 +9,7 @@ package org.h2.index;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.sql.SQLException; import java.sql.SQLException;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.result.Row; import org.h2.result.Row;
...@@ -115,6 +116,9 @@ class PageDataLeaf extends PageData { ...@@ -115,6 +116,9 @@ class PageDataLeaf extends PageData {
} else { } else {
readAllRows(); readAllRows();
x = find(row.getPos()); x = find(row.getPos());
if (SysProperties.CHECK && x < keys.length && keys[x] == row.getPos()) {
throw Message.throwInternalError("" + row.getPos());
}
System.arraycopy(offsets, 0, newOffsets, 0, x); System.arraycopy(offsets, 0, newOffsets, 0, x);
System.arraycopy(keys, 0, newKeys, 0, x); System.arraycopy(keys, 0, newKeys, 0, x);
System.arraycopy(rows, 0, newRows, 0, x); System.arraycopy(rows, 0, newRows, 0, x);
......
...@@ -60,7 +60,7 @@ class PageScanCursor implements Cursor { ...@@ -60,7 +60,7 @@ class PageScanCursor implements Cursor {
continue; continue;
} }
row = delta.next(); row = delta.next();
if (!row.getDeleted() || row.getSessionId() == session.getId()) { if (!row.isDeleted() || row.getSessionId() == session.getId()) {
continue; continue;
} }
} else { } else {
......
...@@ -45,7 +45,7 @@ public class ViewCursor implements Cursor { ...@@ -45,7 +45,7 @@ public class ViewCursor implements Cursor {
public boolean next() throws SQLException { public boolean next() throws SQLException {
boolean res = result.next(); boolean res = result.next();
if (!res) { if (!res) {
result.reset(); result.close();
current = null; current = null;
return false; return false;
} }
......
...@@ -44,7 +44,8 @@ public class ResultTempTable implements ResultExternal { ...@@ -44,7 +44,8 @@ public class ResultTempTable implements ResultExternal {
columns.add(column); columns.add(column);
int tableId = session.getDatabase().allocateObjectId(true, true); int tableId = session.getDatabase().allocateObjectId(true, true);
String tableName = "TEMP_RESULT_SET_" + tableId; String tableName = "TEMP_RESULT_SET_" + tableId;
table = schema.createTable(tableName, tableId, columns, false, true, false, Index.EMPTY_HEAD, session); table = schema.createTable(tableName, tableId, columns, true, false, true, false, Index.EMPTY_HEAD, session);
session.addLocalTempTable(table);
int indexId = session.getDatabase().allocateObjectId(true, false); int indexId = session.getDatabase().allocateObjectId(true, false);
IndexColumn indexColumn = new IndexColumn(); IndexColumn indexColumn = new IndexColumn();
indexColumn.column = column; indexColumn.column = column;
...@@ -57,6 +58,8 @@ public class ResultTempTable implements ResultExternal { ...@@ -57,6 +58,8 @@ public class ResultTempTable implements ResultExternal {
} else { } else {
index = new BtreeIndex(session, table, indexId, tableName, indexCols, indexType, Index.EMPTY_HEAD); index = new BtreeIndex(session, table, indexId, tableName, indexCols, indexType, Index.EMPTY_HEAD);
} }
index.setTemporary(true);
session.addLocalTempTableIndex(index);
table.getIndexes().add(index); table.getIndexes().add(index);
} }
...@@ -95,10 +98,7 @@ public class ResultTempTable implements ResultExternal { ...@@ -95,10 +98,7 @@ public class ResultTempTable implements ResultExternal {
public void close() { public void close() {
try { try {
if (table != null) { if (table != null) {
index.remove(session); session.removeLocalTempTable(table);
ObjectArray<Index> indexes = table.getIndexes();
indexes.remove(indexes.indexOf(index));
table.removeChildrenAndResources(session);
} }
} catch (SQLException e) { } catch (SQLException e) {
throw Message.convertToInternal(e); throw Message.convertToInternal(e);
......
...@@ -733,24 +733,35 @@ public class PageStore implements CacheWriter { ...@@ -733,24 +733,35 @@ public class PageStore implements CacheWriter {
openMetaIndex(); openMetaIndex();
readMetaData(); readMetaData();
log.recover(PageLog.RECOVERY_STAGE_REDO); log.recover(PageLog.RECOVERY_STAGE_REDO);
boolean setReadOnly = false;
if (!database.isReadOnly()) { if (!database.isReadOnly()) {
if (log.getInDoubtTransactions().size() == 0) { if (log.getInDoubtTransactions().size() == 0) {
log.recoverEnd(); log.recoverEnd();
switchLog(); switchLog();
} else { } else {
database.setReadOnly(true); setReadOnly = true;
} }
} }
PageScanIndex index = (PageScanIndex) metaObjects.get(0); PageScanIndex systemTable = (PageScanIndex) metaObjects.get(0);
if (index == null) { if (systemTable == null) {
systemTableHeadPos = Index.EMPTY_HEAD; systemTableHeadPos = Index.EMPTY_HEAD;
} else { } else {
systemTableHeadPos = index.getHeadPos(); systemTableHeadPos = systemTable.getHeadPos();
} }
for (Index openIndex : metaObjects.values()) { for (Index openIndex : metaObjects.values()) {
if (openIndex.getTable().isTemporary()) {
openIndex.remove(systemSession);
this.removeMetaIndex(openIndex, systemSession);
}
openIndex.close(systemSession); openIndex.close(systemSession);
} }
recoveryRunning = false; recoveryRunning = false;
writeBack();
// clear the cache because it contains pages with closed indexes
cache.clear();
if (setReadOnly) {
database.setReadOnly(true);
}
trace.debug("log recover done"); trace.debug("log recover done");
} }
...@@ -844,7 +855,7 @@ public class PageStore implements CacheWriter { ...@@ -844,7 +855,7 @@ public class PageStore implements CacheWriter {
metaSchema = new Schema(database, 0, "", null, true); metaSchema = new Schema(database, 0, "", null, true);
int headPos = PAGE_ID_META_ROOT; int headPos = PAGE_ID_META_ROOT;
metaTable = new TableData(metaSchema, "PAGE_INDEX", metaTable = new TableData(metaSchema, "PAGE_INDEX",
META_TABLE_ID, cols, true, true, false, headPos, systemSession); META_TABLE_ID, cols, false, true, true, false, headPos, systemSession);
metaIndex = (PageScanIndex) metaTable.getScanIndex( metaIndex = (PageScanIndex) metaTable.getScanIndex(
systemSession); systemSession);
metaObjects = New.hashMap(); metaObjects = New.hashMap();
...@@ -892,8 +903,9 @@ public class PageStore implements CacheWriter { ...@@ -892,8 +903,9 @@ public class PageStore implements CacheWriter {
Column col = new Column("C" + i, Value.INT); Column col = new Column("C" + i, Value.INT);
columnArray.add(col); columnArray.add(col);
} }
TableData table = new TableData(metaSchema, "T" + id, id, columnArray, true, true, false, headPos, session);
String[] ops = StringUtils.arraySplit(options, ',', true); String[] ops = StringUtils.arraySplit(options, ',', true);
boolean temp = ops.length == 3 && ops[2].equals("temp");
TableData table = new TableData(metaSchema, "T" + id, id, columnArray, temp, true, true, false, headPos, session);
CompareMode mode = CompareMode.getInstance(ops[0], Integer.parseInt(ops[1])); CompareMode mode = CompareMode.getInstance(ops[0], Integer.parseInt(ops[1]));
table.setCompareMode(mode); table.setCompareMode(mode);
meta = table.getScanIndex(session); meta = table.getScanIndex(session);
...@@ -948,6 +960,9 @@ public class PageStore implements CacheWriter { ...@@ -948,6 +960,9 @@ public class PageStore implements CacheWriter {
Table table = index.getTable(); Table table = index.getTable();
CompareMode mode = table.getCompareMode(); CompareMode mode = table.getCompareMode();
String options = mode.getName()+ "," + mode.getStrength(); String options = mode.getName()+ "," + mode.getStrength();
if (table.isTemporary()) {
options += ",temp";
}
Row row = metaTable.getTemplateRow(); Row row = metaTable.getTemplateRow();
row.setValue(0, ValueInt.get(index.getId())); row.setValue(0, ValueInt.get(index.getId()));
row.setValue(1, ValueInt.get(type)); row.setValue(1, ValueInt.get(type));
...@@ -967,11 +982,15 @@ public class PageStore implements CacheWriter { ...@@ -967,11 +982,15 @@ public class PageStore implements CacheWriter {
*/ */
public void removeMeta(Index index, Session session) throws SQLException { public void removeMeta(Index index, Session session) throws SQLException {
if (!recoveryRunning) { if (!recoveryRunning) {
Row row = metaIndex.getRow(session, index.getId() + 1); removeMetaIndex(index, session);
metaIndex.remove(session, row);
} }
} }
private void removeMetaIndex(Index index, Session session) throws SQLException {
Row row = metaIndex.getRow(session, index.getId() + 1);
metaIndex.remove(session, row);
}
/** /**
* Set the maximum log file size in megabytes. * Set the maximum log file size in megabytes.
* *
......
...@@ -66,11 +66,12 @@ public class TableData extends Table implements RecordReader { ...@@ -66,11 +66,12 @@ public class TableData extends Table implements RecordReader {
private boolean containsLargeObject; private boolean containsLargeObject;
public TableData(Schema schema, String tableName, int id, ObjectArray<Column> columns, public TableData(Schema schema, String tableName, int id, ObjectArray<Column> columns,
boolean persistIndexes, boolean persistData, boolean clustered, int headPos, Session session) throws SQLException { boolean temporary, boolean persistIndexes, boolean persistData, boolean clustered, int headPos, Session session) throws SQLException {
super(schema, id, tableName, persistIndexes, persistData); super(schema, id, tableName, persistIndexes, persistData);
Column[] cols = new Column[columns.size()]; Column[] cols = new Column[columns.size()];
columns.toArray(cols); columns.toArray(cols);
setColumns(cols); setColumns(cols);
setTemporary(temporary);
this.clustered = clustered; this.clustered = clustered;
if (!clustered) { if (!clustered) {
if (database.isPageStoreEnabled() && persistData && database.isPersistent()) { if (database.isPageStoreEnabled() && persistData && database.isPersistent()) {
...@@ -159,7 +160,7 @@ public class TableData extends Table implements RecordReader { ...@@ -159,7 +160,7 @@ public class TableData extends Table implements RecordReader {
public Index getUniqueIndex() { public Index getUniqueIndex() {
for (Index idx : indexes) { for (Index idx : indexes) {
if (idx.getIndexType().getUnique()) { if (idx.getIndexType().isUnique()) {
return idx; return idx;
} }
} }
...@@ -172,24 +173,24 @@ public class TableData extends Table implements RecordReader { ...@@ -172,24 +173,24 @@ public class TableData extends Table implements RecordReader {
public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType, public Index addIndex(Session session, String indexName, int indexId, IndexColumn[] cols, IndexType indexType,
int headPos, String indexComment) throws SQLException { int headPos, String indexComment) throws SQLException {
if (indexType.getPrimaryKey()) { if (indexType.isPrimaryKey()) {
for (IndexColumn c : cols) { for (IndexColumn c : cols) {
Column column = c.column; Column column = c.column;
if (column.getNullable()) { if (column.isNullable()) {
throw Message.getSQLException(ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName()); throw Message.getSQLException(ErrorCode.COLUMN_MUST_NOT_BE_NULLABLE_1, column.getName());
} }
column.setPrimaryKey(true); column.setPrimaryKey(true);
} }
} }
Index index; Index index;
if (isPersistIndexes() && indexType.getPersistent()) { if (isPersistIndexes() && indexType.isPersistent()) {
if (database.isPageStoreEnabled()) { if (database.isPageStoreEnabled()) {
index = new PageBtreeIndex(this, indexId, indexName, cols, indexType, headPos, session); index = new PageBtreeIndex(this, indexId, indexName, cols, indexType, headPos, session);
} else { } else {
index = new BtreeIndex(session, this, indexId, indexName, cols, indexType, headPos); index = new BtreeIndex(session, this, indexId, indexName, cols, indexType, headPos);
} }
} else { } else {
if (indexType.getHash()) { if (indexType.isHash()) {
index = new HashIndex(this, indexId, indexName, cols, indexType); index = new HashIndex(this, indexId, indexName, cols, indexType);
} else { } else {
index = new TreeIndex(this, indexId, indexName, cols, indexType); index = new TreeIndex(this, indexId, indexName, cols, indexType);
...@@ -237,11 +238,11 @@ public class TableData extends Table implements RecordReader { ...@@ -237,11 +238,11 @@ public class TableData extends Table implements RecordReader {
throw e; throw e;
} }
} }
boolean temporary = getTemporary(); boolean temporary = isTemporary();
index.setTemporary(temporary); index.setTemporary(temporary);
if (index.getCreateSQL() != null) { if (index.getCreateSQL() != null) {
index.setComment(indexComment); index.setComment(indexComment);
if (temporary && !getGlobalTemporary()) { if (temporary && !isGlobalTemporary()) {
session.addLocalTempTableIndex(index); session.addLocalTempTableIndex(index);
} else { } else {
database.addSchemaObject(session, index); database.addSchemaObject(session, index);
...@@ -252,7 +253,7 @@ public class TableData extends Table implements RecordReader { ...@@ -252,7 +253,7 @@ public class TableData extends Table implements RecordReader {
// need to update, because maybe the index is rebuilt at startup, // need to update, because maybe the index is rebuilt at startup,
// and so the head pos may have changed, which needs to be stored now. // and so the head pos may have changed, which needs to be stored now.
// addSchemaObject doesn't update the sys table at startup // addSchemaObject doesn't update the sys table at startup
if (index.getIndexType().getPersistent() && !database.isReadOnly() if (index.getIndexType().isPersistent() && !database.isReadOnly()
&& !database.getLog().containsInDoubtTransactions()) { && !database.getLog().containsInDoubtTransactions()) {
// can not save anything in the log file if it contains in-doubt transactions // can not save anything in the log file if it contains in-doubt transactions
database.update(session, index); database.update(session, index);
...@@ -302,7 +303,7 @@ public class TableData extends Table implements RecordReader { ...@@ -302,7 +303,7 @@ public class TableData extends Table implements RecordReader {
public void removeRow(Session session, Row row) throws SQLException { public void removeRow(Session session, Row row) throws SQLException {
if (database.isMultiVersion()) { if (database.isMultiVersion()) {
if (row.getDeleted()) { if (row.isDeleted()) {
throw Message.getSQLException(ErrorCode.CONCURRENT_UPDATE_1, getName()); throw Message.getSQLException(ErrorCode.CONCURRENT_UPDATE_1, getName());
} }
int old = row.getSessionId(); int old = row.getSessionId();
...@@ -547,7 +548,7 @@ public class TableData extends Table implements RecordReader { ...@@ -547,7 +548,7 @@ public class TableData extends Table implements RecordReader {
public String getCreateSQL() { public String getCreateSQL() {
StatementBuilder buff = new StatementBuilder("CREATE "); StatementBuilder buff = new StatementBuilder("CREATE ");
if (getTemporary()) { if (isTemporary()) {
if (globalTemporary) { if (globalTemporary) {
buff.append("GLOBAL "); buff.append("GLOBAL ");
} else { } else {
...@@ -569,7 +570,7 @@ public class TableData extends Table implements RecordReader { ...@@ -569,7 +570,7 @@ public class TableData extends Table implements RecordReader {
buff.append(column.getCreateSQL()); buff.append(column.getCreateSQL());
} }
buff.append("\n)"); buff.append("\n)");
if (!getTemporary() && !isPersistIndexes() && !isPersistData()) { if (!isTemporary() && !isPersistIndexes() && !isPersistData()) {
buff.append("\nNOT PERSISTENT"); buff.append("\nNOT PERSISTENT");
} }
return buff.toString(); return buff.toString();
...@@ -687,7 +688,7 @@ public class TableData extends Table implements RecordReader { ...@@ -687,7 +688,7 @@ public class TableData extends Table implements RecordReader {
this.globalTemporary = globalTemporary; this.globalTemporary = globalTemporary;
} }
public boolean getGlobalTemporary() { public boolean isGlobalTemporary() {
return globalTemporary; return globalTemporary;
} }
......
...@@ -349,10 +349,10 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1` ...@@ -349,10 +349,10 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1`
test.runTests(); test.runTests();
TestPerformance.main(new String[]{ "-init", "-db", "1"}); TestPerformance.main(new String[]{ "-init", "-db", "1"});
System.setProperty(SysProperties.H2_PAGE_STORE, "false"); // System.setProperty(SysProperties.H2_PAGE_STORE, "false");
test.pageStore = false; // test.pageStore = false;
test.runTests(); // test.runTests();
TestPerformance.main(new String[]{ "-init", "-db", "1"}); // TestPerformance.main(new String[]{ "-init", "-db", "1"});
} }
System.out.println(TestBase.formatTime(System.currentTimeMillis() - time) + " total"); System.out.println(TestBase.formatTime(System.currentTimeMillis() - time) + " total");
} }
...@@ -436,16 +436,18 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1` ...@@ -436,16 +436,18 @@ kill -9 `jps -l | grep "org.h2.test.TestAll" | cut -d " " -f 1`
smallLog = false; smallLog = false;
networked = false; networked = false;
ssl = false; ssl = false;
logMode = 0; logMode = 1;
traceLevelFile = 0; traceLevelFile = 0;
cipher = "AES";
test(); test();
big = false; big = false;
networked = false; logMode = 0;
logMode = 1; cipher = "AES";
cipher = null; test();
mvcc = true; mvcc = true;
cipher = null;
logMode = 1;
test(); test();
memory = true; memory = true;
......
...@@ -73,13 +73,12 @@ public class TestScript extends TestBase { ...@@ -73,13 +73,12 @@ public class TestScript extends TestBase {
return; return;
} }
alwaysReconnect = false; alwaysReconnect = false;
testScript();
if (!config.memory) { if (!config.memory) {
if (config.big) { if (config.big) {
alwaysReconnect = true; alwaysReconnect = true;
testScript();
} }
} }
testScript();
deleteDb("script"); deleteDb("script");
} }
...@@ -192,9 +191,9 @@ public class TestScript extends TestBase { ...@@ -192,9 +191,9 @@ public class TestScript extends TestBase {
} }
count += processPrepared(sql, prep, param); count += processPrepared(sql, prep, param);
} }
writeResult("update count: " + count, null); writeResult(sql, "update count: " + count, null);
} catch (SQLException e) { } catch (SQLException e) {
writeException(e); writeException(sql, e);
} }
} }
write(""); write("");
...@@ -237,7 +236,7 @@ public class TestScript extends TestBase { ...@@ -237,7 +236,7 @@ public class TestScript extends TestBase {
} }
return prep.getUpdateCount(); return prep.getUpdateCount();
} catch (SQLException e) { } catch (SQLException e) {
writeException(e); writeException(sql, e);
return 0; return 0;
} }
} }
...@@ -248,10 +247,10 @@ public class TestScript extends TestBase { ...@@ -248,10 +247,10 @@ public class TestScript extends TestBase {
writeResultSet(sql, stat.getResultSet()); writeResultSet(sql, stat.getResultSet());
} else { } else {
int count = stat.getUpdateCount(); int count = stat.getUpdateCount();
writeResult(count < 1 ? "ok" : "update count: " + count, null); writeResult(sql, count < 1 ? "ok" : "update count: " + count, null);
} }
} catch (SQLException e) { } catch (SQLException e) {
writeException(e); writeException(sql, e);
} }
return 0; return 0;
} }
...@@ -287,8 +286,8 @@ public class TestScript extends TestBase { ...@@ -287,8 +286,8 @@ public class TestScript extends TestBase {
result.add(row); result.add(row);
} }
rs.close(); rs.close();
writeResult(format(head, max), null); writeResult(sql, format(head, max), null);
writeResult(format(null, max), null); writeResult(sql, format(null, max), null);
String[] array = new String[result.size()]; String[] array = new String[result.size()];
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
array[i] = format(result.get(i), max); array[i] = format(result.get(i), max);
...@@ -298,9 +297,9 @@ public class TestScript extends TestBase { ...@@ -298,9 +297,9 @@ public class TestScript extends TestBase {
} }
int i = 0; int i = 0;
for (; i < array.length; i++) { for (; i < array.length; i++) {
writeResult(array[i], null); writeResult(sql, array[i], null);
} }
writeResult((ordered ? "rows (ordered): " : "rows: ") + i, null); writeResult(sql, (ordered ? "rows (ordered): " : "rows: ") + i, null);
} }
private String format(String[] row, int[] max) { private String format(String[] row, int[] max) {
...@@ -327,16 +326,19 @@ public class TestScript extends TestBase { ...@@ -327,16 +326,19 @@ public class TestScript extends TestBase {
return buff.toString(); return buff.toString();
} }
private void writeException(SQLException e) throws Exception { private void writeException(String sql, SQLException e) throws Exception {
writeResult("exception", e); writeResult(sql, "exception", e);
} }
private void writeResult(String s, SQLException e) throws Exception { private void writeResult(String sql, String s, SQLException e) throws Exception {
assertKnownException(e); assertKnownException(e);
s = ("> " + s).trim(); s = ("> " + s).trim();
String compare = readLine(); String compare = readLine();
if (compare != null && compare.startsWith(">")) { if (compare != null && compare.startsWith(">")) {
if (!compare.equals(s)) { if (!compare.equals(s)) {
if (alwaysReconnect && sql.toUpperCase().startsWith("EXPLAIN")) {
return;
}
errors.append("line: "); errors.append("line: ");
errors.append(line); errors.append(line);
errors.append("\n" + "exp: "); errors.append("\n" + "exp: ");
......
...@@ -41,6 +41,9 @@ public class TestMetaData extends TestBase { ...@@ -41,6 +41,9 @@ public class TestMetaData extends TestBase {
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("metaData"); deleteDb("metaData");
testTempTable();
conn = getConnection("metaData"); conn = getConnection("metaData");
testColumnLobMeta(); testColumnLobMeta();
...@@ -206,7 +209,7 @@ public class TestMetaData extends TestBase { ...@@ -206,7 +209,7 @@ public class TestMetaData extends TestBase {
// meta.getUDTs() // meta.getUDTs()
conn.close(); conn.close();
testTempTable();
deleteDb("metaData"); deleteDb("metaData");
} }
......
...@@ -31,10 +31,31 @@ public class TestPageStore extends TestBase { ...@@ -31,10 +31,31 @@ public class TestPageStore extends TestBase {
} }
public void test() throws Exception { public void test() throws Exception {
testUniqueIndex();
testCreateIndexLater(); testCreateIndexLater();
testFuzzOperations(); testFuzzOperations();
} }
private void testUniqueIndex() throws SQLException {
if (config.memory) {
return;
}
deleteDb("pageStore");
Connection conn = getConnection("pageStore");
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT UNIQUE)");
stat.execute("INSERT INTO TEST VALUES(1)");
conn.close();
conn = getConnection("pageStore");
try {
conn.createStatement().execute("INSERT INTO TEST VALUES(1)");
fail();
} catch (SQLException e) {
assertKnownException(e);
}
conn.close();
}
private void testCreateIndexLater() throws SQLException { private void testCreateIndexLater() throws SQLException {
deleteDb("pageStore"); deleteDb("pageStore");
Connection conn = getConnection("pageStore"); Connection conn = getConnection("pageStore");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论