Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
08d945e0
提交
08d945e0
authored
3月 29, 2009
作者:
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 {
...
@@ -244,7 +244,7 @@ public class Database implements DataHandler {
}
}
traceSystem
.
close
();
traceSystem
.
close
();
}
}
closeOpenFilesAndUnlock
();
closeOpenFilesAndUnlock
(
false
);
throw
Message
.
convert
(
e
);
throw
Message
.
convert
(
e
);
}
}
}
}
...
@@ -371,7 +371,7 @@ public class Database implements DataHandler {
...
@@ -371,7 +371,7 @@ public class Database implements DataHandler {
if
(
log
!=
null
)
{
if
(
log
!=
null
)
{
try
{
try
{
stopWriter
();
stopWriter
();
log
.
close
();
log
.
close
(
false
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// ignore
// ignore
}
}
...
@@ -520,8 +520,7 @@ public class Database implements DataHandler {
...
@@ -520,8 +520,7 @@ public class Database implements DataHandler {
.
info
(
"opening "
+
databaseName
+
" (build "
+
Constants
.
BUILD_ID
+
")"
);
.
info
(
"opening "
+
databaseName
+
" (build "
+
Constants
.
BUILD_ID
+
")"
);
if
(
autoServerMode
)
{
if
(
autoServerMode
)
{
if
(
readOnly
||
fileLockMethod
==
FileLock
.
LOCK_NO
)
{
if
(
readOnly
||
fileLockMethod
==
FileLock
.
LOCK_NO
)
{
int
todoImproveErrorMessage
;
throw
Message
.
getUnsupportedException
(
"autoServerMode && (readOnly || fileLockMethod == NO)"
);
throw
Message
.
getSQLException
(
ErrorCode
.
FEATURE_NOT_SUPPORTED
);
}
}
}
}
if
(!
readOnly
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
if
(!
readOnly
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
...
@@ -1059,6 +1058,17 @@ public class Database implements DataHandler {
...
@@ -1059,6 +1058,17 @@ public class Database implements DataHandler {
if
(
closing
)
{
if
(
closing
)
{
return
;
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
;
closing
=
true
;
stopServer
();
stopServer
();
if
(
userSessions
.
size
()
>
0
)
{
if
(
userSessions
.
size
()
>
0
)
{
...
@@ -1131,7 +1141,7 @@ public class Database implements DataHandler {
...
@@ -1131,7 +1141,7 @@ public class Database implements DataHandler {
}
}
tempFileDeleter
.
deleteAll
();
tempFileDeleter
.
deleteAll
();
try
{
try
{
closeOpenFilesAndUnlock
();
closeOpenFilesAndUnlock
(
true
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
}
}
...
@@ -1172,19 +1182,21 @@ public class Database implements DataHandler {
...
@@ -1172,19 +1182,21 @@ public class Database implements DataHandler {
}
}
}
}
private
synchronized
void
closeOpenFilesAndUnlock
()
throws
SQLException
{
private
synchronized
void
closeOpenFilesAndUnlock
(
boolean
checkpoint
)
throws
SQLException
{
if
(
log
!=
null
)
{
if
(
log
!=
null
)
{
stopWriter
();
stopWriter
();
try
{
try
{
log
.
close
();
log
.
close
(
checkpoint
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
error
(
"close"
,
e
);
}
}
log
=
null
;
log
=
null
;
}
}
if
(
pageStore
!=
null
)
{
if
(
pageStore
!=
null
)
{
if
(
checkpoint
)
{
pageStore
.
checkpoint
();
pageStore
.
checkpoint
();
}
}
}
closeFiles
();
closeFiles
();
if
(
persistent
&&
lock
==
null
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
if
(
persistent
&&
lock
==
null
&&
fileLockMethod
!=
FileLock
.
LOCK_NO
)
{
// everything already closed (maybe in checkPowerOff)
// everything already closed (maybe in checkPowerOff)
...
@@ -1200,7 +1212,11 @@ public class Database implements DataHandler {
...
@@ -1200,7 +1212,11 @@ public class Database implements DataHandler {
systemSession
=
null
;
systemSession
=
null
;
}
}
if
(
lock
!=
null
)
{
if
(
lock
!=
null
)
{
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
.
unlock
();
}
lock
=
null
;
lock
=
null
;
}
}
}
}
...
@@ -2200,6 +2216,7 @@ public class Database implements DataHandler {
...
@@ -2200,6 +2216,7 @@ public class Database implements DataHandler {
// it may have terminated
// it may have terminated
lock
.
setProperty
(
"changePending"
,
null
);
lock
.
setProperty
(
"changePending"
,
null
);
lock
.
save
();
lock
.
save
();
break
;
}
}
getTrace
().
debug
(
"delay (change pending)"
);
getTrace
().
debug
(
"delay (change pending)"
);
Thread
.
sleep
(
SysProperties
.
RECONNECT_CHECK_DELAY
);
Thread
.
sleep
(
SysProperties
.
RECONNECT_CHECK_DELAY
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论