Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f2a84eda
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
f2a84eda
编写于
5月 20, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: adjust vnode header file
上级
0f9cd430
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
54 deletion
+46
-54
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+17
-17
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+25
-34
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+2
-2
source/libs/sync/test/syncIOSendMsgTest.cpp
source/libs/sync/test/syncIOSendMsgTest.cpp
+2
-1
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
f2a84eda
...
@@ -45,20 +45,20 @@ typedef struct SVnodeCfg SVnodeCfg;
...
@@ -45,20 +45,20 @@ typedef struct SVnodeCfg SVnodeCfg;
extern
const
SVnodeCfg
vnodeCfgDefault
;
extern
const
SVnodeCfg
vnodeCfgDefault
;
int
vnodeInit
(
in
t
nthreads
);
int
32_t
vnodeInit
(
int32_
t
nthreads
);
void
vnodeCleanup
();
void
vnodeCleanup
();
int
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
);
int
32_t
vnodeCreate
(
const
char
*
path
,
SVnodeCfg
*
pCfg
,
STfs
*
pTfs
);
void
vnodeDestroy
(
const
char
*
path
,
STfs
*
pTfs
);
void
vnodeDestroy
(
const
char
*
path
,
STfs
*
pTfs
);
SVnode
*
vnodeOpen
(
const
char
*
path
,
STfs
*
pTfs
,
SMsgCb
msgCb
);
SVnode
*
vnodeOpen
(
const
char
*
path
,
STfs
*
pTfs
,
SMsgCb
msgCb
);
void
vnodeClose
(
SVnode
*
pVnode
);
void
vnodeClose
(
SVnode
*
pVnode
);
int
vnodePreprocessWriteReqs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
,
int64_t
*
version
);
int
32_t
vnodePreprocessWriteReqs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
,
int64_t
*
version
);
int
vnodeProcessWriteReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int64_t
version
,
SRpcMsg
*
pRsp
);
int
32_t
vnodeProcessWriteReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int64_t
version
,
SRpcMsg
*
pRsp
);
int
vnodeProcessCMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int
32_t
vnodeProcessCMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int
32_t
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
);
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int
32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int
vnodeProcessFetchMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
int
32_t
vnodeProcessFetchMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SQueueInfo
*
pInfo
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
int
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
);
int
32_t
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
);
int32_t
vnodeStart
(
SVnode
*
pVnode
);
int32_t
vnodeStart
(
SVnode
*
pVnode
);
void
vnodeStop
(
SVnode
*
pVnode
);
void
vnodeStop
(
SVnode
*
pVnode
);
...
@@ -74,8 +74,8 @@ typedef struct SMetaEntry SMetaEntry;
...
@@ -74,8 +74,8 @@ typedef struct SMetaEntry SMetaEntry;
void
metaReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
);
void
metaReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
);
void
metaReaderClear
(
SMetaReader
*
pReader
);
void
metaReaderClear
(
SMetaReader
*
pReader
);
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int
32_t
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int
metaReadNext
(
SMetaReader
*
pReader
);
int
32_t
metaReadNext
(
SMetaReader
*
pReader
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
);
#if 1 // refact APIs below (TODO)
#if 1 // refact APIs below (TODO)
...
@@ -86,7 +86,7 @@ typedef struct SMTbCursor SMTbCursor;
...
@@ -86,7 +86,7 @@ typedef struct SMTbCursor SMTbCursor;
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
int
32_t
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
#endif
#endif
// tsdb
// tsdb
...
@@ -124,8 +124,8 @@ typedef struct STqReadHandle STqReadHandle;
...
@@ -124,8 +124,8 @@ typedef struct STqReadHandle STqReadHandle;
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
);
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
);
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
);
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
);
int
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int
32_t
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int
32_t
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlockFilterOut
(
STqReadHandle
*
pHandle
,
SHashObj
*
filterOutUids
);
bool
tqNextDataBlockFilterOut
(
STqReadHandle
*
pHandle
,
SHashObj
*
filterOutUids
);
...
@@ -207,15 +207,15 @@ struct SMetaReader {
...
@@ -207,15 +207,15 @@ struct SMetaReader {
SDecoder
coder
;
SDecoder
coder
;
SMetaEntry
me
;
SMetaEntry
me
;
void
*
pBuf
;
void
*
pBuf
;
int
szBuf
;
int
32_t
szBuf
;
};
};
struct
SMTbCursor
{
struct
SMTbCursor
{
TBC
*
pDbc
;
TBC
*
pDbc
;
void
*
pKey
;
void
*
pKey
;
void
*
pVal
;
void
*
pVal
;
int
kLen
;
int
32_t
kLen
;
int
vLen
;
int
32_t
vLen
;
SMetaReader
mr
;
SMetaReader
mr
;
};
};
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
f2a84eda
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
// vnodeDebug ====================
// clang-format off
// clang-format off
#define vFatal(...) do { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define vFatal(...) do { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define vError(...) do { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
#define vError(...) do { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
...
@@ -34,17 +33,17 @@ extern "C" {
...
@@ -34,17 +33,17 @@ extern "C" {
#define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0)
#define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on
// clang-format on
// vnodeCfg
====================
// vnodeCfg
.c
extern
const
SVnodeCfg
vnodeCfgDefault
;
extern
const
SVnodeCfg
vnodeCfgDefault
;
int
vnodeCheckCfg
(
const
SVnodeCfg
*
);
int
32_t
vnodeCheckCfg
(
const
SVnodeCfg
*
);
int
vnodeEncodeConfig
(
const
void
*
pObj
,
SJson
*
pJson
);
int
32_t
vnodeEncodeConfig
(
const
void
*
pObj
,
SJson
*
pJson
);
int
vnodeDecodeConfig
(
const
SJson
*
pJson
,
void
*
pObj
);
int
32_t
vnodeDecodeConfig
(
const
SJson
*
pJson
,
void
*
pObj
);
// vnodeModule
====================
// vnodeModule
.c
int
vnodeScheduleTask
(
in
t
(
*
execute
)(
void
*
),
void
*
arg
);
int
32_t
vnodeScheduleTask
(
int32_
t
(
*
execute
)(
void
*
),
void
*
arg
);
// vnodeBufPool
====================
// vnodeBufPool
.c
typedef
struct
SVBufPoolNode
SVBufPoolNode
;
typedef
struct
SVBufPoolNode
SVBufPoolNode
;
struct
SVBufPoolNode
{
struct
SVBufPoolNode
{
SVBufPoolNode
*
prev
;
SVBufPoolNode
*
prev
;
...
@@ -62,37 +61,29 @@ struct SVBufPool {
...
@@ -62,37 +61,29 @@ struct SVBufPool {
SVBufPoolNode
node
;
SVBufPoolNode
node
;
};
};
int
vnodeOpenBufPool
(
SVnode
*
pVnode
,
int64_t
size
);
int
32_t
vnodeOpenBufPool
(
SVnode
*
pVnode
,
int64_t
size
);
int
vnodeCloseBufPool
(
SVnode
*
pVnode
);
int
32_t
vnodeCloseBufPool
(
SVnode
*
pVnode
);
void
vnodeBufPoolReset
(
SVBufPool
*
pPool
);
void
vnodeBufPoolReset
(
SVBufPool
*
pPool
);
// vnodeQuery
====================
// vnodeQuery
.c
int
vnodeQueryOpen
(
SVnode
*
pVnode
);
int
32_t
vnodeQueryOpen
(
SVnode
*
pVnode
);
void
vnodeQueryClose
(
SVnode
*
pVnode
);
void
vnodeQueryClose
(
SVnode
*
pVnode
);
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int
32_t
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
// vnodeCommit
====================
// vnodeCommit
.c
int
vnodeBegin
(
SVnode
*
pVnode
);
int
32_t
vnodeBegin
(
SVnode
*
pVnode
);
int
vnodeShouldCommit
(
SVnode
*
pVnode
);
int
32_t
vnodeShouldCommit
(
SVnode
*
pVnode
);
int
vnodeCommit
(
SVnode
*
pVnode
);
int
32_t
vnodeCommit
(
SVnode
*
pVnode
);
int
vnodeSaveInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pCfg
);
int
32_t
vnodeSaveInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pCfg
);
int
vnodeCommitInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pInfo
);
int
32_t
vnodeCommitInfo
(
const
char
*
dir
,
const
SVnodeInfo
*
pInfo
);
int
vnodeLoadInfo
(
const
char
*
dir
,
SVnodeInfo
*
pInfo
);
int
32_t
vnodeLoadInfo
(
const
char
*
dir
,
SVnodeInfo
*
pInfo
);
int
vnodeSyncCommit
(
SVnode
*
pVnode
);
int
32_t
vnodeSyncCommit
(
SVnode
*
pVnode
);
int
vnodeAsyncCommit
(
SVnode
*
pVnode
);
int
32_t
vnodeAsyncCommit
(
SVnode
*
pVnode
);
// vnode
Commit ====================
// vnode
Sync.c
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncSetMsgCb
(
SVnode
*
pVnode
);
int32_t
vnodeSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
);
int32_t
vnodeSyncSendMsg
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
vnodeSyncCommitCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
vnodeSyncPreCommitCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
void
vnodeSyncRollBackCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SFsmCbMeta
cbMeta
);
int32_t
vnodeSyncGetSnapshotCb
(
struct
SSyncFSM
*
pFsm
,
SSnapshot
*
pSnapshot
);
SSyncFSM
*
syncVnodeMakeFsm
();
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
f2a84eda
...
@@ -674,10 +674,10 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp
...
@@ -674,10 +674,10 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp
SEpSet
epSet
;
SEpSet
epSet
;
syncUtilraftId2EpSet
(
destRaftId
,
&
epSet
);
syncUtilraftId2EpSet
(
destRaftId
,
&
epSet
);
if
(
pSyncNode
->
FpSendMsg
!=
NULL
)
{
if
(
pSyncNode
->
FpSendMsg
!=
NULL
)
{
pMsg
->
info
.
noResp
=
1
;
// htonl
// htonl
syncUtilMsgHtoN
(
pMsg
->
pCont
);
syncUtilMsgHtoN
(
pMsg
->
pCont
);
pMsg
->
info
.
noResp
=
1
;
pSyncNode
->
FpSendMsg
(
&
epSet
,
pMsg
);
pSyncNode
->
FpSendMsg
(
&
epSet
,
pMsg
);
}
else
{
}
else
{
sTrace
(
"syncNodeSendMsgById pSyncNode->FpSendMsg is NULL"
);
sTrace
(
"syncNodeSendMsgById pSyncNode->FpSendMsg is NULL"
);
...
@@ -689,10 +689,10 @@ int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, S
...
@@ -689,10 +689,10 @@ int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSyncNode, S
SEpSet
epSet
;
SEpSet
epSet
;
syncUtilnodeInfo2EpSet
(
nodeInfo
,
&
epSet
);
syncUtilnodeInfo2EpSet
(
nodeInfo
,
&
epSet
);
if
(
pSyncNode
->
FpSendMsg
!=
NULL
)
{
if
(
pSyncNode
->
FpSendMsg
!=
NULL
)
{
pMsg
->
info
.
noResp
=
1
;
// htonl
// htonl
syncUtilMsgHtoN
(
pMsg
->
pCont
);
syncUtilMsgHtoN
(
pMsg
->
pCont
);
pMsg
->
info
.
noResp
=
1
;
pSyncNode
->
FpSendMsg
(
&
epSet
,
pMsg
);
pSyncNode
->
FpSendMsg
(
&
epSet
,
pMsg
);
}
else
{
}
else
{
sTrace
(
"syncNodeSendMsgByInfo pSyncNode->FpSendMsg is NULL"
);
sTrace
(
"syncNodeSendMsgByInfo pSyncNode->FpSendMsg is NULL"
);
...
...
source/libs/sync/test/syncIOSendMsgTest.cpp
浏览文件 @
f2a84eda
...
@@ -97,11 +97,12 @@ int main(int argc, char** argv) {
...
@@ -97,11 +97,12 @@ int main(int argc, char** argv) {
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
SyncPingReply
*
pSyncMsg
=
SyncPingReply
*
pSyncMsg
=
syncPingReplyBuild2
(
&
pSyncNode
->
myRaftId
,
&
pSyncNode
->
myRaftId
,
1000
,
"syncIOSendMsgTest"
);
syncPingReplyBuild2
(
&
pSyncNode
->
myRaftId
,
&
pSyncNode
->
myRaftId
,
1000
,
"syncIOSendMsgTest"
);
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
=
{
0
}
;
syncPingReply2RpcMsg
(
pSyncMsg
,
&
rpcMsg
);
syncPingReply2RpcMsg
(
pSyncMsg
,
&
rpcMsg
);
SEpSet
epSet
;
SEpSet
epSet
;
syncUtilnodeInfo2EpSet
(
&
pSyncNode
->
myNodeInfo
,
&
epSet
);
syncUtilnodeInfo2EpSet
(
&
pSyncNode
->
myNodeInfo
,
&
epSet
);
rpcMsg
.
info
.
noResp
=
1
;
pSyncNode
->
FpSendMsg
(
&
epSet
,
&
rpcMsg
);
pSyncNode
->
FpSendMsg
(
&
epSet
,
&
rpcMsg
);
taosMsleep
(
1000
);
taosMsleep
(
1000
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录