Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b2f3ff27
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b2f3ff27
编写于
7月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
267e450a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
104 addition
and
13 deletion
+104
-13
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+9
-4
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+48
-9
source/dnode/vnode/src/vnd/vnodeSnapshot.c
source/dnode/vnode/src/vnd/vnodeSnapshot.c
+47
-0
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
b2f3ff27
...
...
@@ -43,6 +43,7 @@ typedef struct SVnode SVnode;
typedef
struct
STsdbCfg
STsdbCfg
;
// todo: remove
typedef
struct
SVnodeCfg
SVnodeCfg
;
typedef
struct
SVSnapshotReader
SVSnapshotReader
;
typedef
struct
SVSnapshotWriter
SVSnapshotWriter
;
extern
const
SVnodeCfg
vnodeCfgDefault
;
...
...
@@ -66,9 +67,6 @@ void vnodeStop(SVnode *pVnode);
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
);
void
vnodeGetSnapshot
(
SVnode
*
pVnode
,
SSnapshot
*
pSnapshot
);
void
vnodeGetInfo
(
SVnode
*
pVnode
,
const
char
**
dbname
,
int32_t
*
vgId
);
int32_t
vnodeSnapshotReaderOpen
(
SVnode
*
pVnode
,
SVSnapshotReader
**
ppReader
,
int64_t
sver
,
int64_t
ever
);
int32_t
vnodeSnapshotReaderClose
(
SVSnapshotReader
*
pReader
);
int32_t
vnodeSnapshotRead
(
SVSnapshotReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
);
int32_t
vnodeProcessCreateTSma
(
SVnode
*
pVnode
,
void
*
pCont
,
uint32_t
contLen
);
int32_t
vnodeGetAllTableList
(
SVnode
*
pVnode
,
uint64_t
uid
,
SArray
*
list
);
int32_t
vnodeGetCtbIdList
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
);
...
...
@@ -159,7 +157,14 @@ int32_t tqRetrieveDataBlock(SSDataBlock *pBlock, SStreamReader *pHandle);
// sma
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
// need to reposition
// SVSnapshotReader
int32_t
vnodeSnapshotReaderOpen
(
SVnode
*
pVnode
,
SVSnapshotReader
**
ppReader
,
int64_t
sver
,
int64_t
ever
);
int32_t
vnodeSnapshotReaderClose
(
SVSnapshotReader
*
pReader
);
int32_t
vnodeSnapshotRead
(
SVSnapshotReader
*
pReader
,
const
void
**
ppData
,
uint32_t
*
nData
);
// SVSnapshotWriter;
int32_t
vnodeSnapshotWriterOpen
(
SVnode
*
pVnode
,
int64_t
sver
,
int64_t
ever
,
SVSnapshotWriter
**
ppWriter
);
int32_t
vnodeSnapshotWrite
(
SVSnapshotWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
);
int32_t
vnodeSnapshotWriterClose
(
SVSnapshotWriter
*
pWriter
,
int8_t
rollback
);
// structs
struct
STsdbCfg
{
...
...
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
b2f3ff27
...
...
@@ -16,21 +16,60 @@
#include "tsdb.h"
struct
STsdbSnapshotReader
{
STsdb
*
pTsdb
;
// TODO
STsdb
*
pTsdb
;
int64_t
sver
;
int64_t
ever
;
// for data file
SDataFReader
*
pDataFReader
;
// for del file
SDelFReader
*
pDelFReader
;
};
typedef
struct
STsdbSnapshotWriter
{
STsdb
*
pTsdb
;
int64_t
sver
;
int64_t
ever
;
// for data file
SDataFWriter
*
pDataFWriter
;
// for del file
SDelFWriter
*
pDelFWriter
;
}
STsdbSnapshotWriter
;
int32_t
tsdbSnapshotReaderOpen
(
STsdb
*
pTsdb
,
STsdbSnapshotReader
**
ppReader
,
int64_t
sver
,
int64_t
ever
)
{
// TODO
return
0
;
}
int32_t
code
=
0
;
STsdbSnapshotReader
*
pReader
=
NULL
;
int32_t
tsdbSnapshotReaderClose
(
STsdbSnapshotReader
*
pReader
)
{
// TODO
return
0
;
// alloc
pReader
=
(
STsdbSnapshotReader
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pReader
));
if
(
pReader
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
pReader
->
pTsdb
=
pTsdb
;
pReader
->
sver
=
sver
;
pReader
->
ever
=
ever
;
*
ppReader
=
pReader
;
return
code
;
_err:
tsdbError
(
"vgId:%d snapshot reader open failed since %s"
,
TD_VID
(
pTsdb
->
pVnode
),
tstrerror
(
code
));
*
ppReader
=
NULL
;
return
code
;
}
int32_t
tsdbSnapshotRead
(
STsdbSnapshotReader
*
pReader
,
void
**
ppData
,
uint32_t
*
nData
)
{
int32_t
code
=
0
;
// TODO
return
0
;
return
code
;
_err:
tsdbError
(
"vgId:%d snapshot read failed since %s"
,
TD_VID
(
pReader
->
pTsdb
->
pVnode
),
tstrerror
(
code
));
return
code
;
}
int32_t
tsdbSnapshotReaderClose
(
STsdbSnapshotReader
*
pReader
)
{
int32_t
code
=
0
;
taosMemoryFree
(
pReader
);
return
code
;
}
source/dnode/vnode/src/vnd/vnodeSnapshot.c
浏览文件 @
b2f3ff27
...
...
@@ -27,6 +27,13 @@ struct SVSnapshotReader {
int32_t
nData
;
};
struct
SVSnapshotWriter
{
SVnode
*
pVnode
;
int64_t
sver
;
int64_t
ever
;
};
// SVSnapshotReader ========================================================
int32_t
vnodeSnapshotReaderOpen
(
SVnode
*
pVnode
,
SVSnapshotReader
**
ppReader
,
int64_t
sver
,
int64_t
ever
)
{
SVSnapshotReader
*
pReader
=
NULL
;
...
...
@@ -106,4 +113,44 @@ int32_t vnodeSnapshotRead(SVSnapshotReader *pReader, const void **ppData, uint32
code
=
TSDB_CODE_VND_READ_END
;
return
code
;
}
// SVSnapshotWriter ========================================================
int32_t
vnodeSnapshotWriterOpen
(
SVnode
*
pVnode
,
int64_t
sver
,
int64_t
ever
,
SVSnapshotWriter
**
ppWriter
)
{
int32_t
code
=
0
;
SVSnapshotWriter
*
pWriter
=
NULL
;
// alloc
pWriter
=
(
SVSnapshotWriter
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pWriter
));
if
(
pWriter
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
pWriter
->
pVnode
=
pVnode
;
pWriter
->
sver
=
sver
;
pWriter
->
ever
=
ever
;
return
code
;
_err:
return
code
;
}
int32_t
vnodeSnapshotWrite
(
SVSnapshotWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
vnodeSnapshotWriterClose
(
SVSnapshotWriter
*
pWriter
,
int8_t
rollback
)
{
int32_t
code
=
0
;
if
(
!
rollback
)
{
// apply the change
}
else
{
// rollback the change
}
taosMemoryFree
(
pWriter
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录