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

--no commit message

--no commit message
上级 131dd96c
...@@ -31,11 +31,13 @@ public class TestOutOfMemory extends TestBase { ...@@ -31,11 +31,13 @@ public class TestOutOfMemory extends TestBase {
deleteDb("outOfMemory"); deleteDb("outOfMemory");
Connection conn = getConnection("outOfMemory"); Connection conn = getConnection("outOfMemory");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create table stuff (id int primary key, text varchar as space(100) || id)"); stat.execute("drop all objects");
stat.execute("create table stuff (id int, text varchar as space(100) || id)");
stat.execute("insert into stuff(id) select x from system_range(1, 2000)"); stat.execute("insert into stuff(id) select x from system_range(1, 2000)");
PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'"); PreparedStatement prep = conn.prepareStatement("update stuff set text = text || ' upd'");
prep.execute(); prep.execute();
eatMemory(80); eatMemory(80);
try {
try { try {
prep.execute(); prep.execute();
fail(); fail();
...@@ -46,8 +48,10 @@ public class TestOutOfMemory extends TestBase { ...@@ -46,8 +48,10 @@ public class TestOutOfMemory extends TestBase {
ResultSet rs = stat.executeQuery("select count(*) from stuff"); ResultSet rs = stat.executeQuery("select count(*) from stuff");
rs.next(); rs.next();
assertEquals(2000, rs.getInt(1)); assertEquals(2000, rs.getInt(1));
} finally {
conn.close(); conn.close();
} }
}
private void eatMemory(int remainingKB) { private void eatMemory(int remainingKB) {
byte[] reserve = new byte[remainingKB * 1024]; byte[] reserve = new byte[remainingKB * 1024];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论