Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
76c4fce8
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看板
提交
76c4fce8
编写于
3月 03, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ping test
上级
a78d7028
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
32 deletion
+23
-32
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+4
-10
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+0
-10
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+19
-12
未找到文件。
source/libs/sync/src/syncIO.c
浏览文件 @
76c4fce8
...
...
@@ -211,23 +211,17 @@ static void *syncIOConsumerFunc(void *param) {
if
(
pRpcMsg
->
msgType
==
SYNC_PING
)
{
if
(
io
->
FpOnSyncPing
!=
NULL
)
{
SyncPing
*
pSyncMsg
;
SRpcMsg
tmpRpcMsg
;
memcpy
(
&
tmpRpcMsg
,
pRpcMsg
,
sizeof
(
SRpcMsg
));
pSyncMsg
=
syncPingBuild
(
tmpRpcMsg
.
contLen
);
pSyncMsg
=
syncPingBuild
(
pRpcMsg
->
contLen
);
syncPingFromRpcMsg
(
pRpcMsg
,
pSyncMsg
);
// memcpy(pSyncMsg, tmpRpcMsg.pCont, tmpRpcMsg.contLen);
io
->
FpOnSyncPing
(
io
->
pSyncNode
,
pSyncMsg
);
}
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_PING_REPLY
)
{
SyncPingReply
*
pSyncMsg
=
syncPingReplyBuild
(
pRpcMsg
->
contLen
);
syncPingReplyFromRpcMsg
(
pRpcMsg
,
pSyncMsg
);
if
(
io
->
FpOnSyncPingReply
!=
NULL
)
{
SyncPingReply
*
pSyncMsg
;
pSyncMsg
=
syncPingReplyBuild
(
pRpcMsg
->
contLen
);
syncPingReplyFromRpcMsg
(
pRpcMsg
,
pSyncMsg
);
io
->
FpOnSyncPingReply
(
io
->
pSyncNode
,
pSyncMsg
);
}
}
else
{
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
76c4fce8
...
...
@@ -171,16 +171,6 @@ static int32_t syncNodePing(SSyncNode* pSyncNode, const SRaftId* destRaftId, Syn
SRpcMsg
rpcMsg
;
syncPing2RpcMsg
(
pMsg
,
&
rpcMsg
);
/*
SRpcMsg rpcMsg;
rpcMsg.contLen = 64;
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
snprintf((char*)rpcMsg.pCont, rpcMsg.contLen, "%s", "xxxxxxxxxxxxxx");
rpcMsg.handle = NULL;
rpcMsg.msgType = 1;
*/
syncNodeSendMsgById
(
destRaftId
,
pSyncNode
,
&
rpcMsg
);
{
...
...
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
76c4fce8
...
...
@@ -13,7 +13,9 @@ void logTest() {
sFatal
(
"--- sync log test: fatal"
);
}
SSyncNode
*
doSync
()
{
uint16_t
ports
[
3
]
=
{
7010
,
7110
,
7210
};
SSyncNode
*
doSync
(
int
myIndex
)
{
SSyncFSM
*
pFsm
;
SSyncInfo
syncInfo
;
...
...
@@ -24,18 +26,18 @@ SSyncNode* doSync() {
snprintf
(
syncInfo
.
path
,
sizeof
(
syncInfo
.
path
),
"%s"
,
"./test_sync_ping"
);
SSyncCfg
*
pCfg
=
&
syncInfo
.
syncCfg
;
pCfg
->
myIndex
=
0
;
pCfg
->
replicaNum
=
2
;
pCfg
->
myIndex
=
myIndex
;
pCfg
->
replicaNum
=
3
;
pCfg
->
nodeInfo
[
0
].
nodePort
=
7010
;
pCfg
->
nodeInfo
[
0
].
nodePort
=
ports
[
0
]
;
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
=
ports
[
1
]
;
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
=
ports
[
2
]
;
snprintf
(
pCfg
->
nodeInfo
[
2
].
nodeFqdn
,
sizeof
(
pCfg
->
nodeInfo
[
2
].
nodeFqdn
),
"%s"
,
"127.0.0.1"
);
// taosGetFqdn(pCfg->nodeInfo[2].nodeFqdn);
...
...
@@ -53,20 +55,25 @@ void timerPingAll(void* param, void* tmrId) {
syncNodePingAll
(
pSyncNode
);
}
int
main
()
{
int
main
(
int
argc
,
char
**
argv
)
{
// taosInitLog((char*)"syncPingTest.log", 100000, 10);
tsAsyncLog
=
0
;
sDebugFlag
=
143
+
64
;
logTest
();
int32_t
ret
=
syncIOStart
((
char
*
)
"127.0.0.1"
,
7010
);
int
myIndex
=
0
;
if
(
argc
>=
2
)
{
myIndex
=
atoi
(
argv
[
1
]);
}
int32_t
ret
=
syncIOStart
((
char
*
)
"127.0.0.1"
,
ports
[
myIndex
]);
assert
(
ret
==
0
);
ret
=
syncEnvStart
();
assert
(
ret
==
0
);
SSyncNode
*
pSyncNode
=
doSync
();
SSyncNode
*
pSyncNode
=
doSync
(
myIndex
);
gSyncIO
->
FpOnSyncPing
=
pSyncNode
->
FpOnPing
;
gSyncIO
->
FpOnSyncPingReply
=
pSyncNode
->
FpOnPingReply
;
...
...
@@ -74,9 +81,9 @@ int main() {
assert
(
ret
==
0
);
/*
taosMsleep(10000);
ret = syncNodeStopPingTimer(pSyncNode);
assert(ret == 0);
taosMsleep(10000);
ret = syncNodeStopPingTimer(pSyncNode);
assert(ret == 0);
*/
while
(
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录