Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8057e44d
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看板
提交
8057e44d
编写于
3月 02, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync modify timer
上级
398d5ec3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
16 deletion
+24
-16
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+3
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+9
-5
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+2
-2
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+2
-3
source/libs/sync/test/syncIOSendMsgClientTest.cpp
source/libs/sync/test/syncIOSendMsgClientTest.cpp
+1
-1
source/libs/sync/test/syncIOSendMsgTest.cpp
source/libs/sync/test/syncIOSendMsgTest.cpp
+1
-1
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+6
-3
未找到文件。
source/libs/sync/src/syncIO.c
浏览文件 @
8057e44d
...
@@ -41,7 +41,8 @@ static void syncIOTickPingFunc(void *param, void *tmrId);
...
@@ -41,7 +41,8 @@ static void syncIOTickPingFunc(void *param, void *tmrId);
// public function ------------
// public function ------------
int32_t
syncIOSendMsg
(
void
*
clientRpc
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
int32_t
syncIOSendMsg
(
void
*
clientRpc
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
sTrace
(
"syncIOSendMsg ... "
);
sTrace
(
"<--- syncIOSendMsg ---> clientRpc:%p, numOfEps:%d, inUse:%d, destAddr:%s-%u"
,
clientRpc
,
pEpSet
->
numOfEps
,
pEpSet
->
inUse
,
pEpSet
->
eps
[
0
].
fqdn
,
pEpSet
->
eps
[
0
].
port
);
pMsg
->
handle
=
NULL
;
pMsg
->
handle
=
NULL
;
rpcSendRequest
(
clientRpc
,
pEpSet
,
pMsg
,
NULL
);
rpcSendRequest
(
clientRpc
,
pEpSet
,
pMsg
,
NULL
);
return
0
;
return
0
;
...
@@ -54,6 +55,7 @@ int32_t syncIOStart(char *host, uint16_t port) {
...
@@ -54,6 +55,7 @@ int32_t syncIOStart(char *host, uint16_t port) {
int32_t
ret
=
syncIOStartInternal
(
gSyncIO
);
int32_t
ret
=
syncIOStartInternal
(
gSyncIO
);
assert
(
ret
==
0
);
assert
(
ret
==
0
);
sTrace
(
"syncIOStart ok, gSyncIO:%p gSyncIO->clientRpc:%p"
,
gSyncIO
,
gSyncIO
->
clientRpc
);
return
0
;
return
0
;
}
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
8057e44d
...
@@ -184,7 +184,7 @@ static int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, Syn
...
@@ -184,7 +184,7 @@ static int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, Syn
SyncPing
*
pMsg2
=
rpcMsg
.
pCont
;
SyncPing
*
pMsg2
=
rpcMsg
.
pCont
;
cJSON
*
pJson
=
syncPing2Json
(
pMsg2
);
cJSON
*
pJson
=
syncPing2Json
(
pMsg2
);
char
*
serialized
=
cJSON_Print
(
pJson
);
char
*
serialized
=
cJSON_Print
(
pJson
);
sTrace
(
"syncNodePing
pMsg2
:%s "
,
serialized
);
sTrace
(
"syncNodePing
rpcMsg.pCont
:%s "
,
serialized
);
free
(
serialized
);
free
(
serialized
);
cJSON_Delete
(
pJson
);
cJSON_Delete
(
pJson
);
}
}
...
@@ -253,12 +253,16 @@ static void syncNodePingTimerCb(void* param, void* tmrId) {
...
@@ -253,12 +253,16 @@ static void syncNodePingTimerCb(void* param, void* tmrId) {
++
(
pSyncNode
->
pingTimerCounter
);
++
(
pSyncNode
->
pingTimerCounter
);
// pSyncNode->pingTimerMS += 100;
// pSyncNode->pingTimerMS += 100;
sTrace
(
"pSyncNode->pingTimerCounter:%lu, pSyncNode->pingTimerMS:%d, pSyncNode->pPingTimer:%p, tmrId:%p "
,
sTrace
(
pSyncNode
->
pingTimerCounter
,
pSyncNode
->
pingTimerMS
,
pSyncNode
->
pPingTimer
,
tmrId
);
"syncNodePingTimerCb: pSyncNode->pingTimerCounter:%lu, pSyncNode->pingTimerMS:%d, pSyncNode->pPingTimer:%p, "
"tmrId:%p "
,
pSyncNode
->
pingTimerCounter
,
pSyncNode
->
pingTimerMS
,
pSyncNode
->
pPingTimer
,
tmrId
);
syncNodePingAll
(
pSyncNode
);
taosTmrReset
(
syncNodePingTimerCb
,
pSyncNode
->
pingTimerMS
,
pSyncNode
,
&
gSyncEnv
->
pTimerManager
,
taosTmrReset
(
syncNodePingTimerCb
,
pSyncNode
->
pingTimerMS
,
pSyncNode
,
&
gSyncEnv
->
pTimerManager
,
&
pSyncNode
->
pPingTimer
);
&
pSyncNode
->
pPingTimer
);
}
else
{
s
yncNodePingAll
(
pSyncNode
);
s
Trace
(
"syncNodePingTimerCb: pingTimerStart:%u "
,
pSyncNode
->
pingTimerStart
);
}
}
}
}
\ No newline at end of file
source/libs/sync/src/syncMessage.c
浏览文件 @
8057e44d
...
@@ -70,7 +70,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) {
...
@@ -70,7 +70,7 @@ cJSON* syncPing2Json(const SyncPing* pMsg) {
cJSON
*
pDestId
=
cJSON_CreateObject
();
cJSON
*
pDestId
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
pDestId
,
"addr"
,
pMsg
->
destId
.
addr
);
cJSON_AddNumberToObject
(
pDestId
,
"addr"
,
pMsg
->
destId
.
addr
);
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"
src
Id"
,
pDestId
);
cJSON_AddItemToObject
(
pRoot
,
"
dest
Id"
,
pDestId
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
cJSON_AddStringToObject
(
pRoot
,
"data"
,
pMsg
->
data
);
cJSON_AddStringToObject
(
pRoot
,
"data"
,
pMsg
->
data
);
...
@@ -145,7 +145,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) {
...
@@ -145,7 +145,7 @@ cJSON* syncPingReply2Json(const SyncPingReply* pMsg) {
cJSON
*
pDestId
=
cJSON_CreateObject
();
cJSON
*
pDestId
=
cJSON_CreateObject
();
cJSON_AddNumberToObject
(
pDestId
,
"addr"
,
pMsg
->
destId
.
addr
);
cJSON_AddNumberToObject
(
pDestId
,
"addr"
,
pMsg
->
destId
.
addr
);
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddNumberToObject
(
pDestId
,
"vgId"
,
pMsg
->
destId
.
vgId
);
cJSON_AddItemToObject
(
pRoot
,
"
src
Id"
,
pDestId
);
cJSON_AddItemToObject
(
pRoot
,
"
dest
Id"
,
pDestId
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
cJSON_AddNumberToObject
(
pRoot
,
"dataLen"
,
pMsg
->
dataLen
);
cJSON_AddStringToObject
(
pRoot
,
"data"
,
pMsg
->
data
);
cJSON_AddStringToObject
(
pRoot
,
"data"
,
pMsg
->
data
);
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
8057e44d
...
@@ -51,11 +51,10 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) {
...
@@ -51,11 +51,10 @@ void syncUtilraftId2EpSet(const SRaftId* raftId, SEpSet* pEpSet) {
pEpSet->numOfEps = 1;
pEpSet->numOfEps = 1;
pEpSet->inUse = 0;
pEpSet->inUse = 0;
pEpSet->eps[0].port = port;
pEpSet->eps[0].port = port;
snprintf(
epSet.eps[0].fqdn, sizeof(epSet.eps[0].fqdn)
, host);
snprintf(
pEpSet->eps[0].fqdn, sizeof(pEpSet->eps[0].fqdn), "%s"
, host);
*/
*/
pEpSet
->
inUse
=
0
;
pEpSet
->
inUse
=
0
;
pEpSet
->
numOfEps
=
1
;
pEpSet
->
numOfEps
=
0
;
addEpIntoEpSet
(
pEpSet
,
host
,
port
);
addEpIntoEpSet
(
pEpSet
,
host
,
port
);
}
}
...
...
source/libs/sync/test/syncIOSendMsgClientTest.cpp
浏览文件 @
8057e44d
...
@@ -34,7 +34,7 @@ int main() {
...
@@ -34,7 +34,7 @@ int main() {
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
msgType
=
77
;
rpcMsg
.
msgType
=
77
;
...
...
source/libs/sync/test/syncIOSendMsgTest.cpp
浏览文件 @
8057e44d
...
@@ -34,7 +34,7 @@ int main() {
...
@@ -34,7 +34,7 @@ int main() {
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
msgType
=
77
;
rpcMsg
.
msgType
=
77
;
...
...
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
8057e44d
...
@@ -28,13 +28,16 @@ SSyncNode* doSync() {
...
@@ -28,13 +28,16 @@ SSyncNode* doSync() {
pCfg
->
replicaNum
=
1
;
pCfg
->
replicaNum
=
1
;
pCfg
->
nodeInfo
[
0
].
nodePort
=
7010
;
pCfg
->
nodeInfo
[
0
].
nodePort
=
7010
;
taosGetFqdn
(
pCfg
->
nodeInfo
[
0
].
nodeFqdn
);
snprintf
(
pCfg
->
nodeInfo
[
0
].
nodeFqdn
,
sizeof
(
pCfg
->
nodeInfo
[
0
].
nodeFqdn
),
"%s"
,
"127.0.0.1"
);
// taosGetFqdn(pCfg->nodeInfo[0].nodeFqdn);
pCfg
->
nodeInfo
[
1
].
nodePort
=
7110
;
pCfg
->
nodeInfo
[
1
].
nodePort
=
7110
;
taosGetFqdn
(
pCfg
->
nodeInfo
[
1
].
nodeFqdn
);
snprintf
(
pCfg
->
nodeInfo
[
1
].
nodeFqdn
,
sizeof
(
pCfg
->
nodeInfo
[
1
].
nodeFqdn
),
"%s"
,
"127.0.0.1"
);
// taosGetFqdn(pCfg->nodeInfo[1].nodeFqdn);
pCfg
->
nodeInfo
[
2
].
nodePort
=
7210
;
pCfg
->
nodeInfo
[
2
].
nodePort
=
7210
;
taosGetFqdn
(
pCfg
->
nodeInfo
[
2
].
nodeFqdn
);
snprintf
(
pCfg
->
nodeInfo
[
2
].
nodeFqdn
,
sizeof
(
pCfg
->
nodeInfo
[
2
].
nodeFqdn
),
"%s"
,
"127.0.0.1"
);
// taosGetFqdn(pCfg->nodeInfo[2].nodeFqdn);
SSyncNode
*
pSyncNode
=
syncNodeOpen
(
&
syncInfo
);
SSyncNode
*
pSyncNode
=
syncNodeOpen
(
&
syncInfo
);
assert
(
pSyncNode
!=
NULL
);
assert
(
pSyncNode
!=
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录