Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
2bc448b8
提交
2bc448b8
authored
6月 22, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create UndoLog only when necessary
上级
9f4ea2c5
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
24 行增加
和
14 行删除
+24
-14
Session.java
h2/src/main/org/h2/engine/Session.java
+24
-14
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
2bc448b8
...
...
@@ -85,7 +85,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
private
final
User
user
;
private
final
int
id
;
private
final
ArrayList
<
Table
>
locks
=
Utils
.
newSmallArrayList
();
private
final
UndoLog
undoLog
;
private
UndoLog
undoLog
;
private
boolean
autoCommit
=
true
;
private
Random
random
;
private
int
lockTimeout
;
...
...
@@ -168,7 +168,6 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
this
.
database
=
database
;
this
.
queryTimeout
=
database
.
getSettings
().
maxQueryTimeout
;
this
.
queryCacheSize
=
database
.
getSettings
().
queryCacheSize
;
this
.
undoLog
=
new
UndoLog
(
this
);
this
.
user
=
user
;
this
.
id
=
id
;
this
.
lockTimeout
=
database
.
getLockTimeout
();
...
...
@@ -691,7 +690,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
database
.
commit
(
this
);
}
removeTemporaryLobs
(
true
);
if
(
undoLog
.
size
()
>
0
)
{
if
(
undoLog
!=
null
&&
undoLog
.
size
()
>
0
)
{
undoLog
.
clear
();
}
if
(!
ddl
)
{
...
...
@@ -761,7 +760,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
checkCommitRollback
();
currentTransactionName
=
null
;
transactionStart
=
null
;
boolean
needCommit
=
undoLog
.
size
()
>
0
||
transaction
!=
null
;
boolean
needCommit
=
undoLog
!=
null
&&
undoLog
.
size
()
>
0
||
transaction
!=
null
;
if
(
needCommit
)
{
rollbackTo
(
null
,
false
);
}
...
...
@@ -784,11 +783,13 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
*/
public
void
rollbackTo
(
Savepoint
savepoint
,
boolean
trimToSize
)
{
int
index
=
savepoint
==
null
?
0
:
savepoint
.
logIndex
;
if
(
undoLog
!=
null
)
{
while
(
undoLog
.
size
()
>
index
)
{
UndoLogRecord
entry
=
undoLog
.
getLast
();
entry
.
undo
(
this
);
undoLog
.
removeLast
(
trimToSize
);
}
}
if
(
transaction
!=
null
)
{
if
(
savepoint
==
null
)
{
transaction
.
rollback
();
...
...
@@ -818,7 +819,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
@Override
public
boolean
hasPendingTransaction
()
{
return
undoLog
.
size
()
>
0
;
return
undoLog
!=
null
&&
undoLog
.
size
()
>
0
;
}
/**
...
...
@@ -828,7 +829,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
*/
public
Savepoint
setSavepoint
()
{
Savepoint
sp
=
new
Savepoint
();
if
(
undoLog
!=
null
)
{
sp
.
logIndex
=
undoLog
.
size
();
}
if
(
database
.
getMvStore
()
!=
null
)
{
sp
.
transactionSavepoint
=
getStatementSavepoint
();
}
...
...
@@ -856,7 +859,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
removeTemporaryLobs
(
false
);
cleanTempTables
(
true
);
if
(
undoLog
!=
null
)
{
undoLog
.
clear
();
}
// Table#removeChildrenAndResources can take the meta lock,
// and we need to unlock before we call removeSession(), which might
// want to take the meta lock using the system session.
...
...
@@ -910,6 +915,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
}
}
}
if
(
undoLog
==
null
)
{
undoLog
=
new
UndoLog
(
this
);
}
undoLog
.
add
(
log
);
}
}
...
...
@@ -942,7 +950,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
private
void
unlockAll
()
{
if
(
SysProperties
.
CHECK
)
{
if
(
undoLog
.
size
()
>
0
)
{
if
(
undoLog
!=
null
&&
undoLog
.
size
()
>
0
)
{
DbException
.
throwInternalError
();
}
}
...
...
@@ -1086,7 +1094,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
savepoints
=
database
.
newStringMap
();
}
Savepoint
sp
=
new
Savepoint
();
if
(
undoLog
!=
null
)
{
sp
.
logIndex
=
undoLog
.
size
();
}
if
(
database
.
getMvStore
()
!=
null
)
{
sp
.
transactionSavepoint
=
getStatementSavepoint
();
}
...
...
@@ -1619,7 +1629,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
if
(!
database
.
isPersistent
())
{
return
ValueNull
.
INSTANCE
;
}
if
(
undoLog
.
size
()
==
0
)
{
if
(
undoLog
==
null
||
undoLog
.
size
()
==
0
)
{
return
ValueNull
.
INSTANCE
;
}
return
ValueString
.
get
(
firstUncommittedLog
+
"-"
+
firstUncommittedPos
+
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论