refact: adjust some assert cases

This commit is contained in:
Shengliang Guan 2022-12-07 17:21:24 +08:00
parent 6bb736aeeb
commit 9b793fd1e6
5 changed files with 7 additions and 6 deletions

View File

@ -84,8 +84,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
; ;
bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...);
#define tAssert(condition, ...) (void)taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__); #define tAssert(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__)
#define tAssertR(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__)
// clang-format off // clang-format off
#define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}

View File

@ -432,7 +432,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic);
// txn guarantees pSub is created // txn guarantees pSub is created
ASSERT(pSub); tAsser(pSub);
taosRLockLatch(&pSub->lock); taosRLockLatch(&pSub->lock);
SMqSubTopicEp topicEp = {0}; SMqSubTopicEp topicEp = {0};

View File

@ -112,7 +112,11 @@ 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); if (tAssert(taosArrayGetSize(pDb->cfg.pRetensions) == pDb->cfg.numOfRetensions,
"db:%s, numOfRetensions:%d not matched with %d", pDb->name, pDb->cfg.numOfRetensions,
taosArrayGetSize(pDb->cfg.pRetensions))) {
pDb->cfg.numOfRetensions = taosArrayGetSize(pDb->cfg.pRetensions);
}
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)

View File

@ -755,7 +755,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

View File

@ -111,7 +111,6 @@ 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);
} }
return type; return type;