Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9cc5ebee
提交
9cc5ebee
authored
12月 23, 2018
作者:
Andrei Tokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor code around append buffer locking
上级
5de4e30b
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
66 行增加
和
123 行删除
+66
-123
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+50
-117
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+1
-1
MVRTreeMap.java
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
+1
-1
TransactionMap.java
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
+14
-4
没有找到文件。
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
9cc5ebee
差异被折叠。
点击展开。
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
9cc5ebee
...
@@ -1400,7 +1400,7 @@ public class MVStore implements AutoCloseable {
...
@@ -1400,7 +1400,7 @@ public class MVStore implements AutoCloseable {
try
{
try
{
ChunkIdsCollector
collector
=
new
ChunkIdsCollector
(
meta
.
getId
());
ChunkIdsCollector
collector
=
new
ChunkIdsCollector
(
meta
.
getId
());
long
oldestVersionToKeep
=
getOldestVersionToKeep
();
long
oldestVersionToKeep
=
getOldestVersionToKeep
();
MVMap
.
RootReference
rootReference
=
meta
.
g
etRoot
();
MVMap
.
RootReference
rootReference
=
meta
.
flushAndG
etRoot
();
if
(
fast
)
{
if
(
fast
)
{
MVMap
.
RootReference
previous
;
MVMap
.
RootReference
previous
;
while
(
rootReference
.
version
>=
oldestVersionToKeep
&&
(
previous
=
rootReference
.
previous
)
!=
null
)
{
while
(
rootReference
.
version
>=
oldestVersionToKeep
&&
(
previous
=
rootReference
.
previous
)
!=
null
)
{
...
...
h2/src/main/org/h2/mvstore/rtree/MVRTreeMap.java
浏览文件 @
9cc5ebee
...
@@ -134,7 +134,7 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
...
@@ -134,7 +134,7 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
int
attempt
=
0
;
int
attempt
=
0
;
while
(
true
)
{
while
(
true
)
{
++
attempt
;
++
attempt
;
RootReference
rootReference
=
g
etRoot
();
RootReference
rootReference
=
flushAndG
etRoot
();
Page
p
=
rootReference
.
root
.
copy
(
true
);
Page
p
=
rootReference
.
root
.
copy
(
true
);
V
result
=
operate
(
p
,
key
,
value
,
decisionMaker
);
V
result
=
operate
(
p
,
key
,
value
,
decisionMaker
);
if
(!
p
.
isLeaf
()
&&
p
.
getTotalCount
()
==
0
)
{
if
(!
p
.
isLeaf
()
&&
p
.
getTotalCount
()
==
0
)
{
...
...
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
浏览文件 @
9cc5ebee
...
@@ -104,7 +104,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -104,7 +104,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
long
undoLogSize
;
long
undoLogSize
;
do
{
do
{
committingTransactions
=
store
.
committingTransactions
.
get
();
committingTransactions
=
store
.
committingTransactions
.
get
();
mapRootReference
=
map
.
g
etRoot
();
mapRootReference
=
map
.
flushAndG
etRoot
();
BitSet
opentransactions
=
store
.
openTransactions
.
get
();
BitSet
opentransactions
=
store
.
openTransactions
.
get
();
undoLogRootReferences
=
new
MVMap
.
RootReference
[
opentransactions
.
length
()];
undoLogRootReferences
=
new
MVMap
.
RootReference
[
opentransactions
.
length
()];
undoLogSize
=
0
;
undoLogSize
=
0
;
...
@@ -113,7 +113,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -113,7 +113,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
if
(
undoLog
!=
null
)
{
if
(
undoLog
!=
null
)
{
MVMap
.
RootReference
rootReference
=
undoLog
.
getRoot
();
MVMap
.
RootReference
rootReference
=
undoLog
.
getRoot
();
undoLogRootReferences
[
i
]
=
rootReference
;
undoLogRootReferences
[
i
]
=
rootReference
;
undoLogSize
+=
rootReference
.
root
.
getTotalCount
()
+
rootReference
.
getAppendCounter
();
undoLogSize
+=
rootReference
.
getTotalCount
();
}
}
}
}
}
while
(
committingTransactions
!=
store
.
committingTransactions
.
get
()
||
}
while
(
committingTransactions
!=
store
.
committingTransactions
.
get
()
||
...
@@ -124,7 +124,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -124,7 +124,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
// should be considered as committed.
// should be considered as committed.
// Subsequent processing uses this snapshot info only.
// Subsequent processing uses this snapshot info only.
Page
mapRootPage
=
mapRootReference
.
root
;
Page
mapRootPage
=
mapRootReference
.
root
;
long
size
=
mapRoot
Pag
e
.
getTotalCount
();
long
size
=
mapRoot
Referenc
e
.
getTotalCount
();
// if we are looking at the map without any uncommitted values
// if we are looking at the map without any uncommitted values
if
(
undoLogSize
==
0
)
{
if
(
undoLogSize
==
0
)
{
return
size
;
return
size
;
...
@@ -240,6 +240,16 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -240,6 +240,16 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
return
set
(
key
,
decisionMaker
);
return
set
(
key
,
decisionMaker
);
}
}
/**
* Appends entry to uderlying map. This method may be used concurrently,
* but latest appended values are not guaranteed to be visible.
* @param key should be higher in map's order than any existing key
* @param value to be appended
*/
public
void
append
(
K
key
,
V
value
)
{
map
.
append
(
key
,
VersionedValue
.
getInstance
(
transaction
.
log
(
map
.
getId
(),
key
,
null
),
value
,
null
));
}
/**
/**
* Lock row for the given key.
* Lock row for the given key.
* <p>
* <p>
...
@@ -678,7 +688,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -678,7 +688,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
MVMap
.
RootReference
mapRootReference
;
MVMap
.
RootReference
mapRootReference
;
do
{
do
{
committingTransactions
=
store
.
committingTransactions
.
get
();
committingTransactions
=
store
.
committingTransactions
.
get
();
mapRootReference
=
map
.
g
etRoot
();
mapRootReference
=
map
.
flushAndG
etRoot
();
}
while
(
committingTransactions
!=
store
.
committingTransactions
.
get
());
}
while
(
committingTransactions
!=
store
.
committingTransactions
.
get
());
// Now we have a snapshot, where mapRootReference points to state of the map
// Now we have a snapshot, where mapRootReference points to state of the map
// and committingTransactions mask tells us which of seemingly uncommitted changes
// and committingTransactions mask tells us which of seemingly uncommitted changes
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论