Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
a8693704
提交
a8693704
authored
2月 03, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New experimental page store.
上级
2376a5e1
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
17 行增加
和
16 行删除
+17
-16
TransactionCommand.java
h2/src/main/org/h2/command/dml/TransactionCommand.java
+3
-2
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
LogSystem.java
h2/src/main/org/h2/log/LogSystem.java
+8
-8
SessionState.java
h2/src/main/org/h2/log/SessionState.java
+5
-5
没有找到文件。
h2/src/main/org/h2/command/dml/TransactionCommand.java
浏览文件 @
a8693704
...
@@ -9,6 +9,7 @@ package org.h2.command.dml;
...
@@ -9,6 +9,7 @@ package org.h2.command.dml;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.command.Prepared
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.log.LogSystem
;
import
org.h2.log.LogSystem
;
...
@@ -123,8 +124,8 @@ public class TransactionCommand extends Prepared {
...
@@ -123,8 +124,8 @@ public class TransactionCommand extends Prepared {
break
;
break
;
case
CHECKPOINT:
case
CHECKPOINT:
session
.
getUser
().
checkAdmin
();
session
.
getUser
().
checkAdmin
();
if
(
SysProperties
.
PAGE_STORE
)
{
PageStore
store
=
session
.
getDatabase
().
getPageStore
();
PageStore
store
=
session
.
getDatabase
().
getPageStore
();
if
(
store
!=
null
)
{
store
.
checkpoint
();
store
.
checkpoint
();
}
}
session
.
getDatabase
().
getLog
().
checkpoint
();
session
.
getDatabase
().
getLog
().
checkpoint
();
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
a8693704
...
@@ -2091,7 +2091,7 @@ public class Database implements DataHandler {
...
@@ -2091,7 +2091,7 @@ public class Database implements DataHandler {
}
}
public
PageStore
getPageStore
()
throws
SQLException
{
public
PageStore
getPageStore
()
throws
SQLException
{
if
(
pageStore
==
null
)
{
if
(
pageStore
==
null
&&
SysProperties
.
PAGE_STORE
)
{
pageStore
=
new
PageStore
(
this
,
databaseName
+
Constants
.
SUFFIX_PAGE_FILE
,
accessModeData
,
pageStore
=
new
PageStore
(
this
,
databaseName
+
Constants
.
SUFFIX_PAGE_FILE
,
accessModeData
,
SysProperties
.
CACHE_SIZE_DEFAULT
);
SysProperties
.
CACHE_SIZE_DEFAULT
);
pageStore
.
open
();
pageStore
.
open
();
...
...
h2/src/main/org/h2/log/LogSystem.java
浏览文件 @
a8693704
...
@@ -42,7 +42,7 @@ public class LogSystem {
...
@@ -42,7 +42,7 @@ public class LogSystem {
private
LogFile
currentLog
;
private
LogFile
currentLog
;
private
String
fileNamePrefix
;
private
String
fileNamePrefix
;
private
HashMap
storages
=
new
HashMap
();
private
HashMap
storages
=
new
HashMap
();
private
HashMap
sessions
=
new
HashMap
();
private
HashMap
session
State
s
=
new
HashMap
();
private
DataPage
rowBuff
;
private
DataPage
rowBuff
;
private
ObjectArray
undo
;
private
ObjectArray
undo
;
// TODO log file / deleteOldLogFilesAutomatically:
// TODO log file / deleteOldLogFilesAutomatically:
...
@@ -252,7 +252,7 @@ public class LogSystem {
...
@@ -252,7 +252,7 @@ public class LogSystem {
database
.
getIndexFile
().
flushRedoLog
();
database
.
getIndexFile
().
flushRedoLog
();
}
}
int
end
=
currentLog
.
getPos
();
int
end
=
currentLog
.
getPos
();
Object
[]
states
=
sessions
.
values
().
toArray
();
Object
[]
states
=
session
State
s
.
values
().
toArray
();
inDoubtTransactions
=
new
ObjectArray
();
inDoubtTransactions
=
new
ObjectArray
();
for
(
int
i
=
0
;
i
<
states
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
states
.
length
;
i
++)
{
SessionState
state
=
(
SessionState
)
states
[
i
];
SessionState
state
=
(
SessionState
)
states
[
i
];
...
@@ -260,10 +260,10 @@ public class LogSystem {
...
@@ -260,10 +260,10 @@ public class LogSystem {
inDoubtTransactions
.
add
(
state
.
inDoubtTransaction
);
inDoubtTransactions
.
add
(
state
.
inDoubtTransaction
);
}
}
}
}
for
(
int
i
=
undo
.
size
()
-
1
;
i
>=
0
&&
sessions
.
size
()
>
0
;
i
--)
{
for
(
int
i
=
undo
.
size
()
-
1
;
i
>=
0
&&
session
State
s
.
size
()
>
0
;
i
--)
{
database
.
setProgress
(
DatabaseEventListener
.
STATE_RECOVER
,
null
,
undo
.
size
()
-
1
-
i
,
undo
.
size
());
database
.
setProgress
(
DatabaseEventListener
.
STATE_RECOVER
,
null
,
undo
.
size
()
-
1
-
i
,
undo
.
size
());
LogRecord
record
=
(
LogRecord
)
undo
.
get
(
i
);
LogRecord
record
=
(
LogRecord
)
undo
.
get
(
i
);
if
(
sessions
.
get
(
ObjectUtils
.
getInteger
(
record
.
sessionId
))
!=
null
)
{
if
(
session
State
s
.
get
(
ObjectUtils
.
getInteger
(
record
.
sessionId
))
!=
null
)
{
// undo only if the session is not yet committed
// undo only if the session is not yet committed
record
.
log
.
undo
(
record
.
logRecordId
);
record
.
log
.
undo
(
record
.
logRecordId
);
database
.
getDataFile
().
flushRedoLog
();
database
.
getDataFile
().
flushRedoLog
();
...
@@ -359,7 +359,7 @@ public class LogSystem {
...
@@ -359,7 +359,7 @@ public class LogSystem {
*/
*/
boolean
isSessionCommitted
(
int
sessionId
,
int
logId
,
int
pos
)
{
boolean
isSessionCommitted
(
int
sessionId
,
int
logId
,
int
pos
)
{
Integer
key
=
ObjectUtils
.
getInteger
(
sessionId
);
Integer
key
=
ObjectUtils
.
getInteger
(
sessionId
);
SessionState
state
=
(
SessionState
)
sessions
.
get
(
key
);
SessionState
state
=
(
SessionState
)
session
State
s
.
get
(
key
);
if
(
state
==
null
)
{
if
(
state
==
null
)
{
return
true
;
return
true
;
}
}
...
@@ -389,10 +389,10 @@ public class LogSystem {
...
@@ -389,10 +389,10 @@ public class LogSystem {
*/
*/
SessionState
getOrAddSessionState
(
int
sessionId
)
{
SessionState
getOrAddSessionState
(
int
sessionId
)
{
Integer
key
=
ObjectUtils
.
getInteger
(
sessionId
);
Integer
key
=
ObjectUtils
.
getInteger
(
sessionId
);
SessionState
state
=
(
SessionState
)
sessions
.
get
(
key
);
SessionState
state
=
(
SessionState
)
session
State
s
.
get
(
key
);
if
(
state
==
null
)
{
if
(
state
==
null
)
{
state
=
new
SessionState
();
state
=
new
SessionState
();
sessions
.
put
(
key
,
state
);
session
State
s
.
put
(
key
,
state
);
state
.
sessionId
=
sessionId
;
state
.
sessionId
=
sessionId
;
}
}
return
state
;
return
state
;
...
@@ -433,7 +433,7 @@ public class LogSystem {
...
@@ -433,7 +433,7 @@ public class LogSystem {
* @param sessionId the session id
* @param sessionId the session id
*/
*/
void
removeSession
(
int
sessionId
)
{
void
removeSession
(
int
sessionId
)
{
sessions
.
remove
(
ObjectUtils
.
getInteger
(
sessionId
));
session
State
s
.
remove
(
ObjectUtils
.
getInteger
(
sessionId
));
}
}
/**
/**
...
...
h2/src/main/org/h2/log/SessionState.java
浏览文件 @
a8693704
...
@@ -15,22 +15,22 @@ public class SessionState {
...
@@ -15,22 +15,22 @@ public class SessionState {
/**
/**
* The session id
* The session id
*/
*/
int
sessionId
;
public
int
sessionId
;
/**
/**
* The last log file id where a commit for this session is found.
* The last log file id where a commit for this session is found.
*/
*/
int
lastCommitLog
;
public
int
lastCommitLog
;
/**
/**
* The position where a commit for this session is found.
* The position where a commit for this session is found.
*/
*/
int
lastCommitPos
;
public
int
lastCommitPos
;
/**
/**
* The in-doubt transaction if there is one.
* The in-doubt transaction if there is one.
*/
*/
InDoubtTransaction
inDoubtTransaction
;
public
InDoubtTransaction
inDoubtTransaction
;
/**
/**
* Check if this session state is already committed at this point.
* Check if this session state is already committed at this point.
...
@@ -39,7 +39,7 @@ public class SessionState {
...
@@ -39,7 +39,7 @@ public class SessionState {
* @param pos the position in the log file
* @param pos the position in the log file
* @return true if it is committed
* @return true if it is committed
*/
*/
boolean
isCommitted
(
int
logId
,
int
pos
)
{
public
boolean
isCommitted
(
int
logId
,
int
pos
)
{
if
(
logId
!=
lastCommitLog
)
{
if
(
logId
!=
lastCommitLog
)
{
return
lastCommitLog
>
logId
;
return
lastCommitLog
>
logId
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论