Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d4b3f8f6
提交
d4b3f8f6
authored
2月 18, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into lower
上级
a629fbfe
a4b3367e
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
20 行增加
和
39 行删除
+20
-39
MVMap.java
h2/src/main/org/h2/mvstore/MVMap.java
+14
-36
Page.java
h2/src/main/org/h2/mvstore/Page.java
+1
-1
TransactionMap.java
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
+1
-1
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+3
-0
Value.java
h2/src/main/org/h2/value/Value.java
+1
-1
没有找到文件。
h2/src/main/org/h2/mvstore/MVMap.java
浏览文件 @
d4b3f8f6
...
@@ -148,19 +148,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -148,19 +148,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
@Override
@Override
public
V
put
(
K
key
,
V
value
)
{
public
V
put
(
K
key
,
V
value
)
{
DataUtils
.
checkArgument
(
value
!=
null
,
"The value may not be null"
);
DataUtils
.
checkArgument
(
value
!=
null
,
"The value may not be null"
);
return
put
(
key
,
value
,
DecisionMaker
.
PUT
);
return
operate
(
key
,
value
,
DecisionMaker
.
PUT
);
}
/**
* Add or replace a key-value pair.
*
* @param key the key (may not be null)
* @param value the value (may not be null)
* @param decisionMaker callback object for update logic
* @return the old value if the key existed, or null otherwise
*/
public
final
V
put
(
K
key
,
V
value
,
DecisionMaker
<?
super
V
>
decisionMaker
)
{
return
operate
(
key
,
value
,
decisionMaker
);
}
}
/**
/**
...
@@ -467,7 +455,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -467,7 +455,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
*/
*/
@Override
@Override
public
final
V
putIfAbsent
(
K
key
,
V
value
)
{
public
final
V
putIfAbsent
(
K
key
,
V
value
)
{
return
put
(
key
,
value
,
DecisionMaker
.
IF_ABSENT
);
return
operate
(
key
,
value
,
DecisionMaker
.
IF_ABSENT
);
}
}
/**
/**
...
@@ -485,17 +473,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -485,17 +473,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
return
decisionMaker
.
getDecision
()
!=
Decision
.
ABORT
;
return
decisionMaker
.
getDecision
()
!=
Decision
.
ABORT
;
}
}
/**
* Check whether the two values are equal.
*
* @param a the first value
* @param b the second value
* @return true if they are equal
*/
public
final
boolean
areValuesEqual
(
Object
a
,
Object
b
)
{
return
areValuesEqual
(
valueType
,
a
,
b
);
}
/**
/**
* Check whether the two values are equal.
* Check whether the two values are equal.
*
*
...
@@ -520,9 +497,9 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -520,9 +497,9 @@ public class MVMap<K, V> extends AbstractMap<K, V>
@Override
@Override
public
final
boolean
replace
(
K
key
,
V
oldValue
,
V
newValue
)
{
public
final
boolean
replace
(
K
key
,
V
oldValue
,
V
newValue
)
{
EqualsDecisionMaker
<
V
>
decisionMaker
=
new
EqualsDecisionMaker
<>(
valueType
,
oldValue
);
EqualsDecisionMaker
<
V
>
decisionMaker
=
new
EqualsDecisionMaker
<>(
valueType
,
oldValue
);
V
result
=
put
(
key
,
newValue
,
decisionMaker
);
V
result
=
operate
(
key
,
newValue
,
decisionMaker
);
boolean
res
=
decisionMaker
.
getDecision
()
!=
Decision
.
ABORT
;
boolean
res
=
decisionMaker
.
getDecision
()
!=
Decision
.
ABORT
;
assert
!
res
||
areValuesEqual
(
oldValue
,
result
)
:
oldValue
+
" != "
+
result
;
assert
!
res
||
areValuesEqual
(
valueType
,
oldValue
,
result
)
:
oldValue
+
" != "
+
result
;
return
res
;
return
res
;
}
}
...
@@ -535,7 +512,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -535,7 +512,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
*/
*/
@Override
@Override
public
final
V
replace
(
K
key
,
V
value
)
{
public
final
V
replace
(
K
key
,
V
value
)
{
return
put
(
key
,
value
,
DecisionMaker
.
IF_PRESENT
);
return
operate
(
key
,
value
,
DecisionMaker
.
IF_PRESENT
);
}
}
/**
/**
...
@@ -1265,11 +1242,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -1265,11 +1242,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
p
=
p
.
copy
();
p
=
p
.
copy
();
p
.
setChild
(
index
,
page
);
p
.
setChild
(
index
,
page
);
p
.
insertNode
(
index
,
key
,
c
);
p
.
insertNode
(
index
,
key
,
c
);
if
((
keyCount
=
p
.
getKeyCount
())
<=
store
.
getKeysPerPage
()
&&
keyCount
=
p
.
getKeyCount
();
(
p
.
getMemory
()
<
store
.
getMaxPageSize
()
||
keyCount
<=
(
p
.
isLeaf
()
?
1
:
2
)))
{
int
at
=
keyCount
-
(
p
.
isLeaf
()
?
1
:
2
);
if
(
keyCount
<=
store
.
getKeysPerPage
()
&&
(
p
.
getMemory
()
<
store
.
getMaxPageSize
()
||
at
<=
0
))
{
break
;
break
;
}
}
int
at
=
keyCount
-
2
;
key
=
p
.
getKey
(
at
);
key
=
p
.
getKey
(
at
);
page
=
p
.
split
(
at
);
page
=
p
.
split
(
at
);
unsavedMemoryHolder
.
value
+=
p
.
getMemory
()
+
page
.
getMemory
();
unsavedMemoryHolder
.
value
+=
p
.
getMemory
()
+
page
.
getMemory
();
...
@@ -1640,7 +1618,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -1640,7 +1618,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
/**
/**
* Provides revised value for insert/update based on original input value
* Provides revised value for insert/update based on original input value
* and value currently existing in the map.
* and value currently existing in the map.
* This method is
not invoked only after
decide(), if it returns PUT.
* This method is
only invoked after call to
decide(), if it returns PUT.
* @param existingValue value currently exists in the map
* @param existingValue value currently exists in the map
* @param providedValue original input value
* @param providedValue original input value
* @param <T> value type
* @param <T> value type
...
@@ -1659,12 +1637,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
...
@@ -1659,12 +1637,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
}
/**
/**
* A
pply an operation to
a key-value pair.
* A
dd, replace or remove
a key-value pair.
*
*
* @param key
key to operate on
* @param key
the key (may not be null)
* @param value new value
* @param value new value
, it may be null when removal is indended
* @param decisionMaker command object to make choices during transaction.
* @param decisionMaker command object to make choices during transaction.
* @return
new valu
e
* @return
previous value, if mapping for that key existed, or null otherwis
e
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
V
operate
(
K
key
,
V
value
,
DecisionMaker
<?
super
V
>
decisionMaker
)
{
public
V
operate
(
K
key
,
V
value
,
DecisionMaker
<?
super
V
>
decisionMaker
)
{
...
...
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
d4b3f8f6
...
@@ -265,7 +265,7 @@ public abstract class Page implements Cloneable
...
@@ -265,7 +265,7 @@ public abstract class Page implements Cloneable
* recursive and needs to wait for children before returning up the call-stack, (b) checking
* recursive and needs to wait for children before returning up the call-stack, (b) checking
* the size of the thread-pool is not reliable.
* the size of the thread-pool is not reliable.
*/
*/
final
List
<
Future
<?>>
futures
=
new
ArrayList
<>(
len
);
final
List
<
Future
<?>>
futures
=
new
ArrayList
<>(
len
+
1
);
for
(
int
i
=
0
;
i
<=
len
;
i
++)
{
for
(
int
i
=
0
;
i
<=
len
;
i
++)
{
final
long
childPagePos
=
buff
.
getLong
();
final
long
childPagePos
=
buff
.
getLong
();
for
(;;)
{
for
(;;)
{
...
...
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
浏览文件 @
d4b3f8f6
...
@@ -303,7 +303,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
...
@@ -303,7 +303,7 @@ public class TransactionMap<K, V> extends AbstractMap<K, V> {
// and any non-null value will do
// and any non-null value will do
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
K
k
=
(
K
)
key
;
K
k
=
(
K
)
key
;
result
=
map
.
put
(
k
,
VersionedValue
.
DUMMY
,
decisionMaker
);
result
=
map
.
operate
(
k
,
VersionedValue
.
DUMMY
,
decisionMaker
);
MVMap
.
Decision
decision
=
decisionMaker
.
getDecision
();
MVMap
.
Decision
decision
=
decisionMaker
.
getDecision
();
assert
decision
!=
null
;
assert
decision
!=
null
;
...
...
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
d4b3f8f6
...
@@ -538,6 +538,9 @@ public class TcpServerThread implements Runnable {
...
@@ -538,6 +538,9 @@ public class TcpServerThread implements Runnable {
}
}
private
int
getState
(
int
oldModificationId
)
{
private
int
getState
(
int
oldModificationId
)
{
if
(
session
==
null
)
{
return
SessionRemote
.
STATUS_CLOSED
;
}
if
(
session
.
getModificationId
()
==
oldModificationId
)
{
if
(
session
.
getModificationId
()
==
oldModificationId
)
{
return
SessionRemote
.
STATUS_OK
;
return
SessionRemote
.
STATUS_OK
;
}
}
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
d4b3f8f6
...
@@ -1405,7 +1405,7 @@ public abstract class Value extends VersionedValue {
...
@@ -1405,7 +1405,7 @@ public abstract class Value extends VersionedValue {
return
0
;
return
0
;
}
}
if
(
this
==
ValueNull
.
INSTANCE
)
{
if
(
this
==
ValueNull
.
INSTANCE
)
{
return
v
==
ValueNull
.
INSTANCE
?
0
:
-
1
;
return
-
1
;
}
else
if
(
v
==
ValueNull
.
INSTANCE
)
{
}
else
if
(
v
==
ValueNull
.
INSTANCE
)
{
return
1
;
return
1
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论