Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b5ec8300
提交
b5ec8300
authored
6 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
issue 1227: lob growth in pagestore mode
looks like a bug introduced at some point when MVStore was added
上级
9f4ea2c5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
43 行增加
和
6 行删除
+43
-6
Session.java
h2/src/main/org/h2/engine/Session.java
+7
-5
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+1
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+35
-0
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
b5ec8300
...
...
@@ -15,7 +15,6 @@ import java.util.LinkedList;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.Command
;
import
org.h2.command.CommandInterface
;
...
...
@@ -1311,13 +1310,14 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
* @param v the value
*/
public
void
removeAtCommit
(
Value
v
)
{
final
String
key
=
v
.
toString
();
if
(
SysProperties
.
CHECK
&&
!
v
.
isLinkedToTable
())
{
DbException
.
throwInternalError
(
v
.
toString
()
);
DbException
.
throwInternalError
(
key
);
}
if
(
removeLobMap
==
null
)
{
removeLobMap
=
new
HashMap
<>();
}
removeLobMap
.
put
(
v
.
toString
()
,
v
);
removeLobMap
.
put
(
key
,
v
);
}
/**
...
...
@@ -1702,13 +1702,15 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
if
(
v
.
getType
()
!=
Value
.
CLOB
&&
v
.
getType
()
!=
Value
.
BLOB
)
{
return
;
}
if
(
v
.
getTableId
()
==
LobStorageFrontend
.
TABLE_RESULT
||
v
.
getTableId
()
==
LobStorageFrontend
.
TABLE_TEMP
)
{
if
(
v
.
getTableId
()
==
LobStorageFrontend
.
TABLE_RESULT
)
{
if
(
temporaryResultLobs
==
null
)
{
temporaryResultLobs
=
new
LinkedList
<>();
}
temporaryResultLobs
.
add
(
new
TimeoutValue
(
v
));
}
else
{
// Things with tableId == LobStorageFrontend.TABLE_TEMP
// end up here because we don't need to keep them alive to cater
// for dodgy clients.
if
(
temporaryLobs
==
null
)
{
temporaryLobs
=
new
ArrayList
<>();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
b5ec8300
...
...
@@ -302,7 +302,7 @@ public class PageDataIndex extends PageIndex {
for
(
int
i
=
0
,
len
=
row
.
getColumnCount
();
i
<
len
;
i
++)
{
Value
v
=
row
.
getValue
(
i
);
if
(
v
.
isLinkedToTable
())
{
session
.
removeAtCommit
Stop
(
v
);
session
.
removeAtCommit
(
v
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
b5ec8300
...
...
@@ -56,6 +56,7 @@ public class TestLob extends TestDb {
public
static
void
main
(
String
...
a
)
throws
Exception
{
TestBase
test
=
TestBase
.
createCaller
().
init
();
test
.
config
.
big
=
true
;
test
.
config
.
mvStore
=
false
;
test
.
test
();
}
...
...
@@ -112,6 +113,7 @@ public class TestLob extends TestDb {
testLob
(
false
);
testLob
(
true
);
testJavaObject
();
testLobGrowth
();
deleteDb
(
"lob"
);
}
...
...
@@ -1685,4 +1687,37 @@ public class TestLob extends TestDb {
}
return
new
String
(
buffer
);
}
private
void
testLobGrowth
()
throws
SQLException
{
if
(
config
.
mvStore
)
{
return
;
}
final
File
dbFile
=
new
File
(
getBaseDir
(),
"lob.h2.db"
);
final
byte
[]
data
=
new
byte
[
2560
];
deleteDb
(
"lob"
);
JdbcConnection
conn
=
(
JdbcConnection
)
getConnection
(
"lob;LOB_TIMEOUT=0"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(ID IDENTITY PRIMARY KEY, DATA BLOB)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST(DATA) VALUES(?)"
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
prep
.
setBinaryStream
(
1
,
new
ByteArrayInputStream
(
data
));
prep
.
executeUpdate
();
}
final
long
initialSize
=
dbFile
.
length
();
prep
=
conn
.
prepareStatement
(
"UPDATE test SET data=? WHERE id=?"
);
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
for
(
int
j
=
0
;
j
<
100
;
j
++)
{
data
[
0
]
=
(
byte
)(
i
);
data
[
1
]
=
(
byte
)(
j
);
prep
.
setBinaryStream
(
1
,
new
ByteArrayInputStream
(
data
));
prep
.
setInt
(
2
,
j
);
prep
.
executeUpdate
();
}
}
assertTrue
(
"dbFile size "
+
dbFile
.
length
()
+
" is > initialSize "
+
initialSize
,
dbFile
.
length
()
<=
(
initialSize
*
1.5
));
conn
.
createStatement
().
execute
(
"drop table test"
);
conn
.
close
();
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论