Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c79cc7e4
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c79cc7e4
编写于
10月 13, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code format
上级
bb659995
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
102 addition
and
106 deletion
+102
-106
source/libs/sync/inc/syncIO.h
source/libs/sync/inc/syncIO.h
+4
-4
source/libs/sync/inc/syncRaftStore.h
source/libs/sync/inc/syncRaftStore.h
+3
-3
source/libs/sync/inc/syncVoteMgr.h
source/libs/sync/inc/syncVoteMgr.h
+4
-4
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+3
-3
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+18
-18
source/libs/sync/src/syncRaftStore.c
source/libs/sync/src/syncRaftStore.c
+1
-1
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+2
-2
source/libs/sync/src/syncVoteMgr.c
source/libs/sync/src/syncVoteMgr.c
+2
-2
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
+2
-2
source/libs/sync/test/syncAppendEntriesTest.cpp
source/libs/sync/test/syncAppendEntriesTest.cpp
+2
-2
source/libs/sync/test/syncApplyMsgTest.cpp
source/libs/sync/test/syncApplyMsgTest.cpp
+2
-2
source/libs/sync/test/syncClientRequestBatchTest.cpp
source/libs/sync/test/syncClientRequestBatchTest.cpp
+1
-1
source/libs/sync/test/syncClientRequestTest.cpp
source/libs/sync/test/syncClientRequestTest.cpp
+2
-2
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
+1
-1
source/libs/sync/test/syncConfigChangeTest.cpp
source/libs/sync/test/syncConfigChangeTest.cpp
+1
-1
source/libs/sync/test/syncEncodeTest.cpp
source/libs/sync/test/syncEncodeTest.cpp
+4
-4
source/libs/sync/test/syncHeartbeatReplyTest.cpp
source/libs/sync/test/syncHeartbeatReplyTest.cpp
+10
-14
source/libs/sync/test/syncHeartbeatTest.cpp
source/libs/sync/test/syncHeartbeatTest.cpp
+8
-8
source/libs/sync/test/syncIndexTest.cpp
source/libs/sync/test/syncIndexTest.cpp
+1
-1
source/libs/sync/test/syncLeaderTransferTest.cpp
source/libs/sync/test/syncLeaderTransferTest.cpp
+2
-2
source/libs/sync/test/syncPingReplyTest.cpp
source/libs/sync/test/syncPingReplyTest.cpp
+3
-3
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+3
-3
source/libs/sync/test/syncRaftCfgIndexTest.cpp
source/libs/sync/test/syncRaftCfgIndexTest.cpp
+4
-4
source/libs/sync/test/syncReconfigFinishTest.cpp
source/libs/sync/test/syncReconfigFinishTest.cpp
+2
-2
source/libs/sync/test/syncRefTest.cpp
source/libs/sync/test/syncRefTest.cpp
+1
-1
source/libs/sync/test/syncRequestVoteReplyTest.cpp
source/libs/sync/test/syncRequestVoteReplyTest.cpp
+2
-2
source/libs/sync/test/syncRequestVoteTest.cpp
source/libs/sync/test/syncRequestVoteTest.cpp
+2
-2
source/libs/sync/test/syncSnapshotRspTest.cpp
source/libs/sync/test/syncSnapshotRspTest.cpp
+2
-2
source/libs/sync/test/syncSnapshotSendTest.cpp
source/libs/sync/test/syncSnapshotSendTest.cpp
+2
-2
source/libs/sync/test/syncSnapshotTest.cpp
source/libs/sync/test/syncSnapshotTest.cpp
+2
-2
source/libs/sync/test/syncTimeoutTest.cpp
source/libs/sync/test/syncTimeoutTest.cpp
+3
-3
source/libs/sync/test/syncWriteTest.cpp
source/libs/sync/test/syncWriteTest.cpp
+2
-2
tools/scripts/codeFormat.sh
tools/scripts/codeFormat.sh
+1
-1
未找到文件。
source/libs/sync/inc/syncIO.h
浏览文件 @
c79cc7e4
...
...
@@ -29,15 +29,15 @@ extern "C" {
#include "tqueue.h"
#include "trpc.h"
#define TICK_Q_TIMER_MS 1000
#define TICK_Q_TIMER_MS
1000
#define TICK_Ping_TIMER_MS 1000
typedef
struct
SSyncIO
{
STaosQueue
*
pMsgQ
;
STaosQset
*
pQset
;
STaosQset
*
pQset
;
TdThread
consumerTid
;
void
*
serverRpc
;
void
*
clientRpc
;
void
*
serverRpc
;
void
*
clientRpc
;
SEpSet
myAddr
;
SMsgCb
msgcb
;
...
...
source/libs/sync/inc/syncRaftStore.h
浏览文件 @
c79cc7e4
...
...
@@ -28,7 +28,7 @@ extern "C" {
#include "taosdef.h"
#define RAFT_STORE_BLOCK_SIZE 512
#define RAFT_STORE_PATH_LEN (TSDB_FILENAME_LEN * 2)
#define RAFT_STORE_PATH_LEN
(TSDB_FILENAME_LEN * 2)
typedef
struct
SRaftStore
{
SyncTerm
currentTerm
;
...
...
@@ -49,8 +49,8 @@ void raftStoreClearVote(SRaftStore *pRaftStore);
void
raftStoreNextTerm
(
SRaftStore
*
pRaftStore
);
void
raftStoreSetTerm
(
SRaftStore
*
pRaftStore
,
SyncTerm
term
);
int32_t
raftStoreFromJson
(
SRaftStore
*
pRaftStore
,
cJSON
*
pJson
);
cJSON
*
raftStore2Json
(
SRaftStore
*
pRaftStore
);
char
*
raftStore2Str
(
SRaftStore
*
pRaftStore
);
cJSON
*
raftStore2Json
(
SRaftStore
*
pRaftStore
);
char
*
raftStore2Str
(
SRaftStore
*
pRaftStore
);
// for debug -------------------
void
raftStorePrint
(
SRaftStore
*
pObj
);
...
...
source/libs/sync/inc/syncVoteMgr.h
浏览文件 @
c79cc7e4
...
...
@@ -46,8 +46,8 @@ void voteGrantedUpdate(SVotesGranted *pVotesGranted, SSyncNode *pSyncN
bool
voteGrantedMajority
(
SVotesGranted
*
pVotesGranted
);
void
voteGrantedVote
(
SVotesGranted
*
pVotesGranted
,
SyncRequestVoteReply
*
pMsg
);
void
voteGrantedReset
(
SVotesGranted
*
pVotesGranted
,
SyncTerm
term
);
cJSON
*
voteGranted2Json
(
SVotesGranted
*
pVotesGranted
);
char
*
voteGranted2Str
(
SVotesGranted
*
pVotesGranted
);
cJSON
*
voteGranted2Json
(
SVotesGranted
*
pVotesGranted
);
char
*
voteGranted2Str
(
SVotesGranted
*
pVotesGranted
);
// for debug -------------------
void
voteGrantedPrint
(
SVotesGranted
*
pObj
);
...
...
@@ -70,8 +70,8 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSync
bool
votesResponded
(
SVotesRespond
*
pVotesRespond
,
const
SRaftId
*
pRaftId
);
void
votesRespondAdd
(
SVotesRespond
*
pVotesRespond
,
const
SyncRequestVoteReply
*
pMsg
);
void
votesRespondReset
(
SVotesRespond
*
pVotesRespond
,
SyncTerm
term
);
cJSON
*
votesRespond2Json
(
SVotesRespond
*
pVotesRespond
);
char
*
votesRespond2Str
(
SVotesRespond
*
pVotesRespond
);
cJSON
*
votesRespond2Json
(
SVotesRespond
*
pVotesRespond
);
char
*
votesRespond2Str
(
SVotesRespond
*
pVotesRespond
);
// for debug -------------------
void
votesRespondPrint
(
SVotesRespond
*
pObj
);
...
...
source/libs/sync/src/syncIO.c
浏览文件 @
c79cc7e4
...
...
@@ -30,7 +30,7 @@ static int32_t syncIODestroy(SSyncIO *io);
static
int32_t
syncIOStartInternal
(
SSyncIO
*
io
);
static
int32_t
syncIOStopInternal
(
SSyncIO
*
io
);
static
void
*
syncIOConsumerFunc
(
void
*
param
);
static
void
*
syncIOConsumerFunc
(
void
*
param
);
static
void
syncIOProcessRequest
(
void
*
pParent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
void
syncIOProcessReply
(
void
*
pParent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
static
int32_t
syncIOAuth
(
void
*
parent
,
char
*
meterId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
...
...
@@ -242,9 +242,9 @@ static int32_t syncIOStopInternal(SSyncIO *io) {
}
static
void
*
syncIOConsumerFunc
(
void
*
param
)
{
SSyncIO
*
io
=
param
;
SSyncIO
*
io
=
param
;
STaosQall
*
qall
=
taosAllocateQall
();
SRpcMsg
*
pRpcMsg
,
rpcMsg
;
SRpcMsg
*
pRpcMsg
,
rpcMsg
;
SQueueInfo
qinfo
=
{
0
};
while
(
1
)
{
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
c79cc7e4
...
...
@@ -52,9 +52,9 @@ int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg);
int32_t
syncNodeOnPingReplyCb
(
SSyncNode
*
ths
,
SyncPingReply
*
pMsg
);
// ---------------------------------
static
void
syncNodeFreeCb
(
void
*
param
)
{
syncNodeClose
(
param
);
param
=
NULL
;
static
void
syncNodeFreeCb
(
void
*
param
)
{
syncNodeClose
(
param
);
param
=
NULL
;
}
int32_t
syncInit
()
{
...
...
@@ -947,15 +947,15 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
meta
.
batchSize
=
pSyncInfo
->
batchSize
;
ret
=
raftCfgCreateFile
((
SSyncCfg
*
)
&
(
pSyncInfo
->
syncCfg
),
meta
,
pSyncNode
->
configPath
);
if
(
ret
!=
0
)
{
sError
(
"failed to create raft cfg file. configPath: %s"
,
pSyncNode
->
configPath
);
goto
_error
;
sError
(
"failed to create raft cfg file. configPath: %s"
,
pSyncNode
->
configPath
);
goto
_error
;
}
}
else
{
// update syncCfg by raft_config.json
pSyncNode
->
pRaftCfg
=
raftCfgOpen
(
pSyncNode
->
configPath
);
if
(
pSyncNode
->
pRaftCfg
==
NULL
)
{
sError
(
"failed to open raft cfg file. path:%s"
,
pSyncNode
->
configPath
);
goto
_error
;
sError
(
"failed to open raft cfg file. path:%s"
,
pSyncNode
->
configPath
);
goto
_error
;
}
pSyncInfo
->
syncCfg
=
pSyncNode
->
pRaftCfg
->
cfg
;
...
...
@@ -985,8 +985,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
// init internal
pSyncNode
->
myNodeInfo
=
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
];
if
(
!
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
myNodeInfo
,
pSyncNode
->
vgId
,
&
pSyncNode
->
myRaftId
))
{
sError
(
"failed to determine my raft member id. vgId:%d"
,
pSyncNode
->
vgId
);
goto
_error
;
sError
(
"failed to determine my raft member id. vgId:%d"
,
pSyncNode
->
vgId
);
goto
_error
;
}
// init peersNum, peers, peersId
...
...
@@ -1000,17 +1000,17 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
}
for
(
int
i
=
0
;
i
<
pSyncNode
->
peersNum
;
++
i
)
{
if
(
!
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
peersNodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
peersId
[
i
]))
{
sError
(
"failed to determine raft member id. vgId:%d, peer:%d"
,
pSyncNode
->
vgId
,
i
);
goto
_error
;
sError
(
"failed to determine raft member id. vgId:%d, peer:%d"
,
pSyncNode
->
vgId
,
i
);
goto
_error
;
}
}
// init replicaNum, replicasId
pSyncNode
->
replicaNum
=
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
if
(
!
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
replicasId
[
i
]))
{
sError
(
"failed to determine raft member id. vgId:%d, replica:%d"
,
pSyncNode
->
vgId
,
i
);
goto
_error
;
if
(
!
syncUtilnodeInfo2raftId
(
&
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
[
i
],
pSyncNode
->
vgId
,
&
pSyncNode
->
replicasId
[
i
]))
{
sError
(
"failed to determine raft member id. vgId:%d, replica:%d"
,
pSyncNode
->
vgId
,
i
);
goto
_error
;
}
}
...
...
@@ -1090,8 +1090,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
SSnapshot
snapshot
=
{
0
};
int32_t
code
=
pSyncNode
->
pFsm
->
FpGetSnapshotInfo
(
pSyncNode
->
pFsm
,
&
snapshot
);
if
(
code
!=
0
)
{
sError
(
"failed to get snapshot info. vgId:%d, code:%d"
,
pSyncNode
->
vgId
,
code
);
goto
_error
;
sError
(
"failed to get snapshot info. vgId:%d, code:%d"
,
pSyncNode
->
vgId
,
code
);
goto
_error
;
}
if
(
snapshot
.
lastApplyIndex
>
commitIndex
)
{
commitIndex
=
snapshot
.
lastApplyIndex
;
...
...
@@ -1191,8 +1191,8 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
_error:
if
(
pSyncInfo
->
pFsm
)
{
taosMemoryFree
(
pSyncInfo
->
pFsm
);
pSyncInfo
->
pFsm
=
NULL
;
taosMemoryFree
(
pSyncInfo
->
pFsm
);
pSyncInfo
->
pFsm
=
NULL
;
}
syncNodeClose
(
pSyncNode
);
pSyncNode
=
NULL
;
...
...
source/libs/sync/src/syncRaftStore.c
浏览文件 @
c79cc7e4
...
...
@@ -218,7 +218,7 @@ cJSON *raftStore2Json(SRaftStore *pRaftStore) {
char
*
raftStore2Str
(
SRaftStore
*
pRaftStore
)
{
cJSON
*
pJson
=
raftStore2Json
(
pRaftStore
);
char
*
serialized
=
cJSON_Print
(
pJson
);
char
*
serialized
=
cJSON_Print
(
pJson
);
cJSON_Delete
(
pJson
);
return
serialized
;
}
...
...
source/libs/sync/src/syncSnapshot.c
浏览文件 @
c79cc7e4
...
...
@@ -36,8 +36,8 @@ SSyncSnapshotSender *snapshotSenderCreate(SSyncNode *pSyncNode, int32_t replicaI
if
(
condition
)
{
pSender
=
taosMemoryMalloc
(
sizeof
(
SSyncSnapshotSender
));
if
(
pSender
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
memset
(
pSender
,
0
,
sizeof
(
*
pSender
));
...
...
source/libs/sync/src/syncVoteMgr.c
浏览文件 @
c79cc7e4
...
...
@@ -130,7 +130,7 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
char
*
voteGranted2Str
(
SVotesGranted
*
pVotesGranted
)
{
cJSON
*
pJson
=
voteGranted2Json
(
pVotesGranted
);
char
*
serialized
=
cJSON_Print
(
pJson
);
char
*
serialized
=
cJSON_Print
(
pJson
);
cJSON_Delete
(
pJson
);
return
serialized
;
}
...
...
@@ -259,7 +259,7 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
char
*
votesRespond2Str
(
SVotesRespond
*
pVotesRespond
)
{
cJSON
*
pJson
=
votesRespond2Json
(
pVotesRespond
);
char
*
serialized
=
cJSON_Print
(
pJson
);
char
*
serialized
=
cJSON_Print
(
pJson
);
cJSON_Delete
(
pJson
);
return
serialized
;
}
...
...
source/libs/sync/test/syncAppendEntriesReplyTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -37,7 +37,7 @@ void test1() {
void
test2
()
{
SyncAppendEntriesReply
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncAppendEntriesReplySerialize
(
pMsg
,
serialized
,
len
);
SyncAppendEntriesReply
*
pMsg2
=
syncAppendEntriesReplyBuild
(
1000
);
syncAppendEntriesReplyDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -52,7 +52,7 @@ void test2() {
void
test3
()
{
SyncAppendEntriesReply
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncAppendEntriesReplySerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncAppendEntriesReplySerialize2
(
pMsg
,
&
len
);
SyncAppendEntriesReply
*
pMsg2
=
syncAppendEntriesReplyDeserialize2
(
serialized
,
len
);
syncAppendEntriesReplyLog2
((
char
*
)
"test3: syncAppendEntriesReplySerialize3 -> syncAppendEntriesReplyDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncAppendEntriesTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -37,7 +37,7 @@ void test1() {
void
test2
()
{
SyncAppendEntries
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncAppendEntriesSerialize
(
pMsg
,
serialized
,
len
);
SyncAppendEntries
*
pMsg2
=
syncAppendEntriesBuild
(
pMsg
->
dataLen
,
1000
);
syncAppendEntriesDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -51,7 +51,7 @@ void test2() {
void
test3
()
{
SyncAppendEntries
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncAppendEntriesSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncAppendEntriesSerialize2
(
pMsg
,
&
len
);
SyncAppendEntries
*
pMsg2
=
syncAppendEntriesDeserialize2
(
serialized
,
len
);
syncAppendEntriesLog2
((
char
*
)
"test3: syncAppendEntriesSerialize3 -> syncAppendEntriesDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncApplyMsgTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -43,7 +43,7 @@ void test1() {
void
test2
()
{
SyncApplyMsg
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncApplyMsgSerialize
(
pMsg
,
serialized
,
len
);
SyncApplyMsg
*
pMsg2
=
syncApplyMsgBuild
(
pMsg
->
dataLen
);
syncApplyMsgDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -57,7 +57,7 @@ void test2() {
void
test3
()
{
SyncApplyMsg
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncApplyMsgSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncApplyMsgSerialize2
(
pMsg
,
&
len
);
SyncApplyMsg
*
pMsg2
=
syncApplyMsgDeserialize2
(
serialized
,
len
);
syncApplyMsgLog2
((
char
*
)
"test3: syncApplyMsgSerialize2 -> syncApplyMsgDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncClientRequestBatchTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -33,7 +33,7 @@ SyncClientRequestBatch *createMsg() {
for
(
int32_t
i
=
0
;
i
<
5
;
++
i
)
{
SRpcMsg
*
pRpcMsg
=
createRpcMsg
(
i
,
20
);
rpcMsgPArr
[
i
]
=
pRpcMsg
;
//taosMemoryFree(pRpcMsg);
//
taosMemoryFree(pRpcMsg);
}
SRaftMeta
raftArr
[
5
];
...
...
source/libs/sync/test/syncClientRequestTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -35,7 +35,7 @@ void test1() {
void
test2
()
{
SyncClientRequest
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncClientRequestSerialize
(
pMsg
,
serialized
,
len
);
SyncClientRequest
*
pMsg2
=
syncClientRequestBuild
(
pMsg
->
dataLen
);
syncClientRequestDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -49,7 +49,7 @@ void test2() {
void
test3
()
{
SyncClientRequest
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncClientRequestSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncClientRequestSerialize2
(
pMsg
,
&
len
);
SyncClientRequest
*
pMsg2
=
syncClientRequestDeserialize2
(
serialized
,
len
);
syncClientRequestLog2
((
char
*
)
"test3: syncClientRequestSerialize3 -> syncClientRequestDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -149,7 +149,7 @@ int32_t SnapshotDoWrite(struct SSyncFSM* pFsm, void* pWriter, void* pBuf, int32_
void
RestoreFinishCb
(
struct
SSyncFSM
*
pFsm
)
{
sTrace
(
"==callback== ==RestoreFinishCb=="
);
}
void
ReConfigCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
)
{
void
ReConfigCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
)
{
sTrace
(
"==callback== ==ReConfigCb== flag:0x%lX, index:%"
PRId64
", code:%d, currentTerm:%"
PRIu64
", term:%"
PRIu64
,
cbMeta
->
flag
,
cbMeta
->
index
,
cbMeta
->
code
,
cbMeta
->
currentTerm
,
cbMeta
->
term
);
}
...
...
source/libs/sync/test/syncConfigChangeTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -80,7 +80,7 @@ int32_t GetSnapshotCb(struct SSyncFSM* pFsm, SSnapshot* pSnapshot) {
void
RestoreFinishCb
(
struct
SSyncFSM
*
pFsm
)
{
sTrace
(
"==callback== ==RestoreFinishCb=="
);
}
void
ReConfigCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
)
{
void
ReConfigCb
(
struct
SSyncFSM
*
pFsm
,
const
SRpcMsg
*
pMsg
,
SReConfigCbMeta
*
cbMeta
)
{
sTrace
(
"==callback== ==ReConfigCb== flag:0x%lX, index:%"
PRId64
", code:%d, currentTerm:%"
PRIu64
", term:%"
PRIu64
,
cbMeta
->
flag
,
cbMeta
->
index
,
cbMeta
->
code
,
cbMeta
->
currentTerm
,
cbMeta
->
term
);
}
...
...
source/libs/sync/test/syncEncodeTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId
ids
[
TSDB_MAX_REPLICA
];
SSyncInfo
syncInfo
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncNode
*
pSyncNode
;
SSyncNode
*
syncNodeInit
()
{
...
...
@@ -187,8 +187,8 @@ int main(int argc, char **argv) {
// step5
uint32_t
len
;
char
*
pMsg5
=
step5
(
pMsg4
,
&
len
);
char
*
s
=
syncUtilprintBin
(
pMsg5
,
len
);
char
*
pMsg5
=
step5
(
pMsg4
,
&
len
);
char
*
s
=
syncUtilprintBin
(
pMsg5
,
len
);
printf
(
"==step5== [%s]
\n
"
,
s
);
taosMemoryFree
(
s
);
...
...
source/libs/sync/test/syncHeartbeatReplyTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -35,13 +35,12 @@ void test1() {
void
test2
()
{
SyncHeartbeatReply
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncHeartbeatReplySerialize
(
pMsg
,
serialized
,
len
);
SyncHeartbeatReply
*
pMsg2
=
syncHeartbeatReplyBuild
(
1000
);
syncHeartbeatReplyDeserialize
(
serialized
,
len
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize "
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test2: syncHeartbeatReplySerialize -> syncHeartbeatReplyDeserialize "
,
pMsg2
);
taosMemoryFree
(
serialized
);
syncHeartbeatReplyDestroy
(
pMsg
);
...
...
@@ -50,11 +49,10 @@ void test2() {
void
test3
()
{
SyncHeartbeatReply
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncHeartbeatReplySerialize2
(
pMsg
,
&
len
);
uint32_t
len
;
char
*
serialized
=
syncHeartbeatReplySerialize2
(
pMsg
,
&
len
);
SyncHeartbeatReply
*
pMsg2
=
syncHeartbeatReplyDeserialize2
(
serialized
,
len
);
syncHeartbeatReplyLog2
((
char
*
)
"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 "
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test3: syncHeartbeatReplySerialize3 -> syncHeartbeatReplyDeserialize2 "
,
pMsg2
);
taosMemoryFree
(
serialized
);
syncHeartbeatReplyDestroy
(
pMsg
);
...
...
@@ -63,12 +61,11 @@ void test3() {
void
test4
()
{
SyncHeartbeatReply
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncHeartbeatReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncHeartbeatReply
*
pMsg2
=
syncHeartbeatReplyBuild
(
1000
);
syncHeartbeatReplyFromRpcMsg
(
&
rpcMsg
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg "
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test4: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg "
,
pMsg2
);
rpcFreeCont
(
rpcMsg
.
pCont
);
syncHeartbeatReplyDestroy
(
pMsg
);
...
...
@@ -77,11 +74,10 @@ void test4() {
void
test5
()
{
SyncHeartbeatReply
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncHeartbeatReply2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncHeartbeatReply
*
pMsg2
=
syncHeartbeatReplyFromRpcMsg2
(
&
rpcMsg
);
syncHeartbeatReplyLog2
((
char
*
)
"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 "
,
pMsg2
);
syncHeartbeatReplyLog2
((
char
*
)
"test5: syncHeartbeatReply2RpcMsg -> syncHeartbeatReplyFromRpcMsg2 "
,
pMsg2
);
rpcFreeCont
(
rpcMsg
.
pCont
);
syncHeartbeatReplyDestroy
(
pMsg
);
...
...
source/libs/sync/test/syncHeartbeatTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -19,7 +19,7 @@ SyncHeartbeat *createMsg() {
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
->
destId
.
vgId
=
100
;
pMsg
->
term
=
8
;
pMsg
->
commitIndex
=
33
;
pMsg
->
privateTerm
=
44
;
...
...
@@ -34,8 +34,8 @@ void test1() {
void
test2
()
{
SyncHeartbeat
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncHeartbeatSerialize
(
pMsg
,
serialized
,
len
);
SyncHeartbeat
*
pMsg2
=
syncHeartbeatBuild
(
789
);
syncHeartbeatDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -48,8 +48,8 @@ void test2() {
void
test3
()
{
SyncHeartbeat
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncHeartbeatSerialize2
(
pMsg
,
&
len
);
uint32_t
len
;
char
*
serialized
=
syncHeartbeatSerialize2
(
pMsg
,
&
len
);
SyncHeartbeat
*
pMsg2
=
syncHeartbeatDeserialize2
(
serialized
,
len
);
syncHeartbeatLog2
((
char
*
)
"test3: syncHeartbeatSerialize2 -> syncHeartbeatDeserialize2 "
,
pMsg2
);
...
...
@@ -60,7 +60,7 @@ void test3() {
void
test4
()
{
SyncHeartbeat
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncHeartbeat2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncHeartbeat
*
pMsg2
=
(
SyncHeartbeat
*
)
taosMemoryMalloc
(
rpcMsg
.
contLen
);
syncHeartbeatFromRpcMsg
(
&
rpcMsg
,
pMsg2
);
...
...
@@ -73,9 +73,9 @@ void test4() {
void
test5
()
{
SyncHeartbeat
*
pMsg
=
createMsg
();
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncHeartbeat2RpcMsg
(
pMsg
,
&
rpcMsg
);
SyncHeartbeat
*
pMsg2
=
syncHeartbeatFromRpcMsg2
(
&
rpcMsg
);
SyncHeartbeat
*
pMsg2
=
syncHeartbeatFromRpcMsg2
(
&
rpcMsg
);
syncHeartbeatLog2
((
char
*
)
"test5: syncHeartbeat2RpcMsg -> syncHeartbeatFromRpcMsg2 "
,
pMsg2
);
rpcFreeCont
(
rpcMsg
.
pCont
);
...
...
source/libs/sync/test/syncIndexTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -9,7 +9,7 @@ void print(SHashObj *pNextIndex) {
uint64_t
*
p
=
(
uint64_t
*
)
taosHashIterate
(
pNextIndex
,
NULL
);
while
(
p
)
{
size_t
len
;
void
*
key
=
taosHashGetKey
(
p
,
&
len
);
void
*
key
=
taosHashGetKey
(
p
,
&
len
);
SRaftId
*
pRaftId
=
(
SRaftId
*
)
key
;
...
...
source/libs/sync/test/syncLeaderTransferTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -36,7 +36,7 @@ void test1() {
void
test2
()
{
SyncLeaderTransfer
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncLeaderTransferSerialize
(
pMsg
,
serialized
,
len
);
SyncLeaderTransfer
*
pMsg2
=
syncLeaderTransferBuild
(
1000
);
syncLeaderTransferDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -50,7 +50,7 @@ void test2() {
void
test3
()
{
SyncLeaderTransfer
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncLeaderTransferSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncLeaderTransferSerialize2
(
pMsg
,
&
len
);
SyncLeaderTransfer
*
pMsg2
=
syncLeaderTransferDeserialize2
(
serialized
,
len
);
syncLeaderTransferLog2
((
char
*
)
"test3: syncLeaderTransferSerialize2 -> syncLeaderTransferDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncPingReplyTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -33,7 +33,7 @@ void test1() {
void
test2
()
{
SyncPingReply
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncPingReplySerialize
(
pMsg
,
serialized
,
len
);
SyncPingReply
*
pMsg2
=
syncPingReplyBuild
(
pMsg
->
dataLen
);
syncPingReplyDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -47,7 +47,7 @@ void test2() {
void
test3
()
{
SyncPingReply
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncPingReplySerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncPingReplySerialize2
(
pMsg
,
&
len
);
SyncPingReply
*
pMsg2
=
syncPingReplyDeserialize2
(
serialized
,
len
);
syncPingReplyLog2
((
char
*
)
"test3: syncPingReplySerialize2 -> syncPingReplyDeserialize2 "
,
pMsg2
);
...
...
@@ -84,7 +84,7 @@ void test5() {
void
test6
()
{
SyncPingReply
*
pMsg
=
createMsg
();
int32_t
bufLen
=
syncPingReplySerialize3
(
pMsg
,
NULL
,
0
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
bufLen
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
bufLen
);
syncPingReplySerialize3
(
pMsg
,
serialized
,
bufLen
);
SyncPingReply
*
pMsg2
=
syncPingReplyDeserialize3
(
serialized
,
bufLen
);
assert
(
pMsg2
!=
NULL
);
...
...
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -33,7 +33,7 @@ void test1() {
void
test2
()
{
SyncPing
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncPingSerialize
(
pMsg
,
serialized
,
len
);
SyncPing
*
pMsg2
=
syncPingBuild
(
pMsg
->
dataLen
);
syncPingDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -47,7 +47,7 @@ void test2() {
void
test3
()
{
SyncPing
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncPingSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncPingSerialize2
(
pMsg
,
&
len
);
SyncPing
*
pMsg2
=
syncPingDeserialize2
(
serialized
,
len
);
syncPingLog2
((
char
*
)
"test3: syncPingSerialize2 -> syncPingDeserialize2 "
,
pMsg2
);
...
...
@@ -84,7 +84,7 @@ void test5() {
void
test6
()
{
SyncPing
*
pMsg
=
createMsg
();
int32_t
bufLen
=
syncPingSerialize3
(
pMsg
,
NULL
,
0
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
bufLen
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
bufLen
);
syncPingSerialize3
(
pMsg
,
serialized
,
bufLen
);
SyncPing
*
pMsg2
=
syncPingDeserialize3
(
serialized
,
bufLen
);
assert
(
pMsg2
!=
NULL
);
...
...
source/libs/sync/test/syncRaftCfgIndexTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -53,20 +53,20 @@ SSyncCfg* createSyncCfg() {
return
pCfg
;
}
const
char
*
pFile
=
"./raft_config_index.json"
;
const
char
*
pFile
=
"./raft_config_index.json"
;
void
test1
()
{
int32_t
code
=
raftCfgIndexCreateFile
(
pFile
);
ASSERT
(
code
==
0
);
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
raftCfgIndexLog2
((
char
*
)
"==test1=="
,
pRaftCfgIndex
);
raftCfgIndexClose
(
pRaftCfgIndex
);
}
void
test2
()
{
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
for
(
int
i
=
0
;
i
<
500
;
++
i
)
{
raftCfgIndexAddConfigIndex
(
pRaftCfgIndex
,
i
);
}
...
...
@@ -77,7 +77,7 @@ void test2() {
}
void
test3
()
{
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
SRaftCfgIndex
*
pRaftCfgIndex
=
raftCfgIndexOpen
(
pFile
);
raftCfgIndexLog2
((
char
*
)
"==test3=="
,
pRaftCfgIndex
);
raftCfgIndexClose
(
pRaftCfgIndex
);
...
...
source/libs/sync/test/syncReconfigFinishTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -69,7 +69,7 @@ void test1() {
void
test2
()
{
SyncReconfigFinish
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncReconfigFinishSerialize
(
pMsg
,
serialized
,
len
);
SyncReconfigFinish
*
pMsg2
=
syncReconfigFinishBuild
(
1000
);
syncReconfigFinishDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -83,7 +83,7 @@ void test2() {
void
test3
()
{
SyncReconfigFinish
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncReconfigFinishSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncReconfigFinishSerialize2
(
pMsg
,
&
len
);
SyncReconfigFinish
*
pMsg2
=
syncReconfigFinishDeserialize2
(
serialized
,
len
);
syncReconfigFinishLog2
((
char
*
)
"test3: SyncReconfigFinishSerialize2 -> syncReconfigFinishDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncRefTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -25,7 +25,7 @@ int g = 100;
typedef
struct
SyncObj
{
int64_t
rid
;
void
*
data
;
void
*
data
;
char
name
[
32
];
int
counter
;
}
SyncObj
;
...
...
source/libs/sync/test/syncRequestVoteReplyTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -34,7 +34,7 @@ void test1() {
void
test2
()
{
SyncRequestVoteReply
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncRequestVoteReplySerialize
(
pMsg
,
serialized
,
len
);
SyncRequestVoteReply
*
pMsg2
=
syncRequestVoteReplyBuild
(
1000
);
syncRequestVoteReplyDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -48,7 +48,7 @@ void test2() {
void
test3
()
{
SyncRequestVoteReply
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncRequestVoteReplySerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncRequestVoteReplySerialize2
(
pMsg
,
&
len
);
SyncRequestVoteReply
*
pMsg2
=
syncRequestVoteReplyDeserialize2
(
serialized
,
len
);
syncRequestVoteReplyLog2
((
char
*
)
"test3: syncRequestVoteReplySerialize3 -> syncRequestVoteReplyDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncRequestVoteTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -35,7 +35,7 @@ void test1() {
void
test2
()
{
SyncRequestVote
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncRequestVoteSerialize
(
pMsg
,
serialized
,
len
);
SyncRequestVote
*
pMsg2
=
syncRequestVoteBuild
(
1000
);
syncRequestVoteDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -49,7 +49,7 @@ void test2() {
void
test3
()
{
SyncRequestVote
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncRequestVoteSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncRequestVoteSerialize2
(
pMsg
,
&
len
);
SyncRequestVote
*
pMsg2
=
syncRequestVoteDeserialize2
(
serialized
,
len
);
syncRequestVoteLog2
((
char
*
)
"test3: syncRequestVoteSerialize3 -> syncRequestVoteDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncSnapshotRspTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -38,7 +38,7 @@ void test1() {
void
test2
()
{
SyncSnapshotRsp
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncSnapshotRspSerialize
(
pMsg
,
serialized
,
len
);
SyncSnapshotRsp
*
pMsg2
=
syncSnapshotRspBuild
(
1000
);
syncSnapshotRspDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -52,7 +52,7 @@ void test2() {
void
test3
()
{
SyncSnapshotRsp
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncSnapshotRspSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncSnapshotRspSerialize2
(
pMsg
,
&
len
);
SyncSnapshotRsp
*
pMsg2
=
syncSnapshotRspDeserialize2
(
serialized
,
len
);
syncSnapshotRspLog2
((
char
*
)
"test3: syncSnapshotRspSerialize2 -> syncSnapshotRspDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncSnapshotSendTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -48,7 +48,7 @@ void test1() {
void
test2
()
{
SyncSnapshotSend
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncSnapshotSendSerialize
(
pMsg
,
serialized
,
len
);
SyncSnapshotSend
*
pMsg2
=
syncSnapshotSendBuild
(
pMsg
->
dataLen
,
1000
);
syncSnapshotSendDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -62,7 +62,7 @@ void test2() {
void
test3
()
{
SyncSnapshotSend
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncSnapshotSendSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncSnapshotSendSerialize2
(
pMsg
,
&
len
);
SyncSnapshotSend
*
pMsg2
=
syncSnapshotSendDeserialize2
(
serialized
,
len
);
syncSnapshotSendLog2
((
char
*
)
"test3: syncSnapshotSendSerialize2 -> syncSnapshotSendDeserialize2 "
,
pMsg2
);
...
...
source/libs/sync/test/syncSnapshotTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId
ids
[
TSDB_MAX_REPLICA
];
SSyncInfo
syncInfo
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncNode
*
gSyncNode
;
SyncIndex
snapshotLastApplyIndex
=
SYNC_INDEX_INVALID
;
...
...
source/libs/sync/test/syncTimeoutTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -30,7 +30,7 @@ void test1() {
void
test2
()
{
SyncTimeout
*
pMsg
=
createMsg
();
uint32_t
len
=
pMsg
->
bytes
;
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
char
*
serialized
=
(
char
*
)
taosMemoryMalloc
(
len
);
syncTimeoutSerialize
(
pMsg
,
serialized
,
len
);
SyncTimeout
*
pMsg2
=
syncTimeoutBuild
();
syncTimeoutDeserialize
(
serialized
,
len
,
pMsg2
);
...
...
@@ -44,7 +44,7 @@ void test2() {
void
test3
()
{
SyncTimeout
*
pMsg
=
createMsg
();
uint32_t
len
;
char
*
serialized
=
syncTimeoutSerialize2
(
pMsg
,
&
len
);
char
*
serialized
=
syncTimeoutSerialize2
(
pMsg
,
&
len
);
SyncTimeout
*
pMsg2
=
syncTimeoutDeserialize2
(
serialized
,
len
);
syncTimeoutLog2
((
char
*
)
"test3: syncTimeoutSerialize3 -> syncTimeoutDeserialize2 "
,
pMsg2
);
...
...
@@ -80,7 +80,7 @@ void test5() {
void
test6
()
{
SyncTimeout
*
pMsg
=
createMsg
();
char
*
jsonStr
=
syncTimeout2Str
(
pMsg
);
char
*
jsonStr
=
syncTimeout2Str
(
pMsg
);
sTrace
(
"jsonStr: %s"
,
jsonStr
);
syncUtilJson2Line
(
jsonStr
);
...
...
source/libs/sync/test/syncWriteTest.cpp
浏览文件 @
c79cc7e4
...
...
@@ -25,8 +25,8 @@ int32_t myIndex = 0;
SRaftId
ids
[
TSDB_MAX_REPLICA
];
SSyncInfo
syncInfo
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncFSM
*
pFsm
;
SWal
*
pWal
;
SSyncNode
*
gSyncNode
;
const
char
*
pDir
=
"./syncWriteTest"
;
...
...
tools/scripts/codeFormat.sh
浏览文件 @
c79cc7e4
...
...
@@ -26,7 +26,7 @@ FORMAT_DIR_LIST=(
# "${PRJ_ROOT_DIR}/source/libs/qworker"
"
${
PRJ_ROOT_DIR
}
/source/libs/scalar"
"
${
PRJ_ROOT_DIR
}
/source/libs/stream"
#
"${PRJ_ROOT_DIR}/source/libs/sync"
"
${
PRJ_ROOT_DIR
}
/source/libs/sync"
"
${
PRJ_ROOT_DIR
}
/source/libs/tdb"
"
${
PRJ_ROOT_DIR
}
/source/libs/tfs"
"
${
PRJ_ROOT_DIR
}
/source/libs/transport"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录