Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
aa4c1bd1
提交
aa4c1bd1
authored
9月 18, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Page store
上级
cd42fd90
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
13 行删除
+18
-13
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+18
-13
没有找到文件。
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
aa4c1bd1
...
@@ -81,17 +81,7 @@ import org.h2.value.ValueString;
...
@@ -81,17 +81,7 @@ import org.h2.value.ValueString;
*/
*/
public
class
PageStore
implements
CacheWriter
{
public
class
PageStore
implements
CacheWriter
{
// TODO freed: truncate when decreasing size
// TODO check commit delay
// TODO do not trim large databases fully, only up to x seconds
// TODO use regular page type for page 1 and 2
// TODO implement checksum; 0 for empty pages
// TODO implement checksum; 0 for empty pages
// TODO undo log: don't store empty space between head and data
// TODO update: only log the key and changed values
// TODO maybe remove some parent pointers
// TODO index creation: use less space (ordered, split at insertion point)
// TODO test running out of disk space (using a special file system)
// TODO test running out of disk space (using a special file system)
// TODO utf-x: test if it's faster
// TODO utf-x: test if it's faster
...
@@ -99,7 +89,9 @@ public class PageStore implements CacheWriter {
...
@@ -99,7 +89,9 @@ public class PageStore implements CacheWriter {
// TODO optimization: try to avoid allocating a byte array per page
// TODO optimization: try to avoid allocating a byte array per page
// TODO optimization: check if calling Data.getValueLen slows things down
// TODO optimization: check if calling Data.getValueLen slows things down
// TODO order pages so that searching for a key only seeks forward
// TODO order pages so that searching for a key only seeks forward
// TODO optimization: update: only log the key and changed values
// TODO maybe remove some parent pointers
// TODO index creation: use less space (ordered, split at insertion point)
// TODO detect circles in linked lists
// TODO detect circles in linked lists
// (input stream, free list, extend pages...)
// (input stream, free list, extend pages...)
// at runtime and recovery
// at runtime and recovery
...
@@ -159,6 +151,9 @@ public class PageStore implements CacheWriter {
...
@@ -159,6 +151,9 @@ public class PageStore implements CacheWriter {
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TYPE_BTREE_INDEX
=
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
int
META_TABLE_ID
=
-
1
;
private
static
final
int
MAX_COMACT_TIME
=
2000
;
private
static
final
int
MAX_COMACT_COUNT
=
Integer
.
MAX_VALUE
;
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
new
SearchRow
[
0
];
private
static
final
SearchRow
[]
EMPTY_SEARCH_ROW
=
new
SearchRow
[
0
];
private
Database
database
;
private
Database
database
;
...
@@ -379,9 +374,15 @@ public class PageStore implements CacheWriter {
...
@@ -379,9 +374,15 @@ public class PageStore implements CacheWriter {
}
finally
{
}
finally
{
recoveryRunning
=
false
;
recoveryRunning
=
false
;
}
}
int
maxMove
=
Integer
.
MAX_VALUE
;
long
start
=
System
.
currentTimeMillis
();
int
maxCompactTime
=
MAX_COMACT_TIME
;
int
maxMove
=
MAX_COMACT_COUNT
;
for
(
int
x
=
lastUsed
,
j
=
0
;
x
>
MIN_PAGE_COUNT
&&
j
<
maxMove
;
x
--,
j
++)
{
for
(
int
x
=
lastUsed
,
j
=
0
;
x
>
MIN_PAGE_COUNT
&&
j
<
maxMove
;
x
--,
j
++)
{
compact
(
x
);
compact
(
x
);
long
now
=
System
.
currentTimeMillis
();
if
(
now
>
start
+
maxCompactTime
)
{
break
;
}
}
}
writeBack
();
writeBack
();
// truncate the log
// truncate the log
...
@@ -399,7 +400,11 @@ public class PageStore implements CacheWriter {
...
@@ -399,7 +400,11 @@ public class PageStore implements CacheWriter {
break
;
break
;
}
}
}
}
pageCount
=
lastUsed
+
1
;
int
newPageCount
=
lastUsed
+
1
;
if
(
newPageCount
<
pageCount
)
{
freed
.
setRange
(
newPageCount
,
pageCount
-
newPageCount
,
false
);
}
pageCount
=
newPageCount
;
// the easiest way to remove superfluous entries
// the easiest way to remove superfluous entries
freeLists
.
clear
();
freeLists
.
clear
();
trace
.
debug
(
"pageCount:"
+
pageCount
);
trace
.
debug
(
"pageCount:"
+
pageCount
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论