Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cec0e8e0
提交
cec0e8e0
authored
9月 09, 2015
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Docs
上级
8527b90d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
55 行增加
和
10 行删除
+55
-10
changelog.html
h2/src/docsrc/html/changelog.html
+5
-0
release.txt
h2/src/installer/release.txt
+1
-0
LobStorageMap.java
h2/src/main/org/h2/store/LobStorageMap.java
+27
-10
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+22
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
cec0e8e0
...
@@ -21,6 +21,11 @@ Change Log
...
@@ -21,6 +21,11 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
MVStore CLOB and BLOB: An exception with the message "Block not found" could be thrown
when using the MVStore storage, when copying LOB objects
(for example due to "alter table" on a table with a LOB object),
and then re-opening the database.
</li>
<li>
Fix for issue #171: Broken QueryStatisticsData duration data when trace level
<
TraceSystem
.
INFO
<li>
Fix for issue #171: Broken QueryStatisticsData duration data when trace level
<
TraceSystem
.
INFO
</
li
>
</
li
>
<li>
Pull request #170: Added SET QUERY_STATISTICS_MAX_ENTRIES
<li>
Pull request #170: Added SET QUERY_STATISTICS_MAX_ENTRIES
...
...
h2/src/installer/release.txt
浏览文件 @
cec0e8e0
...
@@ -19,6 +19,7 @@ Check docs, versions and links in main, downloads, build numbers
...
@@ -19,6 +19,7 @@ Check docs, versions and links in main, downloads, build numbers
Check the PDF file size
Check the PDF file size
Upload to SourceForge
Upload to SourceForge
Upload to ftp://h2database.com/javadoc
Upload to ftp://h2database.com
Upload to ftp://h2database.com
Upload to ftp://h2database.com/m2-repo
Upload to ftp://h2database.com/m2-repo
Github: create a release
Github: create a release
...
...
h2/src/main/org/h2/store/LobStorageMap.java
浏览文件 @
cec0e8e0
...
@@ -24,6 +24,7 @@ import org.h2.mvstore.StreamStore;
...
@@ -24,6 +24,7 @@ import org.h2.mvstore.StreamStore;
import
org.h2.mvstore.db.MVTableEngine.Store
;
import
org.h2.mvstore.db.MVTableEngine.Store
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StringUtils
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLobDb
;
import
org.h2.value.ValueLobDb
;
...
@@ -101,19 +102,26 @@ public class LobStorageMap implements LobStorageInterface {
...
@@ -101,19 +102,26 @@ public class LobStorageMap implements LobStorageInterface {
if
(
dataMap
.
isEmpty
())
{
if
(
dataMap
.
isEmpty
())
{
return
;
return
;
}
}
// search the last referenced block
// search for the last block
// (a lob may not have any referenced blocks if data is kept inline,
// (in theory, only the latest lob can have unreferenced blocks,
// so we need to loop)
// but the latest lob could by a copy of another one, and
// we don't know that, so we iterate over all lobs)
long
lastUsedKey
=
-
1
;
long
lastUsedKey
=
-
1
;
Long
lobId
=
lobMap
.
lastKey
();
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
while
(
lobId
!=
null
)
{
long
lobId
=
e
.
getKey
();
Object
[]
v
=
lobMap
.
get
(
lobId
);
Object
[]
v
=
e
.
getValue
(
);
byte
[]
id
=
(
byte
[])
v
[
0
];
byte
[]
id
=
(
byte
[])
v
[
0
];
lastUsedKey
=
streamStore
.
getMaxBlockKey
(
id
);
long
max
=
streamStore
.
getMaxBlockKey
(
id
);
if
(
lastUsedKey
>=
0
)
{
// a lob may not have a referenced blocks if data is kept inline
break
;
if
(
max
!=
-
1
&&
max
>
lastUsedKey
)
{
lastUsedKey
=
max
;
if
(
TRACE
)
{
trace
(
"lob "
+
lobId
+
" lastUsedKey="
+
lastUsedKey
);
}
}
}
lobId
=
lobMap
.
lowerKey
(
lobId
);
}
if
(
TRACE
)
{
trace
(
"lastUsedKey="
+
lastUsedKey
);
}
}
// delete all blocks that are newer
// delete all blocks that are newer
while
(
true
)
{
while
(
true
)
{
...
@@ -121,6 +129,9 @@ public class LobStorageMap implements LobStorageInterface {
...
@@ -121,6 +129,9 @@ public class LobStorageMap implements LobStorageInterface {
if
(
last
==
null
||
last
<=
lastUsedKey
)
{
if
(
last
==
null
||
last
<=
lastUsedKey
)
{
break
;
break
;
}
}
if
(
TRACE
)
{
trace
(
"gc "
+
last
);
}
dataMap
.
remove
(
last
);
dataMap
.
remove
(
last
);
}
}
// don't re-use block ids, except at the very end
// don't re-use block ids, except at the very end
...
@@ -349,10 +360,16 @@ public class LobStorageMap implements LobStorageInterface {
...
@@ -349,10 +360,16 @@ public class LobStorageMap implements LobStorageInterface {
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
byte
[]
s2
=
(
byte
[])
value
[
0
];
byte
[]
s2
=
(
byte
[])
value
[
0
];
if
(
Arrays
.
equals
(
streamStoreId
,
s2
))
{
if
(
Arrays
.
equals
(
streamStoreId
,
s2
))
{
if
(
TRACE
)
{
trace
(
" stream still needed in lob "
+
value
[
1
]);
}
hasMoreEntries
=
true
;
hasMoreEntries
=
true
;
}
}
}
}
if
(!
hasMoreEntries
)
{
if
(!
hasMoreEntries
)
{
if
(
TRACE
)
{
trace
(
" remove stream "
+
StringUtils
.
convertBytesToHex
(
streamStoreId
));
}
streamStore
.
remove
(
streamStoreId
);
streamStore
.
remove
(
streamStoreId
);
}
}
}
}
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
cec0e8e0
...
@@ -50,6 +50,7 @@ public class TestMVTableEngine extends TestBase {
...
@@ -50,6 +50,7 @@ public class TestMVTableEngine extends TestBase {
@Override
@Override
public
void
test
()
throws
Exception
{
public
void
test
()
throws
Exception
{
testLobCopy
();
testLobReuse
();
testLobReuse
();
testShutdownDuringLobCreation
();
testShutdownDuringLobCreation
();
testLobCreationThenShutdown
();
testLobCreationThenShutdown
();
...
@@ -87,6 +88,27 @@ public class TestMVTableEngine extends TestBase {
...
@@ -87,6 +88,27 @@ public class TestMVTableEngine extends TestBase {
testSimple
();
testSimple
();
}
}
private
void
testLobCopy
()
throws
Exception
{
deleteDb
(
getTestName
());
Connection
conn
=
getConnection
(
getTestName
());
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, data clob)"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"insert into test(id, data) values(2, space(300))"
);
stat
.
execute
(
"insert into test(id, data) values(1, space(300))"
);
stat
.
execute
(
"alter table test add column x int"
);
if
(!
config
.
memory
)
{
conn
.
close
();
conn
=
getConnection
(
getTestName
());
}
stat
=
conn
.
createStatement
();
ResultSet
rs
=
stat
.
executeQuery
(
"select data from test"
);
while
(
rs
.
next
())
{
rs
.
getString
(
1
);
}
conn
.
close
();
}
private
void
testLobReuse
()
throws
Exception
{
private
void
testLobReuse
()
throws
Exception
{
deleteDb
(
getTestName
());
deleteDb
(
getTestName
());
Connection
conn
=
getConnection
(
getTestName
());
Connection
conn
=
getConnection
(
getTestName
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论