Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cc52d9fb
提交
cc52d9fb
authored
6月 10, 2018
作者:
Andrei Tokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename COMMITTING -> COMMITTED
上级
f9694244
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
MVTableEngine.java
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
+1
-1
Transaction.java
h2/src/main/org/h2/mvstore/tx/Transaction.java
+6
-6
TransactionStore.java
h2/src/main/org/h2/mvstore/tx/TransactionStore.java
+2
-2
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+1
-1
没有找到文件。
h2/src/main/org/h2/mvstore/db/MVTableEngine.java
浏览文件 @
cc52d9fb
...
@@ -253,7 +253,7 @@ public class MVTableEngine implements TableEngine {
...
@@ -253,7 +253,7 @@ public class MVTableEngine implements TableEngine {
public
void
initTransactions
()
{
public
void
initTransactions
()
{
List
<
Transaction
>
list
=
transactionStore
.
getOpenTransactions
();
List
<
Transaction
>
list
=
transactionStore
.
getOpenTransactions
();
for
(
Transaction
t
:
list
)
{
for
(
Transaction
t
:
list
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_COMMITT
ING
)
{
if
(
t
.
getStatus
()
==
Transaction
.
STATUS_COMMITT
ED
)
{
t
.
commit
();
t
.
commit
();
}
else
if
(
t
.
getStatus
()
!=
Transaction
.
STATUS_PREPARED
)
{
}
else
if
(
t
.
getStatus
()
!=
Transaction
.
STATUS_PREPARED
)
{
t
.
rollback
();
t
.
rollback
();
...
...
h2/src/main/org/h2/mvstore/tx/Transaction.java
浏览文件 @
cc52d9fb
...
@@ -46,7 +46,7 @@ public class Transaction {
...
@@ -46,7 +46,7 @@ public class Transaction {
* When opening a store, such transactions will automatically
* When opening a store, such transactions will automatically
* be processed and closed as committed.
* be processed and closed as committed.
*/
*/
public
static
final
int
STATUS_COMMITT
ING
=
3
;
public
static
final
int
STATUS_COMMITT
ED
=
3
;
/**
/**
* The status of a transaction that currently in a process of rolling back
* The status of a transaction that currently in a process of rolling back
...
@@ -192,19 +192,19 @@ public class Transaction {
...
@@ -192,19 +192,19 @@ public class Transaction {
case
STATUS_PREPARED:
case
STATUS_PREPARED:
valid
=
currentStatus
==
STATUS_OPEN
;
valid
=
currentStatus
==
STATUS_OPEN
;
break
;
break
;
case
STATUS_COMMITT
ING
:
case
STATUS_COMMITT
ED
:
valid
=
currentStatus
==
STATUS_OPEN
||
valid
=
currentStatus
==
STATUS_OPEN
||
currentStatus
==
STATUS_PREPARED
||
currentStatus
==
STATUS_PREPARED
||
// this case is only possible if called
// this case is only possible if called
// from endLeftoverTransactions()
// from endLeftoverTransactions()
currentStatus
==
STATUS_COMMITT
ING
;
currentStatus
==
STATUS_COMMITT
ED
;
break
;
break
;
case
STATUS_ROLLED_BACK:
case
STATUS_ROLLED_BACK:
valid
=
currentStatus
==
STATUS_OPEN
||
valid
=
currentStatus
==
STATUS_OPEN
||
currentStatus
==
STATUS_PREPARED
;
currentStatus
==
STATUS_PREPARED
;
break
;
break
;
case
STATUS_CLOSED:
case
STATUS_CLOSED:
valid
=
currentStatus
==
STATUS_COMMITT
ING
||
valid
=
currentStatus
==
STATUS_COMMITT
ED
||
currentStatus
==
STATUS_ROLLED_BACK
;
currentStatus
==
STATUS_ROLLED_BACK
;
break
;
break
;
default
:
default
:
...
@@ -361,11 +361,11 @@ public class Transaction {
...
@@ -361,11 +361,11 @@ public class Transaction {
Throwable
ex
=
null
;
Throwable
ex
=
null
;
boolean
hasChanges
=
false
;
boolean
hasChanges
=
false
;
try
{
try
{
long
state
=
setStatus
(
STATUS_COMMITT
ING
);
long
state
=
setStatus
(
STATUS_COMMITT
ED
);
hasChanges
=
hasChanges
(
state
);
hasChanges
=
hasChanges
(
state
);
int
previousStatus
=
getStatus
(
state
);
int
previousStatus
=
getStatus
(
state
);
if
(
hasChanges
)
{
if
(
hasChanges
)
{
store
.
commit
(
this
,
previousStatus
==
STATUS_COMMITT
ING
);
store
.
commit
(
this
,
previousStatus
==
STATUS_COMMITT
ED
);
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
ex
=
e
;
ex
=
e
;
...
...
h2/src/main/org/h2/mvstore/tx/TransactionStore.java
浏览文件 @
cc52d9fb
...
@@ -166,7 +166,7 @@ public class TransactionStore {
...
@@ -166,7 +166,7 @@ public class TransactionStore {
String
name
;
String
name
;
if
(
data
==
null
)
{
if
(
data
==
null
)
{
status
=
mapName
.
charAt
(
UNDO_LOG_NAME_PEFIX
.
length
())
==
UNDO_LOG_OPEN
?
status
=
mapName
.
charAt
(
UNDO_LOG_NAME_PEFIX
.
length
())
==
UNDO_LOG_OPEN
?
Transaction
.
STATUS_OPEN
:
Transaction
.
STATUS_COMMITT
ING
;
Transaction
.
STATUS_OPEN
:
Transaction
.
STATUS_COMMITT
ED
;
name
=
null
;
name
=
null
;
}
else
{
}
else
{
status
=
(
Integer
)
data
[
0
];
status
=
(
Integer
)
data
[
0
];
...
@@ -337,7 +337,7 @@ public class TransactionStore {
...
@@ -337,7 +337,7 @@ public class TransactionStore {
transactions
.
set
(
transactionId
,
transaction
);
transactions
.
set
(
transactionId
,
transaction
);
if
(
undoLogs
[
transactionId
]
==
null
)
{
if
(
undoLogs
[
transactionId
]
==
null
)
{
String
undoName
=
getUndoLogName
(
status
==
Transaction
.
STATUS_COMMITT
ING
,
transactionId
);
String
undoName
=
getUndoLogName
(
status
==
Transaction
.
STATUS_COMMITT
ED
,
transactionId
);
MVMap
<
Long
,
Object
[]>
undoLog
=
store
.
openMap
(
undoName
,
undoLogBuilder
);
MVMap
<
Long
,
Object
[]>
undoLog
=
store
.
openMap
(
undoName
,
undoLogBuilder
);
undoLogs
[
transactionId
]
=
undoLog
;
undoLogs
[
transactionId
]
=
undoLog
;
}
}
...
...
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
cc52d9fb
...
@@ -411,7 +411,7 @@ public class TestTransactionStore extends TestBase {
...
@@ -411,7 +411,7 @@ public class TestTransactionStore extends TestBase {
List
<
Transaction
>
list
=
ts
.
getOpenTransactions
();
List
<
Transaction
>
list
=
ts
.
getOpenTransactions
();
if
(
list
.
size
()
!=
0
)
{
if
(
list
.
size
()
!=
0
)
{
tx
=
list
.
get
(
0
);
tx
=
list
.
get
(
0
);
if
(
tx
.
getStatus
()
==
Transaction
.
STATUS_COMMITT
ING
)
{
if
(
tx
.
getStatus
()
==
Transaction
.
STATUS_COMMITT
ED
)
{
i
++;
i
++;
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论