提交 7e293dc1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Test two rows in TestMvccMultiThreaded2 and fix this case in getValue()

上级 f9935a42
......@@ -1282,7 +1282,7 @@ public class TransactionStore {
// transaction (possibly one with the same id)
data = map.get(key);
} else {
if (map.getId() == (int) d[0]) {
if (map.getId() == (int) d[0] && map.getKeyType().compare(key, d[1]) == 0) {
data = (VersionedValue) d[2];
} else {
// this entry does not belong to this map, try again
......
......@@ -64,6 +64,9 @@ public class TestMvccMultiThreaded2 extends TestBase {
ps.setInt(1, 1);
ps.setInt(2, 100);
ps.executeUpdate();
ps.setInt(1, 2);
ps.setInt(2, 200);
ps.executeUpdate();
conn.commit();
ArrayList<SelectForUpdate> threads = new ArrayList<>();
......@@ -137,11 +140,20 @@ public class TestMvccMultiThreaded2 extends TestBase {
try {
PreparedStatement ps = conn.prepareStatement(
"SELECT * FROM test WHERE entity_id = ? FOR UPDATE");
ps.setString(1, "1");
String id;
int value;
if ((iterationsProcessed & 1) == 0) {
id = "1";
value = 100;
} else {
id = "2";
value = 200;
}
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
assertTrue(rs.next());
assertTrue(rs.getInt(2) == 100);
assertTrue(rs.getInt(2) == value);
conn.commit();
iterationsProcessed++;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论