Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
763da31b
Unverified
提交
763da31b
authored
6 年前
作者:
Andrei Tokar
提交者:
GitHub
6 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1174 from h2database/remove-mapid
Remove mapid
上级
8b4bfee5
d3a1bfca
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
39 行删除
+18
-39
Transaction.java
h2/src/main/org/h2/mvstore/tx/Transaction.java
+1
-2
TransactionMap.java
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
+3
-10
TransactionStore.java
h2/src/main/org/h2/mvstore/tx/TransactionStore.java
+14
-27
没有找到文件。
h2/src/main/org/h2/mvstore/tx/Transaction.java
浏览文件 @
763da31b
...
...
@@ -345,8 +345,7 @@ public class Transaction {
*/
public
<
K
,
V
>
TransactionMap
<
K
,
V
>
openMap
(
MVMap
<
K
,
VersionedValue
>
map
)
{
checkNotClosed
();
int
mapId
=
map
.
getId
();
return
new
TransactionMap
<>(
this
,
map
,
mapId
);
return
new
TransactionMap
<>(
this
,
map
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/tx/TransactionMap.java
浏览文件 @
763da31b
...
...
@@ -24,11 +24,6 @@ import java.util.Map;
*/
public
class
TransactionMap
<
K
,
V
>
{
/**
* The map id.
*/
final
int
mapId
;
/**
* If a record was read that was updated by this transaction, and the
* update occurred before this log id, the older version is read. This
...
...
@@ -50,11 +45,9 @@ public class TransactionMap<K, V> {
*/
final
Transaction
transaction
;
TransactionMap
(
Transaction
transaction
,
MVMap
<
K
,
VersionedValue
>
map
,
int
mapId
)
{
TransactionMap
(
Transaction
transaction
,
MVMap
<
K
,
VersionedValue
>
map
)
{
this
.
transaction
=
transaction
;
this
.
map
=
map
;
this
.
mapId
=
mapId
;
}
/**
...
...
@@ -77,7 +70,7 @@ public class TransactionMap<K, V> {
public
TransactionMap
<
K
,
V
>
getInstance
(
Transaction
transaction
,
long
savepoint
)
{
TransactionMap
<
K
,
V
>
m
=
new
TransactionMap
<>(
transaction
,
map
,
mapId
);
new
TransactionMap
<>(
transaction
,
map
);
m
.
setSavepoint
(
savepoint
);
return
m
;
}
...
...
@@ -141,7 +134,7 @@ public class TransactionMap<K, V> {
cursor
.
next
();
Object
[]
op
=
cursor
.
getValue
();
int
m
=
(
int
)
op
[
0
];
if
(
m
!=
map
Id
)
{
if
(
m
!=
map
.
getId
()
)
{
// a different map - ignore
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/tx/TransactionStore.java
浏览文件 @
763da31b
...
...
@@ -8,7 +8,6 @@ package org.h2.mvstore.tx;
import
java.nio.ByteBuffer
;
import
java.util.ArrayList
;
import
java.util.BitSet
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicReference
;
...
...
@@ -53,12 +52,6 @@ public class TransactionStore {
*/
final
MVMap
<
Long
,
Object
[]>
undoLog
;
/**
* The map of maps.
*/
private
final
HashMap
<
Integer
,
MVMap
<
Object
,
VersionedValue
>>
maps
=
new
HashMap
<>();
private
final
DataType
dataType
;
/**
...
...
@@ -408,7 +401,6 @@ public class TransactionStore {
* @param map the map
*/
synchronized
<
K
,
V
>
void
removeMap
(
TransactionMap
<
K
,
V
>
map
)
{
maps
.
remove
(
map
.
mapId
);
store
.
removeMap
(
map
.
map
);
}
...
...
@@ -476,7 +468,7 @@ public class TransactionStore {
* @param valueType the value type
* @return the map
*/
synchronized
<
K
>
MVMap
<
K
,
VersionedValue
>
openMap
(
String
name
,
<
K
>
MVMap
<
K
,
VersionedValue
>
openMap
(
String
name
,
DataType
keyType
,
DataType
valueType
)
{
if
(
keyType
==
null
)
{
keyType
=
new
ObjectDataType
();
...
...
@@ -490,9 +482,6 @@ public class TransactionStore {
new
MVMap
.
Builder
<
K
,
VersionedValue
>().
keyType
(
keyType
).
valueType
(
vt
);
map
=
store
.
openMap
(
name
,
builder
);
@SuppressWarnings
(
"unchecked"
)
MVMap
<
Object
,
VersionedValue
>
m
=
(
MVMap
<
Object
,
VersionedValue
>)
map
;
maps
.
put
(
map
.
getId
(),
m
);
return
map
;
}
...
...
@@ -502,11 +491,9 @@ public class TransactionStore {
* @param mapId the id
* @return the map
*/
synchronized
MVMap
<
Object
,
VersionedValue
>
openMap
(
int
mapId
)
{
MVMap
<
Object
,
VersionedValue
>
map
=
maps
.
get
(
mapId
);
if
(
map
!=
null
)
{
return
map
;
}
MVMap
<
Object
,
VersionedValue
>
openMap
(
int
mapId
)
{
MVMap
<
Object
,
VersionedValue
>
map
=
store
.
getMap
(
mapId
);
if
(
map
==
null
)
{
String
mapName
=
store
.
getMapName
(
mapId
);
if
(
mapName
==
null
)
{
// the map was removed later on
...
...
@@ -517,7 +504,7 @@ public class TransactionStore {
new
MVMap
.
Builder
<
Object
,
VersionedValue
>().
keyType
(
dataType
).
valueType
(
vt
);
map
=
store
.
openMap
(
mapName
,
mapBuilder
);
maps
.
put
(
mapId
,
map
);
}
return
map
;
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论