enh: remove assert from mnode
This commit is contained in:
parent
5660199016
commit
fc21140e03
|
@ -157,8 +157,10 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) {
|
||||||
smPutNodeMsgToWriteQueue(pMgmt, pMsg);
|
smPutNodeMsgToWriteQueue(pMgmt, pMsg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERTS(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(),
|
terrno = TSDB_CODE_INVALID_PARA;
|
||||||
TMSG_INFO(pMsg->msgType), qtype);
|
rpcFreeCont(pMsg->pCont);
|
||||||
|
taosFreeQitem(pMsg);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,6 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
|
||||||
SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER)
|
SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER)
|
||||||
SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER)
|
SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER)
|
||||||
for (int32_t i = 0; i < pDb->cfg.numOfRetensions; ++i) {
|
for (int32_t i = 0; i < pDb->cfg.numOfRetensions; ++i) {
|
||||||
ASSERT(taosArrayGetSize(pDb->cfg.pRetensions) == pDb->cfg.numOfRetensions);
|
|
||||||
SRetention *pRetension = taosArrayGet(pDb->cfg.pRetensions, i);
|
SRetention *pRetension = taosArrayGet(pDb->cfg.pRetensions, i);
|
||||||
SDB_SET_INT64(pRaw, dataPos, pRetension->freq, _OVER)
|
SDB_SET_INT64(pRaw, dataPos, pRetension->freq, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pRetension->keep, _OVER)
|
SDB_SET_INT64(pRaw, dataPos, pRetension->keep, _OVER)
|
||||||
|
@ -364,6 +363,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
|
||||||
if (pCfg->hashPrefix < TSDB_MIN_HASH_PREFIX || pCfg->hashPrefix > TSDB_MAX_HASH_PREFIX) return -1;
|
if (pCfg->hashPrefix < TSDB_MIN_HASH_PREFIX || pCfg->hashPrefix > TSDB_MAX_HASH_PREFIX) return -1;
|
||||||
if (pCfg->hashSuffix < TSDB_MIN_HASH_SUFFIX || pCfg->hashSuffix > TSDB_MAX_HASH_SUFFIX) return -1;
|
if (pCfg->hashSuffix < TSDB_MIN_HASH_SUFFIX || pCfg->hashSuffix > TSDB_MAX_HASH_SUFFIX) return -1;
|
||||||
if (pCfg->tsdbPageSize < TSDB_MIN_TSDB_PAGESIZE || pCfg->tsdbPageSize > TSDB_MAX_TSDB_PAGESIZE) return -1;
|
if (pCfg->tsdbPageSize < TSDB_MIN_TSDB_PAGESIZE || pCfg->tsdbPageSize > TSDB_MAX_TSDB_PAGESIZE) return -1;
|
||||||
|
if (taosArrayGetSize(pCfg->pRetensions) != pCfg->numOfRetensions) return -1;
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
return terrno;
|
return terrno;
|
||||||
|
|
|
@ -489,7 +489,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
|
||||||
tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
|
tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
ASSERT(cnt == sz);
|
if(cnt != sz) return -1;
|
||||||
tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp);
|
tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp);
|
||||||
tlen += taosEncodeString(buf, pSub->dbName);
|
tlen += taosEncodeString(buf, pSub->dbName);
|
||||||
return tlen;
|
return tlen;
|
||||||
|
|
|
@ -763,7 +763,6 @@ static void mndReloadSyncConfig(SMnode *pMnode) {
|
||||||
mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
|
mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// ASSERT(0);
|
|
||||||
|
|
||||||
if (cfg.myIndex == -1) {
|
if (cfg.myIndex == -1) {
|
||||||
#if 1
|
#if 1
|
||||||
|
|
|
@ -111,7 +111,7 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_PRIVILEGES;
|
type = TSDB_MGMT_TABLE_PRIVILEGES;
|
||||||
} else {
|
} else {
|
||||||
// ASSERT(0);
|
mError("invalid show name:%s len:%d", name, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -488,7 +488,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
memcpy(smaObj.db, pDb->name, TSDB_DB_FNAME_LEN);
|
memcpy(smaObj.db, pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
smaObj.createdTime = taosGetTimestampMs();
|
smaObj.createdTime = taosGetTimestampMs();
|
||||||
smaObj.uid = mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN);
|
smaObj.uid = mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN);
|
||||||
ASSERT(smaObj.uid != 0);
|
|
||||||
char resultTbName[TSDB_TABLE_FNAME_LEN + 16] = {0};
|
char resultTbName[TSDB_TABLE_FNAME_LEN + 16] = {0};
|
||||||
snprintf(resultTbName, TSDB_TABLE_FNAME_LEN + 16, "%s_td_tsma_rst_tb", pCreate->name);
|
snprintf(resultTbName, TSDB_TABLE_FNAME_LEN + 16, "%s_td_tsma_rst_tb", pCreate->name);
|
||||||
memcpy(smaObj.dstTbName, resultTbName, TSDB_TABLE_FNAME_LEN);
|
memcpy(smaObj.dstTbName, resultTbName, TSDB_TABLE_FNAME_LEN);
|
||||||
|
@ -558,13 +558,15 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(streamObj.ast, &pAst) < 0) {
|
if (nodesStringToNode(streamObj.ast, &pAst) < 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_SMA_OPTION;
|
||||||
|
mError("sma:%s, failed to create since parse ast error", smaObj.name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract output schema from ast
|
// extract output schema from ast
|
||||||
if (qExtractResultSchema(pAst, (int32_t *)&streamObj.outputSchema.nCols, &streamObj.outputSchema.pSchema) != 0) {
|
if (qExtractResultSchema(pAst, (int32_t *)&streamObj.outputSchema.nCols, &streamObj.outputSchema.pSchema) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_SMA_OPTION;
|
||||||
|
mError("sma:%s, failed to create since extract result schema error", smaObj.name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,15 +581,18 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
};
|
};
|
||||||
|
|
||||||
if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) {
|
if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_SMA_OPTION;
|
||||||
|
mError("sma:%s, failed to create since create query plan error", smaObj.name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save physcial plan
|
// save physcial plan
|
||||||
if (nodesNodeToString((SNode *)pPlan, false, &streamObj.physicalPlan, NULL) != 0) {
|
if (nodesNodeToString((SNode *)pPlan, false, &streamObj.physicalPlan, NULL) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_SMA_OPTION;
|
||||||
|
mError("sma:%s, failed to create since save physcial plan error", smaObj.name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAst != NULL) nodesDestroyNode(pAst);
|
if (pAst != NULL) nodesDestroyNode(pAst);
|
||||||
nodesDestroyNode((SNode *)pPlan);
|
nodesDestroyNode((SNode *)pPlan);
|
||||||
|
|
||||||
|
@ -826,14 +831,13 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
|
||||||
if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
|
if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) {
|
||||||
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
|
mError("stream:%s, failed to drop task since %s", pStream->name, terrstr());
|
||||||
sdbRelease(pMnode->pSdb, pStream);
|
sdbRelease(pMnode->pSdb, pStream);
|
||||||
ASSERT(0);
|
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop stream
|
// drop stream
|
||||||
if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
|
if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) {
|
||||||
|
mError("stream:%s, failed to drop log since %s", pStream->name, terrstr());
|
||||||
sdbRelease(pMnode->pSdb, pStream);
|
sdbRelease(pMnode->pSdb, pStream);
|
||||||
ASSERT(0);
|
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1177,7 +1177,9 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
|
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC;
|
||||||
|
mError("topic:%s, create ast error", pTopic->name);
|
||||||
|
sdbRelease(pSdb, pTopic);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,7 +1224,9 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(pStream->ast, &pAst) != 0) {
|
if (nodesStringToNode(pStream->ast, &pAst) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_STREAM_OPTION;
|
||||||
|
mError("stream:%s, create ast error", pStream->name);
|
||||||
|
sdbRelease(pSdb, pStream);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2094,7 +2098,9 @@ static int32_t mndCheckDropStbForTopic(SMnode *pMnode, const char *stbFullName,
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
|
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_TOPIC_OPTION;
|
||||||
|
mError("topic:%s, create ast error", pTopic->name);
|
||||||
|
sdbRelease(pSdb, pTopic);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2141,7 +2147,9 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName,
|
||||||
|
|
||||||
SNode *pAst = NULL;
|
SNode *pAst = NULL;
|
||||||
if (nodesStringToNode(pStream->ast, &pAst) != 0) {
|
if (nodesStringToNode(pStream->ast, &pAst) != 0) {
|
||||||
ASSERT(0);
|
terrno = TSDB_CODE_MND_INVALID_STREAM_OPTION;
|
||||||
|
mError("stream:%s, create ast error", pStream->name);
|
||||||
|
sdbRelease(pSdb, pStream);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -693,6 +693,7 @@ static SSdbRaw *mndSubActionEncode(SMqSubscribeObj *pSub) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
void *buf = NULL;
|
void *buf = NULL;
|
||||||
int32_t tlen = tEncodeSubscribeObj(NULL, pSub);
|
int32_t tlen = tEncodeSubscribeObj(NULL, pSub);
|
||||||
|
if (tlen <= 0) goto SUB_ENCODE_OVER;
|
||||||
int32_t size = sizeof(int32_t) + tlen + MND_SUBSCRIBE_RESERVE_SIZE;
|
int32_t size = sizeof(int32_t) + tlen + MND_SUBSCRIBE_RESERVE_SIZE;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SUBSCRIBE, MND_SUBSCRIBE_VER_NUMBER, size);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_SUBSCRIBE, MND_SUBSCRIBE_VER_NUMBER, size);
|
||||||
|
|
|
@ -384,7 +384,11 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
||||||
topicObj.subType = pCreate->subType;
|
topicObj.subType = pCreate->subType;
|
||||||
topicObj.withMeta = pCreate->withMeta;
|
topicObj.withMeta = pCreate->withMeta;
|
||||||
if (topicObj.withMeta) {
|
if (topicObj.withMeta) {
|
||||||
ASSERT(topicObj.subType != TOPIC_SUB_TYPE__COLUMN);
|
if (topicObj.subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||||
|
terrno = TSDB_CODE_MND_INVALID_TOPIC_OPTION;
|
||||||
|
mError("topic:%s, failed to create since %s", pCreate->name, terrstr());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) {
|
if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) {
|
||||||
|
@ -499,7 +503,6 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
ASSERT(0);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len);
|
||||||
|
@ -723,7 +726,6 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
// TODO check if rebalancing
|
// TODO check if rebalancing
|
||||||
if (mndDropSubByTopic(pMnode, pTrans, dropReq.name) < 0) {
|
if (mndDropSubByTopic(pMnode, pTrans, dropReq.name) < 0) {
|
||||||
/*ASSERT(0);*/
|
|
||||||
mError("topic:%s, failed to drop since %s", pTopic->name, terrstr());
|
mError("topic:%s, failed to drop since %s", pTopic->name, terrstr());
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
mndReleaseTopic(pMnode, pTopic);
|
mndReleaseTopic(pMnode, pTopic);
|
||||||
|
|
Loading…
Reference in New Issue