Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
37fea8cf
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
37fea8cf
编写于
2月 21, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(tmq): update the epset when the leader of vnode changed.
上级
9a5b7ce2
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
43 addition
and
17 deletion
+43
-17
include/common/tmisce.h
include/common/tmisce.h
+5
-4
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+22
-11
source/common/src/tmisce.c
source/common/src/tmisce.c
+13
-0
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-1
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+1
-0
未找到文件。
include/common/tmisce.h
浏览文件 @
37fea8cf
...
...
@@ -27,11 +27,12 @@ typedef struct SCorEpSet {
SEpSet
epSet
;
}
SCorEpSet
;
#define GET_ACTIVE_EP(_eps) (&((_eps)->eps[(_eps)->inUse]))
int32_t
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
);
void
addEpIntoEpSet
(
SEpSet
*
pEpSet
,
const
char
*
fqdn
,
uint16_t
port
);
bool
isEpsetEqual
(
const
SEpSet
*
s1
,
const
SEpSet
*
s2
);
void
epsetAssign
(
SEpSet
*
dst
,
const
SEpSet
*
pSrc
);
void
updateEpSet_s
(
SCorEpSet
*
pEpSet
,
SEpSet
*
pNewEpSet
);
SEpSet
getEpSet_s
(
SCorEpSet
*
pEpSet
);
...
...
include/common/tmsg.h
浏览文件 @
37fea8cf
...
...
@@ -1830,7 +1830,7 @@ typedef struct {
}
SMqConsumerLostMsg
,
SMqConsumerRecoverMsg
,
SMqConsumerClearMsg
;
typedef
struct
{
uint64_t
consumerId
;
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
char
clientId
[
256
];
SArray
*
topicNames
;
// SArray<char**>
...
...
source/client/src/clientTmq.c
浏览文件 @
37fea8cf
...
...
@@ -66,7 +66,6 @@ struct tmq_conf_t {
int8_t
snapEnable
;
int32_t
snapBatchSize
;
bool
hbBgEnable
;
uint16_t
port
;
int32_t
autoCommitInterval
;
char
*
ip
;
...
...
@@ -213,6 +212,7 @@ typedef struct {
typedef
struct
{
SMqCommitCbParamSet
*
params
;
STqOffset
*
pOffset
;
SMqClientVg
*
pMqVg
;
/*char topicName[TSDB_TOPIC_FNAME_LEN];*/
/*int32_t vgId;*/
}
SMqCommitCbParam
;
...
...
@@ -440,6 +440,17 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
}
#endif
// there may be race condition. fix it
if
(
pBuf
->
pEpSet
!=
NULL
&&
pParam
->
pMqVg
!=
NULL
)
{
SMqClientVg
*
pMqVg
=
pParam
->
pMqVg
;
SEp
*
pEp
=
GET_ACTIVE_EP
(
pBuf
->
pEpSet
);
SEp
*
pOld
=
GET_ACTIVE_EP
(
&
(
pMqVg
->
epSet
));
uDebug
(
"subKey:%s update the epset vgId:%d, ep:%s:%d, old ep:%s:%d"
,
pParam
->
pOffset
->
subKey
,
pMqVg
->
vgId
,
pEp
->
fqdn
,
pEp
->
port
,
pOld
->
fqdn
,
pOld
->
port
);
pParam
->
pMqVg
->
epSet
=
*
pBuf
->
pEpSet
;
}
taosMemoryFree
(
pParam
->
pOffset
);
taosMemoryFree
(
pBuf
->
pData
);
taosMemoryFree
(
pBuf
->
pEpSet
);
...
...
@@ -448,7 +459,6 @@ int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
* pOffset->version);*/
tmqCommitRspCountDown
(
pParamSet
);
return
0
;
}
...
...
@@ -498,6 +508,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
pParam
->
params
=
pParamSet
;
pParam
->
pOffset
=
pOffset
;
pParam
->
pMqVg
=
pVg
;
// there may be an race condition
// build send info
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
...
...
@@ -518,7 +529,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT
tscDebug
(
"consumer:0x%"
PRIx64
" topic:%s on vgId:%d offset:%"
PRId64
" prev:%"
PRId64
", ep:%s:%d"
,
tmq
->
consumerId
,
pOffset
->
subKey
,
pVg
->
vgId
,
pOffset
->
val
.
version
,
pVg
->
committedOffset
.
version
,
pEp
->
fqdn
,
pEp
->
port
);
// TODO: put into cb
// TODO: put into cb
, the commit offset should be move to the callback function
pVg
->
committedOffset
=
pVg
->
currentOffset
;
pMsgSendInfo
->
requestId
=
generateRequestId
();
...
...
source/common/src/tmisce.c
浏览文件 @
37fea8cf
...
...
@@ -60,6 +60,19 @@ bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
return
true
;
}
void
epsetAssign
(
SEpSet
*
pDst
,
const
SEpSet
*
pSrc
)
{
if
(
pSrc
==
NULL
||
pDst
==
NULL
)
{
return
;
}
pDst
->
inUse
=
pSrc
->
inUse
;
pDst
->
numOfEps
=
pSrc
->
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
pSrc
->
numOfEps
;
++
i
)
{
pDst
->
eps
[
i
].
port
=
pSrc
->
eps
[
i
].
port
;
tstrncpy
(
pDst
->
eps
[
i
].
fqdn
,
pSrc
->
eps
[
i
].
fqdn
,
tListLen
(
pSrc
->
eps
[
i
].
fqdn
));
}
}
void
updateEpSet_s
(
SCorEpSet
*
pEpSet
,
SEpSet
*
pNewEpSet
)
{
taosCorBeginWrite
(
&
pEpSet
->
version
);
pEpSet
->
epSet
=
*
pNewEpSet
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
37fea8cf
...
...
@@ -413,7 +413,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
int32_t
serverEpoch
=
atomic_load_32
(
&
pConsumer
->
epoch
);
// 2. check epoch, only send ep info when epoch
e
s do not match
// 2. check epoch, only send ep info when epochs do not match
if
(
epoch
!=
serverEpoch
)
{
taosRLockLatch
(
&
pConsumer
->
lock
);
mInfo
(
"process ask ep, consumer:%"
PRId64
"(epoch %d), server epoch %d"
,
consumerId
,
epoch
,
serverEpoch
);
...
...
source/libs/transport/src/transCli.c
浏览文件 @
37fea8cf
...
...
@@ -2303,6 +2303,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
STransConnCtx
*
pCtx
=
taosMemoryCalloc
(
1
,
sizeof
(
STransConnCtx
));
pCtx
->
epSet
=
*
pEpSet
;
pCtx
->
origEpSet
=
*
pEpSet
;
pCtx
->
ahandle
=
pReq
->
info
.
ahandle
;
pCtx
->
msgType
=
pReq
->
msgType
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录