Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
691e8a55
提交
691e8a55
authored
7 年前
作者:
Andrei Tokar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
protect first background exception encountered and relate it to clients
上级
ff4993e4
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
32 行删除
+38
-32
Database.java
h2/src/main/org/h2/engine/Database.java
+35
-30
Session.java
h2/src/main/org/h2/engine/Session.java
+2
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+1
-1
没有找到文件。
h2/src/main/org/h2/engine/Database.java
浏览文件 @
691e8a55
...
@@ -218,7 +218,7 @@ public class Database implements DataHandler {
...
@@ -218,7 +218,7 @@ public class Database implements DataHandler {
private
MVTableEngine
.
Store
mvStore
;
private
MVTableEngine
.
Store
mvStore
;
private
int
retentionTime
;
private
int
retentionTime
;
private
boolean
allowBuiltinAliasOverride
;
private
boolean
allowBuiltinAliasOverride
;
private
DbException
backgroundException
;
private
final
AtomicReference
<
DbException
>
backgroundException
=
new
AtomicReference
<>()
;
private
JavaObjectSerializer
javaObjectSerializer
;
private
JavaObjectSerializer
javaObjectSerializer
;
private
String
javaObjectSerializerName
;
private
String
javaObjectSerializerName
;
private
volatile
boolean
javaObjectSerializerInitialized
;
private
volatile
boolean
javaObjectSerializerInitialized
;
...
@@ -314,6 +314,7 @@ public class Database implements DataHandler {
...
@@ -314,6 +314,7 @@ public class Database implements DataHandler {
OnExitDatabaseCloser
.
register
(
this
);
OnExitDatabaseCloser
.
register
(
this
);
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
try
{
if
(
e
instanceof
OutOfMemoryError
)
{
if
(
e
instanceof
OutOfMemoryError
)
{
e
.
fillInStackTrace
();
e
.
fillInStackTrace
();
}
}
...
@@ -331,6 +332,9 @@ public class Database implements DataHandler {
...
@@ -331,6 +332,9 @@ public class Database implements DataHandler {
traceSystem
.
close
();
traceSystem
.
close
();
}
}
closeOpenFilesAndUnlock
(
false
);
closeOpenFilesAndUnlock
(
false
);
}
catch
(
Throwable
ex
)
{
e
.
addSuppressed
(
ex
);
}
throw
DbException
.
convert
(
e
);
throw
DbException
.
convert
(
e
);
}
}
}
}
...
@@ -675,8 +679,7 @@ public class Database implements DataHandler {
...
@@ -675,8 +679,7 @@ public class Database implements DataHandler {
if
(
readOnly
||
if
(
readOnly
||
fileLockMethod
==
FileLockMethod
.
NO
||
fileLockMethod
==
FileLockMethod
.
NO
||
fileLockMethod
==
FileLockMethod
.
SERIALIZED
||
fileLockMethod
==
FileLockMethod
.
SERIALIZED
||
fileLockMethod
==
FileLockMethod
.
FS
||
fileLockMethod
==
FileLockMethod
.
FS
)
{
!
persistent
)
{
throw
DbException
.
getUnsupportedException
(
throw
DbException
.
getUnsupportedException
(
"autoServerMode && (readOnly || "
+
"autoServerMode && (readOnly || "
+
"fileLockMethod == NO || "
+
"fileLockMethod == NO || "
+
...
@@ -2116,22 +2119,15 @@ public class Database implements DataHandler {
...
@@ -2116,22 +2119,15 @@ public class Database implements DataHandler {
}
}
private
void
throwLastBackgroundException
()
{
private
void
throwLastBackgroundException
()
{
if
(
backgroundException
!=
null
)
{
DbException
b
=
backgroundException
.
getAndSet
(
null
);
// we don't care too much about concurrency here,
// we just want to make sure the exception is _normally_
// not just logged to the .trace.db file
DbException
b
=
backgroundException
;
backgroundException
=
null
;
if
(
b
!=
null
)
{
if
(
b
!=
null
)
{
// wrap the exception, so we see it was thrown here
// wrap the exception, so we see it was thrown here
throw
DbException
.
get
(
b
.
getErrorCode
(),
b
,
b
.
getMessage
());
throw
DbException
.
get
(
b
.
getErrorCode
(),
b
,
b
.
getMessage
());
}
}
}
}
}
public
void
setBackgroundException
(
DbException
e
)
{
public
void
setBackgroundException
(
DbException
e
)
{
if
(
backgroundException
==
null
)
{
if
(
backgroundException
.
compareAndSet
(
null
,
e
))
{
backgroundException
=
e
;
TraceSystem
t
=
getTraceSystem
();
TraceSystem
t
=
getTraceSystem
();
if
(
t
!=
null
)
{
if
(
t
!=
null
)
{
t
.
getTrace
(
Trace
.
DATABASE
).
error
(
e
,
"flush"
);
t
.
getTrace
(
Trace
.
DATABASE
).
error
(
e
,
"flush"
);
...
@@ -2139,6 +2135,15 @@ public class Database implements DataHandler {
...
@@ -2139,6 +2135,15 @@ public class Database implements DataHandler {
}
}
}
}
public
Throwable
getBackgroundException
()
{
IllegalStateException
exception
=
mvStore
.
getStore
().
getPanicException
();
if
(
exception
!=
null
)
{
return
exception
;
}
return
backgroundException
.
getAndSet
(
null
);
}
/**
/**
* Flush all pending changes to the transaction log.
* Flush all pending changes to the transaction log.
*/
*/
...
@@ -2153,7 +2158,7 @@ public class Database implements DataHandler {
...
@@ -2153,7 +2158,7 @@ public class Database implements DataHandler {
try
{
try
{
mvStore
.
flush
();
mvStore
.
flush
();
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
backgroundException
=
DbException
.
convert
(
e
);
backgroundException
.
compareAndSet
(
null
,
DbException
.
convert
(
e
)
);
throw
e
;
throw
e
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
691e8a55
...
@@ -1676,8 +1676,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -1676,8 +1676,9 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
MVTableEngine
.
Store
store
=
database
.
getMvStore
();
MVTableEngine
.
Store
store
=
database
.
getMvStore
();
if
(
store
!=
null
)
{
if
(
store
!=
null
)
{
if
(
store
.
getStore
().
isClosed
())
{
if
(
store
.
getStore
().
isClosed
())
{
Throwable
backgroundException
=
database
.
getBackgroundException
();
database
.
shutdownImmediately
();
database
.
shutdownImmediately
();
throw
DbException
.
get
(
ErrorCode
.
DATABASE_IS_CLOSED
);
throw
DbException
.
get
(
ErrorCode
.
DATABASE_IS_CLOSED
,
backgroundException
);
}
}
transaction
=
store
.
getTransactionStore
().
begin
(
this
,
this
.
lockTimeout
,
id
);
transaction
=
store
.
getTransactionStore
().
begin
(
this
,
this
.
lockTimeout
,
id
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
691e8a55
...
@@ -292,7 +292,7 @@ public class MVStore {
...
@@ -292,7 +292,7 @@ public class MVStore {
private
final
Object
compactSync
=
new
Object
();
private
final
Object
compactSync
=
new
Object
();
private
IllegalStateException
panicException
;
private
volatile
IllegalStateException
panicException
;
private
long
lastTimeAbsolute
;
private
long
lastTimeAbsolute
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论