Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9512b51e
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9512b51e
编写于
7月 05, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more snapshor reader
上级
5c7189a4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
55 addition
and
25 deletion
+55
-25
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+55
-25
未找到文件。
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
9512b51e
...
@@ -24,10 +24,11 @@ struct STsdbSnapReader {
...
@@ -24,10 +24,11 @@ struct STsdbSnapReader {
int8_t
dataDone
;
int8_t
dataDone
;
int32_t
fid
;
int32_t
fid
;
SDataFReader
*
pDataFReader
;
SDataFReader
*
pDataFReader
;
int32_t
iBlockIdx
;
SArray
*
aBlockIdx
;
// SArray<SBlockIdx>
SArray
*
aBlockIdx
;
// SArray<SBlockIdx>
int32_t
iBlock
;
int32_t
iBlockIdx
;
SBlockIdx
*
pBlockIdx
;
SMapData
mBlock
;
// SMapData<SBlock>
SMapData
mBlock
;
// SMapData<SBlock>
int32_t
iBlock
;
SBlockData
blkData
;
SBlockData
blkData
;
// for del file
// for del file
int8_t
delDone
;
int8_t
delDone
;
...
@@ -39,39 +40,68 @@ struct STsdbSnapReader {
...
@@ -39,39 +40,68 @@ struct STsdbSnapReader {
static
int32_t
tsdbSnapReadData
(
STsdbSnapReader
*
pReader
,
uint8_t
**
ppData
)
{
static
int32_t
tsdbSnapReadData
(
STsdbSnapReader
*
pReader
,
uint8_t
**
ppData
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SBlock
block
;
SBlock
*
pBlock
=
&
block
;
if
(
pReader
->
pDataFReader
==
NULL
)
{
while
(
true
)
{
code
=
tsdbDataFReaderOpen
(
&
pReader
->
pDataFReader
,
pReader
->
pTsdb
,
NULL
);
if
(
pReader
->
pDataFReader
==
NULL
)
{
if
(
code
)
goto
_err
;
SDFileSet
*
pSet
=
NULL
;
code
=
tsdbReadBlockIdx
(
pReader
->
pDataFReader
,
pReader
->
aBlockIdx
,
NULL
);
// search the next data file set to read (todo)
if
(
code
)
goto
_err
;
if
(
0
/* TODO */
)
{
code
=
TSDB_CODE_VND_READ_END
;
goto
_exit
;
}
pReader
->
iBlockIdx
=
0
;
// open
}
code
=
tsdbDataFReaderOpen
(
&
pReader
->
pDataFReader
,
pReader
->
pTsdb
,
pSet
);
if
(
code
)
goto
_err
;
while
(
pReader
->
iBlockIdx
<
taosArrayGetSize
(
pReader
->
aBlockIdx
))
{
// SBlockIdx
SBlockIdx
*
pBlockIdx
=
taosArrayGet
(
pReader
->
aBlockIdx
,
pReader
->
iBlockIdx
);
code
=
tsdbReadBlockIdx
(
pReader
->
pDataFReader
,
pReader
->
aBlockIdx
,
NULL
);
if
(
code
)
goto
_err
;
pReader
->
iBlockIdx
++
;
pReader
->
iBlockIdx
=
0
;
pReader
->
pBlockIdx
=
NULL
;
}
code
=
tsdbReadBlock
(
pReader
->
pDataFReader
,
pBlockIdx
,
&
pReader
->
mBlock
,
NULL
);
while
(
true
)
{
if
(
code
)
goto
_err
;
if
(
pReader
->
pBlockIdx
==
NULL
)
{
if
(
pReader
->
iBlockIdx
>=
taosArrayGetSize
(
pReader
->
aBlockIdx
))
{
tsdbDataFReaderClose
(
&
pReader
->
pDataFReader
);
break
;
}
break
;
pReader
->
pBlockIdx
=
(
SBlockIdx
*
)
taosArrayGet
(
pReader
->
aBlockIdx
,
pReader
->
iBlockIdx
);
}
pReader
->
iBlockIdx
++
;
// SBlock
code
=
tsdbReadBlock
(
pReader
->
pDataFReader
,
pReader
->
pBlockIdx
,
&
pReader
->
mBlock
,
NULL
);
if
(
code
)
goto
_err
;
while
(
pReader
->
iBlock
<
pReader
->
mBlock
.
nItem
)
{
pReader
->
iBlock
=
0
;
tMapDataGetItemByIdx
(
&
pReader
->
mBlock
,
pReader
->
iBlock
,
pBlock
,
tGetBlock
);
}
pReader
->
iBlock
++
;
while
(
true
)
{
SBlock
block
;
SBlock
*
pBlock
=
&
block
;
if
((
pBlock
->
minVersion
>=
pReader
->
sver
&&
pBlock
->
minVersion
<=
pReader
->
ever
)
&&
if
(
pReader
->
iBlock
>=
pReader
->
mBlock
.
nItem
)
{
(
pBlock
->
maxVersion
>=
pReader
->
sver
&&
pBlock
->
maxVersion
<=
pReader
->
ever
))
{
pReader
->
pBlockIdx
=
NULL
;
// block in range, encode and return the data (todo)
break
;
goto
_exit
;
}
tMapDataGetItemByIdx
(
&
pReader
->
mBlock
,
pReader
->
iBlock
,
pBlock
,
tGetBlock
);
pReader
->
iBlock
++
;
if
((
pBlock
->
minVersion
>=
pReader
->
sver
&&
pBlock
->
minVersion
<=
pReader
->
ever
)
||
(
pBlock
->
maxVersion
>=
pReader
->
sver
&&
pBlock
->
maxVersion
<=
pReader
->
ever
))
{
// overlap (todo)
code
=
tsdbReadBlockData
(
pReader
->
pDataFReader
,
pReader
->
pBlockIdx
,
pBlock
,
&
pReader
->
blkData
,
NULL
,
NULL
);
if
(
code
)
goto
_err
;
goto
_exit
;
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录