Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b4aa3f5a
提交
b4aa3f5a
authored
10月 12, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The Recover tool did not work for databases larger than 2 GB.
上级
943de35a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
23 行删除
+28
-23
Recover.java
h2/src/main/org/h2/tools/Recover.java
+28
-23
没有找到文件。
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
b4aa3f5a
...
@@ -371,7 +371,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -371,7 +371,7 @@ public class Recover extends Tool implements DataHandler {
writeError
(
writer
,
e
);
writeError
(
writer
,
e
);
}
}
Data
s
=
Data
.
create
(
this
,
128
);
Data
s
=
Data
.
create
(
this
,
128
);
s
tore
.
s
eek
(
0
);
seek
(
0
);
store
.
readFully
(
s
.
getBytes
(),
0
,
128
);
store
.
readFully
(
s
.
getBytes
(),
0
,
128
);
s
.
setPos
(
48
);
s
.
setPos
(
48
);
pageSize
=
s
.
readInt
();
pageSize
=
s
.
readInt
();
...
@@ -384,25 +384,25 @@ public class Recover extends Tool implements DataHandler {
...
@@ -384,25 +384,25 @@ public class Recover extends Tool implements DataHandler {
pageSize
=
SysProperties
.
PAGE_SIZE
;
pageSize
=
SysProperties
.
PAGE_SIZE
;
writer
.
println
(
"-- ERROR: page size; using "
+
pageSize
);
writer
.
println
(
"-- ERROR: page size; using "
+
pageSize
);
}
}
int
pageCount
=
(
int
)
(
length
/
pageSize
)
;
long
pageCount
=
length
/
pageSize
;
parents
=
new
int
[
pageCount
];
parents
=
new
int
[
(
int
)
pageCount
];
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
);
for
(
int
i
=
3
;
i
<
pageCount
;
i
++)
{
for
(
long
i
=
3
;
i
<
pageCount
;
i
++)
{
s
.
reset
();
s
.
reset
();
s
tore
.
seek
(
i
*
pageSize
);
s
eek
(
i
);
store
.
readFully
(
s
.
getBytes
(),
0
,
32
);
store
.
readFully
(
s
.
getBytes
(),
0
,
32
);
s
.
readByte
();
s
.
readByte
();
s
.
readShortInt
();
s
.
readShortInt
();
parents
[
i
]
=
s
.
readInt
();
parents
[
(
int
)
i
]
=
s
.
readInt
();
}
}
int
logKey
=
0
,
logFirstTrunkPage
=
0
,
logFirstDataPage
=
0
;
int
logKey
=
0
,
logFirstTrunkPage
=
0
,
logFirstDataPage
=
0
;
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
);
for
(
int
i
=
1
;;
i
++)
{
for
(
long
i
=
1
;;
i
++)
{
if
(
i
==
3
)
{
if
(
i
==
3
)
{
break
;
break
;
}
}
s
.
reset
();
s
.
reset
();
s
tore
.
seek
(
i
*
pageSize
);
s
eek
(
i
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
CRC32
crc
=
new
CRC32
();
CRC32
crc
=
new
CRC32
();
crc
.
update
(
s
.
getBytes
(),
4
,
pageSize
-
4
);
crc
.
update
(
s
.
getBytes
(),
4
,
pageSize
-
4
);
...
@@ -461,11 +461,11 @@ public class Recover extends Tool implements DataHandler {
...
@@ -461,11 +461,11 @@ public class Recover extends Tool implements DataHandler {
}
}
}
}
private
void
dumpPageStore
(
PrintWriter
writer
,
int
pageCount
)
{
private
void
dumpPageStore
(
PrintWriter
writer
,
long
pageCount
)
{
Data
s
=
Data
.
create
(
this
,
pageSize
);
Data
s
=
Data
.
create
(
this
,
pageSize
);
for
(
int
page
=
3
;
page
<
pageCount
;
page
++)
{
for
(
long
page
=
3
;
page
<
pageCount
;
page
++)
{
s
=
Data
.
create
(
this
,
pageSize
);
s
=
Data
.
create
(
this
,
pageSize
);
s
tore
.
seek
(
page
*
pageSiz
e
);
s
eek
(
pag
e
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
store
.
readFully
(
s
.
getBytes
(),
0
,
pageSize
);
int
type
=
s
.
readByte
();
int
type
=
s
.
readByte
();
switch
(
type
)
{
switch
(
type
)
{
...
@@ -475,7 +475,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -475,7 +475,7 @@ public class Recover extends Tool implements DataHandler {
}
}
boolean
last
=
(
type
&
Page
.
FLAG_LAST
)
!=
0
;
boolean
last
=
(
type
&
Page
.
FLAG_LAST
)
!=
0
;
type
&=
~
Page
.
FLAG_LAST
;
type
&=
~
Page
.
FLAG_LAST
;
if
(!
PageStore
.
checksumTest
(
s
.
getBytes
(),
page
,
pageSize
))
{
if
(!
PageStore
.
checksumTest
(
s
.
getBytes
(),
(
int
)
page
,
pageSize
))
{
writer
.
println
(
"-- ERROR: page "
+
page
+
" checksum mismatch type: "
+
type
);
writer
.
println
(
"-- ERROR: page "
+
page
+
" checksum mismatch type: "
+
type
);
}
}
s
.
readShortInt
();
s
.
readShortInt
();
...
@@ -685,15 +685,15 @@ public class Recover extends Tool implements DataHandler {
...
@@ -685,15 +685,15 @@ public class Recover extends Tool implements DataHandler {
private
final
FileStore
store
;
private
final
FileStore
store
;
private
final
Data
page
;
private
final
Data
page
;
private
final
int
pageSize
;
private
final
int
pageSize
;
private
int
trunkPage
;
private
long
trunkPage
;
private
int
dataPage
;
private
long
dataPage
;
private
IntArray
dataPages
=
new
IntArray
();
private
IntArray
dataPages
=
new
IntArray
();
private
boolean
endOfFile
;
private
boolean
endOfFile
;
private
int
remaining
;
private
int
remaining
;
private
int
logKey
;
private
int
logKey
;
public
PageInputStream
(
PrintWriter
writer
,
DataHandler
handler
,
public
PageInputStream
(
PrintWriter
writer
,
DataHandler
handler
,
FileStore
store
,
int
logKey
,
int
firstTrunkPage
,
int
firstDataPage
,
int
pageSize
)
{
FileStore
store
,
int
logKey
,
long
firstTrunkPage
,
long
firstDataPage
,
int
pageSize
)
{
this
.
writer
=
writer
;
this
.
writer
=
writer
;
this
.
store
=
store
;
this
.
store
=
store
;
this
.
pageSize
=
pageSize
;
this
.
pageSize
=
pageSize
;
...
@@ -750,10 +750,10 @@ public class Recover extends Tool implements DataHandler {
...
@@ -750,10 +750,10 @@ public class Recover extends Tool implements DataHandler {
endOfFile
=
true
;
endOfFile
=
true
;
return
;
return
;
}
}
store
.
seek
(
(
long
)
trunkPage
*
pageSize
);
store
.
seek
(
trunkPage
*
pageSize
);
store
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
store
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
page
.
reset
();
page
.
reset
();
if
(!
PageStore
.
checksumTest
(
page
.
getBytes
(),
trunkPage
,
pageSize
))
{
if
(!
PageStore
.
checksumTest
(
page
.
getBytes
(),
(
int
)
trunkPage
,
pageSize
))
{
writer
.
println
(
"-- ERROR: checksum mismatch page: "
+
trunkPage
);
writer
.
println
(
"-- ERROR: checksum mismatch page: "
+
trunkPage
);
endOfFile
=
true
;
endOfFile
=
true
;
return
;
return
;
...
@@ -788,13 +788,13 @@ public class Recover extends Tool implements DataHandler {
...
@@ -788,13 +788,13 @@ public class Recover extends Tool implements DataHandler {
}
}
if
(
dataPages
.
size
()
>
0
)
{
if
(
dataPages
.
size
()
>
0
)
{
page
.
reset
();
page
.
reset
();
int
nextPage
=
dataPages
.
get
(
0
);
long
nextPage
=
dataPages
.
get
(
0
);
dataPages
.
remove
(
0
);
dataPages
.
remove
(
0
);
store
.
seek
(
(
long
)
nextPage
*
pageSize
);
store
.
seek
(
nextPage
*
pageSize
);
store
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
store
.
readFully
(
page
.
getBytes
(),
0
,
pageSize
);
page
.
reset
();
page
.
reset
();
int
t
=
page
.
readByte
();
int
t
=
page
.
readByte
();
if
(
t
!=
0
&&
!
PageStore
.
checksumTest
(
page
.
getBytes
(),
nextPage
,
pageSize
))
{
if
(
t
!=
0
&&
!
PageStore
.
checksumTest
(
page
.
getBytes
(),
(
int
)
nextPage
,
pageSize
))
{
writer
.
println
(
"-- ERROR: checksum mismatch page: "
+
nextPage
);
writer
.
println
(
"-- ERROR: checksum mismatch page: "
+
nextPage
);
endOfFile
=
true
;
endOfFile
=
true
;
return
;
return
;
...
@@ -818,7 +818,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -818,7 +818,7 @@ public class Recover extends Tool implements DataHandler {
}
}
}
}
private
void
dumpPageBtreeNode
(
PrintWriter
writer
,
Data
s
,
int
pageId
,
boolean
positionOnly
)
{
private
void
dumpPageBtreeNode
(
PrintWriter
writer
,
Data
s
,
long
pageId
,
boolean
positionOnly
)
{
int
rowCount
=
s
.
readInt
();
int
rowCount
=
s
.
readInt
();
int
entryCount
=
s
.
readShortInt
();
int
entryCount
=
s
.
readShortInt
();
int
[]
children
=
new
int
[
entryCount
+
1
];
int
[]
children
=
new
int
[
entryCount
+
1
];
...
@@ -976,7 +976,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -976,7 +976,7 @@ public class Recover extends Tool implements DataHandler {
while
(
true
)
{
while
(
true
)
{
checkParent
(
writer
,
parent
,
new
int
[]{(
int
)
next
},
0
);
checkParent
(
writer
,
parent
,
new
int
[]{(
int
)
next
},
0
);
parent
=
next
;
parent
=
next
;
s
tore
.
seek
(
pageSize
*
next
);
s
eek
(
next
);
store
.
readFully
(
s2
.
getBytes
(),
0
,
pageSize
);
store
.
readFully
(
s2
.
getBytes
(),
0
,
pageSize
);
s2
.
reset
();
s2
.
reset
();
int
type
=
s2
.
readByte
();
int
type
=
s2
.
readByte
();
...
@@ -1037,7 +1037,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -1037,7 +1037,7 @@ public class Recover extends Tool implements DataHandler {
append
(
'\''
);
append
(
'\''
);
byte
[]
replacement
=
buff
.
toString
().
getBytes
();
byte
[]
replacement
=
buff
.
toString
().
getBytes
();
System
.
arraycopy
(
replacement
,
0
,
s
.
getBytes
(),
saltIndex
,
replacement
.
length
);
System
.
arraycopy
(
replacement
,
0
,
s
.
getBytes
(),
saltIndex
,
replacement
.
length
);
s
tore
.
seek
(
pageSize
*
pageId
);
s
eek
(
pageId
);
store
.
write
(
s
.
getBytes
(),
0
,
pageSize
);
store
.
write
(
s
.
getBytes
(),
0
,
pageSize
);
if
(
trace
)
{
if
(
trace
)
{
out
.
println
(
"User: "
+
userName
);
out
.
println
(
"User: "
+
userName
);
...
@@ -1050,6 +1050,11 @@ public class Recover extends Tool implements DataHandler {
...
@@ -1050,6 +1050,11 @@ public class Recover extends Tool implements DataHandler {
}
}
}
}
private
void
seek
(
long
page
)
{
// page is long to avoid integer overflow
store
.
seek
(
page
*
pageSize
);
}
private
Value
[]
createRecord
(
PrintWriter
writer
,
Data
s
,
int
columnCount
)
{
private
Value
[]
createRecord
(
PrintWriter
writer
,
Data
s
,
int
columnCount
)
{
recordLength
=
columnCount
;
recordLength
=
columnCount
;
if
(
columnCount
<=
0
)
{
if
(
columnCount
<=
0
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论