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

--no commit message

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