Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
88aef2d1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
88aef2d1
编写于
3月 10, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync refactor
上级
73d768d2
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
197 addition
and
42 deletion
+197
-42
source/libs/sync/inc/syncIndexMgr.h
source/libs/sync/inc/syncIndexMgr.h
+6
-0
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+8
-5
source/libs/sync/inc/syncRaftEntry.h
source/libs/sync/inc/syncRaftEntry.h
+4
-4
source/libs/sync/inc/syncRaftStore.h
source/libs/sync/inc/syncRaftStore.h
+6
-1
source/libs/sync/inc/syncVoteMgr.h
source/libs/sync/inc/syncVoteMgr.h
+12
-0
source/libs/sync/src/syncIndexMgr.c
source/libs/sync/src/syncIndexMgr.c
+27
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+25
-5
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+11
-11
source/libs/sync/src/syncRaftStore.c
source/libs/sync/src/syncRaftStore.c
+26
-4
source/libs/sync/src/syncVoteMgr.c
source/libs/sync/src/syncVoteMgr.c
+54
-0
source/libs/sync/test/syncInitTest.cpp
source/libs/sync/test/syncInitTest.cpp
+1
-1
source/libs/sync/test/syncLogStoreTest.cpp
source/libs/sync/test/syncLogStoreTest.cpp
+4
-4
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+5
-5
source/libs/sync/test/syncRaftStoreTest.cpp
source/libs/sync/test/syncRaftStoreTest.cpp
+8
-2
未找到文件。
source/libs/sync/inc/syncIndexMgr.h
浏览文件 @
88aef2d1
...
...
@@ -42,6 +42,12 @@ SyncIndex syncIndexMgrGetIndex(SSyncIndexMgr *pSyncIndexMgr, const SRaftId
cJSON
*
syncIndexMgr2Json
(
SSyncIndexMgr
*
pSyncIndexMgr
);
char
*
syncIndexMgr2Str
(
SSyncIndexMgr
*
pSyncIndexMgr
);
// for debug -------------------
void
syncIndexMgrPrint
(
SSyncIndexMgr
*
pObj
);
void
syncIndexMgrPrint2
(
char
*
s
,
SSyncIndexMgr
*
pObj
);
void
syncIndexMgrLog
(
SSyncIndexMgr
*
pObj
);
void
syncIndexMgrLog2
(
char
*
s
,
SSyncIndexMgr
*
pObj
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/sync/inc/syncInt.h
浏览文件 @
88aef2d1
...
...
@@ -211,11 +211,14 @@ int32_t syncNodeStopElectTimer(SSyncNode* pSyncNode);
int32_t
syncNodeRestartElectTimer
(
SSyncNode
*
pSyncNode
,
int32_t
ms
);
int32_t
syncNodeStartHeartbeatTimer
(
SSyncNode
*
pSyncNode
);
int32_t
syncNodeStopHeartbeatTimer
(
SSyncNode
*
pSyncNode
);
// for debug
cJSON
*
syncNode2Json
(
const
SSyncNode
*
pSyncNode
);
char
*
syncNode2Str
(
const
SSyncNode
*
pSyncNode
);
void
syncNodePrint
(
char
*
s
,
const
SSyncNode
*
pSyncNode
);
cJSON
*
syncNode2Json
(
const
SSyncNode
*
pSyncNode
);
char
*
syncNode2Str
(
const
SSyncNode
*
pSyncNode
);
// for debug --------------
void
syncNodePrint
(
SSyncNode
*
pObj
);
void
syncNodePrint2
(
char
*
s
,
SSyncNode
*
pObj
);
void
syncNodeLog
(
SSyncNode
*
pObj
);
void
syncNodeLog2
(
char
*
s
,
SSyncNode
*
pObj
);
#ifdef __cplusplus
}
...
...
source/libs/sync/inc/syncRaftEntry.h
浏览文件 @
88aef2d1
...
...
@@ -48,10 +48,10 @@ cJSON* syncEntry2Json(const SSyncRaftEntry* pEntry);
char
*
syncEntry2Str
(
const
SSyncRaftEntry
*
pEntry
);
// for debug
void
syncEntryPrint
(
const
SSyncRaftEntry
*
p
Entry
);
void
syncEntryPrint2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Entry
);
void
syncEntryLog
(
const
SSyncRaftEntry
*
p
Entry
);
void
syncEntryLog2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Entry
);
void
syncEntryPrint
(
const
SSyncRaftEntry
*
p
Obj
);
void
syncEntryPrint2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Obj
);
void
syncEntryLog
(
const
SSyncRaftEntry
*
p
Obj
);
void
syncEntryLog2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Obj
);
#ifdef __cplusplus
}
...
...
source/libs/sync/inc/syncRaftStore.h
浏览文件 @
88aef2d1
...
...
@@ -42,7 +42,12 @@ int32_t raftStoreClose(SRaftStore *pRaftStore);
int32_t
raftStorePersist
(
SRaftStore
*
pRaftStore
);
int32_t
raftStoreSerialize
(
SRaftStore
*
pRaftStore
,
char
*
buf
,
size_t
len
);
int32_t
raftStoreDeserialize
(
SRaftStore
*
pRaftStore
,
char
*
buf
,
size_t
len
);
void
raftStorePrint
(
SRaftStore
*
pRaftStore
);
// for debug -------------------
void
raftStorePrint
(
SRaftStore
*
pObj
);
void
raftStorePrint2
(
char
*
s
,
SRaftStore
*
pObj
);
void
raftStoreLog
(
SRaftStore
*
pObj
);
void
raftStoreLog2
(
char
*
s
,
SRaftStore
*
pObj
);
#ifdef __cplusplus
}
...
...
source/libs/sync/inc/syncVoteMgr.h
浏览文件 @
88aef2d1
...
...
@@ -48,6 +48,12 @@ void voteGrantedReset(SVotesGranted *pVotesGranted, SyncTerm term);
cJSON
*
voteGranted2Json
(
SVotesGranted
*
pVotesGranted
);
char
*
voteGranted2Str
(
SVotesGranted
*
pVotesGranted
);
// for debug -------------------
void
voteGrantedPrint
(
SVotesGranted
*
pObj
);
void
voteGrantedPrint2
(
char
*
s
,
SVotesGranted
*
pObj
);
void
voteGrantedLog
(
SVotesGranted
*
pObj
);
void
voteGrantedLog2
(
char
*
s
,
SVotesGranted
*
pObj
);
// SVotesRespond -----------------------------
typedef
struct
SVotesRespond
{
SRaftId
(
*
replicas
)[
TSDB_MAX_REPLICA
];
...
...
@@ -65,6 +71,12 @@ void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term);
cJSON
*
votesRespond2Json
(
SVotesRespond
*
pVotesRespond
);
char
*
votesRespond2Str
(
SVotesRespond
*
pVotesRespond
);
// for debug -------------------
void
votesRespondPrint
(
SVotesRespond
*
pObj
);
void
votesRespondPrint2
(
char
*
s
,
SVotesRespond
*
pObj
);
void
votesRespondLog
(
SVotesRespond
*
pObj
);
void
votesRespondLog2
(
char
*
s
,
SVotesRespond
*
pObj
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/sync/src/syncIndexMgr.c
浏览文件 @
88aef2d1
...
...
@@ -97,4 +97,31 @@ char *syncIndexMgr2Str(SSyncIndexMgr *pSyncIndexMgr) {
char
*
serialized
=
cJSON_Print
(
pJson
);
cJSON_Delete
(
pJson
);
return
serialized
;
}
// for debug -------------------
void
syncIndexMgrPrint
(
SSyncIndexMgr
*
pObj
)
{
char
*
serialized
=
syncIndexMgr2Str
(
pObj
);
printf
(
"syncIndexMgrPrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncIndexMgrPrint2
(
char
*
s
,
SSyncIndexMgr
*
pObj
)
{
char
*
serialized
=
syncIndexMgr2Str
(
pObj
);
printf
(
"syncIndexMgrPrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncIndexMgrLog
(
SSyncIndexMgr
*
pObj
)
{
char
*
serialized
=
syncIndexMgr2Str
(
pObj
);
sTrace
(
"syncIndexMgrLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
syncIndexMgrLog2
(
char
*
s
,
SSyncIndexMgr
*
pObj
)
{
char
*
serialized
=
syncIndexMgr2Str
(
pObj
);
sTrace
(
"syncIndexMgrLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
\ No newline at end of file
source/libs/sync/src/syncMain.c
浏览文件 @
88aef2d1
...
...
@@ -327,11 +327,31 @@ char* syncNode2Str(const SSyncNode* pSyncNode) {
return
serialized
;
}
void
syncNodePrint
(
char
*
s
,
const
SSyncNode
*
pSyncNode
)
{
char
*
ss
=
syncNode2Str
(
pSyncNode
);
// sTrace("syncNodePrint: %s [len:%lu]| %s", s, strlen(ss), ss);
fprintf
(
stderr
,
"syncNodePrint: %s [len:%lu]| %s"
,
s
,
strlen
(
ss
),
ss
);
free
(
ss
);
// for debug --------------
void
syncNodePrint
(
SSyncNode
*
pObj
)
{
char
*
serialized
=
syncNode2Str
(
pObj
);
printf
(
"syncNodePrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncNodePrint2
(
char
*
s
,
SSyncNode
*
pObj
)
{
char
*
serialized
=
syncNode2Str
(
pObj
);
printf
(
"syncNodePrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncNodeLog
(
SSyncNode
*
pObj
)
{
char
*
serialized
=
syncNode2Str
(
pObj
);
sTrace
(
"syncNodeLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
syncNodeLog2
(
char
*
s
,
SSyncNode
*
pObj
)
{
char
*
serialized
=
syncNode2Str
(
pObj
);
sTrace
(
"syncNodeLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
int32_t
syncNodeSendMsgById
(
const
SRaftId
*
destRaftId
,
SSyncNode
*
pSyncNode
,
SRpcMsg
*
pMsg
)
{
...
...
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
88aef2d1
...
...
@@ -105,28 +105,28 @@ char* syncEntry2Str(const SSyncRaftEntry* pEntry) {
}
// for debug -----------
void
syncEntryPrint
(
const
SSyncRaftEntry
*
p
Entry
)
{
char
*
serialized
=
syncEntry2Str
(
p
Entry
);
void
syncEntryPrint
(
const
SSyncRaftEntry
*
p
Obj
)
{
char
*
serialized
=
syncEntry2Str
(
p
Obj
);
printf
(
"syncEntryPrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncEntryPrint2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Entry
)
{
char
*
serialized
=
syncEntry2Str
(
p
Entry
);
printf
(
"syncEntryPrint | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
void
syncEntryPrint2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Obj
)
{
char
*
serialized
=
syncEntry2Str
(
p
Obj
);
printf
(
"syncEntryPrint
2
| len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
syncEntryLog
(
const
SSyncRaftEntry
*
p
Entry
)
{
char
*
serialized
=
syncEntry2Str
(
p
Entry
);
sTrace
(
"syncEntry
Print
| len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
void
syncEntryLog
(
const
SSyncRaftEntry
*
p
Obj
)
{
char
*
serialized
=
syncEntry2Str
(
p
Obj
);
sTrace
(
"syncEntry
Log
| len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
syncEntryLog2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Entry
)
{
char
*
serialized
=
syncEntry2Str
(
p
Entry
);
sTrace
(
"syncEntry
Print
| len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
void
syncEntryLog2
(
char
*
s
,
const
SSyncRaftEntry
*
p
Obj
)
{
char
*
serialized
=
syncEntry2Str
(
p
Obj
);
sTrace
(
"syncEntry
Log2
| len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
\ No newline at end of file
source/libs/sync/src/syncRaftStore.c
浏览文件 @
88aef2d1
...
...
@@ -135,8 +135,30 @@ int32_t raftStoreDeserialize(SRaftStore *pRaftStore, char *buf, size_t len) {
return
0
;
}
void
raftStorePrint
(
SRaftStore
*
pRaftStore
)
{
char
storeBuf
[
RAFT_STORE_BLOCK_SIZE
];
raftStoreSerialize
(
pRaftStore
,
storeBuf
,
sizeof
(
storeBuf
));
printf
(
"%s
\n
"
,
storeBuf
);
// for debug -------------------
void
raftStorePrint
(
SRaftStore
*
pObj
)
{
char
serialized
[
RAFT_STORE_BLOCK_SIZE
];
raftStoreSerialize
(
pObj
,
serialized
,
sizeof
(
serialized
));
printf
(
"raftStorePrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
}
void
raftStorePrint2
(
char
*
s
,
SRaftStore
*
pObj
)
{
char
serialized
[
RAFT_STORE_BLOCK_SIZE
];
raftStoreSerialize
(
pObj
,
serialized
,
sizeof
(
serialized
));
printf
(
"raftStorePrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
}
void
raftStoreLog
(
SRaftStore
*
pObj
)
{
char
serialized
[
RAFT_STORE_BLOCK_SIZE
];
raftStoreSerialize
(
pObj
,
serialized
,
sizeof
(
serialized
));
sTrace
(
"raftStoreLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
}
void
raftStoreLog2
(
char
*
s
,
SRaftStore
*
pObj
)
{
char
serialized
[
RAFT_STORE_BLOCK_SIZE
];
raftStoreSerialize
(
pObj
,
serialized
,
sizeof
(
serialized
));
sTrace
(
"raftStoreLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
}
source/libs/sync/src/syncVoteMgr.c
浏览文件 @
88aef2d1
...
...
@@ -119,6 +119,33 @@ char *voteGranted2Str(SVotesGranted *pVotesGranted) {
return
serialized
;
}
// for debug -------------------
void
voteGrantedPrint
(
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
printf
(
"voteGrantedPrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
voteGrantedPrint2
(
char
*
s
,
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
printf
(
"voteGrantedPrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
voteGrantedLog
(
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
sTrace
(
"voteGrantedLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
voteGrantedLog2
(
char
*
s
,
SVotesGranted
*
pObj
)
{
char
*
serialized
=
voteGranted2Str
(
pObj
);
sTrace
(
"voteGrantedLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
// SVotesRespond -----------------------------
SVotesRespond
*
votesRespondCreate
(
SSyncNode
*
pSyncNode
)
{
SVotesRespond
*
pVotesRespond
=
malloc
(
sizeof
(
SVotesRespond
));
...
...
@@ -210,4 +237,31 @@ char *votesRespond2Str(SVotesRespond *pVotesRespond) {
char
*
serialized
=
cJSON_Print
(
pJson
);
cJSON_Delete
(
pJson
);
return
serialized
;
}
// for debug -------------------
void
votesRespondPrint
(
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
printf
(
"votesRespondPrint | len:%lu | %s
\n
"
,
strlen
(
serialized
),
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
votesRespondPrint2
(
char
*
s
,
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
printf
(
"votesRespondPrint2 | len:%lu | %s | %s
\n
"
,
strlen
(
serialized
),
s
,
serialized
);
fflush
(
NULL
);
free
(
serialized
);
}
void
votesRespondLog
(
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
sTrace
(
"votesRespondLog | len:%lu | %s"
,
strlen
(
serialized
),
serialized
);
free
(
serialized
);
}
void
votesRespondLog2
(
char
*
s
,
SVotesRespond
*
pObj
)
{
char
*
serialized
=
votesRespond2Str
(
pObj
);
sTrace
(
"votesRespondLog2 | len:%lu | %s | %s"
,
strlen
(
serialized
),
s
,
serialized
);
free
(
serialized
);
}
\ No newline at end of file
source/libs/sync/test/syncInitTest.cpp
浏览文件 @
88aef2d1
...
...
@@ -89,7 +89,7 @@ int main(int argc, char** argv) {
SSyncNode
*
pSyncNode
=
syncInitTest
();
assert
(
pSyncNode
!=
NULL
);
syncNodePrint
((
char
*
)
"syncInitTest"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"syncInitTest"
,
pSyncNode
);
initRaftId
(
pSyncNode
);
...
...
source/libs/sync/test/syncLogStoreTest.cpp
浏览文件 @
88aef2d1
...
...
@@ -83,7 +83,7 @@ SSyncNode* syncInitTest() { return syncNodeInit(); }
void
logStoreTest
()
{
logStorePrint
(
pSyncNode
->
pLogStore
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
int32_t
dataLen
=
10
;
int32_t
dataLen
=
10
;
SSyncRaftEntry
*
pEntry
=
syncEntryBuild
(
dataLen
);
assert
(
pEntry
!=
NULL
);
pEntry
->
msgType
=
1
;
...
...
@@ -94,7 +94,7 @@ void logStoreTest() {
pEntry
->
index
=
pSyncNode
->
pLogStore
->
getLastIndex
(
pSyncNode
->
pLogStore
)
+
1
;
snprintf
(
pEntry
->
data
,
dataLen
,
"value%d"
,
i
);
//syncEntryPrint2((char*)"write entry:", pEntry);
//
syncEntryPrint2((char*)"write entry:", pEntry);
pSyncNode
->
pLogStore
->
appendEntry
(
pSyncNode
->
pLogStore
,
pEntry
);
syncEntryDestory
(
pEntry
);
}
...
...
@@ -132,8 +132,8 @@ int main(int argc, char** argv) {
pSyncNode
=
syncInitTest
();
assert
(
pSyncNode
!=
NULL
);
//syncNodePrint((char*)"syncLogStoreTest", pSyncNode);
//initRaftId(pSyncNode);
//
syncNodePrint((char*)"syncLogStoreTest", pSyncNode);
//
initRaftId(pSyncNode);
logStoreTest
();
...
...
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
88aef2d1
...
...
@@ -86,7 +86,7 @@ int main(int argc, char** argv) {
SSyncNode
*
pSyncNode
=
syncInitTest
();
assert
(
pSyncNode
!=
NULL
);
syncNodePrint
((
char
*
)
"----1"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"----1"
,
pSyncNode
);
initRaftId
(
pSyncNode
);
...
...
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
sTrace
(
"syncNodeStartPingTimer ..."
);
ret
=
syncNodeStartPingTimer
(
pSyncNode
);
assert
(
ret
==
0
);
syncNodePrint
((
char
*
)
"----2"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"----2"
,
pSyncNode
);
sTrace
(
"sleep ..."
);
taosMsleep
(
10000
);
...
...
@@ -103,7 +103,7 @@ int main(int argc, char** argv) {
sTrace
(
"syncNodeStopPingTimer ..."
);
ret
=
syncNodeStopPingTimer
(
pSyncNode
);
assert
(
ret
==
0
);
syncNodePrint
((
char
*
)
"----3"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"----3"
,
pSyncNode
);
sTrace
(
"sleep ..."
);
taosMsleep
(
5000
);
...
...
@@ -111,7 +111,7 @@ int main(int argc, char** argv) {
sTrace
(
"syncNodeStartPingTimer ..."
);
ret
=
syncNodeStartPingTimer
(
pSyncNode
);
assert
(
ret
==
0
);
syncNodePrint
((
char
*
)
"----4"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"----4"
,
pSyncNode
);
sTrace
(
"sleep ..."
);
taosMsleep
(
10000
);
...
...
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
sTrace
(
"syncNodeStopPingTimer ..."
);
ret
=
syncNodeStopPingTimer
(
pSyncNode
);
assert
(
ret
==
0
);
syncNodePrint
((
char
*
)
"----5"
,
pSyncNode
);
syncNodePrint
2
((
char
*
)
"----5"
,
pSyncNode
);
while
(
1
)
{
sTrace
(
"while 1 sleep ..."
);
...
...
source/libs/sync/test/syncRaftStoreTest.cpp
浏览文件 @
88aef2d1
...
...
@@ -22,15 +22,21 @@ int main() {
SRaftStore
*
pRaftStore
=
raftStoreOpen
(
"./raft_store.json"
);
assert
(
pRaftStore
!=
NULL
);
raftStorePrint
(
pRaftStore
);
#if 0
pRaftStore->currentTerm = 100;
pRaftStore->voteFor.addr = 200;
pRaftStore->voteFor.vgId = 300;
raftStorePersist(pRaftStore);
raftStorePrint(pRaftStore);
#endif
++
(
pRaftStore
->
currentTerm
);
++
(
pRaftStore
->
voteFor
.
addr
);
++
(
pRaftStore
->
voteFor
.
vgId
);
raftStorePersist
(
pRaftStore
);
raftStorePrint
(
pRaftStore
);
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录