Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
078d94ce
提交
078d94ce
authored
16 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Running out of memory could result in incomplete transactions or corrupted databases
上级
66f3f69d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
31 行增加
和
2 行删除
+31
-2
Command.java
h2/src/main/org/h2/command/Command.java
+2
-1
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+8
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+19
-0
Mode.java
h2/src/main/org/h2/engine/Mode.java
+0
-1
FileLock.java
h2/src/main/org/h2/store/FileLock.java
+2
-0
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
078d94ce
...
...
@@ -193,6 +193,7 @@ public abstract class Command implements CommandInterface {
public
int
executeUpdate
()
throws
SQLException
{
startTime
=
System
.
currentTimeMillis
();
Database
database
=
session
.
getDatabase
();
database
.
allocateReserveMemory
();
Object
sync
=
database
.
getMultiThreaded
()
?
(
Object
)
session
:
(
Object
)
database
;
session
.
waitIfExclusiveModeEnabled
();
synchronized
(
sync
)
{
...
...
@@ -200,10 +201,10 @@ public abstract class Command implements CommandInterface {
session
.
setCurrentCommand
(
this
,
startTime
);
try
{
database
.
checkPowerOff
();
int
test
;
try
{
return
update
();
}
catch
(
OutOfMemoryError
e
)
{
database
.
freeReserveMemory
();
throw
Message
.
convert
(
e
);
}
catch
(
Throwable
e
)
{
throw
Message
.
convert
(
e
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
078d94ce
...
...
@@ -389,6 +389,14 @@ public class SysProperties {
*/
public
static
final
int
REDO_BUFFER_SIZE
=
getIntSetting
(
"h2.redoBufferSize"
,
256
*
1024
);
/**
* System property <code>h2.reserveMemory</code> (default: 131072).<br />
* This many bytes in main memory are allocated as a reserve. This reserve
* is freed up when if no memory is available, so that rolling back a large
* transaction is easier.
*/
public
static
final
int
RESERVE_MEMORY
=
getIntSetting
(
"h2.reserveMemory"
,
128
*
1024
);
/**
* System property <code>h2.reuseSpaceAfter</code> (default: 16).<br />
* Reuse space in database files after this many pages are free.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
078d94ce
...
...
@@ -157,6 +157,8 @@ public class Database implements DataHandler {
private
boolean
lobFilesInDirectories
=
SysProperties
.
LOB_FILES_IN_DIRECTORIES
;
private
SmallLRUCache
lobFileListCache
=
new
SmallLRUCache
(
128
);
private
Object
reserveMemory
;
public
Database
(
String
name
,
ConnectionInfo
ci
,
String
cipher
)
throws
SQLException
{
this
.
compareMode
=
new
CompareMode
(
null
,
null
,
0
);
this
.
persistent
=
ci
.
isPersistent
();
...
...
@@ -2005,4 +2007,21 @@ public class Database implements DataHandler {
return
meta
.
isLockedExclusively
();
}
/**
* Allocate a little main memory that is freed up when if no memory is
* available, so that rolling back a large transaction is easier.
*/
public
void
allocateReserveMemory
()
{
if
(
reserveMemory
==
null
)
{
reserveMemory
=
new
byte
[
SysProperties
.
RESERVE_MEMORY
];
}
}
/**
* Free up the reserve memory.
*/
public
void
freeReserveMemory
()
{
reserveMemory
=
null
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
078d94ce
...
...
@@ -115,7 +115,6 @@ public class Mode {
add
(
mode
);
mode
=
new
Mode
(
"Oracle"
);
mode
.
uniqueIndexSingleNull
=
true
;
add
(
mode
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileLock.java
浏览文件 @
078d94ce
...
...
@@ -260,6 +260,8 @@ public class FileLock {
save
();
}
Thread
.
sleep
(
sleep
);
}
catch
(
OutOfMemoryError
e
)
{
// ignore
}
catch
(
Exception
e
)
{
trace
.
debug
(
"watchdog"
,
e
);
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论