Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5eeccf53
提交
5eeccf53
authored
4月 02, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Slightly improved storage format.
上级
8807a867
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
55 行删除
+23
-55
TransactionStore.java
h2/src/main/org/h2/mvstore/db/TransactionStore.java
+23
-55
没有找到文件。
h2/src/main/org/h2/mvstore/db/TransactionStore.java
浏览文件 @
5eeccf53
...
@@ -33,12 +33,6 @@ public class TransactionStore {
...
@@ -33,12 +33,6 @@ public class TransactionStore {
*/
*/
private
static
final
boolean
CONCURRENT
=
false
;
private
static
final
boolean
CONCURRENT
=
false
;
private
static
final
boolean
PACK_DATA
=
true
;
;
// TODO find out why TestTransactionStore.testStopWhileCommitting
// fails when the following is enabled:
private
static
final
boolean
PACK_DATA2
=
false
;
/**
/**
* The store.
* The store.
*/
*/
...
@@ -108,6 +102,11 @@ public class TransactionStore {
...
@@ -108,6 +102,11 @@ public class TransactionStore {
valueType
(
undoLogValueType
);
valueType
(
undoLogValueType
);
undoLog
=
store
.
openMap
(
"undoLog"
,
builder
);
undoLog
=
store
.
openMap
(
"undoLog"
,
builder
);
// remove all temporary maps
// remove all temporary maps
if
(
undoLog
.
getValueType
()
!=
undoLogValueType
)
{
throw
DataUtils
.
newIllegalStateException
(
DataUtils
.
ERROR_TRANSACTION_CORRUPT
,
"Undo map open with a different value type"
);
}
for
(
String
mapName
:
store
.
getMapNames
())
{
for
(
String
mapName
:
store
.
getMapNames
())
{
if
(
mapName
.
startsWith
(
"temp."
))
{
if
(
mapName
.
startsWith
(
"temp."
))
{
MVMap
<
Object
,
Integer
>
temp
=
openTempMap
(
mapName
);
MVMap
<
Object
,
Integer
>
temp
=
openTempMap
(
mapName
);
...
@@ -1537,29 +1536,16 @@ public class TransactionStore {
...
@@ -1537,29 +1536,16 @@ public class TransactionStore {
}
}
@Override
@Override
public
void
read
(
ByteBuffer
buff
,
Object
[]
obj
,
public
void
read
(
ByteBuffer
buff
,
Object
[]
obj
,
int
len
,
boolean
key
)
{
int
len
,
boolean
key
)
{
if
(
buff
.
get
()
==
0
)
{
if
(
PACK_DATA
)
{
// fast path (no op ids or null entries)
// Read the operationIds
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
VersionedValue
v
=
new
VersionedValue
();
VersionedValue
v
=
new
VersionedValue
();
v
.
operationId
=
DataUtils
.
readVarLong
(
buff
);
obj
[
i
]
=
v
;
}
// Read the null/not-null indicators.
final
byte
[]
notNullIndicators
=
new
byte
[(
len
+
7
)
/
8
];
buff
.
get
(
notNullIndicators
,
0
,
notNullIndicators
.
length
);
// Read the child values.
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
int
x
=
notNullIndicators
[
i
/
8
]
&
0xff
;
x
=
x
>>
(
i
%
8
);
x
=
x
&
1
;
if
(
x
==
1
)
{
v
.
value
=
valueType
.
read
(
buff
);
v
.
value
=
valueType
.
read
(
buff
);
}
obj
[
i
]
=
v
;
}
}
}
else
{
}
else
{
// slow path (some entries may be null)
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
obj
[
i
]
=
read
(
buff
);
obj
[
i
]
=
read
(
buff
);
}
}
...
@@ -1577,41 +1563,24 @@ public class TransactionStore {
...
@@ -1577,41 +1563,24 @@ public class TransactionStore {
}
}
@Override
@Override
public
void
write
(
WriteBuffer
buff
,
Object
[]
obj
,
public
void
write
(
WriteBuffer
buff
,
Object
[]
obj
,
int
len
,
boolean
key
)
{
int
len
,
boolean
key
)
{
boolean
fastPath
=
true
;
if
(
PACK_DATA
)
{
// Write the operationIds
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
buff
.
putVarLong
(
v
.
operationId
);
if
(
v
.
operationId
!=
0
||
v
.
value
==
null
)
{
fastPath
=
false
;
}
}
// Write the not-null-indicators as a bit-packed array
int
x
=
0
;
int
byteIdx
=
0
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
if
(
v
.
value
!=
null
)
{
x
|=
1
<<
byteIdx
;
}
byteIdx
++;
if
(
byteIdx
==
8
)
{
buff
.
put
((
byte
)
x
);
byteIdx
=
0
;
x
=
0
;
}
}
if
(
fastPath
)
{
}
buff
.
put
((
byte
)
0
);
if
(
byteIdx
!=
0
)
{
buff
.
put
((
byte
)
x
);
}
// Write the child values.
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
VersionedValue
v
=
(
VersionedValue
)
obj
[
i
];
if
(
v
.
value
!=
null
)
{
valueType
.
write
(
buff
,
v
.
value
);
valueType
.
write
(
buff
,
v
.
value
);
}
}
}
}
else
{
}
else
{
// slow path:
// store op ids, and some entries may be null
buff
.
put
((
byte
)
1
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
write
(
buff
,
obj
[
i
]);
write
(
buff
,
obj
[
i
]);
}
}
...
@@ -1723,4 +1692,3 @@ public class TransactionStore {
...
@@ -1723,4 +1692,3 @@ public class TransactionStore {
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论