Merge pull request #17877 from taosdata/enh/TD-19920
enh: add show rewrite mask in query msg
This commit is contained in:
commit
7081ebe9e6
|
@ -216,9 +216,14 @@ typedef struct SEp {
|
|||
uint16_t port;
|
||||
} SEp;
|
||||
|
||||
#define SHOW_REWRITE_MASK() (1 << 0)
|
||||
|
||||
#define TEST_SHOW_REWRITE_MASK(m) (((m) & SHOW_REWRITE_MASK()) != 0)
|
||||
|
||||
typedef struct {
|
||||
int32_t contLen;
|
||||
int32_t vgId;
|
||||
int32_t msgMask;
|
||||
} SMsgHead;
|
||||
|
||||
// Submit message for one table
|
||||
|
|
|
@ -758,6 +758,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
|||
case 'd': {
|
||||
if (strcasecmp("dDebugFlag", name) == 0) {
|
||||
dDebugFlag = cfgGetItem(pCfg, "dDebugFlag")->i32;
|
||||
} else if (strcasecmp("debugFlag", name) == 0) {
|
||||
int32_t flag = cfgGetItem(pCfg, "debugFlag")->i32;
|
||||
taosSetAllDebugFlag(flag, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
|||
|
||||
pHead->contLen = ntohl(pHead->contLen);
|
||||
pHead->vgId = ntohl(pHead->vgId);
|
||||
pHead->msgMask = ntohl(pHead->msgMask);
|
||||
|
||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId);
|
||||
if (pVnode == NULL) {
|
||||
|
@ -155,7 +156,7 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
|
|||
|
||||
switch (qtype) {
|
||||
case QUERY_QUEUE:
|
||||
if ((pMsg->msgType == TDMT_SCH_QUERY) && (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS)) {
|
||||
if ((pMsg->msgType == TDMT_SCH_QUERY) && (grantCheck(TSDB_GRANT_TIME) != TSDB_CODE_SUCCESS) && !TEST_SHOW_REWRITE_MASK(pHead->msgMask)) {
|
||||
terrno = TSDB_CODE_GRANT_EXPIRED;
|
||||
code = terrno;
|
||||
dDebug("vgId:%d, msg:%p put into vnode-query queue failed since %s", pVnode->vgId, pMsg, terrstr(code));
|
||||
|
|
|
@ -466,7 +466,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
|
|||
|
||||
contLen += sizeof(SMsgHead);
|
||||
|
||||
SMsgHead *pHead = taosMemoryMalloc(contLen);
|
||||
SMsgHead *pHead = taosMemoryCalloc(1, contLen);
|
||||
if (pHead == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _err;
|
||||
|
@ -519,6 +519,7 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
|
|||
|
||||
pHead->contLen = htonl(contLen);
|
||||
pHead->vgId = htonl(pVgroup->vgId);
|
||||
pHead->msgMask = htonl(0);
|
||||
|
||||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||
|
||||
|
@ -2596,4 +2597,4 @@ const char *mndGetStbStr(const char *src) {
|
|||
if (posStb != NULL) ++posStb;
|
||||
if (posStb == NULL) return posDb;
|
||||
return posStb;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1047,6 +1047,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
|
|||
|
||||
SSubQueryMsg *pMsg = msg;
|
||||
pMsg->header.vgId = htonl(addr->nodeId);
|
||||
pMsg->header.msgMask = htonl((pTask->plan->showRewrite) ? SHOW_REWRITE_MASK() : 0);
|
||||
pMsg->sId = htobe64(schMgmt.sId);
|
||||
pMsg->queryId = htobe64(pJob->queryId);
|
||||
pMsg->taskId = htobe64(pTask->taskId);
|
||||
|
|
|
@ -72,6 +72,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
|
|||
SMsgHead head;
|
||||
head.vgId = vgId;
|
||||
head.contLen = sizeof(SMsgHead);
|
||||
head.msgMask = 0;
|
||||
SRpcMsg rpcMsg;
|
||||
memset(&rpcMsg, 0, sizeof(SRpcMsg));
|
||||
rpcMsg.contLen = head.contLen;
|
||||
|
|
Loading…
Reference in New Issue