Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9a695218
提交
9a695218
authored
10月 26, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New system properties h2.maxCompactCount and h2.maxCompactTime
上级
8d64639e
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
6 行删除
+24
-6
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+13
-0
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+11
-6
没有找到文件。
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
9a695218
...
...
@@ -311,6 +311,19 @@ public class SysProperties {
*/
public
static
final
String
LOG_ALL_ERRORS_FILE
=
getStringSetting
(
"h2.logAllErrorsFile"
,
"h2errors.txt"
);
/**
* System property <code>h2.maxCompactCount</code>
* (default: Integer.MAX_VALUE).<br />
* The maximum number of pages to move when closing a database.
*/
public
static
final
int
MAX_COMPACT_COUNT
=
getIntSetting
(
"h2.maxCompactCount"
,
Integer
.
MAX_VALUE
);
/**
* System property <code>h2.maxCompactTime</code> (default: 1000).<br />
* The maximum time in milliseconds used to compact a database when closing.
*/
public
static
final
int
MAX_COMPACT_TIME
=
getIntSetting
(
"h2.maxCompactTime"
,
1000
);
/**
* System property <code>h2.maxFileRetry</code> (default: 16).<br />
* Number of times to retry file delete and rename. in Windows, files can't
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
9a695218
...
...
@@ -113,6 +113,8 @@ public class PageStore implements CacheWriter {
// remove Database.objectIds
// remove TableData.checkRowCount
// remove Row.setPos
// remove database URL option RECOVER=1 option
// remove old database URL options and documentation
/**
* The smallest possible page size.
...
...
@@ -143,9 +145,6 @@ public class PageStore implements CacheWriter {
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
int
MAX_COMPACT_TIME
=
2000
;
private
static
final
int
MAX_COMPACT_COUNT
=
Integer
.
MAX_VALUE
;
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
new
SearchRow
[
0
];
private
Database
database
;
...
...
@@ -352,8 +351,10 @@ public class PageStore implements CacheWriter {
/**
* Shrink the file so there are no empty pages at the end.
*
* @param fully if the database should be fully compressed
*/
public
void
trim
(
)
throws
SQLException
{
public
void
compact
(
boolean
fully
)
throws
SQLException
{
if
(!
SysProperties
.
PAGE_STORE_TRIM
)
{
return
;
}
...
...
@@ -378,8 +379,12 @@ public class PageStore implements CacheWriter {
recoveryRunning
=
false
;
}
long
start
=
System
.
currentTimeMillis
();
int
maxCompactTime
=
MAX_COMPACT_TIME
;
int
maxMove
=
MAX_COMPACT_COUNT
;
int
maxCompactTime
=
SysProperties
.
MAX_COMPACT_TIME
;
int
maxMove
=
SysProperties
.
MAX_COMPACT_COUNT
;
if
(
fully
)
{
maxCompactTime
=
Integer
.
MAX_VALUE
;
maxMove
=
Integer
.
MAX_VALUE
;
}
for
(
int
x
=
lastUsed
,
j
=
0
;
x
>
MIN_PAGE_COUNT
&&
j
<
maxMove
;
x
--,
j
++)
{
compact
(
x
);
long
now
=
System
.
currentTimeMillis
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论