Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
54f91e94
提交
54f91e94
authored
8月 14, 2015
作者:
Thomas Mueller Graf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved logging
上级
67ea49f6
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
62 行增加
和
3 行删除
+62
-3
MVStoreTool.java
h2/src/main/org/h2/mvstore/MVStoreTool.java
+2
-2
StreamStore.java
h2/src/main/org/h2/mvstore/StreamStore.java
+44
-0
Recover.java
h2/src/main/org/h2/tools/Recover.java
+16
-1
没有找到文件。
h2/src/main/org/h2/mvstore/MVStoreTool.java
浏览文件 @
54f91e94
...
@@ -113,9 +113,9 @@ public class MVStoreTool {
...
@@ -113,9 +113,9 @@ public class MVStoreTool {
block
.
rewind
();
block
.
rewind
();
int
headerType
=
block
.
get
();
int
headerType
=
block
.
get
();
if
(
headerType
==
'H'
)
{
if
(
headerType
==
'H'
)
{
String
header
=
new
String
(
block
.
array
(),
DataUtils
.
LATIN
).
trim
();
pw
.
printf
(
"%0"
+
len
+
"x fileHeader %s%n"
,
pw
.
printf
(
"%0"
+
len
+
"x fileHeader %s%n"
,
pos
,
pos
,
header
);
new
String
(
block
.
array
(),
DataUtils
.
LATIN
).
trim
());
pos
+=
blockSize
;
pos
+=
blockSize
;
continue
;
continue
;
}
}
...
...
h2/src/main/org/h2/mvstore/StreamStore.java
浏览文件 @
54f91e94
...
@@ -311,6 +311,50 @@ public class StreamStore {
...
@@ -311,6 +311,50 @@ public class StreamStore {
}
}
}
}
/**
* Convert the id to a human readable string.
*
* @param id the stream id
* @return the string
*/
public
static
String
toString
(
byte
[]
id
)
{
StringBuilder
buff
=
new
StringBuilder
();
ByteBuffer
idBuffer
=
ByteBuffer
.
wrap
(
id
);
long
length
=
0
;
while
(
idBuffer
.
hasRemaining
())
{
long
block
;
int
len
;
switch
(
idBuffer
.
get
())
{
case
0
:
// in-place: 0, len (int), data
len
=
DataUtils
.
readVarInt
(
idBuffer
);
idBuffer
.
position
(
idBuffer
.
position
()
+
len
);
buff
.
append
(
"data len="
).
append
(
len
);
length
+=
len
;
break
;
case
1
:
// block: 1, len (int), blockId (long)
len
=
DataUtils
.
readVarInt
(
idBuffer
);
length
+=
len
;
block
=
DataUtils
.
readVarLong
(
idBuffer
);
buff
.
append
(
"block "
).
append
(
block
).
append
(
" len="
).
append
(
len
);
break
;
case
2
:
// indirect: 2, total len (long), blockId (long)
len
=
DataUtils
.
readVarInt
(
idBuffer
);
length
+=
DataUtils
.
readVarLong
(
idBuffer
);
block
=
DataUtils
.
readVarLong
(
idBuffer
);
buff
.
append
(
"indirect block "
).
append
(
block
).
append
(
" len="
).
append
(
len
);
break
;
default
:
buff
.
append
(
"error"
);
}
buff
.
append
(
", "
);
}
buff
.
append
(
"length="
).
append
(
length
);
return
buff
.
toString
();
}
/**
/**
* Calculate the number of data bytes for the given id. As the length is
* Calculate the number of data bytes for the given id. As the length is
* encoded in the id, this operation does not cause any reads in the map.
* encoded in the id, this operation does not cause any reads in the map.
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
54f91e94
...
@@ -691,11 +691,13 @@ public class Recover extends Tool implements DataHandler {
...
@@ -691,11 +691,13 @@ public class Recover extends Tool implements DataHandler {
MVMap
<
Long
,
byte
[]>
lobData
=
mv
.
openMap
(
"lobData"
);
MVMap
<
Long
,
byte
[]>
lobData
=
mv
.
openMap
(
"lobData"
);
StreamStore
streamStore
=
new
StreamStore
(
lobData
);
StreamStore
streamStore
=
new
StreamStore
(
lobData
);
MVMap
<
Long
,
Object
[]>
lobMap
=
mv
.
openMap
(
"lobMap"
);
MVMap
<
Long
,
Object
[]>
lobMap
=
mv
.
openMap
(
"lobMap"
);
writer
.
println
(
"-- LOB"
);
writer
.
println
(
"-- LOB (lobMap.id=0x"
+
Integer
.
toHexString
(
lobMap
.
getId
())
+
", lobData.id=0x"
+
Integer
.
toHexString
(
lobData
.
getId
())
+
")"
);
writer
.
println
(
"CREATE TABLE IF NOT EXISTS "
+
writer
.
println
(
"CREATE TABLE IF NOT EXISTS "
+
"INFORMATION_SCHEMA.LOB_BLOCKS("
+
"INFORMATION_SCHEMA.LOB_BLOCKS("
+
"LOB_ID BIGINT, SEQ INT, DATA BINARY, "
+
"LOB_ID BIGINT, SEQ INT, DATA BINARY, "
+
"PRIMARY KEY(LOB_ID, SEQ));"
);
"PRIMARY KEY(LOB_ID, SEQ));"
);
boolean
hasErrors
=
false
;
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
for
(
Entry
<
Long
,
Object
[]>
e
:
lobMap
.
entrySet
())
{
long
lobId
=
e
.
getKey
();
long
lobId
=
e
.
getKey
();
Object
[]
value
=
e
.
getValue
();
Object
[]
value
=
e
.
getValue
();
...
@@ -717,6 +719,19 @@ public class Recover extends Tool implements DataHandler {
...
@@ -717,6 +719,19 @@ public class Recover extends Tool implements DataHandler {
}
}
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
writeError
(
writer
,
ex
);
writeError
(
writer
,
ex
);
hasErrors
=
true
;
}
}
if
(
hasErrors
)
{
writer
.
println
(
"-- lobMap"
);
for
(
Long
k
:
lobMap
.
keyList
())
{
Object
[]
value
=
lobMap
.
get
(
k
);
byte
[]
streamStoreId
=
(
byte
[])
value
[
0
];
writer
.
println
(
"-- "
+
k
+
" "
+
StreamStore
.
toString
(
streamStoreId
));
}
writer
.
println
(
"-- lobData"
);
for
(
Long
k
:
lobData
.
keyList
())
{
writer
.
println
(
"-- "
+
k
+
" len "
+
lobData
.
get
(
k
).
length
);
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论