Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
26a94693
提交
26a94693
authored
10月 09, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue 506: RFE: Include Thread.getName() in case of a deadlock
上级
dc3c9717
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
7 行删除
+22
-7
Session.java
h2/src/main/org/h2/engine/Session.java
+8
-2
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+7
-3
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+7
-2
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
26a94693
...
...
@@ -106,6 +106,7 @@ public class Session extends SessionWithState {
private
int
queryTimeout
;
private
boolean
commitOrRollbackDisabled
;
private
Table
waitForLock
;
private
Thread
waitForLockThread
;
private
int
modificationId
;
private
int
objectId
;
private
final
int
queryCacheSize
;
...
...
@@ -1292,14 +1293,19 @@ public class Session extends SessionWithState {
return
queryTimeout
;
}
public
void
setWaitForLock
(
Table
table
)
{
this
.
waitForLock
=
table
;
public
void
setWaitForLock
(
Table
waitForLock
,
Thread
waitForLockThread
)
{
this
.
waitForLock
=
waitForLock
;
this
.
waitForLockThread
=
waitForLockThread
;
}
public
Table
getWaitForLock
()
{
return
waitForLock
;
}
public
Thread
getWaitForLockThread
()
{
return
waitForLockThread
;
}
public
int
getModificationId
()
{
return
modificationId
;
}
...
...
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
26a94693
...
...
@@ -11,7 +11,6 @@ import java.util.Collections;
import
java.util.Comparator
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.command.ddl.Analyze
;
import
org.h2.command.ddl.CreateTableData
;
...
...
@@ -127,7 +126,7 @@ public class MVTable extends TableBase {
try
{
doLock
(
session
,
lockMode
,
exclusive
);
}
finally
{
session
.
setWaitForLock
(
null
);
session
.
setWaitForLock
(
null
,
null
);
}
}
}
...
...
@@ -175,7 +174,7 @@ public class MVTable extends TableBase {
return
;
}
}
session
.
setWaitForLock
(
this
);
session
.
setWaitForLock
(
this
,
Thread
.
currentThread
()
);
if
(
checkDeadlock
)
{
ArrayList
<
Session
>
sessions
=
checkDeadlock
(
session
,
null
,
null
);
if
(
sessions
!=
null
)
{
...
...
@@ -219,11 +218,16 @@ public class MVTable extends TableBase {
}
private
static
String
getDeadlockDetails
(
ArrayList
<
Session
>
sessions
)
{
// We add the thread details here to make it easier for customers to match up
// these error messages with their own logs.
StringBuilder
buff
=
new
StringBuilder
();
for
(
Session
s
:
sessions
)
{
Table
lock
=
s
.
getWaitForLock
();
Thread
thread
=
s
.
getWaitForLockThread
();
buff
.
append
(
"\nSession "
).
append
(
s
.
toString
()).
append
(
" on thread "
).
append
(
thread
.
getName
()).
append
(
" is waiting to lock "
).
append
(
lock
.
toString
()).
append
(
" while locking "
);
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
26a94693
...
...
@@ -451,7 +451,7 @@ public class RegularTable extends TableBase {
try
{
doLock
(
session
,
lockMode
,
exclusive
);
}
finally
{
session
.
setWaitForLock
(
null
);
session
.
setWaitForLock
(
null
,
null
);
}
}
}
...
...
@@ -499,7 +499,7 @@ public class RegularTable extends TableBase {
return
;
}
}
session
.
setWaitForLock
(
this
);
session
.
setWaitForLock
(
this
,
Thread
.
currentThread
()
);
if
(
checkDeadlock
)
{
ArrayList
<
Session
>
sessions
=
checkDeadlock
(
session
,
null
,
null
);
if
(
sessions
!=
null
)
{
...
...
@@ -543,11 +543,16 @@ public class RegularTable extends TableBase {
}
private
static
String
getDeadlockDetails
(
ArrayList
<
Session
>
sessions
)
{
// We add the thread details here to make it easier for customers to match up
// these error messages with their own logs.
StringBuilder
buff
=
new
StringBuilder
();
for
(
Session
s
:
sessions
)
{
Table
lock
=
s
.
getWaitForLock
();
Thread
thread
=
s
.
getWaitForLockThread
();
buff
.
append
(
"\nSession "
).
append
(
s
.
toString
()).
append
(
" on thread "
).
append
(
thread
.
getName
()).
append
(
" is waiting to lock "
).
append
(
lock
.
toString
()).
append
(
" while locking "
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论