Unverified 提交 8a2c61e1 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1205 from h2database/misc-test-fixes

Misc test fixes
...@@ -267,7 +267,7 @@ public class PageDataIndex extends PageIndex { ...@@ -267,7 +267,7 @@ public class PageDataIndex extends PageIndex {
} }
Value v = row.getValue(mainIndexColumn); Value v = row.getValue(mainIndexColumn);
if (v == null) { if (v == null) {
throw DbException.throwInternalError(row.toString()); return row.getKey();
} else if (v == ValueNull.INSTANCE) { } else if (v == ValueNull.INSTANCE) {
return ifNull; return ifNull;
} }
......
...@@ -144,7 +144,8 @@ public class TransactionStore { ...@@ -144,7 +144,8 @@ public class TransactionStore {
if (!init) { if (!init) {
for (String mapName : store.getMapNames()) { for (String mapName : store.getMapNames()) {
if (mapName.startsWith(UNDO_LOG_NAME_PEFIX)) { if (mapName.startsWith(UNDO_LOG_NAME_PEFIX)) {
if (store.hasData(mapName)) { boolean committed = mapName.charAt(UNDO_LOG_NAME_PEFIX.length()) == UNDO_LOG_COMMITTED;
if (store.hasData(mapName) || committed) {
int transactionId = Integer.parseInt(mapName.substring(UNDO_LOG_NAME_PEFIX.length() + 1)); int transactionId = Integer.parseInt(mapName.substring(UNDO_LOG_NAME_PEFIX.length() + 1));
VersionedBitSet openTxBitSet = openTransactions.get(); VersionedBitSet openTxBitSet = openTransactions.get();
if (!openTxBitSet.get(transactionId)) { if (!openTxBitSet.get(transactionId)) {
...@@ -158,15 +159,15 @@ public class TransactionStore { ...@@ -158,15 +159,15 @@ public class TransactionStore {
status = (Integer) data[0]; status = (Integer) data[0];
name = (String) data[1]; name = (String) data[1];
} }
if (mapName.charAt(UNDO_LOG_NAME_PEFIX.length()) == UNDO_LOG_COMMITTED) { if (committed) {
status = Transaction.STATUS_COMMITTED; status = Transaction.STATUS_COMMITTED;
} }
MVMap<Long, Object[]> undoLog = store.openMap(mapName, undoLogBuilder); MVMap<Long, Object[]> undoLog = store.openMap(mapName, undoLogBuilder);
undoLogs[transactionId] = undoLog; undoLogs[transactionId] = undoLog;
Long lastUndoKey = undoLog.lastKey(); Long lastUndoKey = undoLog.lastKey();
assert lastUndoKey != null; assert committed || lastUndoKey != null;
assert getTransactionId(lastUndoKey) == transactionId; assert committed || getTransactionId(lastUndoKey) == transactionId;
long logId = getLogId(lastUndoKey) + 1; long logId = lastUndoKey == null ? 0 : getLogId(lastUndoKey) + 1;
registerTransaction(transactionId, status, name, logId, timeoutMillis, 0, RollbackListener.NONE); registerTransaction(transactionId, status, name, logId, timeoutMillis, 0, RollbackListener.NONE);
} }
} }
......
...@@ -67,12 +67,12 @@ public class TableSynonym extends SchemaObjectBase { ...@@ -67,12 +67,12 @@ public class TableSynonym extends SchemaObjectBase {
@Override @Override
public String getCreateSQL() { public String getCreateSQL() {
return "CREATE SYNONYM " + getName() + " FOR " + data.synonymForSchema.getName() + "." + data.synonymFor; return "CREATE SYNONYM " + getSQL() + " FOR " + data.synonymForSchema.getName() + "." + data.synonymFor;
} }
@Override @Override
public String getDropSQL() { public String getDropSQL() {
return "DROP SYNONYM " + getName(); return "DROP SYNONYM " + getSQL();
} }
@Override @Override
......
...@@ -45,17 +45,7 @@ public class TestRecovery extends TestBase { ...@@ -45,17 +45,7 @@ public class TestRecovery extends TestBase {
} }
testRecoverClob(); testRecoverClob();
testRecoverFulltext(); testRecoverFulltext();
// TODO testRedoTransactions() testRedoTransactions();
// DELETE FROM PUBLIC.TEST WHERE _ROWID_ = 1
// java.lang.RuntimeException: ( /* key:1 */ null, null)
// at org.h2.message.DbException.throwInternalError(DbException.java:253)
// at org.h2.index.PageDataIndex.getKey(PageDataIndex.java:270)
// at org.h2.index.PageDelegateIndex.find(PageDelegateIndex.java:66)
// at org.h2.index.BaseIndex.find(BaseIndex.java:131)
// at org.h2.index.IndexCursor.find(IndexCursor.java:175)
// at org.h2.table.TableFilter.next(TableFilter.java:471)
// at org.h2.command.dml.Delete.update(Delete.java:78)
// testRedoTransactions();
testCorrupt(); testCorrupt();
testWithTransactionLog(); testWithTransactionLog();
testCompressedAndUncompressed(); testCompressedAndUncompressed();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论