Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
afeacc24
提交
afeacc24
authored
13 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Log output
上级
c469b6ea
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
34 行增加
和
29 行删除
+34
-29
PageInputStream.java
h2/src/main/org/h2/store/PageInputStream.java
+1
-1
PageLog.java
h2/src/main/org/h2/store/PageLog.java
+18
-18
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+15
-10
没有找到文件。
h2/src/main/org/h2/store/PageInputStream.java
浏览文件 @
afeacc24
...
...
@@ -109,7 +109,7 @@ public class PageInputStream extends InputStream {
}
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"pageIn.readPage
{0}"
,
next
);
trace
.
debug
(
"pageIn.readPage
"
+
next
);
}
dataPage
=
-
1
;
data
=
null
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageLog.java
浏览文件 @
afeacc24
...
...
@@ -179,7 +179,7 @@ public class PageLog {
* @param atEnd whether only pages at the end of the file should be used
*/
void
openForWriting
(
int
newFirstTrunkPage
,
boolean
atEnd
)
{
trace
.
debug
(
"log openForWriting firstPage:
{0}"
,
newFirstTrunkPage
);
trace
.
debug
(
"log openForWriting firstPage:
"
+
newFirstTrunkPage
);
this
.
firstTrunkPage
=
newFirstTrunkPage
;
logKey
++;
pageOut
=
new
PageOutputStream
(
store
,
newFirstTrunkPage
,
undoAll
,
logKey
,
atEnd
);
...
...
@@ -252,7 +252,7 @@ public class PageLog {
*/
void
recover
(
int
stage
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log recover stage:
{0}"
,
stage
);
trace
.
debug
(
"log recover stage:
"
+
stage
);
}
if
(
stage
==
RECOVERY_STAGE_ALLOCATE
)
{
PageInputStream
in
=
new
PageInputStream
(
store
,
logKey
,
firstTrunkPage
,
firstDataPage
);
...
...
@@ -311,12 +311,12 @@ public class PageLog {
}
else
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo + table:
{0} s:{1} {2}"
,
tableId
,
sessionId
,
row
);
trace
.
debug
(
"log redo + table:
"
+
tableId
+
" s: "
+
sessionId
+
" "
+
row
);
}
store
.
redo
(
pos
,
tableId
,
row
,
true
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
{0} + table:{1} {2}"
,
sessionId
,
tableId
,
row
);
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" + table: "
+
tableId
+
" "
+
row
);
}
}
}
...
...
@@ -327,12 +327,12 @@ public class PageLog {
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo - table:
{0} key:{1}"
,
tableId
,
key
);
trace
.
debug
(
"log redo - table:
"
+
tableId
+
" s:"
+
sessionId
+
" key: "
+
key
);
}
store
.
redoDelete
(
pos
,
tableId
,
key
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
{0} - table:{1} key:{2}"
,
sessionId
,
tableId
,
key
);
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" - table: "
+
tableId
+
" "
+
key
);
}
}
}
...
...
@@ -342,12 +342,12 @@ public class PageLog {
if
(
stage
==
RECOVERY_STAGE_REDO
)
{
if
(
isSessionCommitted
(
sessionId
,
logId
,
pos
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log redo truncate table:
{0}"
,
tableId
);
trace
.
debug
(
"log redo truncate table:
"
+
tableId
);
}
store
.
redoTruncate
(
tableId
);
}
else
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log ignore s:
{0} truncate table:{1}"
,
sessionId
,
tableId
);
trace
.
debug
(
"log ignore s:
"
+
sessionId
+
" truncate table: "
+
tableId
);
}
}
}
...
...
@@ -355,7 +355,7 @@ public class PageLog {
int
sessionId
=
in
.
readVarInt
();
String
transaction
=
in
.
readString
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log prepare commit
{0} {1} pos:{2}"
,
sessionId
,
transaction
,
pos
);
trace
.
debug
(
"log prepare commit
"
+
sessionId
+
" "
+
transaction
+
" pos: "
+
pos
);
}
if
(
stage
==
RECOVERY_STAGE_UNDO
)
{
int
page
=
pageIn
.
getDataPage
();
...
...
@@ -364,13 +364,13 @@ public class PageLog {
}
else
if
(
x
==
ROLLBACK
)
{
int
sessionId
=
in
.
readVarInt
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log rollback
{0} pos:{1}"
,
sessionId
,
pos
);
trace
.
debug
(
"log rollback
"
+
sessionId
+
" pos: "
+
pos
);
}
// ignore - this entry is just informational
}
else
if
(
x
==
COMMIT
)
{
int
sessionId
=
in
.
readVarInt
();
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log commit
{0} pos:{1}"
,
sessionId
,
pos
);
trace
.
debug
(
"log commit
"
+
sessionId
+
" pos: "
+
pos
);
}
if
(
stage
==
RECOVERY_STAGE_UNDO
)
{
setLastCommitForSession
(
sessionId
,
logId
,
pos
);
...
...
@@ -475,7 +475,7 @@ public class PageLog {
return
;
}
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log undo
{0}"
,
pageId
);
trace
.
debug
(
"log undo
"
+
pageId
);
}
if
(
SysProperties
.
CHECK
)
{
if
(
page
==
null
)
{
...
...
@@ -513,7 +513,7 @@ public class PageLog {
private
void
freeLogPages
(
IntArray
pages
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log frees
{0}..{1}"
,
pages
.
get
(
0
),
pages
.
get
(
pages
.
size
()
-
1
));
trace
.
debug
(
"log frees
"
+
pages
.
get
(
0
)
+
".."
+
pages
.
get
(
pages
.
size
()
-
1
));
}
Data
buffer
=
getBuffer
();
buffer
.
writeByte
((
byte
)
FREE_LOG
);
...
...
@@ -537,7 +537,7 @@ public class PageLog {
*/
void
commit
(
int
sessionId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log commit s:
{0}"
,
sessionId
);
trace
.
debug
(
"log commit s:
"
+
sessionId
);
}
if
(
store
.
getDatabase
().
getPageStore
()
==
null
)
{
// database already closed
...
...
@@ -560,7 +560,7 @@ public class PageLog {
*/
void
prepareCommit
(
Session
session
,
String
transaction
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log prepare commit s:
{0}, {1}"
,
session
.
getId
(),
transaction
);
trace
.
debug
(
"log prepare commit s:
"
+
session
.
getId
()
+
", "
+
transaction
);
}
if
(
store
.
getDatabase
().
getPageStore
()
==
null
)
{
// database already closed
...
...
@@ -596,7 +596,7 @@ public class PageLog {
*/
void
logAddOrRemoveRow
(
Session
session
,
int
tableId
,
Row
row
,
boolean
add
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log
{0} s:{1} table:{2} row:{3}"
,
add
?
"+"
:
"-"
,
session
.
getId
(),
tableId
,
row
);
trace
.
debug
(
"log
"
+
(
add
?
"+"
:
"-"
)
+
" s: "
+
session
.
getId
()
+
" table: "
+
tableId
+
" row: "
+
row
);
}
session
.
addLogPos
(
logSectionId
,
logPos
);
logPos
++;
...
...
@@ -640,7 +640,7 @@ public class PageLog {
*/
void
logTruncate
(
Session
session
,
int
tableId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"log truncate s:
{0} table:{1}"
,
session
.
getId
(),
tableId
);
trace
.
debug
(
"log truncate s:
"
+
session
.
getId
()
+
" table: "
+
tableId
);
}
session
.
addLogPos
(
logSectionId
,
logPos
);
logPos
++;
...
...
@@ -713,7 +713,7 @@ public class PageLog {
* @return the trunk page of the data page to keep
*/
private
int
removeUntil
(
int
trunkPage
,
int
firstDataPageToKeep
)
{
trace
.
debug
(
"log.removeUntil
{0} {1}"
,
trunkPage
,
firstDataPageToKeep
);
trace
.
debug
(
"log.removeUntil
"
+
trunkPage
+
" "
+
firstDataPageToKeep
);
while
(
true
)
{
Page
p
=
store
.
getPage
(
trunkPage
);
PageStreamTrunk
t
=
(
PageStreamTrunk
)
p
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
afeacc24
...
...
@@ -425,7 +425,7 @@ public class PageStore implements CacheWriter {
freed
.
clear
(
i
);
}
else
if
(!
freed
.
get
(
i
))
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"free
{0}"
,
i
);
trace
.
debug
(
"free
"
+
i
);
}
file
.
seek
((
long
)
i
<<
pageSizeShift
);
file
.
readFully
(
test
,
0
,
16
);
...
...
@@ -602,7 +602,7 @@ public class PageStore implements CacheWriter {
pageCount
=
newPageCount
;
// the easiest way to remove superfluous entries
freeLists
.
clear
();
trace
.
debug
(
"pageCount:
{0}"
,
pageCount
);
trace
.
debug
(
"pageCount:
"
+
pageCount
);
long
newLength
=
(
long
)
pageCount
<<
pageSizeShift
;
if
(
file
.
length
()
!=
newLength
)
{
file
.
setLength
(
newLength
);
...
...
@@ -630,7 +630,9 @@ public class PageStore implements CacheWriter {
if
(
f
!=
null
)
{
DbException
.
throwInternalError
(
"not free: "
+
f
);
}
trace
.
debug
(
"swap {0} and {1} via {2}"
,
a
,
b
,
free
);
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"swap "
+
a
+
" and "
+
b
+
" via "
+
free
);
}
Page
pageA
=
null
;
if
(
isUsed
(
a
))
{
pageA
=
getPage
(
a
);
...
...
@@ -675,7 +677,9 @@ public class PageStore implements CacheWriter {
freePage
(
full
);
}
}
else
{
trace
.
debug
(
"move {0} to {1}"
,
p
.
getPos
(),
free
);
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"move "
+
p
.
getPos
()
+
" to "
+
free
);
}
try
{
p
.
moveTo
(
systemSession
,
free
);
}
finally
{
...
...
@@ -899,7 +903,7 @@ public class PageStore implements CacheWriter {
*/
void
setLogFirstPage
(
int
logKey
,
int
trunkPageId
,
int
dataPageId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"setLogFirstPage key:
{0} trunk: {1} data: {2}"
,
logKey
,
trunkPageId
,
dataPageId
);
trace
.
debug
(
"setLogFirstPage key:
"
+
logKey
+
" trunk: "
+
trunkPageId
+
" data: "
+
dataPageId
);
}
this
.
logKey
=
logKey
;
this
.
logFirstTrunkPage
=
trunkPageId
;
...
...
@@ -970,7 +974,7 @@ public class PageStore implements CacheWriter {
public
synchronized
void
writeBack
(
CacheObject
obj
)
{
Page
record
=
(
Page
)
obj
;
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"writeBack
{0}"
,
record
);
trace
.
debug
(
"writeBack
"
+
record
);
}
record
.
write
();
record
.
setChanged
(
false
);
...
...
@@ -1007,7 +1011,7 @@ public class PageStore implements CacheWriter {
public
synchronized
void
update
(
Page
page
)
{
if
(
trace
.
isDebugEnabled
())
{
if
(!
page
.
isChanged
())
{
trace
.
debug
(
"updateRecord
{0}"
,
page
.
toString
());
trace
.
debug
(
"updateRecord
"
+
page
.
toString
());
}
}
checkOpen
();
...
...
@@ -1199,7 +1203,7 @@ public class PageStore implements CacheWriter {
*/
void
freeUnused
(
int
pageId
)
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"freeUnused
{0}"
,
pageId
);
trace
.
debug
(
"freeUnused
"
+
pageId
);
}
cache
.
remove
(
pageId
);
freePage
(
pageId
);
...
...
@@ -1313,7 +1317,7 @@ public class PageStore implements CacheWriter {
if
(
reservedPages
!=
null
)
{
for
(
int
r
:
reservedPages
.
keySet
())
{
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"reserve
{0}"
,
r
);
trace
.
debug
(
"reserve
"
+
r
);
}
allocatePage
(
r
);
}
...
...
@@ -1557,7 +1561,8 @@ public class PageStore implements CacheWriter {
String
[]
ops
=
StringUtils
.
arraySplit
(
options
,
','
,
false
);
Index
meta
;
if
(
trace
.
isDebugEnabled
())
{
trace
.
debug
(
"addMeta id={0} type={1} root={2} parent={3} columns={4}"
,
id
,
type
,
rootPageId
,
parent
,
columnList
);
trace
.
debug
(
"addMeta id="
+
id
+
" type="
+
type
+
" root="
+
rootPageId
+
" parent="
+
parent
+
" columns="
+
columnList
);
}
if
(
redo
&&
rootPageId
!=
0
)
{
// ensure the page is empty, but not used by regular data
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论