Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
08d945e0
提交
08d945e0
authored
16 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Server-less multi-connection mode: two processes writing, corrupt after closing.
上级
62974d5f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
26 行增加
和
9 行删除
+26
-9
Database.java
h2/src/main/org/h2/engine/Database.java
+26
-9
没有找到文件。
h2/src/main/org/h2/engine/Database.java
浏览文件 @
08d945e0
...
...
@@ -244,7 +244,7 @@ public class Database implements DataHandler {
}
traceSystem
.
close
();
}
closeOpenFilesAndUnlock
();
closeOpenFilesAndUnlock
(
false
);
throw
Message
.
convert
(
e
);
}
}
...
...
@@ -371,7 +371,7 @@ public class Database implements DataHandler {
if
(
log
!=
null
)
{
try
{
stopWriter
();
log
.
close
();
log
.
close
(
false
);
}
catch
(
SQLException
e
)
{
// ignore
}
...
...
@@ -520,8 +520,7 @@ public class Database implements DataHandler {
.
info
(
"opening "
+
databaseName
+
" (build "
+
Constants
.
BUILD_ID
+
")"
);
if
(
autoServerMode
)
{
if
(
readOnly
||
fileLockMethod
==
FileLock
.
LOCK_NO
)
{
int
todoImproveErrorMessage
;
throw
Message
.
getSQLException
(
ErrorCode
.
FEATURE_NOT_SUPPORTED
);
throw
Message
.
getUnsupportedException
(
"autoServerMode && (readOnly || fileLockMethod == NO)"
);
}
}
if
(!
readOnly
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
...
...
@@ -1059,6 +1058,17 @@ public class Database implements DataHandler {
if
(
closing
)
{
return
;
}
if
(
isReconnectNeeded
())
{
// another connection wrote - don't write anything
try
{
closeOpenFilesAndUnlock
(
false
);
}
catch
(
SQLException
e
)
{
// ignore
}
traceSystem
.
close
();
Engine
.
getInstance
().
close
(
databaseName
);
return
;
}
closing
=
true
;
stopServer
();
if
(
userSessions
.
size
()
>
0
)
{
...
...
@@ -1131,7 +1141,7 @@ public class Database implements DataHandler {
}
tempFileDeleter
.
deleteAll
();
try
{
closeOpenFilesAndUnlock
();
closeOpenFilesAndUnlock
(
true
);
}
catch
(
SQLException
e
)
{
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
}
...
...
@@ -1172,18 +1182,20 @@ public class Database implements DataHandler {
}
}
private
synchronized
void
closeOpenFilesAndUnlock
()
throws
SQLException
{
private
synchronized
void
closeOpenFilesAndUnlock
(
boolean
checkpoint
)
throws
SQLException
{
if
(
log
!=
null
)
{
stopWriter
();
try
{
log
.
close
();
log
.
close
(
checkpoint
);
}
catch
(
Throwable
e
)
{
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
}
log
=
null
;
}
if
(
pageStore
!=
null
)
{
pageStore
.
checkpoint
();
if
(
checkpoint
)
{
pageStore
.
checkpoint
();
}
}
closeFiles
();
if
(
persistent
&&
lock
==
null
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
...
...
@@ -1200,7 +1212,11 @@ public class Database implements DataHandler {
systemSession
=
null
;
}
if
(
lock
!=
null
)
{
lock
.
unlock
();
if
(
fileLockMethod
!=
FileLock
.
LOCK_SERIALIZED
)
{
// must not delete the .lock file if we wrote something,
// otherwise other connections can not detect that
lock
.
unlock
();
}
lock
=
null
;
}
}
...
...
@@ -2200,6 +2216,7 @@ public class Database implements DataHandler {
// it may have terminated
lock
.
setProperty
(
"changePending"
,
null
);
lock
.
save
();
break
;
}
getTrace
().
debug
(
"delay (change pending)"
);
Thread
.
sleep
(
SysProperties
.
RECONNECT_CHECK_DELAY
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论