Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
530549d2
提交
530549d2
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Page store bugfixes
上级
06214924
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
22 行删除
+14
-22
PageDataLeaf.java
h2/src/main/org/h2/index/PageDataLeaf.java
+1
-20
PageDataOverflow.java
h2/src/main/org/h2/index/PageDataOverflow.java
+1
-0
CacheLRU.java
h2/src/main/org/h2/util/CacheLRU.java
+12
-2
没有找到文件。
h2/src/main/org/h2/index/PageDataLeaf.java
浏览文件 @
530549d2
...
...
@@ -33,7 +33,7 @@ import org.h2.store.PageStore;
* </ul>
*/
public
class
PageDataLeaf
extends
PageData
{
/**
* The start of the data in the last overflow page.
*/
...
...
@@ -222,11 +222,6 @@ public class PageDataLeaf extends PageData {
all
.
checkCapacity
(
data
.
length
());
all
.
write
(
data
.
getBytes
(),
0
,
data
.
length
());
data
.
truncate
(
index
.
getPageStore
().
getPageSize
());
// write the page now to disk, to avoid problems
// when the page needs to be written before the overflow
// is written to disk (the cache first removes elements,
// moves them in a write queue, and then writes them)
write
(
null
);
do
{
int
type
,
size
,
next
;
if
(
remaining
<=
pageSize
-
PageDataOverflow
.
START_LAST
)
{
...
...
@@ -507,19 +502,5 @@ public class PageDataLeaf extends PageData {
public
int
getMemorySize
()
{
return
index
.
getMemorySizePerPage
();
}
void
setParentPageId
(
int
id
)
{
// never reset the written flag not only for speed, but also
// because if would cause the page to be written again if
// it contains overflow, which would cause the data to be read,
// and that's not possible because the overflow page may be
// not in the cache but in the write queue already
if
(
written
)
{
data
.
setInt
(
START_PARENT
,
id
);
this
.
parentPageId
=
id
;
}
else
{
super
.
setParentPageId
(
id
);
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/PageDataOverflow.java
浏览文件 @
530549d2
...
...
@@ -110,6 +110,7 @@ public class PageDataOverflow extends Page {
Data
data
=
store
.
createData
();
PageDataOverflow
p
=
new
PageDataOverflow
(
store
,
page
,
data
);
data
.
writeByte
((
byte
)
type
);
data
.
writeShortInt
(
0
);
data
.
writeInt
(
parentPageId
);
if
(
type
==
Page
.
TYPE_DATA_OVERFLOW
)
{
data
.
writeInt
(
next
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
530549d2
...
...
@@ -126,8 +126,11 @@ public class CacheLRU implements Cache {
private
void
removeOld
()
throws
SQLException
{
int
i
=
0
;
int
todoImplementInOtherCachesAsWell
;
ObjectArray
<
CacheObject
>
changed
=
ObjectArray
.
newInstance
();
while
(
sizeMemory
*
4
>
maxSize
*
3
&&
recordCount
>
Constants
.
CACHE_MIN_RECORDS
)
{
int
mem
=
sizeMemory
;
int
rc
=
recordCount
;
while
(
mem
*
4
>
maxSize
*
3
&&
rc
>
Constants
.
CACHE_MIN_RECORDS
)
{
i
++;
if
(
i
==
recordCount
)
{
writer
.
flushLog
();
...
...
@@ -151,10 +154,13 @@ public class CacheLRU implements Cache {
addToFront
(
last
);
continue
;
}
remove
(
last
.
getPos
());
if
(
last
.
isChanged
())
{
changed
.
add
(
last
);
}
else
{
remove
(
last
.
getPos
());
}
rc
--;
mem
-=
last
.
getMemorySize
();
}
if
(
changed
.
size
()
>
0
)
{
CacheObject
.
sort
(
changed
);
...
...
@@ -162,6 +168,10 @@ public class CacheLRU implements Cache {
CacheObject
rec
=
changed
.
get
(
i
);
writer
.
writeBack
(
rec
);
}
for
(
i
=
0
;
i
<
changed
.
size
();
i
++)
{
CacheObject
rec
=
changed
.
get
(
i
);
remove
(
rec
.
getPos
());
}
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论