Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f5c6cbe5
提交
f5c6cbe5
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SHUTDOWN COMPACT and compacting in general is faster.
上级
b9cafa06
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
39 行增加
和
12 行删除
+39
-12
changelog.html
h2/src/docsrc/html/changelog.html
+9
-3
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+30
-9
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
f5c6cbe5
...
...
@@ -18,9 +18,15 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The built-in profiling tool now uses a default stack depth of 32 elements and a default interval of 10 ms.
</li><li>
Database files now grow 2 MB at a time instead of 256 KB. This improves performance, specially
when loading a new database.
<ul><li>
Storing lobs in the database has been changed. It is now faster.
Unfortunately, the change is not backward compatible; if you have used h2.lobInDatabase before
you will need to re-build the database.
</li><li>
SHUTDOWN COMPACT and compacting in general is faster.
</li><li>
H2 Console: requesting the status did not always show the window on top of others.
</li><li>
H2 Console: on some system, the browser windows got opened when requesting a new one.
</li><li>
The built-in profiling tool now uses a default stack depth of 32 elements and a default interval of 10 ms.
</li><li>
Database files now grows in 1 MB blocks (and at least 2%) at a time,
instead of always 256 KB. This speeds up loading a new database.
</li><li>
H2 Console: new built-in command @sleep to help profile another session.
</li><li>
For improved performance, LOG=0 and LOG=1 are again supported.
LOG=0 means the transaction log is disabled completely (fastest; for loading a database).
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
f5c6cbe5
...
...
@@ -121,13 +121,15 @@ public class PageStore implements CacheWriter {
private
static
final
int
PAGE_ID_FREE_LIST_ROOT
=
3
;
private
static
final
int
PAGE_ID_META_ROOT
=
4
;
private
static
final
int
MIN_PAGE_COUNT
=
6
;
private
static
final
int
INCREMENT_KB
=
2048
;
private
static
final
int
INCREMENT_KB
=
1024
;
private
static
final
int
INCREMENT_PERCENT_MIN
=
2
;
private
static
final
int
READ_VERSION
=
3
;
private
static
final
int
WRITE_VERSION
=
3
;
private
static
final
int
META_TYPE_DATA_INDEX
=
0
;
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
{
};
private
static
final
int
COMPACT_BLOCK_SIZE
=
1536
;
private
Database
database
;
private
final
Trace
trace
;
private
String
fileName
;
...
...
@@ -291,7 +293,7 @@ public class PageStore implements CacheWriter {
log
.
openForWriting
(
logFirstTrunkPage
,
false
);
isNew
=
true
;
recoveryRunning
=
false
;
increaseFileSize
(
INCREMENT_KB
*
1024
/
pageSize
);
increaseFileSize
();
}
private
void
openExisting
()
{
...
...
@@ -443,16 +445,26 @@ public class PageStore implements CacheWriter {
maxCompactTime
=
Integer
.
MAX_VALUE
;
maxMove
=
Integer
.
MAX_VALUE
;
}
for
(
int
x
=
lastUsed
,
j
=
0
;
x
>
MIN_PAGE_COUNT
&&
j
<
maxMove
;
x
--,
j
++)
{
int
blockSize
=
COMPACT_BLOCK_SIZE
;
for
(
int
x
=
lastUsed
,
j
=
0
;
x
>
MIN_PAGE_COUNT
&&
j
<
maxMove
;
x
-=
blockSize
)
{
for
(
int
y
=
x
-
blockSize
+
1
;
y
<=
x
;
y
++)
{
if
(
y
>
MIN_PAGE_COUNT
)
{
getPage
(
y
);
}
}
for
(
int
y
=
x
-
blockSize
+
1
;
y
<=
x
;
y
++)
{
if
(
y
>
MIN_PAGE_COUNT
)
{
synchronized
(
database
)
{
compact
(
x
);
compact
(
y
);
}
j
++;
}
}
long
now
=
System
.
currentTimeMillis
();
if
(
now
>
start
+
maxCompactTime
)
{
break
;
}
}
// TODO can most likely be simplified
checkpoint
();
log
.
checkpoint
();
...
...
@@ -878,7 +890,7 @@ public class PageStore implements CacheWriter {
synchronized
(
database
)
{
int
p
=
PAGE_ID_FREE_LIST_ROOT
+
i
*
freeListPagesPerList
;
while
(
p
>=
pageCount
)
{
increaseFileSize
(
INCREMENT_KB
*
1024
/
pageSize
);
increaseFileSize
();
}
if
(
p
<
pageCount
)
{
list
=
(
PageFreeList
)
getPage
(
p
);
...
...
@@ -954,8 +966,8 @@ public class PageStore implements CacheWriter {
break
;
}
}
if
(
page
>=
pageCount
)
{
increaseFileSize
(
INCREMENT_KB
*
1024
/
pageSize
);
while
(
page
>=
pageCount
)
{
increaseFileSize
();
}
if
(
trace
.
isDebugEnabled
())
{
// trace.debug("allocatePage " + pos);
...
...
@@ -964,6 +976,15 @@ public class PageStore implements CacheWriter {
}
}
private
void
increaseFileSize
()
{
int
increment
=
INCREMENT_KB
*
1024
/
pageSize
;
int
percent
=
pageCount
*
INCREMENT_PERCENT_MIN
/
100
;
if
(
increment
<
percent
)
{
increment
=
(
1
+
(
percent
/
increment
))
*
increment
;
}
increaseFileSize
(
increment
);
}
private
void
increaseFileSize
(
int
increment
)
{
for
(
int
i
=
pageCount
;
i
<
pageCount
+
increment
;
i
++)
{
freed
.
set
(
i
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论