Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dbea8004
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dbea8004
编写于
1月 16, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
1月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19555 from taosdata/enh/TD-20047
fix: update epset on dnode info changed
上级
60800c77
ad8c7364
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
61 addition
and
21 deletion
+61
-21
include/common/tmsgcb.h
include/common/tmsgcb.h
+1
-0
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+1
-0
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+29
-21
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+21
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+1
-0
source/libs/transport/src/tmsgcb.c
source/libs/transport/src/tmsgcb.c
+6
-0
未找到文件。
include/common/tmsgcb.h
浏览文件 @
dbea8004
...
@@ -71,6 +71,7 @@ void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
...
@@ -71,6 +71,7 @@ void tmsgRegisterBrokenLinkArg(SRpcMsg* pMsg);
void
tmsgReleaseHandle
(
SRpcHandleInfo
*
pHandle
,
int8_t
type
);
void
tmsgReleaseHandle
(
SRpcHandleInfo
*
pHandle
,
int8_t
type
);
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
);
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
);
void
tmsgUpdateDnodeInfo
(
int32_t
*
dnodeId
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
);
void
tmsgUpdateDnodeInfo
(
int32_t
*
dnodeId
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
);
void
tmsgUpdateDnodeEpSet
(
SEpSet
*
epset
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
dbea8004
...
@@ -100,6 +100,7 @@ typedef struct {
...
@@ -100,6 +100,7 @@ typedef struct {
bool
stopped
;
bool
stopped
;
SEpSet
mnodeEps
;
SEpSet
mnodeEps
;
SArray
*
dnodeEps
;
SArray
*
dnodeEps
;
SArray
*
oldDnodeEps
;
SHashObj
*
dnodeHash
;
SHashObj
*
dnodeHash
;
TdThreadRwlock
lock
;
TdThreadRwlock
lock
;
SMsgCb
msgCb
;
SMsgCb
msgCb
;
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
dbea8004
...
@@ -332,40 +332,48 @@ void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) {
...
@@ -332,40 +332,48 @@ void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) {
}
}
}
}
void
dmUpdateDnodeInfo
(
void
*
data
,
int32_t
*
d
nodeI
d
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
)
{
void
dmUpdateDnodeInfo
(
void
*
data
,
int32_t
*
d
i
d
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
)
{
SDnodeData
*
pData
=
data
;
SDnodeData
*
pData
=
data
;
int32_t
ret
=
-
1
;
int32_t
dnodeId
=
-
1
;
if
(
did
!=
NULL
)
dnodeId
=
*
did
;
taosThreadRwlockRdlock
(
&
pData
->
lock
);
taosThreadRwlockRdlock
(
&
pData
->
lock
);
if
(
*
dnodeId
<=
0
)
{
for
(
int32_t
i
=
0
;
i
<
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
++
i
)
{
if
(
pData
->
oldDnodeEps
!=
NULL
)
{
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
pData
->
oldDnodeEps
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SDnodeEp
*
pDnodeEp
=
taosArrayGet
(
pData
->
oldDnodeEps
,
i
);
if
(
strcmp
(
pDnodeEp
->
ep
.
fqdn
,
fqdn
)
==
0
&&
pDnodeEp
->
ep
.
port
==
*
port
)
{
dInfo
(
"dnode:%d, update ep:%s:%u to %s:%u"
,
dnodeId
,
fqdn
,
*
port
,
pDnodeEp
->
ep
.
fqdn
,
pDnodeEp
->
ep
.
port
);
tstrncpy
(
fqdn
,
pDnodeEp
->
ep
.
fqdn
,
TSDB_FQDN_LEN
);
*
port
=
pDnodeEp
->
ep
.
port
;
}
}
}
if
(
did
!=
NULL
&&
dnodeId
<=
0
)
{
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SDnodeEp
*
pDnodeEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
SDnodeEp
*
pDnodeEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
if
(
strcmp
(
pDnodeEp
->
ep
.
fqdn
,
fqdn
)
==
0
&&
pDnodeEp
->
ep
.
port
==
*
port
)
{
if
(
strcmp
(
pDnodeEp
->
ep
.
fqdn
,
fqdn
)
==
0
&&
pDnodeEp
->
ep
.
port
==
*
port
)
{
dInfo
(
"dnode:%s:%u, update dnodeId
from %d to %d"
,
fqdn
,
*
port
,
*
dnodeId
,
pDnodeEp
->
id
);
dInfo
(
"dnode:%s:%u, update dnodeId
to dnode:%d"
,
fqdn
,
*
port
,
pDnodeEp
->
id
);
*
d
nodeI
d
=
pDnodeEp
->
id
;
*
d
i
d
=
pDnodeEp
->
id
;
if
(
clusterId
!=
NULL
)
*
clusterId
=
pData
->
clusterId
;
if
(
clusterId
!=
NULL
)
*
clusterId
=
pData
->
clusterId
;
ret
=
0
;
}
}
}
}
if
(
ret
!=
0
)
{
}
dInfo
(
"dnode:%s:%u, failed to update dnodeId:%d"
,
fqdn
,
*
port
,
*
dnodeId
);
}
if
(
dnodeId
>
0
)
{
}
else
{
SDnodeEp
*
pDnodeEp
=
taosHashGet
(
pData
->
dnodeHash
,
&
dnodeId
,
sizeof
(
int32_t
));
SDnodeEp
*
pDnodeEp
=
taosHashGet
(
pData
->
dnodeHash
,
dnodeId
,
sizeof
(
int32_t
));
if
(
pDnodeEp
)
{
if
(
pDnodeEp
)
{
if
(
strcmp
(
pDnodeEp
->
ep
.
fqdn
,
fqdn
)
!=
0
)
{
if
(
strcmp
(
pDnodeEp
->
ep
.
fqdn
,
fqdn
)
!=
0
||
pDnodeEp
->
ep
.
port
!=
*
port
)
{
dInfo
(
"dnode:%d, update
port from %s to %s"
,
*
dnodeId
,
fqdn
,
pDnodeEp
->
ep
.
fqdn
);
dInfo
(
"dnode:%d, update
ep:%s:%u to %s:%u"
,
dnodeId
,
fqdn
,
*
port
,
pDnodeEp
->
ep
.
fqdn
,
pDnodeEp
->
ep
.
port
);
tstrncpy
(
fqdn
,
pDnodeEp
->
ep
.
fqdn
,
TSDB_FQDN_LEN
);
tstrncpy
(
fqdn
,
pDnodeEp
->
ep
.
fqdn
,
TSDB_FQDN_LEN
);
}
if
(
pDnodeEp
->
ep
.
port
!=
*
port
)
{
dInfo
(
"dnode:%d, update port from %u to %u"
,
*
dnodeId
,
*
port
,
pDnodeEp
->
ep
.
port
);
*
port
=
pDnodeEp
->
ep
.
port
;
*
port
=
pDnodeEp
->
ep
.
port
;
}
}
if
(
clusterId
!=
NULL
)
*
clusterId
=
pData
->
clusterId
;
if
(
clusterId
!=
NULL
)
*
clusterId
=
pData
->
clusterId
;
ret
=
0
;
}
else
{
dInfo
(
"dnode:%d, failed to update dnode info"
,
*
dnodeId
);
}
}
}
}
taosThreadRwlockUnlock
(
&
pData
->
lock
);
taosThreadRwlockUnlock
(
&
pData
->
lock
);
// return ret;
}
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
dbea8004
...
@@ -742,6 +742,7 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
...
@@ -742,6 +742,7 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) {
if
(
tDecodeSMqConsumerObj
(
buf
,
pConsumer
)
==
NULL
)
{
if
(
tDecodeSMqConsumerObj
(
buf
,
pConsumer
)
==
NULL
)
{
goto
CM_DECODE_OVER
;
goto
CM_DECODE_OVER
;
}
}
tmsgUpdateDnodeEpSet
(
&
pConsumer
->
ep
);
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
dbea8004
...
@@ -180,6 +180,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
...
@@ -180,6 +180,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) {
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_DNODE_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
terrno
=
0
;
tmsgUpdateDnodeInfo
(
&
pDnode
->
id
,
NULL
,
pDnode
->
fqdn
,
&
pDnode
->
port
);
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
if
(
terrno
!=
0
)
{
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
dbea8004
...
@@ -760,6 +760,27 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
...
@@ -760,6 +760,27 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) {
goto
SUB_DECODE_OVER
;
goto
SUB_DECODE_OVER
;
}
}
// update epset saved in mnode
if
(
pSub
->
unassignedVgs
!=
NULL
)
{
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
pSub
->
unassignedVgs
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SMqVgEp
*
pMqVgEp
=
taosArrayGet
(
pSub
->
unassignedVgs
,
i
);
tmsgUpdateDnodeEpSet
(
&
pMqVgEp
->
epSet
);
}
}
if
(
pSub
->
consumerHash
!=
NULL
)
{
void
*
pIter
=
taosHashIterate
(
pSub
->
consumerHash
,
NULL
);
while
(
pIter
)
{
SMqConsumerEp
*
pConsumerEp
=
pIter
;
int32_t
size
=
(
int32_t
)
taosArrayGetSize
(
pConsumerEp
->
vgs
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SMqVgEp
*
pMqVgEp
=
taosArrayGet
(
pConsumerEp
->
vgs
,
i
);
tmsgUpdateDnodeEpSet
(
&
pMqVgEp
->
epSet
);
}
pIter
=
taosHashIterate
(
pSub
->
consumerHash
,
pIter
);
}
}
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
SUB_DECODE_OVER:
SUB_DECODE_OVER:
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
dbea8004
...
@@ -329,6 +329,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
...
@@ -329,6 +329,7 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
action
.
pRaw
=
NULL
;
action
.
pRaw
=
NULL
;
}
else
if
(
action
.
actionType
==
TRANS_ACTION_MSG
)
{
}
else
if
(
action
.
actionType
==
TRANS_ACTION_MSG
)
{
SDB_GET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
),
_OVER
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
(
void
*
)
&
action
.
epSet
,
sizeof
(
SEpSet
),
_OVER
);
tmsgUpdateDnodeEpSet
(
&
action
.
epSet
);
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
action
.
msgType
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
action
.
msgType
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
unused
/*&action.msgSent*/
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
unused
/*&action.msgSent*/
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
unused
/*&action.msgReceived*/
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
unused
/*&action.msgReceived*/
,
_OVER
)
...
...
source/libs/transport/src/tmsgcb.c
浏览文件 @
dbea8004
...
@@ -62,3 +62,9 @@ void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.repo
...
@@ -62,3 +62,9 @@ void tmsgReportStartup(const char* name, const char* desc) { (*defaultMsgCb.repo
void
tmsgUpdateDnodeInfo
(
int32_t
*
dnodeId
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
)
{
void
tmsgUpdateDnodeInfo
(
int32_t
*
dnodeId
,
int64_t
*
clusterId
,
char
*
fqdn
,
uint16_t
*
port
)
{
(
*
defaultMsgCb
.
updateDnodeInfoFp
)(
defaultMsgCb
.
data
,
dnodeId
,
clusterId
,
fqdn
,
port
);
(
*
defaultMsgCb
.
updateDnodeInfoFp
)(
defaultMsgCb
.
data
,
dnodeId
,
clusterId
,
fqdn
,
port
);
}
}
void
tmsgUpdateDnodeEpSet
(
SEpSet
*
epset
)
{
for
(
int32_t
i
=
0
;
i
<
epset
->
numOfEps
;
++
i
)
{
tmsgUpdateDnodeInfo
(
NULL
,
NULL
,
epset
->
eps
[
i
].
fqdn
,
&
epset
->
eps
[
i
].
port
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录