提交 dc642580 authored 作者: andrei's avatar andrei

fix for "Unique index or primary key violation" in TestMvccMultiThreaded2

上级 458dd3d8
......@@ -342,24 +342,21 @@ public class TransactionStore {
}
int mapId = (Integer) op[0];
MVMap<Object, VersionedValue> map = openMap(mapId);
if (map == null) {
// map was later removed
} else {
if (map != null) { // might be null if map was removed later
Object key = op[1];
VersionedValue value = map.get(key);
if (value == null) {
// nothing to do
} else if (value.value == null) {
int tx = getTransactionId(value.operationId);
if (tx == t.transactionId) {
// remove the value
// only if it's transaction id is same as current transaction id
map.remove(key);
if (value != null) {
// only commit (remove/update) value if we've reached
// last undoLog entry for a given key
if (value.operationId == undoKey) {
if (value.value == null) {
map.remove(key);
} else {
VersionedValue v2 = new VersionedValue();
v2.value = value.value;
map.put(key, v2);
}
}
} else {
VersionedValue v2 = new VersionedValue();
v2.value = value.value;
map.put(key, v2);
}
}
undoLog.remove(undoKey);
......
......@@ -103,10 +103,7 @@ public class TestMvccMultiThreaded2 extends TestBase {
if (now - start > 1000 * 60)
done = true;
} catch (JdbcSQLException e1) {
// skip DUPLICATE_KEY_1 to just focus on this bug.
if (e1.getErrorCode() != ErrorCode.DUPLICATE_KEY_1) {
throw e1;
}
throw e1;
}
}
} catch (SQLException e) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论