Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
398d5ec3
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
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看板
提交
398d5ec3
编写于
3月 02, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync io
上级
a2d9cd44
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
179 addition
and
3 deletion
+179
-3
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+1
-1
source/libs/sync/test/CMakeLists.txt
source/libs/sync/test/CMakeLists.txt
+42
-0
source/libs/sync/test/syncIOSendMsgClientTest.cpp
source/libs/sync/test/syncIOSendMsgClientTest.cpp
+50
-0
source/libs/sync/test/syncIOSendMsgServerTest.cpp
source/libs/sync/test/syncIOSendMsgServerTest.cpp
+33
-0
source/libs/sync/test/syncIOSendMsgTest.cpp
source/libs/sync/test/syncIOSendMsgTest.cpp
+50
-0
source/libs/sync/test/syncPingTest.cpp
source/libs/sync/test/syncPingTest.cpp
+3
-2
未找到文件。
source/libs/sync/src/syncIO.c
浏览文件 @
398d5ec3
...
@@ -112,7 +112,7 @@ static int32_t syncIOStartInternal(SSyncIO *io) {
...
@@ -112,7 +112,7 @@ static int32_t syncIOStartInternal(SSyncIO *io) {
{
{
SRpcInit
rpcInit
;
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
7010
;
rpcInit
.
localPort
=
io
->
myAddr
.
eps
[
0
].
port
;
rpcInit
.
label
=
"SYNC-IO-SERVER"
;
rpcInit
.
label
=
"SYNC-IO-SERVER"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
syncIOProcessRequest
;
rpcInit
.
cfp
=
syncIOProcessRequest
;
...
...
source/libs/sync/test/CMakeLists.txt
浏览文件 @
398d5ec3
...
@@ -4,6 +4,9 @@ add_executable(syncPingTest "")
...
@@ -4,6 +4,9 @@ add_executable(syncPingTest "")
add_executable
(
syncEncodeTest
""
)
add_executable
(
syncEncodeTest
""
)
add_executable
(
syncIOTickQTest
""
)
add_executable
(
syncIOTickQTest
""
)
add_executable
(
syncIOTickPingTest
""
)
add_executable
(
syncIOTickPingTest
""
)
add_executable
(
syncIOSendMsgTest
""
)
add_executable
(
syncIOSendMsgClientTest
""
)
add_executable
(
syncIOSendMsgServerTest
""
)
target_sources
(
syncTest
target_sources
(
syncTest
...
@@ -30,6 +33,18 @@ target_sources(syncIOTickPingTest
...
@@ -30,6 +33,18 @@ target_sources(syncIOTickPingTest
PRIVATE
PRIVATE
"syncIOTickPingTest.cpp"
"syncIOTickPingTest.cpp"
)
)
target_sources
(
syncIOSendMsgTest
PRIVATE
"syncIOSendMsgTest.cpp"
)
target_sources
(
syncIOSendMsgClientTest
PRIVATE
"syncIOSendMsgClientTest.cpp"
)
target_sources
(
syncIOSendMsgServerTest
PRIVATE
"syncIOSendMsgServerTest.cpp"
)
target_include_directories
(
syncTest
target_include_directories
(
syncTest
...
@@ -62,6 +77,21 @@ target_include_directories(syncIOTickPingTest
...
@@ -62,6 +77,21 @@ target_include_directories(syncIOTickPingTest
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
)
target_include_directories
(
syncIOSendMsgTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_include_directories
(
syncIOSendMsgClientTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_include_directories
(
syncIOSendMsgServerTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/sync"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc"
)
target_link_libraries
(
syncTest
target_link_libraries
(
syncTest
...
@@ -88,6 +118,18 @@ target_link_libraries(syncIOTickPingTest
...
@@ -88,6 +118,18 @@ target_link_libraries(syncIOTickPingTest
sync
sync
gtest_main
gtest_main
)
)
target_link_libraries
(
syncIOSendMsgTest
sync
gtest_main
)
target_link_libraries
(
syncIOSendMsgClientTest
sync
gtest_main
)
target_link_libraries
(
syncIOSendMsgServerTest
sync
gtest_main
)
enable_testing
()
enable_testing
()
...
...
source/libs/sync/test/syncIOSendMsgClientTest.cpp
0 → 100644
浏览文件 @
398d5ec3
#include <stdio.h>
#include "gtest/gtest.h"
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.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
main
()
{
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog
=
0
;
sDebugFlag
=
143
+
64
;
logTest
();
int32_t
ret
;
ret
=
syncIOStart
((
char
*
)
"127.0.0.1"
,
7010
);
assert
(
ret
==
0
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
SEpSet
epSet
;
epSet
.
inUse
=
0
;
epSet
.
numOfEps
=
1
;
addEpIntoEpSet
(
&
epSet
,
"127.0.0.1"
,
7030
);
SRpcMsg
rpcMsg
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
msgType
=
77
;
syncIOSendMsg
(
gSyncIO
->
clientRpc
,
&
epSet
,
&
rpcMsg
);
sleep
(
1
);
}
while
(
1
)
{
sleep
(
1
);
}
return
0
;
}
source/libs/sync/test/syncIOSendMsgServerTest.cpp
0 → 100644
浏览文件 @
398d5ec3
#include <stdio.h>
#include "gtest/gtest.h"
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.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
main
()
{
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog
=
0
;
sDebugFlag
=
143
+
64
;
logTest
();
int32_t
ret
;
ret
=
syncIOStart
((
char
*
)
"127.0.0.1"
,
7030
);
assert
(
ret
==
0
);
while
(
1
)
{
sleep
(
1
);
}
return
0
;
}
source/libs/sync/test/syncIOSendMsgTest.cpp
0 → 100644
浏览文件 @
398d5ec3
#include <stdio.h>
#include "gtest/gtest.h"
#include "syncIO.h"
#include "syncInt.h"
#include "syncRaftStore.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
main
()
{
// taosInitLog((char *)"syncTest.log", 100000, 10);
tsAsyncLog
=
0
;
sDebugFlag
=
143
+
64
;
logTest
();
int32_t
ret
;
ret
=
syncIOStart
((
char
*
)
"127.0.0.1"
,
7010
);
assert
(
ret
==
0
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
SEpSet
epSet
;
epSet
.
inUse
=
0
;
epSet
.
numOfEps
=
1
;
addEpIntoEpSet
(
&
epSet
,
"127.0.0.1"
,
7010
);
SRpcMsg
rpcMsg
;
rpcMsg
.
contLen
=
64
;
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
snprintf
((
char
*
)
rpcMsg
.
pCont
,
rpcMsg
.
contLen
,
"%s"
,
"syncIOSendMsgTest"
);
rpcMsg
.
handle
=
NULL
;
rpcMsg
.
msgType
=
77
;
syncIOSendMsg
(
gSyncIO
->
clientRpc
,
&
epSet
,
&
rpcMsg
);
sleep
(
1
);
}
while
(
1
)
{
sleep
(
1
);
}
return
0
;
}
source/libs/sync/test/syncPingTest.cpp
浏览文件 @
398d5ec3
...
@@ -68,10 +68,11 @@ int main() {
...
@@ -68,10 +68,11 @@ int main() {
ret
=
syncNodeStartPingTimer
(
pSyncNode
);
ret
=
syncNodeStartPingTimer
(
pSyncNode
);
assert
(
ret
==
0
);
assert
(
ret
==
0
);
taosMsleep
(
5000
);
/*
taosMsleep(10000);
ret = syncNodeStopPingTimer(pSyncNode);
ret = syncNodeStopPingTimer(pSyncNode);
assert(ret == 0);
assert(ret == 0);
*/
while
(
1
)
{
while
(
1
)
{
taosMsleep
(
1000
);
taosMsleep
(
1000
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录