Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c156d964
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看板
未验证
提交
c156d964
编写于
6月 14, 2022
作者:
L
Li Minghao
提交者:
GitHub
6月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13841 from taosdata/feature/3.0_mhli
refactor(sync): add respMgr trace log
上级
2f43d3a9
a51eee06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
4 deletion
+41
-4
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-3
source/libs/sync/src/syncRespMgr.c
source/libs/sync/src/syncRespMgr.c
+14
-0
source/libs/sync/src/syncUtil.c
source/libs/sync/src/syncUtil.c
+26
-1
未找到文件。
source/libs/sync/src/syncMain.c
浏览文件 @
c156d964
...
...
@@ -561,8 +561,6 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, const SRpcMsg* pMsg, bool isWeak)
stub
.
createTime
=
taosGetTimestampMs
();
stub
.
rpcMsg
=
*
pMsg
;
uint64_t
seqNum
=
syncRespMgrAdd
(
pSyncNode
->
pSyncRespMgr
,
&
stub
);
sDebug
(
"vgId:%d sync event propose, type:%s seq:%"
PRIu64
" handle:%p"
,
pSyncNode
->
vgId
,
TMSG_INFO
(
pMsg
->
msgType
),
seqNum
,
pMsg
->
info
.
handle
);
SyncClientRequest
*
pSyncMsg
=
syncClientRequestBuild2
(
pMsg
,
seqNum
,
isWeak
,
pSyncNode
->
vgId
);
SRpcMsg
rpcMsg
;
...
...
@@ -771,7 +769,7 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
}
// tools
pSyncNode
->
pSyncRespMgr
=
syncRespMgrCreate
(
NULL
,
0
);
pSyncNode
->
pSyncRespMgr
=
syncRespMgrCreate
(
pSyncNode
,
0
);
assert
(
pSyncNode
->
pSyncRespMgr
!=
NULL
);
// restore state
...
...
source/libs/sync/src/syncRespMgr.c
浏览文件 @
c156d964
...
...
@@ -44,6 +44,10 @@ int64_t syncRespMgrAdd(SSyncRespMgr *pObj, SRespStub *pStub) {
uint64_t
keyCode
=
++
(
pObj
->
seqNum
);
taosHashPut
(
pObj
->
pRespHash
,
&
keyCode
,
sizeof
(
keyCode
),
pStub
,
sizeof
(
SRespStub
));
SSyncNode
*
pSyncNode
=
pObj
->
data
;
sDebug
(
"vgId:%d sync event resp mgr add, type:%s seq:%lu handle:%p"
,
pSyncNode
->
vgId
,
TMSG_INFO
(
pStub
->
rpcMsg
.
msgType
),
keyCode
,
pStub
->
rpcMsg
.
info
.
handle
);
taosThreadMutexUnlock
(
&
(
pObj
->
mutex
));
return
keyCode
;
}
...
...
@@ -63,6 +67,11 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStub) {
void
*
pTmp
=
taosHashGet
(
pObj
->
pRespHash
,
&
index
,
sizeof
(
index
));
if
(
pTmp
!=
NULL
)
{
memcpy
(
pStub
,
pTmp
,
sizeof
(
SRespStub
));
SSyncNode
*
pSyncNode
=
pObj
->
data
;
sDebug
(
"vgId:%d sync event resp mgr get, type:%s seq:%lu handle:%p"
,
pSyncNode
->
vgId
,
TMSG_INFO
(
pStub
->
rpcMsg
.
msgType
),
index
,
pStub
->
rpcMsg
.
info
.
handle
);
taosThreadMutexUnlock
(
&
(
pObj
->
mutex
));
return
1
;
// get one object
}
...
...
@@ -76,6 +85,11 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t index, SRespStub *pStu
void
*
pTmp
=
taosHashGet
(
pObj
->
pRespHash
,
&
index
,
sizeof
(
index
));
if
(
pTmp
!=
NULL
)
{
memcpy
(
pStub
,
pTmp
,
sizeof
(
SRespStub
));
SSyncNode
*
pSyncNode
=
pObj
->
data
;
sDebug
(
"vgId:%d sync event resp mgr get and del, type:%s seq:%lu handle:%p"
,
pSyncNode
->
vgId
,
TMSG_INFO
(
pStub
->
rpcMsg
.
msgType
),
index
,
pStub
->
rpcMsg
.
info
.
handle
);
taosHashRemove
(
pObj
->
pRespHash
,
&
index
,
sizeof
(
index
));
taosThreadMutexUnlock
(
&
(
pObj
->
mutex
));
return
1
;
// get one object
...
...
source/libs/sync/src/syncUtil.c
浏览文件 @
c156d964
...
...
@@ -14,6 +14,8 @@
*/
#include "syncUtil.h"
#include <stdio.h>
#include "syncEnv.h"
void
addEpIntoEpSet
(
SEpSet
*
pEpSet
,
const
char
*
fqdn
,
uint16_t
port
);
...
...
@@ -21,8 +23,31 @@ void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port);
// ---- encode / decode
uint64_t
syncUtilAddr2U64
(
const
char
*
host
,
uint16_t
port
)
{
uint64_t
u64
;
uint32_t
hostU32
=
taosGetIpv4FromFqdn
(
host
);
if
(
hostU32
==
(
uint32_t
)
-
1
)
{
sError
(
"Get IP address error"
);
return
-
1
;
}
/*
uint32_t hostU32 = (uint32_t)taosInetAddr(host);
// assert(hostU32 != (uint32_t)-1);
if (hostU32 == (uint32_t)-1) {
struct hostent* hostEnt = gethostbyname(host);
if (hostEnt == NULL) {
sError("Get IP address error");
return -1;
}
const char* newHost = taosInetNtoa(*(struct in_addr*)(hostEnt->h_addr_list[0]));
hostU32 = (uint32_t)taosInetAddr(newHost);
if (hostU32 == (uint32_t)-1) {
sError("change %s to id, error", newHost);
}
// ASSERT(hostU32 != (uint32_t)-1);
}
*/
u64
=
(((
uint64_t
)
hostU32
)
<<
32
)
|
(((
uint32_t
)
port
)
<<
16
);
return
u64
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录