提交 29e2a7ef authored 作者: Thomas Mueller's avatar Thomas Mueller

Storing lobs in the database has been changed. It is now faster.

上级 22e6097b
...@@ -49,6 +49,7 @@ public class TestLob extends TestBase { ...@@ -49,6 +49,7 @@ public class TestLob extends TestBase {
} }
public void test() throws Exception { public void test() throws Exception {
testDelete();
testTempFilesDeleted(); testTempFilesDeleted();
testAddLobRestart(); testAddLobRestart();
testLobServerMemory(); testLobServerMemory();
...@@ -81,6 +82,39 @@ public class TestLob extends TestBase { ...@@ -81,6 +82,39 @@ public class TestLob extends TestBase {
FileSystem.getInstance(TEMP_DIR).deleteRecursive(TEMP_DIR, true); FileSystem.getInstance(TEMP_DIR).deleteRecursive(TEMP_DIR, true);
} }
private void testDelete() throws Exception {
if (!SysProperties.LOB_IN_DATABASE || config.memory) {
return;
}
deleteDb("lob");
Connection conn;
Statement stat;
conn = getConnection("lob");
stat = conn.createStatement();
stat.execute("create table test(id int primary key, name clob)");
stat.execute("insert into test values(1, space(10000))");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("insert into test values(2, space(10000))");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("delete from test where id = 1");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("insert into test values(3, space(10000))");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("insert into test values(4, space(10000))");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("delete from test where id = 2");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("delete from test where id = 3");
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 1);
stat.execute("delete from test");
conn.close();
conn = getConnection("lob");
stat = conn.createStatement();
assertSingleValue(stat, "select count(*) from information_schema.lob_data", 0);
stat.execute("drop table test");
conn.close();
}
private void testTempFilesDeleted() throws Exception { private void testTempFilesDeleted() throws Exception {
String[] list; String[] list;
FileSystem.getInstance(TEMP_DIR).deleteRecursive(TEMP_DIR, true); FileSystem.getInstance(TEMP_DIR).deleteRecursive(TEMP_DIR, true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论