enh(tq): update tb uid when droping table
This commit is contained in:
parent
82b2ae4194
commit
2f9c63ae3f
|
@ -848,7 +848,7 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataAppend(pColInfo, numOfRows, (const char *)cgroup, false);
|
||||
|
||||
// app id
|
||||
// client id
|
||||
char clientId[TSDB_CGROUP_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||
tstrncpy(varDataVal(clientId), pConsumer->clientId, TSDB_CGROUP_LEN);
|
||||
varDataSetLen(clientId, strlen(varDataVal(clientId)));
|
||||
|
|
|
@ -118,7 +118,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode, SWal* pWal);
|
|||
void tqClose(STQ*);
|
||||
int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver);
|
||||
int tqCommit(STQ*);
|
||||
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList);
|
||||
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd);
|
||||
int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen);
|
||||
int32_t tqProcessVgDeleteReq(STQ* pTq, char* msg, int32_t msgLen);
|
||||
int32_t tqProcessTaskExec(STQ* pTq, char* msg, int32_t msgLen, int32_t workerId);
|
||||
|
|
|
@ -104,7 +104,7 @@ static void tdSRowDemo() {
|
|||
taosMemoryFree(pTSChema);
|
||||
}
|
||||
|
||||
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList) {
|
||||
int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
|
||||
void* pIter = NULL;
|
||||
STqExec* pExec = NULL;
|
||||
while (1) {
|
||||
|
@ -113,7 +113,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList) {
|
|||
pExec = (STqExec*)pIter;
|
||||
if (pExec->subType == TOPIC_SUB_TYPE__DB) continue;
|
||||
for (int32_t i = 0; i < 5; i++) {
|
||||
int32_t code = qUpdateQualifiedTableId(pExec->task[i], tbUidList, true);
|
||||
int32_t code = qUpdateQualifiedTableId(pExec->task[i], tbUidList, isAdd);
|
||||
ASSERT(code == 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
|
|||
|
||||
tDecoderClear(&decoder);
|
||||
|
||||
tqUpdateTbUidList(pVnode->pTq, tbUids);
|
||||
tqUpdateTbUidList(pVnode->pTq, tbUids, true);
|
||||
tdUpdateTbUidList(pVnode->pSma, pStore);
|
||||
tdUidStoreFree(pStore);
|
||||
|
||||
|
@ -517,6 +517,7 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
|
|||
SDecoder decoder = {0};
|
||||
SEncoder encoder = {0};
|
||||
int ret;
|
||||
SArray *tbUids;
|
||||
|
||||
pRsp->msgType = TDMT_VND_DROP_TABLE_RSP;
|
||||
pRsp->pCont = NULL;
|
||||
|
@ -533,7 +534,10 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
|
|||
}
|
||||
|
||||
// process req
|
||||
tbUids = taosArrayInit(req.nReqs, sizeof(int64_t));
|
||||
rsp.pArray = taosArrayInit(req.nReqs, sizeof(SVDropTbRsp));
|
||||
if (tbUids == NULL || rsp.pArray == NULL) goto _exit;
|
||||
|
||||
for (int iReq = 0; iReq < req.nReqs; iReq++) {
|
||||
SVDropTbReq *pDropTbReq = req.pReqs + iReq;
|
||||
SVDropTbRsp dropTbRsp = {0};
|
||||
|
@ -553,7 +557,10 @@ static int vnodeProcessDropTbReq(SVnode *pVnode, int64_t version, void *pReq, in
|
|||
taosArrayPush(rsp.pArray, &dropTbRsp);
|
||||
}
|
||||
|
||||
tqUpdateTbUidList(pVnode->pTq, tbUids, false);
|
||||
|
||||
_exit:
|
||||
taosArrayDestroy(tbUids);
|
||||
tDecoderClear(&decoder);
|
||||
tEncodeSize(tEncodeSVDropTbBatchRsp, &rsp, pRsp->contLen, ret);
|
||||
pRsp->pCont = rpcMallocCont(pRsp->contLen);
|
||||
|
|
Loading…
Reference in New Issue