Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
efc5d747
提交
efc5d747
authored
8月 03, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various bugfixes and improvements in the page store mechanism (still experimental).
上级
16bdacb2
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
18 行增加
和
4 行删除
+18
-4
PageBtreeNode.java
h2/src/main/org/h2/index/PageBtreeNode.java
+1
-1
PageDataNode.java
h2/src/main/org/h2/index/PageDataNode.java
+11
-1
PageScanIndex.java
h2/src/main/org/h2/index/PageScanIndex.java
+1
-1
PageInputStream.java
h2/src/main/org/h2/store/PageInputStream.java
+3
-1
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+2
-0
没有找到文件。
h2/src/main/org/h2/index/PageBtreeNode.java
浏览文件 @
efc5d747
...
@@ -172,6 +172,7 @@ class PageBtreeNode extends PageBtree {
...
@@ -172,6 +172,7 @@ class PageBtreeNode extends PageBtree {
p2
.
onlyPosition
=
true
;
p2
.
onlyPosition
=
true
;
}
}
int
firstChild
=
childPageIds
[
splitPoint
];
int
firstChild
=
childPageIds
[
splitPoint
];
readAllRows
();
for
(
int
i
=
splitPoint
;
i
<
entryCount
;)
{
for
(
int
i
=
splitPoint
;
i
<
entryCount
;)
{
p2
.
addChild
(
p2
.
entryCount
,
childPageIds
[
splitPoint
+
1
],
rows
[
splitPoint
]);
p2
.
addChild
(
p2
.
entryCount
,
childPageIds
[
splitPoint
+
1
],
rows
[
splitPoint
]);
removeChild
(
splitPoint
);
removeChild
(
splitPoint
);
...
@@ -258,7 +259,6 @@ class PageBtreeNode extends PageBtree {
...
@@ -258,7 +259,6 @@ class PageBtreeNode extends PageBtree {
// no more children - this page is empty as well
// no more children - this page is empty as well
return
true
;
return
true
;
}
}
written
=
false
;
removeChild
(
at
);
removeChild
(
at
);
index
.
getPageStore
().
updateRecord
(
this
,
true
,
data
);
index
.
getPageStore
().
updateRecord
(
this
,
true
,
data
);
return
false
;
return
false
;
...
...
h2/src/main/org/h2/index/PageDataNode.java
浏览文件 @
efc5d747
...
@@ -60,6 +60,7 @@ class PageDataNode extends PageData {
...
@@ -60,6 +60,7 @@ class PageDataNode extends PageData {
}
}
private
void
addChild
(
int
x
,
int
childPageId
,
int
key
)
{
private
void
addChild
(
int
x
,
int
childPageId
,
int
key
)
{
written
=
false
;
int
[]
newKeys
=
new
int
[
entryCount
+
1
];
int
[]
newKeys
=
new
int
[
entryCount
+
1
];
int
[]
newChildPageIds
=
new
int
[
entryCount
+
2
];
int
[]
newChildPageIds
=
new
int
[
entryCount
+
2
];
if
(
childPageIds
!=
null
)
{
if
(
childPageIds
!=
null
)
{
...
@@ -256,6 +257,14 @@ class PageDataNode extends PageData {
...
@@ -256,6 +257,14 @@ class PageDataNode extends PageData {
}
}
public
void
write
(
DataPage
buff
)
throws
SQLException
{
public
void
write
(
DataPage
buff
)
throws
SQLException
{
write
();
index
.
getPageStore
().
writePage
(
getPos
(),
data
);
}
private
void
write
()
{
if
(
written
)
{
return
;
}
check
();
check
();
data
.
reset
();
data
.
reset
();
data
.
writeInt
(
parentPageId
);
data
.
writeInt
(
parentPageId
);
...
@@ -267,10 +276,11 @@ class PageDataNode extends PageData {
...
@@ -267,10 +276,11 @@ class PageDataNode extends PageData {
data
.
writeInt
(
childPageIds
[
i
]);
data
.
writeInt
(
childPageIds
[
i
]);
data
.
writeInt
(
keys
[
i
]);
data
.
writeInt
(
keys
[
i
]);
}
}
index
.
getPageStore
().
writePage
(
getPos
(),
data
)
;
written
=
true
;
}
}
private
void
removeChild
(
int
i
)
{
private
void
removeChild
(
int
i
)
{
written
=
false
;
entryCount
--;
entryCount
--;
if
(
entryCount
<
0
)
{
if
(
entryCount
<
0
)
{
Message
.
throwInternalError
();
Message
.
throwInternalError
();
...
...
h2/src/main/org/h2/index/PageScanIndex.java
浏览文件 @
efc5d747
...
@@ -211,7 +211,7 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
...
@@ -211,7 +211,7 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
result
.
read
();
result
.
read
();
if
(
parent
!=
-
1
)
{
if
(
parent
!=
-
1
)
{
if
(
result
.
getParentPageId
()
!=
parent
)
{
if
(
result
.
getParentPageId
()
!=
parent
)
{
throw
Message
.
throwInternalError
(
result
.
getParentPageId
()
+
" "
+
parent
+
" "
+
resul
t
);
throw
Message
.
throwInternalError
(
result
+
" parent "
+
result
.
getParentPageId
()
+
" expected "
+
paren
t
);
}
}
}
}
return
result
;
return
result
;
...
...
h2/src/main/org/h2/store/PageInputStream.java
浏览文件 @
efc5d747
...
@@ -86,16 +86,18 @@ public class PageInputStream extends InputStream {
...
@@ -86,16 +86,18 @@ public class PageInputStream extends InputStream {
if
(
trunk
==
null
)
{
if
(
trunk
==
null
)
{
trunk
=
new
PageStreamTrunk
(
store
,
trunkNext
);
trunk
=
new
PageStreamTrunk
(
store
,
trunkNext
);
trunk
.
read
();
trunk
.
read
();
trunkNext
=
trunk
.
getNextTrunk
();
}
}
int
next
;
int
next
;
while
(
true
)
{
while
(
true
)
{
next
=
trunk
.
getNextPageData
();
next
=
trunk
.
getNextPageData
();
if
(
dataPage
==
-
1
||
dataPage
==
next
)
{
if
(
dataPage
==
-
1
||
dataPage
==
next
)
{
if
(
next
!=
0
)
{
if
(
next
!=
-
1
)
{
break
;
break
;
}
}
trunk
=
new
PageStreamTrunk
(
store
,
trunkNext
);
trunk
=
new
PageStreamTrunk
(
store
,
trunkNext
);
trunk
.
read
();
trunk
.
read
();
trunkNext
=
trunk
.
getNextTrunk
();
}
}
}
}
if
(
trace
.
isDebugEnabled
())
{
if
(
trace
.
isDebugEnabled
())
{
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
efc5d747
...
@@ -669,6 +669,8 @@ public class PageStore implements CacheWriter {
...
@@ -669,6 +669,8 @@ public class PageStore implements CacheWriter {
synchronized
(
database
)
{
synchronized
(
database
)
{
if
(
pos
>=
pageCount
)
{
if
(
pos
>=
pageCount
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_CORRUPTED_1
,
pos
+
" of "
+
pageCount
);
throw
Message
.
getSQLException
(
ErrorCode
.
FILE_CORRUPTED_1
,
pos
+
" of "
+
pageCount
);
}
else
if
(
pos
<
0
)
{
throw
Message
.
throwInternalError
(
"negative offset: "
+
pos
);
}
}
file
.
seek
((
long
)
pos
<<
pageSizeShift
);
file
.
seek
((
long
)
pos
<<
pageSizeShift
);
file
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
file
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论