Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
317f7669
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看板
提交
317f7669
编写于
3月 11, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync refactor
上级
690dabd6
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
260 addition
and
21 deletion
+260
-21
source/libs/sync/inc/syncMessage.h
source/libs/sync/inc/syncMessage.h
+6
-0
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+44
-9
source/libs/sync/test/CMakeLists.txt
source/libs/sync/test/CMakeLists.txt
+14
-0
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
+1
-0
source/libs/sync/test/syncPingReplyTest.cpp
source/libs/sync/test/syncPingReplyTest.cpp
+6
-6
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+6
-6
source/libs/sync/test/syncRequestVoteReplyTest.cpp
source/libs/sync/test/syncRequestVoteReplyTest.cpp
+1
-0
source/libs/sync/test/syncRequestVoteTest.cpp
source/libs/sync/test/syncRequestVoteTest.cpp
+1
-0
source/libs/sync/test/syncRpcMsgTest.cpp
source/libs/sync/test/syncRpcMsgTest.cpp
+181
-0
未找到文件。
source/libs/sync/inc/syncMessage.h
浏览文件 @
317f7669
...
...
@@ -47,6 +47,12 @@ cJSON* syncRpcMsg2Json(SRpcMsg* pRpcMsg);
cJSON
*
syncRpcUnknownMsg2Json
();
char
*
syncRpcMsg2Str
(
SRpcMsg
*
pRpcMsg
);
// for debug ----------------------
void
syncRpcMsgPrint
(
SRpcMsg
*
pMsg
);
void
syncRpcMsgPrint2
(
char
*
s
,
SRpcMsg
*
pMsg
);
void
syncRpcMsgLog
(
SRpcMsg
*
pMsg
);
void
syncRpcMsgLog2
(
char
*
s
,
SRpcMsg
*
pMsg
);
// ---------------------------------------------
typedef
enum
ESyncTimeoutType
{
SYNC_TIMEOUT_PING
=
100
,
...
...
source/libs/sync/src/syncMessage.c
浏览文件 @
317f7669
...
...
@@ -23,39 +23,47 @@ cJSON* syncRpcMsg2Json(SRpcMsg* pRpcMsg) {
// in compiler optimization, switch case = if else constants
if
(
pRpcMsg
->
msgType
==
SYNC_TIMEOUT
)
{
SyncTimeout
*
pSyncMsg
=
(
SyncTimeout
*
)
pRpcMsg
->
pCont
;
SyncTimeout
*
pSyncMsg
=
syncTimeoutDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncTimeout2Json
(
pSyncMsg
);
syncTimeoutDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_PING
)
{
SyncPing
*
pSyncMsg
=
(
SyncPing
*
)
pRpcMsg
->
pCont
;
SyncPing
*
pSyncMsg
=
syncPingDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncPing2Json
(
pSyncMsg
);
syncPingDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_PING_REPLY
)
{
SyncPingReply
*
pSyncMsg
=
(
SyncPingReply
*
)
pRpcMsg
->
pCont
;
SyncPingReply
*
pSyncMsg
=
syncPingReplyDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncPingReply2Json
(
pSyncMsg
);
syncPingReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_CLIENT_REQUEST
)
{
SyncClientRequest
*
pSyncMsg
=
(
SyncClientRequest
*
)
pRpcMsg
->
pCont
;
SyncClientRequest
*
pSyncMsg
=
syncClientRequestDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncClientRequest2Json
(
pSyncMsg
);
syncClientRequestDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_CLIENT_REQUEST_REPLY
)
{
pRoot
=
syncRpcUnknownMsg2Json
();
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_REQUEST_VOTE
)
{
SyncRequestVote
*
pSyncMsg
=
(
SyncRequestVote
*
)
pRpcMsg
->
pCont
;
SyncRequestVote
*
pSyncMsg
=
syncRequestVoteDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncRequestVote2Json
(
pSyncMsg
);
syncRequestVoteDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_REQUEST_VOTE_REPLY
)
{
SyncRequestVoteReply
*
pSyncMsg
=
(
SyncRequestVoteReply
*
)
pRpcMsg
->
pCont
;
SyncRequestVoteReply
*
pSyncMsg
=
syncRequestVoteReplyDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncRequestVoteReply2Json
(
pSyncMsg
);
syncRequestVoteReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_APPEND_ENTRIES
)
{
SyncAppendEntries
*
pSyncMsg
=
(
SyncAppendEntries
*
)
pRpcMsg
->
pCont
;
SyncAppendEntries
*
pSyncMsg
=
syncAppendEntriesDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncAppendEntries2Json
(
pSyncMsg
);
syncAppendEntriesDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
SYNC_APPEND_ENTRIES_REPLY
)
{
SyncAppendEntriesReply
*
pSyncMsg
=
(
SyncAppendEntriesReply
*
)
pRpcMsg
->
pCont
;
SyncAppendEntriesReply
*
pSyncMsg
=
syncAppendEntriesReplyDeserialize2
(
pRpcMsg
->
pCont
,
pRpcMsg
->
contLen
)
;
pRoot
=
syncAppendEntriesReply2Json
(
pSyncMsg
);
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
}
else
{
pRoot
=
syncRpcUnknownMsg2Json
();
...
...
@@ -72,7 +80,7 @@ cJSON* syncRpcUnknownMsg2Json() {
cJSON_AddStringToObject
(
pRoot
,
"data"
,
"known message"
);
cJSON
*
pJson
=
cJSON_CreateObject
();
cJSON_AddItemToObject
(
pJson
,
"Sync
Ping
"
,
pRoot
);
cJSON_AddItemToObject
(
pJson
,
"Sync
Unknown
"
,
pRoot
);
return
pJson
;
}
...
...
@@ -83,6 +91,33 @@ char* syncRpcMsg2Str(SRpcMsg* pRpcMsg) {
return
serialized
;
}
// for debug ----------------------
void
syncRpcMsgPrint
(
SRpcMsg
*
pMsg
)
{
char
*
serialized
=
syncRpcMsg2Str
(
pMsg
);
printf
(
"syncRpcMsgPrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncRpcMsgPrint2
(
char
*
s
,
SRpcMsg
*
pMsg
)
{
char
*
serialized
=
syncRpcMsg2Str
(
pMsg
);
printf
(
"syncRpcMsgPrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncRpcMsgLog
(
SRpcMsg
*
pMsg
)
{
char
*
serialized
=
syncRpcMsg2Str
(
pMsg
);
sTrace
(
"syncRpcMsgLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
syncRpcMsgLog2
(
char
*
s
,
SRpcMsg
*
pMsg
)
{
char
*
serialized
=
syncRpcMsg2Str
(
pMsg
);
sTrace
(
"syncRpcMsgLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
// ---- message process SyncTimeout----
SyncTimeout
*
syncTimeoutBuild
()
{
uint32_t
bytes
=
sizeof
(
SyncTimeout
);
...
...
source/libs/sync/test/CMakeLists.txt
浏览文件 @
317f7669
...
...
@@ -25,6 +25,7 @@ add_executable(syncClientRequestTest "")
add_executable
(
syncTimeoutTest
""
)
add_executable
(
syncPingTest
""
)
add_executable
(
syncPingReplyTest
""
)
add_executable
(
syncRpcMsgTest
""
)
target_sources
(
syncTest
...
...
@@ -135,6 +136,10 @@ target_sources(syncPingReplyTest
PRIVATE
"syncPingReplyTest.cpp"
)
target_sources
(
syncRpcMsgTest
PRIVATE
"syncRpcMsgTest.cpp"
)
target_include_directories
(
syncTest
...
...
@@ -272,6 +277,11 @@ target_include_directories(syncPingReplyTest
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_include_directories
(
syncRpcMsgTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_link_libraries
(
syncTest
...
...
@@ -382,6 +392,10 @@ target_link_libraries(syncPingReplyTest
sync
gtest_main
)
target_link_libraries
(
syncRpcMsgTest
sync
gtest_main
)
enable_testing
()
...
...
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
浏览文件 @
317f7669
...
...
@@ -22,6 +22,7 @@ SyncAppendEntriesReply *createMsg() {
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
success
=
true
;
pMsg
->
matchIndex
=
77
;
return
pMsg
;
}
void
test1
()
{
...
...
source/libs/sync/test/syncPingReplyTest.cpp
浏览文件 @
317f7669
...
...
@@ -32,8 +32,8 @@ void test1() {
void
test2
()
{
SyncPingReply
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
malloc
(
len
);
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
malloc
(
len
);
syncPingReplySerialize
(
pMsg
,
serialized
,
len
);
SyncPingReply
*
pMsg2
=
syncPingReplyBuild
(
pMsg
->
dataLen
);
syncPingReplyDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -46,8 +46,8 @@ void test2() {
void
test3
()
{
SyncPingReply
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncPingReplySerialize2
(
pMsg
,
&
len
);
uint32_t
len
;
char
*
serialized
=
syncPingReplySerialize2
(
pMsg
,
&
len
);
SyncPingReply
*
pMsg2
=
syncPingReplyDeserialize2
(
serialized
,
len
);
syncPingReplyPrint2
((
char
*
)
"test3: syncPingReplySerialize3 -> syncPingReplyDeserialize2 "
,
pMsg2
);
...
...
@@ -58,7 +58,7 @@ void test3() {
void
test4
()
{
SyncPingReply
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncPingReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncPingReply
*
pMsg2
=
(
SyncPingReply
*
)
malloc
(
rpcMsg
.
contLen
);
syncPingReplyFromRpcMsg
(
&
rpcMsg
,
pMsg2
);
...
...
@@ -70,7 +70,7 @@ void test4() {
void
test5
()
{
SyncPingReply
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncPingReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncPingReply
*
pMsg2
=
syncPingReplyFromRpcMsg2
(
&
rpcMsg
);
syncPingReplyPrint2
((
char
*
)
"test5: syncPingReply2RpcMsg -> syncPingReplyFromRpcMsg2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
317f7669
...
...
@@ -32,8 +32,8 @@ void test1() {
void
test2
()
{
SyncPing
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
malloc
(
len
);
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
malloc
(
len
);
syncPingSerialize
(
pMsg
,
serialized
,
len
);
SyncPing
*
pMsg2
=
syncPingBuild
(
pMsg
->
dataLen
);
syncPingDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -46,8 +46,8 @@ void test2() {
void
test3
()
{
SyncPing
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncPingSerialize2
(
pMsg
,
&
len
);
uint32_t
len
;
char
*
serialized
=
syncPingSerialize2
(
pMsg
,
&
len
);
SyncPing
*
pMsg2
=
syncPingDeserialize2
(
serialized
,
len
);
syncPingPrint2
((
char
*
)
"test3: syncPingSerialize3 -> syncPingDeserialize2 "
,
pMsg2
);
...
...
@@ -58,7 +58,7 @@ void test3() {
void
test4
()
{
SyncPing
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncPing2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncPing
*
pMsg2
=
(
SyncPing
*
)
malloc
(
rpcMsg
.
contLen
);
syncPingFromRpcMsg
(
&
rpcMsg
,
pMsg2
);
...
...
@@ -70,7 +70,7 @@ void test4() {
void
test5
()
{
SyncPing
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncPing2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncPing
*
pMsg2
=
syncPingFromRpcMsg2
(
&
rpcMsg
);
syncPingPrint2
((
char
*
)
"test5: syncPing2RpcMsg -> syncPingFromRpcMsg2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncRequestVoteReplyTest.cpp
浏览文件 @
317f7669
...
...
@@ -22,6 +22,7 @@ SyncRequestVoteReply *createMsg() {
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
term
=
77
;
pMsg
->
voteGranted
=
true
;
return
pMsg
;
}
void
test1
()
{
...
...
source/libs/sync/test/syncRequestVoteTest.cpp
浏览文件 @
317f7669
...
...
@@ -23,6 +23,7 @@ SyncRequestVote *createMsg() {
pMsg
->
currentTerm
=
11
;
pMsg
->
lastLogIndex
=
22
;
pMsg
->
lastLogTerm
=
33
;
return
pMsg
;
}
void
test1
()
{
...
...
source/libs/sync/test/syncRpcMsgTest.cpp
0 → 100644
浏览文件 @
317f7669
#include <gtest/gtest.h>
#include <stdio.h>
#include "syncIO.h"
#include "syncInt.h"
#include "syncMessage.h"
#include "syncUtil.h"
void
logTest
()
{
sTrace
(
"--- sync log test: trace"
);
sDebug
(
"--- sync log test: debug"
);
sInfo
(
"--- sync log test: info"
);
sWarn
(
"--- sync log test: warn"
);
sError
(
"--- sync log test: error"
);
sFatal
(
"--- sync log test: fatal"
);
}
int
gg
=
0
;
SyncTimeout
*
createSyncTimeout
()
{
SyncTimeout
*
pMsg
=
syncTimeoutBuild2
(
SYNC_TIMEOUT_PING
,
999
,
333
,
&
gg
);
return
pMsg
;
}
SyncPing
*
createSyncPing
()
{
SRaftId
srcId
,
destId
;
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
srcId
.
vgId
=
100
;
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
destId
.
vgId
=
100
;
SyncPing
*
pMsg
=
syncPingBuild3
(
&
srcId
,
&
destId
);
return
pMsg
;
}
SyncPingReply
*
createSyncPingReply
()
{
SRaftId
srcId
,
destId
;
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
srcId
.
vgId
=
100
;
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
destId
.
vgId
=
100
;
SyncPingReply
*
pMsg
=
syncPingReplyBuild3
(
&
srcId
,
&
destId
);
return
pMsg
;
}
SyncClientRequest
*
createSyncClientRequest
()
{
SRpcMsg
rpcMsg
;
memset
(
&
rpcMsg
,
0
,
sizeof
(
rpcMsg
));
rpcMsg
.
msgType
=
12345
;
rpcMsg
.
contLen
=
20
;
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
strcpy
((
char
*
)
rpcMsg
.
pCont
,
"hello rpc"
);
SyncClientRequest
*
pMsg
=
syncClientRequestBuild2
(
&
rpcMsg
,
123
,
true
);
return
pMsg
;
}
SyncRequestVote
*
createSyncRequestVote
()
{
SyncRequestVote
*
pMsg
=
syncRequestVoteBuild
();
pMsg
->
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
pMsg
->
srcId
.
vgId
=
100
;
pMsg
->
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
currentTerm
=
11
;
pMsg
->
lastLogIndex
=
22
;
pMsg
->
lastLogTerm
=
33
;
return
pMsg
;
}
SyncRequestVoteReply
*
createSyncRequestVoteReply
()
{
SyncRequestVoteReply
*
pMsg
=
syncRequestVoteReplyBuild
();
pMsg
->
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
pMsg
->
srcId
.
vgId
=
100
;
pMsg
->
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
term
=
77
;
pMsg
->
voteGranted
=
true
;
return
pMsg
;
}
SyncAppendEntries
*
createSyncAppendEntries
()
{
SyncAppendEntries
*
pMsg
=
syncAppendEntriesBuild
(
20
);
pMsg
->
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
pMsg
->
srcId
.
vgId
=
100
;
pMsg
->
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
prevLogIndex
=
11
;
pMsg
->
prevLogTerm
=
22
;
pMsg
->
commitIndex
=
33
;
strcpy
(
pMsg
->
data
,
"hello world"
);
return
pMsg
;
}
SyncAppendEntriesReply
*
createSyncAppendEntriesReply
()
{
SyncAppendEntriesReply
*
pMsg
=
syncAppendEntriesReplyBuild
();
pMsg
->
srcId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
1234
);
pMsg
->
srcId
.
vgId
=
100
;
pMsg
->
destId
.
addr
=
syncUtilAddr2U64
(
"127.0.0.1"
,
5678
);
pMsg
->
destId
.
vgId
=
100
;
pMsg
->
success
=
true
;
pMsg
->
matchIndex
=
77
;
return
pMsg
;
}
void
test1
()
{
SyncTimeout
*
pMsg
=
createSyncTimeout
();
SRpcMsg
rpcMsg
;
syncTimeout2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test1"
,
&
rpcMsg
);
syncTimeoutDestroy
(
pMsg
);
}
void
test2
()
{
SyncPing
*
pMsg
=
createSyncPing
();
SRpcMsg
rpcMsg
;
syncPing2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test2"
,
&
rpcMsg
);
syncPingDestroy
(
pMsg
);
}
void
test3
()
{
SyncPingReply
*
pMsg
=
createSyncPingReply
();
SRpcMsg
rpcMsg
;
syncPingReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test3"
,
&
rpcMsg
);
syncPingReplyDestroy
(
pMsg
);
}
void
test4
()
{
SyncRequestVote
*
pMsg
=
createSyncRequestVote
();
SRpcMsg
rpcMsg
;
syncRequestVote2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test4"
,
&
rpcMsg
);
syncRequestVoteDestroy
(
pMsg
);
}
void
test5
()
{
SyncRequestVoteReply
*
pMsg
=
createSyncRequestVoteReply
();
SRpcMsg
rpcMsg
;
syncRequestVoteReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test5"
,
&
rpcMsg
);
syncRequestVoteReplyDestroy
(
pMsg
);
}
void
test6
()
{
SyncAppendEntries
*
pMsg
=
createSyncAppendEntries
();
SRpcMsg
rpcMsg
;
syncAppendEntries2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test6"
,
&
rpcMsg
);
syncAppendEntriesDestroy
(
pMsg
);
}
void
test7
()
{
SyncAppendEntriesReply
*
pMsg
=
createSyncAppendEntriesReply
();
SRpcMsg
rpcMsg
;
syncAppendEntriesReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test7"
,
&
rpcMsg
);
syncAppendEntriesReplyDestroy
(
pMsg
);
}
void
test8
()
{
SyncClientRequest
*
pMsg
=
createSyncClientRequest
();
SRpcMsg
rpcMsg
;
syncClientRequest2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRpcMsgPrint2
((
char
*
)
"test8"
,
&
rpcMsg
);
syncClientRequestDestroy
(
pMsg
);
}
int
main
()
{
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog
=
0
;
sDebugFlag
=
143
+
64
;
logTest
();
test1
();
test2
();
test3
();
test4
();
test5
();
test6
();
test7
();
test8
();
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录