Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e4152b43
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,发现更多精彩内容 >>
未验证
提交
e4152b43
编写于
7月 16, 2022
作者:
L
Liu Jicong
提交者:
GitHub
7月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14993 from taosdata/feature/stream
feat(tmq): support background heartbeat
上级
c0baae64
01a345a7
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
394 addition
and
420 deletion
+394
-420
include/common/tmsg.h
include/common/tmsg.h
+37
-105
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+2
-6
source/client/src/tmq.c
source/client/src/tmq.c
+317
-246
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-0
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+35
-2
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-61
未找到文件。
include/common/tmsg.h
浏览文件 @
e4152b43
...
...
@@ -75,13 +75,18 @@ typedef uint16_t tmsg_t;
#define TSDB_IE_TYPE_DNODE_EXT 6
#define TSDB_IE_TYPE_DNODE_STATE 7
enum
{
CONN_TYPE__QUERY
=
1
,
CONN_TYPE__TMQ
,
CONN_TYPE__UDFD
,
CONN_TYPE__MAX
};
enum
{
CONN_TYPE__QUERY
=
1
,
CONN_TYPE__TMQ
,
CONN_TYPE__UDFD
,
CONN_TYPE__MAX
,
};
enum
{
HEARTBEAT_KEY_USER_AUTHINFO
=
1
,
HEARTBEAT_KEY_DBINFO
,
HEARTBEAT_KEY_STBINFO
,
HEARTBEAT_KEY_
MQ_TMP
,
HEARTBEAT_KEY_
TMQ
,
};
typedef
enum
_mgmt_table
{
...
...
@@ -2146,6 +2151,15 @@ typedef struct {
char
cgroup
[
TSDB_CGROUP_LEN
];
}
SMqAskEpReq
;
typedef
struct
{
int64_t
consumerId
;
int32_t
epoch
;
}
SMqHbReq
;
typedef
struct
{
int8_t
reserved
;
}
SMqHbRsp
;
typedef
struct
{
int32_t
key
;
int32_t
valueLen
;
...
...
@@ -2335,29 +2349,30 @@ static FORCE_INLINE int32_t tDecodeSClientHbKey(SDecoder* pDecoder, SClientHbKey
return
0
;
}
typedef
struct
SMqHbVgInfo
{
typedef
struct
{
int32_t
vgId
;
}
SMqHbVgInfo
;
// TODO stas
}
SMqReportVgInfo
;
static
FORCE_INLINE
int32_t
taosEncodeSMqVgInfo
(
void
**
buf
,
const
SMq
Hb
VgInfo
*
pVgInfo
)
{
static
FORCE_INLINE
int32_t
taosEncodeSMqVgInfo
(
void
**
buf
,
const
SMq
Report
VgInfo
*
pVgInfo
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgInfo
->
vgId
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqVgInfo
(
void
*
buf
,
SMq
Hb
VgInfo
*
pVgInfo
)
{
static
FORCE_INLINE
void
*
taosDecodeSMqVgInfo
(
void
*
buf
,
SMq
Report
VgInfo
*
pVgInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgInfo
->
vgId
);
return
buf
;
}
typedef
struct
SMqHbTopicInfo
{
typedef
struct
{
int32_t
epoch
;
int64_t
topicUid
;
char
name
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
pVgInfo
;
// SArray<SMqHbVgInfo>
}
SMq
Hb
TopicInfo
;
}
SMqTopicInfo
;
static
FORCE_INLINE
int32_t
taosEncodeSMq
HbTopicInfoMsg
(
void
**
buf
,
const
SMqHb
TopicInfo
*
pTopicInfo
)
{
static
FORCE_INLINE
int32_t
taosEncodeSMq
TopicInfoMsg
(
void
**
buf
,
const
SMq
TopicInfo
*
pTopicInfo
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pTopicInfo
->
epoch
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pTopicInfo
->
topicUid
);
...
...
@@ -2365,35 +2380,35 @@ static FORCE_INLINE int32_t taosEncodeSMqHbTopicInfoMsg(void** buf, const SMqHbT
int32_t
sz
=
taosArrayGetSize
(
pTopicInfo
->
pVgInfo
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMq
HbVgInfo
*
pVgInfo
=
(
SMqHb
VgInfo
*
)
taosArrayGet
(
pTopicInfo
->
pVgInfo
,
i
);
SMq
ReportVgInfo
*
pVgInfo
=
(
SMqReport
VgInfo
*
)
taosArrayGet
(
pTopicInfo
->
pVgInfo
,
i
);
tlen
+=
taosEncodeSMqVgInfo
(
buf
,
pVgInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMq
HbTopicInfoMsg
(
void
*
buf
,
SMqHb
TopicInfo
*
pTopicInfo
)
{
static
FORCE_INLINE
void
*
taosDecodeSMq
TopicInfoMsg
(
void
*
buf
,
SMq
TopicInfo
*
pTopicInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pTopicInfo
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pTopicInfo
->
topicUid
);
buf
=
taosDecodeStringTo
(
buf
,
pTopicInfo
->
name
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pTopicInfo
->
pVgInfo
=
taosArrayInit
(
sz
,
sizeof
(
SMq
Hb
VgInfo
));
pTopicInfo
->
pVgInfo
=
taosArrayInit
(
sz
,
sizeof
(
SMq
Report
VgInfo
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMq
Hb
VgInfo
vgInfo
;
SMq
Report
VgInfo
vgInfo
;
buf
=
taosDecodeSMqVgInfo
(
buf
,
&
vgInfo
);
taosArrayPush
(
pTopicInfo
->
pVgInfo
,
&
vgInfo
);
}
return
buf
;
}
typedef
struct
SMqHbMsg
{
typedef
struct
{
int32_t
status
;
// ask hb endpoint
int32_t
epoch
;
int64_t
consumerId
;
SArray
*
pTopics
;
// SArray<SMqHbTopicInfo>
}
SMq
HbMsg
;
}
SMq
ReportReq
;
static
FORCE_INLINE
int32_t
taosEncodeSMq
Msg
(
void
**
buf
,
const
SMqHbMsg
*
pMsg
)
{
static
FORCE_INLINE
int32_t
taosEncodeSMq
ReportMsg
(
void
**
buf
,
const
SMqReportReq
*
pMsg
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
status
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
epoch
);
...
...
@@ -2401,22 +2416,22 @@ static FORCE_INLINE int32_t taosEncodeSMqMsg(void** buf, const SMqHbMsg* pMsg) {
int32_t
sz
=
taosArrayGetSize
(
pMsg
->
pTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMq
HbTopicInfo
*
topicInfo
=
(
SMqHb
TopicInfo
*
)
taosArrayGet
(
pMsg
->
pTopics
,
i
);
tlen
+=
taosEncodeSMq
Hb
TopicInfoMsg
(
buf
,
topicInfo
);
SMq
TopicInfo
*
topicInfo
=
(
SMq
TopicInfo
*
)
taosArrayGet
(
pMsg
->
pTopics
,
i
);
tlen
+=
taosEncodeSMqTopicInfoMsg
(
buf
,
topicInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMq
Msg
(
void
*
buf
,
SMqHbMsg
*
pMsg
)
{
static
FORCE_INLINE
void
*
taosDecodeSMq
ReportMsg
(
void
*
buf
,
SMqReportReq
*
pMsg
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
status
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pMsg
->
consumerId
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pMsg
->
pTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMq
Hb
TopicInfo
));
pMsg
->
pTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqTopicInfo
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMq
Hb
TopicInfo
topicInfo
;
buf
=
taosDecodeSMq
Hb
TopicInfoMsg
(
buf
,
&
topicInfo
);
SMqTopicInfo
topicInfo
;
buf
=
taosDecodeSMqTopicInfoMsg
(
buf
,
&
topicInfo
);
taosArrayPush
(
pMsg
->
pTopics
,
&
topicInfo
);
}
return
buf
;
...
...
@@ -2921,89 +2936,6 @@ typedef struct {
int32_t
tEncodeSMqDataRsp
(
SEncoder
*
pEncoder
,
const
SMqDataRsp
*
pRsp
);
int32_t
tDecodeSMqDataRsp
(
SDecoder
*
pDecoder
,
SMqDataRsp
*
pRsp
);
#if 0
typedef struct {
SMqRspHead head;
int64_t reqOffset;
int64_t rspOffset;
int32_t skipLogNum;
int32_t blockNum;
int8_t withTbName;
int8_t withSchema;
SArray* blockDataLen; // SArray<int32_t>
SArray* blockData; // SArray<SRetrieveTableRsp*>
SArray* blockTbName; // SArray<char*>
SArray* blockSchema; // SArray<SSchemaWrapper>
} SMqDataBlkRsp;
static FORCE_INLINE int32_t tEncodeSMqDataBlkRsp(void** buf, const SMqDataBlkRsp* pRsp) {
int32_t tlen = 0;
tlen += taosEncodeFixedI64(buf, pRsp->reqOffset);
tlen += taosEncodeFixedI64(buf, pRsp->rspOffset);
tlen += taosEncodeFixedI32(buf, pRsp->skipLogNum);
tlen += taosEncodeFixedI32(buf, pRsp->blockNum);
if (pRsp->blockNum != 0) {
tlen += taosEncodeFixedI8(buf, pRsp->withTbName);
tlen += taosEncodeFixedI8(buf, pRsp->withSchema);
for (int32_t i = 0; i < pRsp->blockNum; i++) {
int32_t bLen = *(int32_t*)taosArrayGet(pRsp->blockDataLen, i);
void* data = taosArrayGetP(pRsp->blockData, i);
tlen += taosEncodeFixedI32(buf, bLen);
tlen += taosEncodeBinary(buf, data, bLen);
if (pRsp->withSchema) {
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRsp->blockSchema, i);
tlen += taosEncodeSSchemaWrapper(buf, pSW);
}
if (pRsp->withTbName) {
char* tbName = (char*)taosArrayGetP(pRsp->blockTbName, i);
tlen += taosEncodeString(buf, tbName);
}
}
}
return tlen;
}
static FORCE_INLINE void* tDecodeSMqDataBlkRsp(const void* buf, SMqDataBlkRsp* pRsp) {
buf = taosDecodeFixedI64(buf, &pRsp->reqOffset);
buf = taosDecodeFixedI64(buf, &pRsp->rspOffset);
buf = taosDecodeFixedI32(buf, &pRsp->skipLogNum);
buf = taosDecodeFixedI32(buf, &pRsp->blockNum);
if (pRsp->blockNum != 0) {
pRsp->blockData = taosArrayInit(pRsp->blockNum, sizeof(void*));
pRsp->blockDataLen = taosArrayInit(pRsp->blockNum, sizeof(int32_t));
buf = taosDecodeFixedI8(buf, &pRsp->withTbName);
buf = taosDecodeFixedI8(buf, &pRsp->withSchema);
if (pRsp->withTbName) {
pRsp->blockTbName = taosArrayInit(pRsp->blockNum, sizeof(void*));
}
if (pRsp->withSchema) {
pRsp->blockSchema = taosArrayInit(pRsp->blockNum, sizeof(void*));
}
for (int32_t i = 0; i < pRsp->blockNum; i++) {
int32_t bLen = 0;
void* data = NULL;
buf = taosDecodeFixedI32(buf, &bLen);
buf = taosDecodeBinary(buf, &data, bLen);
taosArrayPush(pRsp->blockDataLen, &bLen);
taosArrayPush(pRsp->blockData, &data);
if (pRsp->withSchema) {
SSchemaWrapper* pSW = (SSchemaWrapper*)taosMemoryMalloc(sizeof(SSchemaWrapper));
buf = taosDecodeSSchemaWrapper(buf, pSW);
taosArrayPush(pRsp->blockSchema, &pSW);
}
if (pRsp->withTbName) {
char* name = NULL;
buf = taosDecodeString(buf, &name);
taosArrayPush(pRsp->blockTbName, &name);
}
}
}
return (void*)buf;
}
#endif
typedef
struct
{
SMqRspHead
head
;
char
cgroup
[
TSDB_CGROUP_LEN
];
...
...
include/common/tmsgdef.h
浏览文件 @
e4152b43
...
...
@@ -144,6 +144,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_ASK_EP
,
"ask-ep"
,
SMqAskEpReq
,
SMqAskEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_LOST
,
"consumer-lost"
,
SMqConsumerLostMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_RECOVER
,
"consumer-recover"
,
SMqConsumerRecoverMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_HB
,
"consumer-hb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"do-rebalance"
,
SMqDoRebalanceMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DROP_CGROUP
,
"drop-cgroup"
,
SMqDropCGroupReq
,
SMqDropCGroupRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_COMMIT_OFFSET
,
"mnode-commit-offset"
,
SMqCMCommitOffsetReq
,
SMqCMCommitOffsetRsp
)
...
...
source/client/src/clientHb.c
浏览文件 @
e4152b43
...
...
@@ -571,7 +571,8 @@ int32_t hbQueryHbReqHandle(SClientHbKey *connKey, void *param, SClientHbReq *req
return
TSDB_CODE_SUCCESS
;
}
void
hbMgrInitMqHbHandle
()
{
static
FORCE_INLINE
void
hbMgrInitHandle
()
{
// init all handle
clientHbMgr
.
reqHandle
[
CONN_TYPE__QUERY
]
=
hbQueryHbReqHandle
;
clientHbMgr
.
reqHandle
[
CONN_TYPE__TMQ
]
=
hbMqHbReqHandle
;
...
...
@@ -579,11 +580,6 @@ void hbMgrInitMqHbHandle() {
clientHbMgr
.
rspHandle
[
CONN_TYPE__TMQ
]
=
hbMqHbRspHandle
;
}
static
FORCE_INLINE
void
hbMgrInitHandle
()
{
// init all handle
hbMgrInitMqHbHandle
();
}
SClientHbBatchReq
*
hbGatherAllInfo
(
SAppHbMgr
*
pAppHbMgr
)
{
SClientHbBatchReq
*
pBatchReq
=
taosMemoryCalloc
(
1
,
sizeof
(
SClientHbBatchReq
));
if
(
pBatchReq
==
NULL
)
{
...
...
source/client/src/tmq.c
浏览文件 @
e4152b43
此差异已折叠。
点击以展开。
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
e4152b43
...
...
@@ -196,6 +196,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_TOPIC
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SUBSCRIBE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MQ_ASK_EP
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MQ_HB
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MQ_DROP_CGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MQ_DROP_CGROUP_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MQ_COMMIT_OFFSET
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
e4152b43
...
...
@@ -48,6 +48,7 @@ static void mndCancelGetNextConsumer(SMnode *pMnode, void *pIter);
static
int32_t
mndProcessSubscribeReq
(
SRpcMsg
*
pMsg
);
static
int32_t
mndProcessAskEpReq
(
SRpcMsg
*
pMsg
);
static
int32_t
mndProcessMqHbReq
(
SRpcMsg
*
pMsg
);
static
int32_t
mndProcessMqTimerMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
mndProcessConsumerLostMsg
(
SRpcMsg
*
pMsg
);
static
int32_t
mndProcessConsumerRecoverMsg
(
SRpcMsg
*
pMsg
);
...
...
@@ -62,6 +63,7 @@ int32_t mndInitConsumer(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndConsumerActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SUBSCRIBE
,
mndProcessSubscribeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_HB
,
mndProcessMqHbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_ASK_EP
,
mndProcessAskEpReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_TIMER
,
mndProcessMqTimerMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_CONSUMER_LOST
,
mndProcessConsumerLostMsg
);
...
...
@@ -255,6 +257,33 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) {
return
0
;
}
static
int32_t
mndProcessMqHbReq
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SMqHbReq
*
pReq
=
(
SMqHbReq
*
)
pMsg
->
pCont
;
int64_t
consumerId
=
be64toh
(
pReq
->
consumerId
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
atomic_store_32
(
&
pConsumer
->
hbStatus
,
0
);
int32_t
status
=
atomic_load_32
(
&
pConsumer
->
status
);
if
(
status
==
MQ_CONSUMER_STATUS__LOST_REBD
)
{
SMqConsumerRecoverMsg
*
pRecoverMsg
=
rpcMallocCont
(
sizeof
(
SMqConsumerRecoverMsg
));
pRecoverMsg
->
consumerId
=
consumerId
;
SRpcMsg
*
pRpcMsg
=
taosMemoryCalloc
(
1
,
sizeof
(
SRpcMsg
));
pRpcMsg
->
msgType
=
TDMT_MND_MQ_CONSUMER_RECOVER
;
pRpcMsg
->
pCont
=
pRecoverMsg
;
pRpcMsg
->
contLen
=
sizeof
(
SMqConsumerRecoverMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
pRpcMsg
);
}
mndReleaseConsumer
(
pMnode
,
pConsumer
);
return
0
;
}
static
int32_t
mndProcessAskEpReq
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SMqAskEpReq
*
pReq
=
(
SMqAskEpReq
*
)
pMsg
->
pCont
;
...
...
@@ -262,19 +291,22 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
int64_t
consumerId
=
be64toh
(
pReq
->
consumerId
);
int32_t
epoch
=
ntohl
(
pReq
->
epoch
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pM
sg
->
info
.
node
,
consumerId
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
if
(
pConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_MND_CONSUMER_NOT_EXIST
;
return
-
1
;
}
ASSERT
(
strcmp
(
pReq
->
cgroup
,
pConsumer
->
cgroup
)
==
0
);
/*int32_t hbStatus = atomic_load_32(&pConsumer->hbStatus);*/
#if 1
atomic_store_32
(
&
pConsumer
->
hbStatus
,
0
);
#endif
// 1. check consumer status
int32_t
status
=
atomic_load_32
(
&
pConsumer
->
status
);
#if 1
if
(
status
==
MQ_CONSUMER_STATUS__LOST_REBD
)
{
SMqConsumerRecoverMsg
*
pRecoverMsg
=
rpcMallocCont
(
sizeof
(
SMqConsumerRecoverMsg
));
...
...
@@ -285,6 +317,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
pRpcMsg
->
contLen
=
sizeof
(
SMqConsumerRecoverMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
pRpcMsg
);
}
#endif
if
(
status
!=
MQ_CONSUMER_STATUS__READY
)
{
terrno
=
TSDB_CODE_MND_CONSUMER_NOT_READY
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
e4152b43
...
...
@@ -388,67 +388,7 @@ static void mndCancelGetNextApp(SMnode *pMnode, void *pIter) {
}
static
SClientHbRsp
*
mndMqHbBuildRsp
(
SMnode
*
pMnode
,
SClientHbReq
*
pReq
)
{
#if 0
SClientHbRsp* pRsp = taosMemoryMalloc(sizeof(SClientHbRsp));
if (pRsp == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
pRsp->connKey = pReq->connKey;
SMqHbBatchRsp batchRsp;
batchRsp.batchRsps = taosArrayInit(0, sizeof(SMqHbRsp));
if (batchRsp.batchRsps == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
SClientHbKey connKey = pReq->connKey;
SHashObj* pObj = pReq->info;
SKv* pKv = taosHashGet(pObj, "mq-tmp", strlen("mq-tmp") + 1);
if (pKv == NULL) {
taosMemoryFree(pRsp);
return NULL;
}
SMqHbMsg mqHb;
taosDecodeSMqMsg(pKv->value, &mqHb);
/*int64_t clientUid = htonl(pKv->value);*/
/*if (mqHb.epoch )*/
int sz = taosArrayGetSize(mqHb.pTopics);
SMqConsumerObj* pConsumer = mndAcquireConsumer(pMnode, mqHb.consumerId);
for (int i = 0; i < sz; i++) {
SMqHbOneTopicBatchRsp innerBatchRsp;
innerBatchRsp.rsps = taosArrayInit(sz, sizeof(SMqHbRsp));
if (innerBatchRsp.rsps == NULL) {
//TODO
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
SMqHbTopicInfo* topicInfo = taosArrayGet(mqHb.pTopics, i);
SMqConsumerTopic* pConsumerTopic = taosHashGet(pConsumer->topicHash, topicInfo->name, strlen(topicInfo->name)+1);
if (pConsumerTopic->epoch != topicInfo->epoch) {
//add new vgids into rsp
int vgSz = taosArrayGetSize(topicInfo->pVgInfo);
for (int j = 0; j < vgSz; j++) {
SMqHbRsp innerRsp;
SMqHbVgInfo* pVgInfo = taosArrayGet(topicInfo->pVgInfo, i);
SVgObj* pVgObj = mndAcquireVgroup(pMnode, pVgInfo->vgId);
innerRsp.epSet = mndGetVgroupEpset(pMnode, pVgObj);
taosArrayPush(innerBatchRsp.rsps, &innerRsp);
}
}
taosArrayPush(batchRsp.batchRsps, &innerBatchRsp);
}
int32_t tlen = taosEncodeSMqHbBatchRsp(NULL, &batchRsp);
void* buf = taosMemoryMalloc(tlen);
if (buf == NULL) {
//TODO
return NULL;
}
void* abuf = buf;
taosEncodeSMqHbBatchRsp(&abuf, &batchRsp);
pRsp->body = buf;
pRsp->bodyLen = tlen;
return pRsp;
#endif
//
return
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录