Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
932f95ac
提交
932f95ac
authored
10 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make changes to page references atomic
上级
79798338
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
98 行增加
和
88 行删除
+98
-88
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+5
-3
MVMapConcurrent.java
h2/src/main/org/h2/mvstore/MVMapConcurrent.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+10
-7
Page.java
h2/src/main/org/h2/mvstore/Page.java
+62
-70
MVRTreeMap.java
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
+20
-7
没有找到文件。
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
932f95ac
...
...
@@ -154,12 +154,14 @@ public class MVMap<K, V> extends AbstractMap<K, V>
Object
k
=
p
.
getKey
(
at
);
Page
split
=
p
.
split
(
at
);
Object
[]
keys
=
{
k
};
long
[]
children
=
{
p
.
getPos
(),
split
.
getPos
()
};
Page
[]
childrenPages
=
{
p
,
split
};
Page
.
PageReference
[]
children
=
{
new
Page
.
PageReference
(
p
,
p
.
getPos
()),
new
Page
.
PageReference
(
split
,
split
.
getPos
()),
};
long
[]
counts
=
{
p
.
getTotalCount
(),
split
.
getTotalCount
()
};
p
=
Page
.
create
(
this
,
writeVersion
,
1
,
keys
,
null
,
2
,
children
,
c
hildrenPages
,
c
ounts
,
2
,
children
,
counts
,
totalCount
,
0
,
0
);
return
p
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVMapConcurrent.java
浏览文件 @
932f95ac
...
...
@@ -57,7 +57,7 @@ public class MVMapConcurrent<K, V> extends MVMap<K, V> {
afterWrite
();
}
}
@Override
protected
void
waitUntilWritten
(
long
version
)
{
// no need to wait
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
932f95ac
...
...
@@ -112,6 +112,9 @@ MVStore:
a map lookup when reading old data; also, this
old data map needs to be cleaned up somehow;
maybe using an additional timeout
- rollback of removeMap should restore the data -
which has big consequences, as the metadata map
would probably need references to the root nodes of all maps
*/
...
...
@@ -823,11 +826,10 @@ public class MVStore {
/**
* Whether the chunk at the given position is live.
*
* @param
pos the position of the page
* @param
the chunk id
* @return true if it is live
*/
boolean
isChunkLive
(
long
pos
)
{
int
chunkId
=
DataUtils
.
getPageChunkId
(
pos
);
boolean
isChunkLive
(
int
chunkId
)
{
String
s
=
meta
.
get
(
Chunk
.
getMetaKey
(
chunkId
));
return
s
!=
null
;
}
...
...
@@ -2262,9 +2264,10 @@ public class MVStore {
}
/**
* Remove a map.
*
* @param map the map
* Remove a map. Please note rolling back this operation does not restore
* the data; if you need this ability, use Map.clear().
*
* @param map the map to remove
*/
public
synchronized
void
removeMap
(
MVMap
<?,
?>
map
)
{
checkOpen
();
...
...
@@ -2397,7 +2400,7 @@ public class MVStore {
return
;
}
autoCommitDelay
=
millis
;
if
(
fileStore
==
null
)
{
if
(
fileStore
==
null
||
fileStore
.
isReadOnly
()
)
{
return
;
}
stopBackgroundThread
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
932f95ac
差异被折叠。
点击展开。
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
浏览文件 @
932f95ac
...
...
@@ -248,13 +248,16 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
Object
k1
=
getBounds
(
p
);
Object
k2
=
getBounds
(
split
);
Object
[]
keys
=
{
k1
,
k2
};
long
[]
children
=
{
p
.
getPos
(),
split
.
getPos
(),
0
};
Page
[]
childrenPages
=
{
p
,
split
,
null
};
Page
.
PageReference
[]
children
=
{
new
Page
.
PageReference
(
p
,
p
.
getPos
()),
new
Page
.
PageReference
(
split
,
split
.
getPos
()),
new
Page
.
PageReference
(
null
,
0
)
};
long
[]
counts
=
{
p
.
getTotalCount
(),
split
.
getTotalCount
(),
0
};
p
=
Page
.
create
(
this
,
v
,
2
,
keys
,
null
,
3
,
children
,
c
hildrenPages
,
c
ounts
,
3
,
children
,
counts
,
totalCount
,
0
,
0
);
// now p is a node; continues
}
...
...
@@ -449,12 +452,22 @@ public class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
}
private
Page
newPage
(
boolean
leaf
,
long
writeVersion
)
{
Object
[]
values
=
leaf
?
new
Object
[
4
]
:
null
;
long
[]
c
=
leaf
?
null
:
new
long
[
1
];
Page
[]
cp
=
leaf
?
null
:
new
Page
[
1
];
Object
[]
values
;
Page
.
PageReference
[]
refs
;
long
[]
c
;
if
(
leaf
)
{
values
=
new
Object
[
4
];
refs
=
null
;
c
=
null
;
}
else
{
values
=
null
;
refs
=
new
Page
.
PageReference
[]
{
new
Page
.
PageReference
(
null
,
0
)};
c
=
new
long
[
1
];
}
return
Page
.
create
(
this
,
writeVersion
,
0
,
new
Object
[
4
],
values
,
leaf
?
0
:
1
,
c
,
cp
,
c
,
0
,
0
,
0
);
leaf
?
0
:
1
,
refs
,
c
,
0
,
0
,
0
);
}
private
static
void
move
(
Page
source
,
Page
target
,
int
sourceIndex
)
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论