Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b4699143
提交
b4699143
authored
11月 19, 2015
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CLOB and BLOB objects of removed rows were sometimes kept in the database file.
上级
f21d0c31
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
37 行增加
和
1 行删除
+37
-1
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+4
-0
LobStorageMap.java
h2/src/main/org/h2/store/LobStorageMap.java
+1
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+30
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
b4699143
...
@@ -21,6 +21,8 @@ Change Log
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
CLOB and BLOB objects of removed rows were sometimes kept in the database file.
</li>
<li>
Server mode: executing "shutdown" left a thread on the server.
<li>
Server mode: executing "shutdown" left a thread on the server.
</li>
</li>
<li>
The condition "in(select...)" did not work correctly in some cases if the subquery had an "order by".
<li>
The condition "in(select...)" did not work correctly in some cases if the subquery had an "order by".
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
b4699143
...
@@ -1134,6 +1134,10 @@ public class Session extends SessionWithState {
...
@@ -1134,6 +1134,10 @@ public class Session extends SessionWithState {
if
(
SysProperties
.
CHECK
&&
!
v
.
isLinkedToTable
())
{
if
(
SysProperties
.
CHECK
&&
!
v
.
isLinkedToTable
())
{
DbException
.
throwInternalError
();
DbException
.
throwInternalError
();
}
}
if
(
removeLobMap
==
null
)
{
removeLobMap
=
New
.
hashMap
();
removeLobMap
.
put
(
v
.
toString
(),
v
);
}
}
}
/**
/**
...
...
h2/src/main/org/h2/store/LobStorageMap.java
浏览文件 @
b4699143
...
@@ -104,7 +104,7 @@ public class LobStorageMap implements LobStorageInterface {
...
@@ -104,7 +104,7 @@ public class LobStorageMap implements LobStorageInterface {
}
}
// search for the last block
// search for the last block
// (in theory, only the latest lob can have unreferenced blocks,
// (in theory, only the latest lob can have unreferenced blocks,
// but the latest lob could b
y
a copy of another one, and
// but the latest lob could b
e
a copy of another one, and
// we don't know that, so we iterate over all lobs)
// we don't know that, so we iterate over all lobs)
long
lastUsedKey
=
-
1
;
long
lastUsedKey
=
-
1
;
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
b4699143
...
@@ -28,7 +28,9 @@ import org.h2.api.ErrorCode;
...
@@ -28,7 +28,9 @@ import org.h2.api.ErrorCode;
import
org.h2.engine.SysProperties
;
import
org.h2.engine.SysProperties
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.tools.Recover
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -57,6 +59,7 @@ public class TestLob extends TestBase {
...
@@ -57,6 +59,7 @@ public class TestLob extends TestBase {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
testRemoveAfterDeleteAndClose
();
testRemovedAfterTimeout
();
testRemovedAfterTimeout
();
testConcurrentRemoveRead
();
testConcurrentRemoveRead
();
testCloseLobTwice
();
testCloseLobTwice
();
...
@@ -109,6 +112,33 @@ public class TestLob extends TestBase {
...
@@ -109,6 +112,33 @@ public class TestLob extends TestBase {
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
}
}
private
void
testRemoveAfterDeleteAndClose
()
throws
Exception
{
if
(
config
.
memory
)
{
return
;
}
deleteDb
(
"lob"
);
Connection
conn
=
getConnection
(
"lob"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, data clob)"
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
stat
.
execute
(
"insert into test values(1, space(100000))"
);
if
(
i
>
5
)
{
ResultSet
rs
=
stat
.
executeQuery
(
"select * from test"
);
rs
.
next
();
Clob
c
=
rs
.
getClob
(
2
);
stat
.
execute
(
"delete from test where id = 1"
);
c
.
getSubString
(
1
,
10
);
}
else
{
stat
.
execute
(
"delete from test where id = 1"
);
}
}
// some clobs are removed only here (those that were queries for)
conn
.
close
();
Recover
.
execute
(
getBaseDir
(),
"lob"
);
long
size
=
FileUtils
.
size
(
getBaseDir
()
+
"/lob.h2.sql"
);
assertTrue
(
"size: "
+
size
,
size
>
1000
&&
size
<
10000
);
}
private
void
testLargeClob
()
throws
Exception
{
private
void
testLargeClob
()
throws
Exception
{
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
Connection
conn
;
Connection
conn
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论