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