Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d246514d
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看板
提交
d246514d
编写于
10月 31, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(sync): check msgcb, putToQueueFp NULL
上级
6b744129
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
53 addition
and
8 deletion
+53
-8
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+34
-1
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+14
-2
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+4
-4
source/libs/sync/src/syncTimeout.c
source/libs/sync/src/syncTimeout.c
+1
-1
未找到文件。
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
d246514d
...
@@ -17,11 +17,44 @@
...
@@ -17,11 +17,44 @@
#include "mndSync.h"
#include "mndSync.h"
#include "mndTrans.h"
#include "mndTrans.h"
static
int32_t
mndSyncEqCtrlMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
{
return
-
1
;
}
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
if
(
msgcb
==
NULL
||
msgcb
->
putToQueueFp
==
NULL
)
{
rpcFreeCont
(
pMsg
->
pCont
);
pMsg
->
pCont
=
NULL
;
return
-
1
;
}
int32_t
code
=
tmsgPutToQueue
(
msgcb
,
SYNC_CTRL_QUEUE
,
pMsg
);
if
(
code
!=
0
)
{
rpcFreeCont
(
pMsg
->
pCont
);
pMsg
->
pCont
=
NULL
;
}
return
code
;
}
static
int32_t
mndSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
static
int32_t
mndSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
{
return
-
1
;
}
SMsgHead
*
pHead
=
pMsg
->
pCont
;
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
if
(
msgcb
==
NULL
||
msgcb
->
putToQueueFp
==
NULL
)
{
rpcFreeCont
(
pMsg
->
pCont
);
pMsg
->
pCont
=
NULL
;
return
-
1
;
}
int32_t
code
=
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
int32_t
code
=
tmsgPutToQueue
(
msgcb
,
SYNC_QUEUE
,
pMsg
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
...
@@ -212,7 +245,7 @@ int32_t mndInitSync(SMnode *pMnode) {
...
@@ -212,7 +245,7 @@ int32_t mndInitSync(SMnode *pMnode) {
.
msgcb
=
NULL
,
.
msgcb
=
NULL
,
.
FpSendMsg
=
mndSyncSendMsg
,
.
FpSendMsg
=
mndSyncSendMsg
,
.
FpEqMsg
=
mndSyncEqMsg
,
.
FpEqMsg
=
mndSyncEqMsg
,
.
FpEqCtrlMsg
=
NULL
,
.
FpEqCtrlMsg
=
mndSyncEqCtrlMsg
,
};
};
snprintf
(
syncInfo
.
path
,
sizeof
(
syncInfo
.
path
),
"%s%ssync"
,
pMnode
->
path
,
TD_DIRSEP
);
snprintf
(
syncInfo
.
path
,
sizeof
(
syncInfo
.
path
),
"%s%ssync"
,
pMnode
->
path
,
TD_DIRSEP
);
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
d246514d
...
@@ -365,7 +365,13 @@ int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -365,7 +365,13 @@ int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
}
static
int32_t
vnodeSyncEqCtrlMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
static
int32_t
vnodeSyncEqCtrlMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
if
(
msgcb
==
NULL
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
{
return
-
1
;
}
if
(
msgcb
==
NULL
||
msgcb
->
putToQueueFp
==
NULL
)
{
rpcFreeCont
(
pMsg
->
pCont
);
pMsg
->
pCont
=
NULL
;
return
-
1
;
return
-
1
;
}
}
...
@@ -378,7 +384,13 @@ static int32_t vnodeSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
...
@@ -378,7 +384,13 @@ static int32_t vnodeSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
}
}
static
int32_t
vnodeSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
static
int32_t
vnodeSyncEqMsg
(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
)
{
if
(
msgcb
==
NULL
)
{
if
(
pMsg
==
NULL
||
pMsg
->
pCont
==
NULL
)
{
return
-
1
;
}
if
(
msgcb
==
NULL
||
msgcb
->
putToQueueFp
==
NULL
)
{
rpcFreeCont
(
pMsg
->
pCont
);
pMsg
->
pCont
=
NULL
;
return
-
1
;
return
-
1
;
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
d246514d
...
@@ -508,7 +508,7 @@ int32_t syncEndSnapshot(int64_t rid) {
...
@@ -508,7 +508,7 @@ int32_t syncEndSnapshot(int64_t rid) {
SSyncLogStoreData
*
pData
=
pSyncNode
->
pLogStore
->
data
;
SSyncLogStoreData
*
pData
=
pSyncNode
->
pLogStore
->
data
;
code
=
walEndSnapshot
(
pData
->
pWal
);
code
=
walEndSnapshot
(
pData
->
pWal
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sError
(
"vgId:%d, wal snapshot end error since:%s"
,
pSyncNode
->
vgId
,
terrstr
(
terrno
));
sError
(
"vgId:%d, wal snapshot end error since:%s"
,
pSyncNode
->
vgId
,
terrstr
());
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
return
-
1
;
return
-
1
;
...
@@ -2793,7 +2793,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
...
@@ -2793,7 +2793,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
pSyncNode
->
vgId
,
pSyncNode
);
pSyncNode
->
vgId
,
pSyncNode
);
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncTimeout2RpcMsg
(
pSyncMsg
,
&
rpcMsg
);
syncTimeout2RpcMsg
(
pSyncMsg
,
&
rpcMsg
);
if
(
pSyncNode
->
FpEqMsg
!=
NULL
)
{
if
(
pSyncNode
->
FpEqMsg
!=
NULL
&&
pSyncNode
->
msgcb
!=
NULL
&&
pSyncNode
->
msgcb
->
putToQueueFp
!=
NULL
)
{
int32_t
code
=
pSyncNode
->
FpEqMsg
(
pSyncNode
->
msgcb
,
&
rpcMsg
);
int32_t
code
=
pSyncNode
->
FpEqMsg
(
pSyncNode
->
msgcb
,
&
rpcMsg
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sError
(
"vgId:%d, sync enqueue elect msg error, code:%d"
,
pSyncNode
->
vgId
,
code
);
sError
(
"vgId:%d, sync enqueue elect msg error, code:%d"
,
pSyncNode
->
vgId
,
code
);
...
...
source/libs/sync/src/syncTimeout.c
浏览文件 @
d246514d
...
@@ -76,7 +76,7 @@ int32_t syncNodeTimerRoutine(SSyncNode* ths) {
...
@@ -76,7 +76,7 @@ int32_t syncNodeTimerRoutine(SSyncNode* ths) {
SSyncLogStoreData
*
pData
=
ths
->
pLogStore
->
data
;
SSyncLogStoreData
*
pData
=
ths
->
pLogStore
->
data
;
int32_t
code
=
walEndSnapshot
(
pData
->
pWal
);
int32_t
code
=
walEndSnapshot
(
pData
->
pWal
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
sError
(
"vgId:%d,
wal snapshot end error since:%s"
,
ths
->
vgId
,
terrstr
(
terrno
));
sError
(
"vgId:%d,
timer wal snapshot end error since:%s"
,
ths
->
vgId
,
terrstr
(
));
return
-
1
;
return
-
1
;
}
else
{
}
else
{
do
{
do
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录