improvement
This commit is contained in:
parent
f51295a23c
commit
5d6066319a
|
@ -1649,8 +1649,7 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t leftForVer;
|
int64_t leftForVer;
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
int64_t oldConsumerId;
|
int64_t consumerId;
|
||||||
int64_t newConsumerId;
|
|
||||||
char topicName[TSDB_TOPIC_FNAME_LEN];
|
char topicName[TSDB_TOPIC_FNAME_LEN];
|
||||||
char cgroup[TSDB_CONSUMER_GROUP_LEN];
|
char cgroup[TSDB_CONSUMER_GROUP_LEN];
|
||||||
char* sql;
|
char* sql;
|
||||||
|
@ -1659,55 +1658,30 @@ typedef struct {
|
||||||
char* qmsg;
|
char* qmsg;
|
||||||
} SMqSetCVgReq;
|
} SMqSetCVgReq;
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSSubQueryMsg(void** buf, const SSubQueryMsg* pMsg) {
|
|
||||||
int32_t tlen = 0;
|
|
||||||
tlen += taosEncodeFixedU64(buf, pMsg->sId);
|
|
||||||
tlen += taosEncodeFixedU64(buf, pMsg->queryId);
|
|
||||||
tlen += taosEncodeFixedU64(buf, pMsg->taskId);
|
|
||||||
tlen += taosEncodeFixedU32(buf, pMsg->sqlLen);
|
|
||||||
tlen += taosEncodeFixedU32(buf, pMsg->phyLen);
|
|
||||||
//tlen += taosEncodeBinary(buf, pMsg->msg, pMsg->contentLen);
|
|
||||||
return tlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSSubQueryMsg(void* buf, SSubQueryMsg* pMsg) {
|
|
||||||
buf = taosDecodeFixedU64(buf, &pMsg->sId);
|
|
||||||
buf = taosDecodeFixedU64(buf, &pMsg->queryId);
|
|
||||||
buf = taosDecodeFixedU64(buf, &pMsg->taskId);
|
|
||||||
buf = taosDecodeFixedU32(buf, &pMsg->sqlLen);
|
|
||||||
buf = taosDecodeFixedU32(buf, &pMsg->phyLen);
|
|
||||||
//buf = taosDecodeBinaryTo(buf, pMsg->msg, pMsg->contentLen);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tEncodeSMqSetCVgReq(void** buf, const SMqSetCVgReq* pReq) {
|
static FORCE_INLINE int32_t tEncodeSMqSetCVgReq(void** buf, const SMqSetCVgReq* pReq) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
tlen += taosEncodeFixedI64(buf, pReq->leftForVer);
|
tlen += taosEncodeFixedI64(buf, pReq->leftForVer);
|
||||||
tlen += taosEncodeFixedI32(buf, pReq->vgId);
|
tlen += taosEncodeFixedI32(buf, pReq->vgId);
|
||||||
tlen += taosEncodeFixedI64(buf, pReq->oldConsumerId);
|
tlen += taosEncodeFixedI64(buf, pReq->consumerId);
|
||||||
tlen += taosEncodeFixedI64(buf, pReq->newConsumerId);
|
|
||||||
tlen += taosEncodeString(buf, pReq->topicName);
|
tlen += taosEncodeString(buf, pReq->topicName);
|
||||||
tlen += taosEncodeString(buf, pReq->cgroup);
|
tlen += taosEncodeString(buf, pReq->cgroup);
|
||||||
tlen += taosEncodeString(buf, pReq->sql);
|
tlen += taosEncodeString(buf, pReq->sql);
|
||||||
tlen += taosEncodeString(buf, pReq->logicalPlan);
|
tlen += taosEncodeString(buf, pReq->logicalPlan);
|
||||||
tlen += taosEncodeString(buf, pReq->physicalPlan);
|
tlen += taosEncodeString(buf, pReq->physicalPlan);
|
||||||
tlen += taosEncodeString(buf, pReq->qmsg);
|
tlen += taosEncodeString(buf, pReq->qmsg);
|
||||||
//tlen += tEncodeSSubQueryMsg(buf, &pReq->msg);
|
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void* tDecodeSMqSetCVgReq(void* buf, SMqSetCVgReq* pReq) {
|
static FORCE_INLINE void* tDecodeSMqSetCVgReq(void* buf, SMqSetCVgReq* pReq) {
|
||||||
buf = taosDecodeFixedI64(buf, &pReq->leftForVer);
|
buf = taosDecodeFixedI64(buf, &pReq->leftForVer);
|
||||||
buf = taosDecodeFixedI32(buf, &pReq->vgId);
|
buf = taosDecodeFixedI32(buf, &pReq->vgId);
|
||||||
buf = taosDecodeFixedI64(buf, &pReq->oldConsumerId);
|
buf = taosDecodeFixedI64(buf, &pReq->consumerId);
|
||||||
buf = taosDecodeFixedI64(buf, &pReq->newConsumerId);
|
|
||||||
buf = taosDecodeStringTo(buf, pReq->topicName);
|
buf = taosDecodeStringTo(buf, pReq->topicName);
|
||||||
buf = taosDecodeStringTo(buf, pReq->cgroup);
|
buf = taosDecodeStringTo(buf, pReq->cgroup);
|
||||||
buf = taosDecodeString(buf, &pReq->sql);
|
buf = taosDecodeString(buf, &pReq->sql);
|
||||||
buf = taosDecodeString(buf, &pReq->logicalPlan);
|
buf = taosDecodeString(buf, &pReq->logicalPlan);
|
||||||
buf = taosDecodeString(buf, &pReq->physicalPlan);
|
buf = taosDecodeString(buf, &pReq->physicalPlan);
|
||||||
buf = taosDecodeString(buf, &pReq->qmsg);
|
buf = taosDecodeString(buf, &pReq->qmsg);
|
||||||
//buf = tDecodeSSubQueryMsg(buf, &pReq->msg);
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -671,6 +671,8 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tmq->nextTopicIdx = (tmq->nextTopicIdx + 1) % taosArrayGetSize(tmq->clientTopics);
|
tmq->nextTopicIdx = (tmq->nextTopicIdx + 1) % taosArrayGetSize(tmq->clientTopics);
|
||||||
|
int32_t beginVgIdx = pTopic->nextVgIdx;
|
||||||
|
while(1) {
|
||||||
pTopic->nextVgIdx = (pTopic->nextVgIdx + 1) % taosArrayGetSize(pTopic->vgs);
|
pTopic->nextVgIdx = (pTopic->nextVgIdx + 1) % taosArrayGetSize(pTopic->vgs);
|
||||||
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, pTopic->nextVgIdx);
|
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, pTopic->nextVgIdx);
|
||||||
/*printf("consume vg %d, offset %ld\n", pVg->vgId, pVg->currentOffset);*/
|
/*printf("consume vg %d, offset %ld\n", pVg->vgId, pVg->currentOffset);*/
|
||||||
|
@ -711,10 +713,15 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
|
||||||
free(param);
|
free(param);
|
||||||
|
|
||||||
if (tmq_message == NULL) {
|
if (tmq_message == NULL) {
|
||||||
|
if (beginVgIdx == pTopic->nextVgIdx) {
|
||||||
usleep(blocking_time * 1000);
|
usleep(blocking_time * 1000);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmq_message;
|
return tmq_message;
|
||||||
|
}
|
||||||
|
|
||||||
/*tsem_wait(&pRequest->body.rspSem);*/
|
/*tsem_wait(&pRequest->body.rspSem);*/
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,6 @@ static int32_t mndBuildRebalanceMsg(void **pBuf, int32_t *pLen, const SMqConsume
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) {
|
static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) {
|
||||||
|
|
||||||
ASSERT(pConsumerEp->oldConsumerId != -1);
|
ASSERT(pConsumerEp->oldConsumerId != -1);
|
||||||
int32_t vgId = pConsumerEp->vgId;
|
int32_t vgId = pConsumerEp->vgId;
|
||||||
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
|
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
|
||||||
|
@ -161,8 +160,7 @@ static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqC
|
||||||
|
|
||||||
static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp) {
|
static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp) {
|
||||||
SMqSetCVgReq req = {0};
|
SMqSetCVgReq req = {0};
|
||||||
req.oldConsumerId = pConsumerEp->consumerId;
|
req.consumerId = pConsumerEp->consumerId;
|
||||||
req.newConsumerId = -1;
|
|
||||||
|
|
||||||
int32_t tlen = tEncodeSMqSetCVgReq(NULL, &req);
|
int32_t tlen = tEncodeSMqSetCVgReq(NULL, &req);
|
||||||
void *buf = malloc(sizeof(SMsgHead) + tlen);
|
void *buf = malloc(sizeof(SMsgHead) + tlen);
|
||||||
|
@ -232,7 +230,7 @@ static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
|
||||||
rsp.consumerId = consumerId;
|
rsp.consumerId = consumerId;
|
||||||
rsp.epoch = pConsumer->epoch;
|
rsp.epoch = pConsumer->epoch;
|
||||||
if (epoch != rsp.epoch) {
|
if (epoch != rsp.epoch) {
|
||||||
mInfo("old epoch %d, new epoch %d", epoch, rsp.epoch);
|
mInfo("send new assignment to consumer, consumer epoch %d, server epoch %d", epoch, rsp.epoch);
|
||||||
SArray *pTopics = pConsumer->currentTopics;
|
SArray *pTopics = pConsumer->currentTopics;
|
||||||
int sz = taosArrayGetSize(pTopics);
|
int sz = taosArrayGetSize(pTopics);
|
||||||
rsp.topics = taosArrayInit(sz, sizeof(SMqSubTopicEp));
|
rsp.topics = taosArrayInit(sz, sizeof(SMqSubTopicEp));
|
||||||
|
@ -406,10 +404,13 @@ static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
|
||||||
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
|
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
|
||||||
int vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
|
int vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
|
||||||
int vgThisConsumerAfterRb;
|
int vgThisConsumerAfterRb;
|
||||||
if (i < imbalanceVg) vgThisConsumerAfterRb = vgEachConsumer + 1;
|
if (i < imbalanceVg)
|
||||||
else vgThisConsumerAfterRb = vgEachConsumer;
|
vgThisConsumerAfterRb = vgEachConsumer + 1;
|
||||||
|
else
|
||||||
|
vgThisConsumerAfterRb = vgEachConsumer;
|
||||||
|
|
||||||
mInfo("mq consumer:%ld, connectted vgroup number change from %d to %d", pSubConsumer->consumerId, vgThisConsumerBeforeRb, vgThisConsumerAfterRb);
|
mInfo("mq consumer:%ld, connectted vgroup number change from %d to %d", pSubConsumer->consumerId,
|
||||||
|
vgThisConsumerBeforeRb, vgThisConsumerAfterRb);
|
||||||
|
|
||||||
while (taosArrayGetSize(pSubConsumer->vgInfo) > vgThisConsumerAfterRb) {
|
while (taosArrayGetSize(pSubConsumer->vgInfo) > vgThisConsumerAfterRb) {
|
||||||
SMqConsumerEp *pConsumerEp = taosArrayPop(pSubConsumer->vgInfo);
|
SMqConsumerEp *pConsumerEp = taosArrayPop(pSubConsumer->vgInfo);
|
||||||
|
@ -422,8 +423,7 @@ static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
|
||||||
int32_t status = atomic_load_32(&pRebConsumer->status);
|
int32_t status = atomic_load_32(&pRebConsumer->status);
|
||||||
if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb ||
|
if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb ||
|
||||||
(vgThisConsumerAfterRb != 0 && status != MQ_CONSUMER_STATUS__ACTIVE) ||
|
(vgThisConsumerAfterRb != 0 && status != MQ_CONSUMER_STATUS__ACTIVE) ||
|
||||||
(vgThisConsumerAfterRb == 0 && status != MQ_CONSUMER_STATUS__LOST)
|
(vgThisConsumerAfterRb == 0 && status != MQ_CONSUMER_STATUS__LOST)) {
|
||||||
) {
|
|
||||||
pRebConsumer->epoch++;
|
pRebConsumer->epoch++;
|
||||||
if (vgThisConsumerAfterRb != 0) {
|
if (vgThisConsumerAfterRb != 0) {
|
||||||
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE);
|
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE);
|
||||||
|
@ -446,8 +446,10 @@ static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
|
||||||
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
|
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
|
||||||
int vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
|
int vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
|
||||||
int vgThisConsumerAfterRb;
|
int vgThisConsumerAfterRb;
|
||||||
if (i < imbalanceVg) vgThisConsumerAfterRb = vgEachConsumer + 1;
|
if (i < imbalanceVg)
|
||||||
else vgThisConsumerAfterRb = vgEachConsumer;
|
vgThisConsumerAfterRb = vgEachConsumer + 1;
|
||||||
|
else
|
||||||
|
vgThisConsumerAfterRb = vgEachConsumer;
|
||||||
|
|
||||||
while (taosArrayGetSize(pSubConsumer->vgInfo) < vgThisConsumerAfterRb) {
|
while (taosArrayGetSize(pSubConsumer->vgInfo) < vgThisConsumerAfterRb) {
|
||||||
SMqConsumerEp *pConsumerEp = taosArrayPop(pSub->unassignedVg);
|
SMqConsumerEp *pConsumerEp = taosArrayPop(pSub->unassignedVg);
|
||||||
|
@ -463,14 +465,16 @@ static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
|
||||||
mndSplitSubscribeKey(pSub->key, &topic, &cgroup);
|
mndSplitSubscribeKey(pSub->key, &topic, &cgroup);
|
||||||
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
|
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
|
||||||
|
|
||||||
mInfo("mq set conn: assign vgroup %d of topic %s to consumer %ld", pConsumerEp->vgId, topic, pConsumerEp->consumerId);
|
mInfo("mq set conn: assign vgroup %d of topic %s to consumer %ld", pConsumerEp->vgId, topic,
|
||||||
|
pConsumerEp->consumerId);
|
||||||
|
|
||||||
mndPersistMqSetConnReq(pMnode, pTrans, pTopic, cgroup, pConsumerEp);
|
mndPersistMqSetConnReq(pMnode, pTrans, pTopic, cgroup, pConsumerEp);
|
||||||
mndReleaseTopic(pMnode, pTopic);
|
mndReleaseTopic(pMnode, pTopic);
|
||||||
free(topic);
|
free(topic);
|
||||||
free(cgroup);
|
free(cgroup);
|
||||||
} else {
|
} else {
|
||||||
mInfo("mq rebalance: assign vgroup %d, from consumer %ld to consumer %ld", pConsumerEp->vgId, pConsumerEp->oldConsumerId, pConsumerEp->consumerId);
|
mInfo("mq rebalance: assign vgroup %d, from consumer %ld to consumer %ld", pConsumerEp->vgId,
|
||||||
|
pConsumerEp->oldConsumerId, pConsumerEp->consumerId);
|
||||||
|
|
||||||
mndPersistRebalanceMsg(pMnode, pTrans, pConsumerEp);
|
mndPersistRebalanceMsg(pMnode, pTrans, pConsumerEp);
|
||||||
}
|
}
|
||||||
|
@ -488,10 +492,12 @@ static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) {
|
if (mndTransPrepare(pMnode, pTrans) != 0) {
|
||||||
mError("mq-rebalance-trans:%d, failed to prepare since %s", pTrans->id, terrstr());
|
mError("mq-rebalance-trans:%d, failed to prepare since %s", pTrans->id, terrstr());
|
||||||
|
taosHashCleanup(pReq->rebSubHash);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosHashCleanup(pReq->rebSubHash);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -738,15 +744,13 @@ static int mndInitUnassignedVg(SMnode *pMnode, const SMqTopicObj *pTopic, SMqSub
|
||||||
|
|
||||||
static int mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqTopicObj *pTopic, const char *cgroup,
|
static int mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqTopicObj *pTopic, const char *cgroup,
|
||||||
const SMqConsumerEp *pConsumerEp) {
|
const SMqConsumerEp *pConsumerEp) {
|
||||||
|
|
||||||
ASSERT(pConsumerEp->oldConsumerId == -1);
|
ASSERT(pConsumerEp->oldConsumerId == -1);
|
||||||
int32_t vgId = pConsumerEp->vgId;
|
int32_t vgId = pConsumerEp->vgId;
|
||||||
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
|
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
|
||||||
|
|
||||||
SMqSetCVgReq req = {
|
SMqSetCVgReq req = {
|
||||||
.vgId = vgId,
|
.vgId = vgId,
|
||||||
.oldConsumerId = -1,
|
.consumerId = pConsumerEp->consumerId,
|
||||||
.newConsumerId = pConsumerEp->consumerId,
|
|
||||||
.sql = pTopic->sql,
|
.sql = pTopic->sql,
|
||||||
.logicalPlan = pTopic->logicalPlan,
|
.logicalPlan = pTopic->logicalPlan,
|
||||||
.physicalPlan = pTopic->physicalPlan,
|
.physicalPlan = pTopic->physicalPlan,
|
||||||
|
|
|
@ -134,7 +134,6 @@ const void* tqDeserializeConsumer(const STqSerializedHead* pHead, STqConsumerHan
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
|
int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
SMqConsumeReq* pReq = pMsg->pCont;
|
SMqConsumeReq* pReq = pMsg->pCont;
|
||||||
int64_t reqId = pReq->reqId;
|
int64_t reqId = pReq->reqId;
|
||||||
|
@ -160,7 +159,7 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
STqTopicHandle* pTopic = taosArrayGet(pConsumer->topics, i);
|
STqTopicHandle* pTopic = taosArrayGet(pConsumer->topics, i);
|
||||||
// TODO: support multiple topic in one req
|
// TODO: support multiple topic in one req
|
||||||
if (strcmp(pTopic->topicName, pReq->topic) != 0) {
|
if (strcmp(pTopic->topicName, pReq->topic) != 0) {
|
||||||
ASSERT(false);
|
/*ASSERT(false);*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,23 +300,20 @@ int32_t tqProcessRebReq(STQ* pTq, char* msg) {
|
||||||
int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
|
int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
|
||||||
SMqSetCVgReq req = {0};
|
SMqSetCVgReq req = {0};
|
||||||
tDecodeSMqSetCVgReq(msg, &req);
|
tDecodeSMqSetCVgReq(msg, &req);
|
||||||
ASSERT(req.oldConsumerId == -1);
|
|
||||||
|
|
||||||
STqConsumerHandle* pConsumer = tqHandleGet(pTq->tqMeta, req.oldConsumerId);
|
|
||||||
/*printf("vg %d set to consumer from %ld to %ld\n", req.vgId, req.oldConsumerId, req.newConsumerId);*/
|
/*printf("vg %d set to consumer from %ld to %ld\n", req.vgId, req.oldConsumerId, req.newConsumerId);*/
|
||||||
if (pConsumer == NULL) {
|
STqConsumerHandle* pConsumer = calloc(1, sizeof(STqConsumerHandle));
|
||||||
pConsumer = calloc(sizeof(STqConsumerHandle), 1);
|
|
||||||
if (pConsumer == NULL) {
|
if (pConsumer == NULL) {
|
||||||
terrno = TSDB_CODE_TQ_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_TQ_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
strcpy(pConsumer->cgroup, req.cgroup);
|
strcpy(pConsumer->cgroup, req.cgroup);
|
||||||
pConsumer->topics = taosArrayInit(0, sizeof(STqTopicHandle));
|
pConsumer->topics = taosArrayInit(0, sizeof(STqTopicHandle));
|
||||||
pConsumer->consumerId = req.newConsumerId;
|
pConsumer->consumerId = req.consumerId;
|
||||||
pConsumer->epoch = 0;
|
pConsumer->epoch = 0;
|
||||||
|
|
||||||
STqTopicHandle* pTopic = calloc(sizeof(STqTopicHandle), 1);
|
STqTopicHandle* pTopic = calloc(1, sizeof(STqTopicHandle));
|
||||||
if (pTopic == NULL) {
|
if (pTopic == NULL) {
|
||||||
free(pConsumer);
|
free(pConsumer);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -342,8 +338,8 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
|
||||||
pTopic->buffer.output[i].task = qCreateStreamExecTaskInfo(req.qmsg, &handle);
|
pTopic->buffer.output[i].task = qCreateStreamExecTaskInfo(req.qmsg, &handle);
|
||||||
}
|
}
|
||||||
taosArrayPush(pConsumer->topics, pTopic);
|
taosArrayPush(pConsumer->topics, pTopic);
|
||||||
tqHandleMovePut(pTq->tqMeta, req.newConsumerId, pConsumer);
|
tqHandleMovePut(pTq->tqMeta, req.consumerId, pConsumer);
|
||||||
tqHandleCommit(pTq->tqMeta, req.newConsumerId);
|
tqHandleCommit(pTq->tqMeta, req.consumerId);
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue