Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0408ba41
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
0408ba41
编写于
7月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
fd98b908
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
27 deletion
+26
-27
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/vnd/vnodeSnapshot.c
source/dnode/vnode/src/vnd/vnodeSnapshot.c
+25
-26
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
0408ba41
...
...
@@ -163,8 +163,8 @@ int32_t vnodeSnapReaderClose(SVSnapReader *pReader);
int32_t
vnodeSnapRead
(
SVSnapReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
);
// SVSnapWriter;
int32_t
vnodeSnapshotWriterOpen
(
SVnode
*
pVnode
,
int64_t
sver
,
int64_t
ever
,
SVSnapWriter
**
ppWriter
);
int32_t
vnodeSnapshotWrite
(
SVSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
);
int32_t
vnodeSnapshotWriterClose
(
SVSnapWriter
*
pWriter
,
int8_t
rollback
);
int32_t
vnodeSnapshotWrite
(
SVSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
);
// structs
struct
STsdbCfg
{
...
...
source/dnode/vnode/src/vnd/vnodeSnapshot.c
浏览文件 @
0408ba41
...
...
@@ -16,12 +16,14 @@
#include "vnodeInt.h"
struct
SVSnapReader
{
SVnode
*
pVnode
;
int64_t
sver
;
int64_t
ever
;
int8_t
isMetaEnd
;
int8_t
isTsdbEnd
;
SVnode
*
pVnode
;
int64_t
sver
;
int64_t
ever
;
// meta
int8_t
metaDone
;
SMetaSnapReader
*
pMetaReader
;
// tsdb
int8_t
tsdbDone
;
STsdbSnapReader
*
pTsdbReader
;
void
*
pData
;
int32_t
nData
;
...
...
@@ -35,6 +37,7 @@ struct SVSnapWriter {
// SVSnapReader ========================================================
int32_t
vnodeSnapReaderOpen
(
SVnode
*
pVnode
,
int64_t
sver
,
int64_t
ever
,
SVSnapReader
**
ppReader
)
{
int32_t
code
=
0
;
SVSnapReader
*
pReader
=
NULL
;
pReader
=
(
SVSnapReader
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pReader
));
...
...
@@ -45,8 +48,6 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapRe
pReader
->
pVnode
=
pVnode
;
pReader
->
sver
=
sver
;
pReader
->
ever
=
ever
;
pReader
->
isMetaEnd
=
0
;
pReader
->
isTsdbEnd
=
0
;
if
(
metaSnapReaderOpen
(
pVnode
->
pMeta
,
&
pReader
->
pMetaReader
,
sver
,
ever
)
<
0
)
{
taosMemoryFree
(
pReader
);
...
...
@@ -59,33 +60,31 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapRe
goto
_err
;
}
_exit:
*
ppReader
=
pReader
;
return
0
;
return
code
;
_err:
*
ppReader
=
NULL
;
return
-
1
;
return
code
;
}
int32_t
vnodeSnapReaderClose
(
SVSnapReader
*
pReader
)
{
if
(
pReader
)
{
vnodeFree
(
pReader
->
pData
);
tsdbSnapReaderClose
(
pReader
->
pTsdbReader
);
metaSnapReaderClose
(
pReader
->
pMetaReader
);
taosMemoryFree
(
pReader
);
}
vnodeFree
(
pReader
->
pData
);
tsdbSnapReaderClose
(
pReader
->
pTsdbReader
);
metaSnapReaderClose
(
pReader
->
pMetaReader
);
taosMemoryFree
(
pReader
);
return
0
;
}
int32_t
vnodeSnapRead
(
SVSnapReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
)
{
int32_t
code
=
0
;
if
(
!
pReader
->
isMetaEnd
)
{
if
(
!
pReader
->
metaDone
)
{
code
=
metaSnapRead
(
pReader
->
pMetaReader
,
&
pReader
->
pData
,
&
pReader
->
nData
);
if
(
code
)
{
if
(
code
==
TSDB_CODE_VND_READ_END
)
{
pReader
->
isMetaEnd
=
1
;
pReader
->
metaDone
=
1
;
}
else
{
return
code
;
}
...
...
@@ -96,11 +95,11 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, const void **ppData, uint32_t *nDat
}
}
if
(
!
pReader
->
isTsdbEnd
)
{
if
(
!
pReader
->
tsdbDone
)
{
code
=
tsdbSnapRead
(
pReader
->
pTsdbReader
,
&
pReader
->
pData
,
&
pReader
->
nData
);
if
(
code
)
{
if
(
code
==
TSDB_CODE_VND_READ_END
)
{
pReader
->
isTsdbEnd
=
1
;
pReader
->
tsdbDone
=
1
;
}
else
{
return
code
;
}
...
...
@@ -136,12 +135,6 @@ _err:
return
code
;
}
int32_t
vnodeSnapshotWrite
(
SVSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
vnodeSnapshotWriterClose
(
SVSnapWriter
*
pWriter
,
int8_t
rollback
)
{
int32_t
code
=
0
;
...
...
@@ -153,4 +146,10 @@ int32_t vnodeSnapshotWriterClose(SVSnapWriter *pWriter, int8_t rollback) {
taosMemoryFree
(
pWriter
);
return
code
;
}
int32_t
vnodeSnapshotWrite
(
SVSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录