Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0cc4689e
提交
0cc4689e
authored
7月 12, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Recover: more detailed trace output.
上级
5a9f3926
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
17 行删除
+32
-17
Recover.java
h2/src/main/org/h2/tools/Recover.java
+32
-17
没有找到文件。
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
0cc4689e
...
...
@@ -413,12 +413,11 @@ public class Recover extends Tool implements DataHandler {
}
writer
.
println
(
"-- head "
+
i
+
": writeCounter: "
+
writeCounter
+
" log key: "
+
key
+
" trunk: "
+
firstTrunkPage
+
"/"
+
firstDataPage
+
" crc expected "
+
expected
+
" got "
+
got
+
" ("
+
(
expected
==
got
?
"ok"
:
"different"
)
+
")"
);
" log "
+
key
+
":"
+
firstTrunkPage
+
"/"
+
firstDataPage
+
" crc "
+
got
+
" ("
+
(
expected
==
got
?
"ok"
:
(
"expected: "
+
expected
))
+
")"
);
}
writer
.
println
(
"--
firstTrunkPage:
"
+
logFirstTrunkPage
+
"
firstDataPage:
"
+
logFirstDataPage
);
writer
.
println
(
"--
log "
+
logKey
+
":
"
+
logFirstTrunkPage
+
"
/
"
+
logFirstDataPage
);
PrintWriter
devNull
=
new
PrintWriter
(
new
OutputStream
()
{
public
void
write
(
int
b
)
{
...
...
@@ -432,7 +431,7 @@ public class Recover extends Tool implements DataHandler {
dumpPageStore
(
writer
,
pageCount
);
writeSchema
(
writer
);
try
{
dumpPageLogStream
(
writer
,
logKey
,
logFirstTrunkPage
,
logFirstDataPage
);
dumpPageLogStream
(
writer
,
logKey
,
logFirstTrunkPage
,
logFirstDataPage
,
pageCount
);
}
catch
(
IOException
e
)
{
// ignore
}
...
...
@@ -488,11 +487,17 @@ public class Recover extends Tool implements DataHandler {
s
=
Data
.
create
(
this
,
pageSize
);
seek
(
page
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
dumpPage
(
writer
,
s
,
page
,
pageCount
);
}
}
private
void
dumpPage
(
PrintWriter
writer
,
Data
s
,
long
page
,
long
pageCount
)
{
try
{
int
type
=
s
.
readByte
();
switch
(
type
)
{
case
Page
.
TYPE_EMPTY
:
stat
.
pageTypeCount
[
type
]++;
continue
;
return
;
}
boolean
last
=
(
type
&
Page
.
FLAG_LAST
)
!=
0
;
type
&=
~
Page
.
FLAG_LAST
;
...
...
@@ -572,11 +577,13 @@ public class Recover extends Tool implements DataHandler {
writer
.
println
(
"-- ERROR page "
+
page
+
" unknown type "
+
type
);
break
;
}
}
catch
(
Exception
e
)
{
writeError
(
writer
,
e
);
}
}
private
void
dumpPageLogStream
(
PrintWriter
writer
,
int
logKey
,
int
logFirstTrunkPage
,
int
logFirstDataPage
)
throws
IOException
{
int
logFirstTrunkPage
,
int
logFirstDataPage
,
long
pageCount
)
throws
IOException
{
Data
s
=
Data
.
create
(
this
,
pageSize
);
DataReader
in
=
new
DataReader
(
new
PageInputStream
(
writer
,
this
,
store
,
logKey
,
logFirstTrunkPage
,
logFirstDataPage
,
pageSize
)
...
...
@@ -644,13 +651,17 @@ public class Recover extends Tool implements DataHandler {
break
;
}
writer
.
println
(
"-- undo page "
+
pageId
+
" "
+
typeName
);
if
(
trace
)
{
Data
d
=
Data
.
create
(
null
,
data
);
dumpPage
(
writer
,
d
,
pageId
,
pageCount
);
}
}
else
if
(
x
==
PageLog
.
ADD
)
{
int
sessionId
=
in
.
readVarInt
();
setStorage
(
in
.
readVarInt
());
Row
row
=
PageLog
.
readRow
(
in
,
s
);
writer
.
println
(
"-- session "
+
sessionId
+
" table "
+
storageId
+
"
add
"
+
row
.
toString
());
"
+
"
+
row
.
toString
());
if
(
transactionLog
)
{
if
(
storageId
==
0
&&
row
.
getColumnCount
()
>=
4
)
{
int
tableId
=
(
int
)
row
.
getKey
();
...
...
@@ -680,7 +691,7 @@ public class Recover extends Tool implements DataHandler {
long
key
=
in
.
readVarLong
();
writer
.
println
(
"-- session "
+
sessionId
+
" table "
+
storageId
+
"
remove
"
+
key
);
"
-
"
+
key
);
if
(
transactionLog
)
{
if
(
storageId
==
0
)
{
int
tableId
=
(
int
)
key
;
...
...
@@ -749,6 +760,7 @@ public class Recover extends Tool implements DataHandler {
private
final
Data
page
;
private
final
int
pageSize
;
private
long
trunkPage
;
private
long
nextTrunkPage
;
private
long
dataPage
;
private
IntArray
dataPages
=
new
IntArray
();
private
boolean
endOfFile
;
...
...
@@ -761,7 +773,7 @@ public class Recover extends Tool implements DataHandler {
this
.
store
=
store
;
this
.
pageSize
=
pageSize
;
this
.
logKey
=
logKey
-
1
;
this
.
t
runkPage
=
firstTrunkPage
;
this
.
nextT
runkPage
=
firstTrunkPage
;
this
.
dataPage
=
firstDataPage
;
page
=
Data
.
create
(
handler
,
pageSize
);
}
...
...
@@ -809,10 +821,11 @@ public class Recover extends Tool implements DataHandler {
return
;
}
while
(
dataPages
.
size
()
==
0
)
{
if
(
t
runkPage
==
0
)
{
if
(
nextT
runkPage
==
0
)
{
endOfFile
=
true
;
return
;
}
trunkPage
=
nextTrunkPage
;
store
.
seek
(
trunkPage
*
pageSize
);
store
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
page
.
reset
();
...
...
@@ -824,7 +837,7 @@ public class Recover extends Tool implements DataHandler {
int
t
=
page
.
readByte
();
page
.
readShortInt
();
if
(
t
!=
Page
.
TYPE_STREAM_TRUNK
)
{
writer
.
println
(
"--
eof page:
"
+
trunkPage
+
" type: "
+
t
+
" expected type: "
+
Page
.
TYPE_STREAM_TRUNK
);
writer
.
println
(
"--
log eof
"
+
trunkPage
+
" type: "
+
t
+
" expected type: "
+
Page
.
TYPE_STREAM_TRUNK
);
endOfFile
=
true
;
return
;
}
...
...
@@ -832,9 +845,10 @@ public class Recover extends Tool implements DataHandler {
int
key
=
page
.
readInt
();
logKey
++;
if
(
key
!=
logKey
)
{
writer
.
println
(
"--
eof page:
"
+
trunkPage
+
" type: "
+
t
+
" expected key: "
+
logKey
+
" got: "
+
key
);
writer
.
println
(
"--
log eof
"
+
trunkPage
+
" type: "
+
t
+
" expected key: "
+
logKey
+
" got: "
+
key
);
}
trunkPage
=
page
.
readInt
();
nextTrunkPage
=
page
.
readInt
();
writer
.
println
(
"-- log "
+
key
+
":"
+
trunkPage
+
" next: "
+
nextTrunkPage
);
int
pageCount
=
page
.
readShortInt
();
for
(
int
i
=
0
;
i
<
pageCount
;
i
++)
{
int
d
=
page
.
readInt
();
...
...
@@ -865,13 +879,14 @@ public class Recover extends Tool implements DataHandler {
page
.
readShortInt
();
int
p
=
page
.
readInt
();
int
k
=
page
.
readInt
();
writer
.
println
(
"-- log "
+
k
+
":"
+
trunkPage
+
"/"
+
nextPage
);
if
(
t
!=
Page
.
TYPE_STREAM_DATA
)
{
writer
.
println
(
"--
eof page:
"
+
nextPage
+
" type: "
+
t
+
" parent: "
+
p
+
writer
.
println
(
"--
log eof
"
+
nextPage
+
" type: "
+
t
+
" parent: "
+
p
+
" expected type: "
+
Page
.
TYPE_STREAM_DATA
);
endOfFile
=
true
;
return
;
}
else
if
(
k
!=
logKey
)
{
writer
.
println
(
"--
eof page:
"
+
nextPage
+
" type: "
+
t
+
" parent: "
+
p
+
writer
.
println
(
"--
log eof
"
+
nextPage
+
" type: "
+
t
+
" parent: "
+
p
+
" expected key: "
+
logKey
+
" got: "
+
k
);
endOfFile
=
true
;
return
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论