Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
25386a28
提交
25386a28
authored
7 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix TestLinkedTable test in pagestore mode
上级
02b7615e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
20 行增加
和
12 行删除
+20
-12
Database.java
h2/src/main/org/h2/engine/Database.java
+20
-12
没有找到文件。
h2/src/main/org/h2/engine/Database.java
浏览文件 @
25386a28
...
@@ -20,7 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -20,7 +20,6 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.JavaObjectSerializer
;
import
org.h2.api.JavaObjectSerializer
;
...
@@ -94,6 +93,7 @@ public class Database implements DataHandler {
...
@@ -94,6 +93,7 @@ public class Database implements DataHandler {
private
static
int
initialPowerOffCount
;
private
static
int
initialPowerOffCount
;
private
static
final
ThreadLocal
<
Session
>
META_LOCK_DEBUGGING
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Session
>
META_LOCK_DEBUGGING
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Database
>
META_LOCK_DEBUGGING_DB
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Throwable
>
META_LOCK_DEBUGGING_STACK
=
new
ThreadLocal
<>();
private
static
final
ThreadLocal
<
Throwable
>
META_LOCK_DEBUGGING_STACK
=
new
ThreadLocal
<>();
/**
/**
...
@@ -211,6 +211,7 @@ public class Database implements DataHandler {
...
@@ -211,6 +211,7 @@ public class Database implements DataHandler {
public
Database
(
ConnectionInfo
ci
,
String
cipher
)
{
public
Database
(
ConnectionInfo
ci
,
String
cipher
)
{
META_LOCK_DEBUGGING
.
set
(
null
);
META_LOCK_DEBUGGING
.
set
(
null
);
META_LOCK_DEBUGGING_DB
.
set
(
null
);
META_LOCK_DEBUGGING_STACK
.
set
(
null
);
META_LOCK_DEBUGGING_STACK
.
set
(
null
);
String
name
=
ci
.
getName
();
String
name
=
ci
.
getName
();
this
.
dbSettings
=
ci
.
getDbSettings
();
this
.
dbSettings
=
ci
.
getDbSettings
();
...
@@ -932,17 +933,23 @@ public class Database implements DataHandler {
...
@@ -932,17 +933,23 @@ public class Database implements DataHandler {
return
true
;
return
true
;
}
}
if
(
SysProperties
.
CHECK2
)
{
if
(
SysProperties
.
CHECK2
)
{
final
Session
prev
=
META_LOCK_DEBUGGING
.
get
();
// If we are locking two different databases in the same stack, just ignore it.
if
(
prev
==
null
)
{
// This only happens in TestLinkedTable where we connect to another h2 DB in the same process.
META_LOCK_DEBUGGING
.
set
(
session
);
if
(
META_LOCK_DEBUGGING_DB
.
get
()
!=
null
META_LOCK_DEBUGGING_STACK
.
set
(
new
Throwable
(
"Last meta lock granted in this stack trace, "
+
&&
META_LOCK_DEBUGGING_DB
.
get
()
!=
this
)
{
"this is debug information for following IllegalStateException"
));
final
Session
prev
=
META_LOCK_DEBUGGING
.
get
();
}
else
if
(
prev
!=
session
)
{
if
(
prev
==
null
)
{
META_LOCK_DEBUGGING_STACK
.
get
().
printStackTrace
();
META_LOCK_DEBUGGING
.
set
(
session
);
throw
new
IllegalStateException
(
"meta currently locked by "
META_LOCK_DEBUGGING_DB
.
set
(
this
);
+
prev
+
", sessionid="
+
prev
.
getId
()
META_LOCK_DEBUGGING_STACK
.
set
(
new
Throwable
(
"Last meta lock granted in this stack trace, "
+
+
" and trying to be locked by different session, "
"this is debug information for following IllegalStateException"
));
+
session
+
", sessionid="
+
session
.
getId
()
+
" on same thread"
);
}
else
if
(
prev
!=
session
)
{
META_LOCK_DEBUGGING_STACK
.
get
().
printStackTrace
();
throw
new
IllegalStateException
(
"meta currently locked by "
+
prev
+
", sessionid="
+
prev
.
getId
()
+
" and trying to be locked by different session, "
+
session
+
", sessionid="
+
session
.
getId
()
+
" on same thread"
);
}
}
}
}
}
return
meta
.
lock
(
session
,
true
,
true
);
return
meta
.
lock
(
session
,
true
,
true
);
...
@@ -969,6 +976,7 @@ public class Database implements DataHandler {
...
@@ -969,6 +976,7 @@ public class Database implements DataHandler {
if
(
SysProperties
.
CHECK2
)
{
if
(
SysProperties
.
CHECK2
)
{
if
(
META_LOCK_DEBUGGING
.
get
()
==
session
)
{
if
(
META_LOCK_DEBUGGING
.
get
()
==
session
)
{
META_LOCK_DEBUGGING
.
set
(
null
);
META_LOCK_DEBUGGING
.
set
(
null
);
META_LOCK_DEBUGGING_DB
.
set
(
null
);
META_LOCK_DEBUGGING_STACK
.
set
(
null
);
META_LOCK_DEBUGGING_STACK
.
set
(
null
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论