From cf3ec5ad40c9715f8a374b2bea222d548e210f08 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 6 Dec 2022 11:42:53 +0800 Subject: [PATCH 01/66] fix: add default command line to start udfd when taosd is started directly from command line --- source/libs/function/src/tudf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index c78ec5b999..73f5f8ce68 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -88,11 +88,13 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { } #ifdef WINDOWS if (strlen(path) == 0) { - strcat(path, "udfd.exe"); - } else { - strcat(path, "\\udfd.exe"); + strcat(path, "C:\\TDengine") } + strcat(path, "\\udfd.exe"); #else + if (strlen(path) == 0) { + strcat(path, "/usr/bin"); + } strcat(path, "/udfd"); #endif char *argsUdfd[] = {path, "-c", configDir, NULL}; From 387983f6f4be62b93544431a5485561814a30f75 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Wed, 7 Dec 2022 11:44:39 +0800 Subject: [PATCH 02/66] fix(query): fix percentile crash when input has more than 10 million records --- source/libs/function/src/tpercentile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index e5727f1472..56f55bde32 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -367,16 +367,16 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) { pSlot->info.data = NULL; } - SArray *pPageIdList = (SArray *)taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); + SArray **pPageIdList = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); if (pPageIdList == NULL) { SArray *pList = taosArrayInit(4, sizeof(int32_t)); taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pList, POINTER_BYTES); - pPageIdList = pList; + pPageIdList = &pList; } pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId); pSlot->info.pageId = pageId; - taosArrayPush(pPageIdList, &pageId); + taosArrayPush(*pPageIdList, &pageId); } memcpy(pSlot->info.data->data + pSlot->info.data->num * pBucket->bytes, d, pBucket->bytes); From bed68741746cea75d1413d630db3c2c69f6590d7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 13:46:53 +0800 Subject: [PATCH 03/66] enh: add tassert --- include/util/tlog.h | 5 +++++ source/common/src/tglobal.c | 7 ++++++- source/util/src/tlog.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/util/tlog.h b/include/util/tlog.h index 68b004cda7..12103d97f1 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -38,6 +38,7 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content); extern bool tsLogEmbedded; extern bool tsAsyncLog; +extern bool tsAssert; extern int32_t tsNumOfLogLines; extern int32_t tsLogKeepDays; extern LogFp tsLogFp; @@ -82,6 +83,10 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #endif ; +bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); +#define tAssert(...) (void)taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__); +#define tAssertR(...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) + // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 3bcfddb8b2..26c8bd3586 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -334,6 +334,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddLocale(pCfg, "locale", tsLocale) != 0) return -1; if (cfgAddCharset(pCfg, "charset", tsCharset) != 0) return -1; if (cfgAddBool(pCfg, "enableCoreFile", 1, 1) != 0) return -1; + if (cfgAddBool(pCfg, "assert", 1, 1) != 0) return -1; if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1) != 0) return -1; if (cfgAddBool(pCfg, "SSE42", tsSSE42Enable, 0) != 0) return -1; @@ -693,6 +694,8 @@ static void taosSetSystemCfg(SConfig *pCfg) { bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; taosSetCoreDump(enableCore); + tsAssert = cfgGetItem(pCfg, "assert")->bval; + // todo tsVersion = 30000000; } @@ -788,7 +791,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { case 'a': { if (strcasecmp("asyncLog", name) == 0) { tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval; - } + } else if (strcasecmp("assert", name) == 0) { + tsAssert = cfgGetItem(pCfg, "assert")->bval; + } break; } case 'c': { diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index be1db74f1a..5d887bb1ac 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -72,6 +72,7 @@ static int32_t tsDaylightActive; /* Currently in daylight saving time. */ bool tsLogEmbedded = 0; bool tsAsyncLog = true; +bool tsAssert = true; int32_t tsNumOfLogLines = 10000000; int32_t tsLogKeepDays = 0; LogFp tsLogFp = NULL; @@ -778,3 +779,32 @@ cmp_end: return ret; } + +bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { + if (!condition) return false; + + char buffer[LOG_MAX_LINE_BUFFER_SIZE]; + int32_t len = taosBuildLogHead(buffer, "UTL FATAL"); + + va_list argpointer; + va_start(argpointer, format); + int32_t writeLen = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); + va_end(argpointer); + + char fullBuf[LOG_MAX_LINE_BUFFER_SIZE]; + int32_t fullLen = snprintf(fullBuf, sizeof(fullBuf), "ASSERT at file:%s:%d, %s", file, line, buffer); + taosPrintLogImp(1, 255, fullBuf, fullLen); + + if (tsAssert) { + taosCloseLog(); + taosMsleep(300); + +#if NDEBUG + abort(); +#else + ASSERT(1); +#endif + } + + return true; +} From a4549b00dee60f502f78644833fedcc68e732d06 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 7 Dec 2022 15:11:37 +0800 Subject: [PATCH 04/66] fix: retention --- source/dnode/vnode/src/tsdb/tsdbCommit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 906e3b2638..8ec59ea959 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -53,6 +53,7 @@ typedef struct { // -------------- TSKEY nextKey; // reset by each table commit int32_t commitFid; + int32_t expLevel; TSKEY minKey; TSKEY maxKey; // commit file data @@ -503,6 +504,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { // memory pCommitter->commitFid = tsdbKeyFid(pCommitter->nextKey, pCommitter->minutes, pCommitter->precision); + pCommitter->expLevel = tsdbFidLevel(pCommitter->commitFid, &pCommitter->pTsdb->keepCfg, taosGetTimestampSec()); tsdbFidKeyRange(pCommitter->commitFid, pCommitter->minutes, pCommitter->precision, &pCommitter->minKey, &pCommitter->maxKey); #if 0 @@ -556,7 +558,10 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { } } else { SDiskID did = {0}; - tfsAllocDisk(pTsdb->pVnode->pTfs, 0, &did); + if (tfsAllocDisk(pTsdb->pVnode->pTfs, pCommitter->expLevel, &did) < 0) { + code = terrno; + TSDB_CHECK_CODE(code, lino, _exit); + } tfsMkdirRecurAt(pTsdb->pVnode->pTfs, pTsdb->path, did); wSet.diskId = did; wSet.nSttF = 1; From e7ee48fd38788e3b6edbfd948999d1d67d3a54f9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 16:06:07 +0800 Subject: [PATCH 05/66] enh: add tassert funcs --- include/os/os.h | 1 + include/os/osSystem.h | 20 ++++++++++++++++++++ include/util/tlog.h | 4 ++-- source/dnode/mgmt/node_mgmt/src/dmMgmt.c | 2 ++ source/util/src/tlog.c | 23 ++++++++++++++--------- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/include/os/os.h b/include/os/os.h index 0688eeb9ad..b27fa84406 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -27,6 +27,7 @@ extern "C" { #if !defined(WINDOWS) #include +#include #include #include #include diff --git a/include/os/osSystem.h b/include/os/osSystem.h index eca984c41a..dd1c5cd204 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -46,6 +46,26 @@ void taosSetTerminalMode(); int32_t taosGetOldTerminalMode(); void taosResetTerminalMode(); +#if defined(LINUX) +#define taosPrintTrace(flags, level, dflag) \ + { \ + void* array[100]; \ + int32_t size = backtrace(array, 100); \ + char** strings = backtrace_symbols(array, size); \ + if (strings != NULL) { \ + taosPrintLog(flags, level, dflag, "obtained %d stack frames", size); \ + for (int32_t i = 0; i < size; i++) { \ + taosPrintLog(flags, level, dflag, "frame:%d, %s", i, strings[i]); \ + } \ + } \ + \ + taosMemoryFree(strings); \ + } +#else +#define taosPrintTrace(flags, level, dflag) \ + {} +#endif + #ifdef __cplusplus } #endif diff --git a/include/util/tlog.h b/include/util/tlog.h index 12103d97f1..2caeaf71a9 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -84,8 +84,8 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons ; bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); -#define tAssert(...) (void)taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__); -#define tAssertR(...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +#define tAssert(condition, ...) (void)taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__); +#define tAssertR(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index 02a268afda..c3f5313f7b 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -103,6 +103,8 @@ int32_t dmInitDnode(SDnode *pDnode) { goto _OVER; } + tAssert(0, ""); + pDnode->wrappers[DNODE].func = dmGetMgmtFunc(); pDnode->wrappers[MNODE].func = mmGetMgmtFunc(); pDnode->wrappers[VNODE].func = vmGetMgmtFunc(); diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 5d887bb1ac..7beddd5d4f 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -781,28 +781,33 @@ cmp_end: } bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { - if (!condition) return false; + if (condition) return false; - char buffer[LOG_MAX_LINE_BUFFER_SIZE]; - int32_t len = taosBuildLogHead(buffer, "UTL FATAL"); + const char *flags = "UTL FATAL "; + ELogLevel level = DEBUG_FATAL; + int32_t dflag = 255; // tsLogEmbedded ? 255 : uDebugFlag + char buffer[LOG_MAX_LINE_BUFFER_SIZE]; + int32_t len = taosBuildLogHead(buffer, flags); va_list argpointer; va_start(argpointer, format); - int32_t writeLen = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); + len = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); va_end(argpointer); + buffer[len++] = '\n'; + buffer[len] = 0; + taosPrintLogImp(1, 255, buffer, len); - char fullBuf[LOG_MAX_LINE_BUFFER_SIZE]; - int32_t fullLen = snprintf(fullBuf, sizeof(fullBuf), "ASSERT at file:%s:%d, %s", file, line, buffer); - taosPrintLogImp(1, 255, fullBuf, fullLen); + taosPrintLog(flags, level, dflag, "ASSERT at file %s:%d exit:%d", file, line, tsAssert); + taosPrintTrace(flags, level, dflag); if (tsAssert) { taosCloseLog(); taosMsleep(300); -#if NDEBUG +#ifdef NDEBUG abort(); #else - ASSERT(1); + ASSERT(0); #endif } From c6e9b8c0fa04c9ed4e64f8f910feac27d73925ae Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 16:27:20 +0800 Subject: [PATCH 06/66] enh: add tassert funcs --- include/os/osSystem.h | 2 +- source/dnode/mgmt/node_mgmt/src/dmMgmt.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/os/osSystem.h b/include/os/osSystem.h index dd1c5cd204..31ec513fca 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -46,7 +46,7 @@ void taosSetTerminalMode(); int32_t taosGetOldTerminalMode(); void taosResetTerminalMode(); -#if defined(LINUX) +#if !defined(WINDOWS) #define taosPrintTrace(flags, level, dflag) \ { \ void* array[100]; \ diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index c3f5313f7b..02a268afda 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -103,8 +103,6 @@ int32_t dmInitDnode(SDnode *pDnode) { goto _OVER; } - tAssert(0, ""); - pDnode->wrappers[DNODE].func = dmGetMgmtFunc(); pDnode->wrappers[MNODE].func = mmGetMgmtFunc(); pDnode->wrappers[VNODE].func = vmGetMgmtFunc(); From 6bb736aeeba3fb1e232e9d1a5f88d2d220a1d8cc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 16:30:21 +0800 Subject: [PATCH 07/66] refact: adjust some assert cases --- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 5 +++-- source/dnode/mnode/impl/src/mndConsumer.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 2d2a121795..12b75add4b 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -139,7 +139,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { SSnode *pSnode = pMgmt->pSnode; if (pSnode == NULL) { - dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + dError("msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), TMSG_INFO(pMsg->msgType), qtype); taosFreeQitem(pMsg); rpcFreeCont(pRpc->pCont); @@ -161,7 +161,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { smPutNodeMsgToWriteQueue(pMgmt, pMsg); break; default: - ASSERT(0); + tAssert(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + TMSG_INFO(pMsg->msgType), qtype); } return 0; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 76bff9a70f..a04a5351eb 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -133,7 +133,9 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; SMqConsumerRecoverMsg *pRecoverMsg = pMsg->pCont; SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pRecoverMsg->consumerId); - ASSERT(pConsumer); + + tAssert(pConsumer != NULL, "receive consumer recover msg, consumer id %" PRId64 ", status %s", + pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); mInfo("receive consumer recover msg, consumer id %" PRId64 ", status %s", pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); @@ -381,7 +383,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { return -1; } - ASSERT(strcmp(req.cgroup, pConsumer->cgroup) == 0); + tAssert(strcmp(req.cgroup, pConsumer->cgroup) == 0, "cgroup:%s not match consumer:%s", req.cgroup, pConsumer->cgroup); atomic_store_32(&pConsumer->hbStatus, 0); From 3710dbe2e024285b0b735248f019e7699a7162ed Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 7 Dec 2022 16:57:45 +0800 Subject: [PATCH 08/66] fix mem leak --- source/libs/transport/src/transSvr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 73c6dc4011..2b1f68d5f6 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1195,6 +1195,8 @@ void transCloseServer(void* arg) { sendQuitToWorkThrd(srv->pThreadObj[i]); destroyWorkThrd(srv->pThreadObj[i]); } + } else { + uv_loop_close(srv->loop); } taosMemoryFree(srv->pThreadObj); From d2375cd8e452c7559575f716b6375d30af492741 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 7 Dec 2022 17:00:01 +0800 Subject: [PATCH 09/66] fix: Query message compatibility --- source/util/src/tjson.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c index cc823decf4..48638af8d5 100644 --- a/source/util/src/tjson.c +++ b/source/util/src/tjson.c @@ -181,7 +181,7 @@ int32_t tjsonGetObjectValueString(const SJson* pJson, char** pValueString) { int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) { char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName)); if (NULL == p) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } strcpy(pVal, p); return TSDB_CODE_SUCCESS; @@ -190,7 +190,7 @@ int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) { int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal) { char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName)); if (NULL == p) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } *pVal = strdup(p); return TSDB_CODE_SUCCESS; @@ -199,7 +199,7 @@ int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal) int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal) { char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName)); if (NULL == p) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } #ifdef WINDOWS sscanf(p, "%" PRId64, pVal); @@ -233,7 +233,7 @@ int32_t tjsonGetTinyIntValue(const SJson* pJson, const char* pName, int8_t* pVal int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pVal) { char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName)); if (NULL == p) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } #ifdef WINDOWS sscanf(p, "%" PRIu64, pVal); @@ -259,6 +259,9 @@ int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pV int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) { const SJson* pObject = tjsonGetObjectItem(pJson, pName); + if (NULL == pObject) { + return TSDB_CODE_SUCCESS; + } if (!cJSON_IsBool(pObject)) { return TSDB_CODE_FAILED; } @@ -268,6 +271,9 @@ int32_t tjsonGetBoolValue(const SJson* pJson, const char* pName, bool* pVal) { int32_t tjsonGetDoubleValue(const SJson* pJson, const char* pName, double* pVal) { const SJson* pObject = tjsonGetObjectItem(pJson, pName); + if (NULL == pObject) { + return TSDB_CODE_SUCCESS; + } if (!cJSON_IsNumber(pObject)) { return TSDB_CODE_FAILED; } @@ -282,7 +288,7 @@ SJson* tjsonGetArrayItem(const SJson* pJson, int32_t index) { return cJSON_GetAr int32_t tjsonToObject(const SJson* pJson, const char* pName, FToObject func, void* pObj) { SJson* pJsonObj = tjsonGetObjectItem(pJson, pName); if (NULL == pJsonObj) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } return func(pJsonObj, pObj); } @@ -294,7 +300,7 @@ int32_t tjsonMakeObject(const SJson* pJson, const char* pName, FToObject func, v SJson* pJsonObj = tjsonGetObjectItem(pJson, pName); if (NULL == pJsonObj) { - return TSDB_CODE_FAILED; + return TSDB_CODE_SUCCESS; } *pObj = taosMemoryCalloc(1, objSize); if (NULL == *pObj) { From 9b793fd1e6482086cce7e6f9513ab53e509d5ca8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 17:21:24 +0800 Subject: [PATCH 10/66] refact: adjust some assert cases --- include/util/tlog.h | 3 +-- source/dnode/mnode/impl/src/mndConsumer.c | 2 +- source/dnode/mnode/impl/src/mndDb.c | 6 +++++- source/dnode/mnode/impl/src/mndMnode.c | 1 - source/dnode/mnode/impl/src/mndShow.c | 1 - 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/util/tlog.h b/include/util/tlog.h index 2caeaf71a9..7c5d89b680 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -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, ...); -#define tAssert(condition, ...) (void)taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__); -#define tAssertR(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +#define tAssert(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index a04a5351eb..45bf4df77f 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -432,7 +432,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); // txn guarantees pSub is created - ASSERT(pSub); + tAsser(pSub); taosRLockLatch(&pSub->lock); SMqSubTopicEp topicEp = {0}; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 5fa86dffe2..61b5be414e 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -112,7 +112,11 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER) 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); SDB_SET_INT64(pRaw, dataPos, pRetension->freq, _OVER) SDB_SET_INT64(pRaw, dataPos, pRetension->keep, _OVER) diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 9c847c1138..674bd9f74a 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -755,7 +755,6 @@ static void mndReloadSyncConfig(SMnode *pMnode) { mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes); return; } - // ASSERT(0); if (cfg.myIndex == -1) { #if 1 diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 6a7e2aaa51..cb11ffc196 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -111,7 +111,6 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { } else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) { type = TSDB_MGMT_TABLE_PRIVILEGES; } else { - // ASSERT(0); } return type; From 50883689e7bdaf579d75615bd61a03985bc456a7 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Wed, 7 Dec 2022 15:16:05 +0800 Subject: [PATCH 11/66] enh: check contiguousness of indexes applied to vnode tsdb --- include/common/tmsg.h | 5 +++++ source/dnode/mnode/impl/src/mndSync.c | 8 +++++++- source/dnode/vnode/src/vnd/vnodeSvr.c | 4 ++++ source/libs/sync/inc/syncUtil.h | 1 - source/libs/sync/src/syncPipeline.c | 7 +------ source/libs/sync/src/syncUtil.c | 2 -- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 470b7bba7e..bb1addf1b6 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -70,6 +70,11 @@ static inline bool vnodeIsMsgBlock(tmsg_t type) { return (type == TDMT_VND_CREATE_TABLE) || (type == TDMT_VND_ALTER_TABLE) || (type == TDMT_VND_DROP_TABLE) || (type == TDMT_VND_UPDATE_TAG_VAL); } + +static inline bool syncUtilUserCommit(tmsg_t msgType) { + return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; +} + /* ------------------------ OTHER DEFINITIONS ------------------------ */ // IE type #define TSDB_IE_TYPE_SEC 1 diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 895d7fedc4..7cba69ed50 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -119,7 +119,13 @@ int32_t mndProcessWriteMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta } int32_t mndSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) { - int32_t code = mndProcessWriteMsg(pFsm, pMsg, pMeta); + int32_t code = 0; + if (!syncUtilUserCommit(pMsg->msgType)) { + goto _out; + } + code = mndProcessWriteMsg(pFsm, pMsg, pMeta); + +_out: rpcFreeCont(pMsg->pCont); pMsg->pCont = NULL; return code; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d8c8a3e1b2..0fc42f3744 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -190,9 +190,13 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp version); ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); + ASSERT(pVnode->state.applied + 1 == version); + pVnode->state.applied = version; pVnode->state.applyTerm = pMsg->info.conn.applyTerm; + if (!syncUtilUserCommit(pMsg->msgType)) goto _exit; + // skip header pReq = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); len = pMsg->contLen - sizeof(SMsgHead); diff --git a/source/libs/sync/inc/syncUtil.h b/source/libs/sync/inc/syncUtil.h index f198f3809d..be14ef91a4 100644 --- a/source/libs/sync/inc/syncUtil.h +++ b/source/libs/sync/inc/syncUtil.h @@ -79,7 +79,6 @@ char* syncUtilPrintBin2(char* ptr, uint32_t len); void syncUtilMsgHtoN(void* msg); void syncUtilMsgNtoH(void* msg); bool syncUtilUserPreCommit(tmsg_t msgType); -bool syncUtilUserCommit(tmsg_t msgType); bool syncUtilUserRollback(tmsg_t msgType); void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNode* pNode, const char* format, ...); diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 5d6905f99e..f8fcdbddb3 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -513,13 +513,8 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm if (!syncUtilUserCommit(pEntry->originalRpcType)) { sInfo("vgId:%d, commit sync barrier. index: %" PRId64 ", term:%" PRId64 ", type: %s", vgId, pEntry->index, pEntry->term, TMSG_INFO(pEntry->originalRpcType)); - pBuf->commitIndex = index; - if (!inBuf) { - syncEntryDestroy(pEntry); - pEntry = NULL; - } - continue; } + if (syncLogFsmExecute(pNode, pFsm, role, term, pEntry) != 0) { sError("vgId:%d, failed to execute sync log entry. index:%" PRId64 ", term:%" PRId64 ", role: %d, current term: %" PRId64, diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 7787438dfe..22ff50dbbb 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -160,8 +160,6 @@ void syncUtilMsgNtoH(void* msg) { bool syncUtilUserPreCommit(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; } -bool syncUtilUserCommit(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; } - bool syncUtilUserRollback(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; } void syncCfg2SimpleStr(const SSyncCfg* pCfg, char* buf, int32_t bufLen) { From 15b8b289725b2ba38a9e4280441d73decf59984d Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 7 Dec 2022 17:52:49 +0800 Subject: [PATCH 12/66] fix(query): SMA ensure support info pColAgg capacity over column numfor this table --- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 9 ++++++++- source/libs/executor/src/scanoperator.c | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index c4040644b1..7065364eaf 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -174,7 +174,7 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL void tsdbReaderClose(STsdbReader *pReader); bool tsdbNextDataBlock(STsdbReader *pReader); void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow); -int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SColumnDataAgg ***pBlockSMA, bool *allHave); +int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SSDataBlock* pBlock, bool *allHave); SSDataBlock *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList); int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond); int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index a4581f5472..00e6a5c541 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4112,8 +4112,9 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_ } } -int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockSMA, bool* allHave) { +int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pBlock, bool* allHave) { int32_t code = 0; + SColumnDataAgg ***pBlockSMA = &pBlock->pBlockAgg; *allHave = false; if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { @@ -4161,6 +4162,12 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockS int32_t i = 0, j = 0; size_t size = taosArrayGetSize(pSup->pColAgg); + // ensure capacity + if(pBlock->pDataBlock) { + size_t colsNum = taosArrayGetSize(pBlock->pDataBlock); + taosArrayEnsureCap(pSup->pColAgg, colsNum); + } + SSDataBlock* pResBlock = pReader->pResBlock; if (pResBlock->pBlockAgg == NULL) { size_t num = taosArrayGetSize(pResBlock->pDataBlock); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 0f35d3778d..eae2ff3c72 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -224,7 +224,7 @@ static bool doFilterByBlockSMA(SFilterInfo* pFilterInfo, SColumnDataAgg** pColsA static bool doLoadBlockSMA(STableScanBase* pTableScanInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo) { bool allColumnsHaveAgg = true; - int32_t code = tsdbRetrieveDatablockSMA(pTableScanInfo->dataReader, &pBlock->pBlockAgg, &allColumnsHaveAgg); + int32_t code = tsdbRetrieveDatablockSMA(pTableScanInfo->dataReader, pBlock, &allColumnsHaveAgg); if (code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, code); } From cc285d49006cc10ed5ab7fad6aaf2951cc7fac93 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 7 Dec 2022 18:00:32 +0800 Subject: [PATCH 13/66] fix(query): SMA ensure support info pColAgg capacity over column numfor this table --- source/dnode/vnode/inc/vnode.h | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 7065364eaf..99260ffefd 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -174,7 +174,7 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL void tsdbReaderClose(STsdbReader *pReader); bool tsdbNextDataBlock(STsdbReader *pReader); void tsdbRetrieveDataBlockInfo(const STsdbReader *pReader, int32_t *rows, uint64_t *uid, STimeWindow *pWindow); -int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SSDataBlock* pBlock, bool *allHave); +int32_t tsdbRetrieveDatablockSMA(STsdbReader *pReader, SSDataBlock* pDataBlock, bool *allHave); SSDataBlock *tsdbRetrieveDataBlock(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList); int32_t tsdbReaderReset(STsdbReader *pReader, SQueryTableDataCond *pCond); int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 00e6a5c541..3ec4f63c30 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4112,9 +4112,9 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_ } } -int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pBlock, bool* allHave) { +int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pDataBlock, bool* allHave) { int32_t code = 0; - SColumnDataAgg ***pBlockSMA = &pBlock->pBlockAgg; + SColumnDataAgg ***pBlockSMA = &pDataBlock->pBlockAgg; *allHave = false; if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { @@ -4163,8 +4163,8 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SSDataBlock* pBlock, bool size_t size = taosArrayGetSize(pSup->pColAgg); // ensure capacity - if(pBlock->pDataBlock) { - size_t colsNum = taosArrayGetSize(pBlock->pDataBlock); + if(pDataBlock->pDataBlock) { + size_t colsNum = taosArrayGetSize(pDataBlock->pDataBlock); taosArrayEnsureCap(pSup->pColAgg, colsNum); } From b3d1204e864f9c2e10e0422e66f8ae4fb2a7a6a8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 7 Dec 2022 18:04:35 +0800 Subject: [PATCH 14/66] error config --- source/dnode/mgmt/node_mgmt/src/dmTransport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 2383a09343..99f8bd002a 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -301,6 +301,7 @@ int32_t dmInitServer(SDnode *pDnode) { rpcInit.connType = TAOS_CONN_SERVER; rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.parent = pDnode; + rpcInit.compressSize = tsCompressMsgSize; pTrans->serverRpc = rpcOpen(&rpcInit); if (pTrans->serverRpc == NULL) { From 2736380b29dd291e3b2456350589740cd6959c52 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 7 Dec 2022 18:08:34 +0800 Subject: [PATCH 15/66] fix(query):fix the invalid write operation. --- source/dnode/vnode/src/meta/metaCache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 6a704d0425..0ed68dce95 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -454,7 +454,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK SListNode* pNode = NULL; while ((pNode = tdListNext(&iter)) != NULL) { - memcpy(pBuf + sizeof(suid), pNode->data, keyLen); + memcpy(&pBuf[1], pNode->data, keyLen); // check whether it is existed in LRU cache, and remove it from linked list if not. LRUHandle* pRes = taosLRUCacheLookup(pCache, pBuf, len); From 0c8bbf5496c167346a79e373c37094be34750652 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 7 Dec 2022 18:16:12 +0800 Subject: [PATCH 16/66] fix(query):add an assert. --- source/libs/executor/src/timesliceoperator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 2374d80bbf..072a96fa83 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -95,6 +95,8 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo // TODO: optimize to ignore null values for linear interpolation. if (!pLinearInfo->isStartSet) { if (!colDataIsNull_s(pColInfoData, rowIndex)) { + ASSERT(IS_MATHABLE_TYPE(pColInfoData->info.type)); + pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex); memcpy(pLinearInfo->start.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes); } From f69a188f7e5a169fb2b5a4cee00fcc405f968df8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 17:51:45 +0800 Subject: [PATCH 17/66] refact: replcase ASSERT with tAssert --- include/os/osString.h | 2 +- include/util/tlog.h | 3 +- source/client/src/clientEnv.c | 4 +- source/client/src/clientImpl.c | 6 +- source/client/src/clientMain.c | 2 +- source/client/src/clientSml.c | 8 +-- source/client/src/clientTmq.c | 4 +- source/common/src/tdatablock.c | 6 +- source/common/src/tdataformat.c | 48 +++++++------- source/common/src/tmsg.c | 16 ++--- source/common/src/trow.c | 49 ++++++++------- source/common/src/ttime.c | 10 +-- source/dnode/mgmt/exe/dmMain.c | 7 ++- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 4 +- source/dnode/mnode/impl/src/mndConsumer.c | 37 +++++------ source/dnode/mnode/impl/src/mndDb.c | 6 +- source/dnode/mnode/impl/src/mndDef.c | 2 +- source/dnode/mnode/impl/src/mndScheduler.c | 8 +-- source/dnode/mnode/impl/src/mndSma.c | 12 ++-- source/dnode/mnode/impl/src/mndStb.c | 8 +-- source/dnode/mnode/impl/src/mndStream.c | 12 ++-- source/dnode/mnode/impl/src/mndSubscribe.c | 6 +- source/dnode/mnode/impl/src/mndTopic.c | 4 +- source/dnode/snode/src/snode.c | 4 +- source/dnode/vnode/src/meta/metaEntry.c | 4 +- source/dnode/vnode/src/meta/metaSnapshot.c | 6 +- source/dnode/vnode/src/meta/metaTable.c | 6 +- source/dnode/vnode/src/sma/smaEnv.c | 4 +- source/dnode/vnode/src/sma/smaOpen.c | 6 +- source/dnode/vnode/src/sma/smaRollup.c | 4 +- source/dnode/vnode/src/sma/smaSnapshot.c | 2 +- source/dnode/vnode/src/sma/smaTimeRange.c | 2 +- source/dnode/vnode/src/tq/tq.c | 26 ++++---- source/dnode/vnode/src/tq/tqExec.c | 8 +-- source/dnode/vnode/src/tq/tqMeta.c | 40 ++++++------ source/dnode/vnode/src/tq/tqOffset.c | 16 ++--- source/dnode/vnode/src/tq/tqOffsetSnapshot.c | 14 ++--- source/dnode/vnode/src/tq/tqPush.c | 8 +-- source/dnode/vnode/src/tq/tqRead.c | 20 +++--- source/dnode/vnode/src/tq/tqSink.c | 4 +- source/dnode/vnode/src/tq/tqStreamStateSnap.c | 2 +- source/dnode/vnode/src/tq/tqStreamTaskSnap.c | 2 +- source/dnode/vnode/src/tsdb/tsdbCache.c | 6 +- source/dnode/vnode/src/tsdb/tsdbCommit.c | 2 +- source/dnode/vnode/src/tsdb/tsdbFile.c | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 8 +-- source/dnode/vnode/src/tsdb/tsdbRetention.c | 2 +- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 6 +- source/dnode/vnode/src/tsdb/tsdbUtil.c | 16 ++--- source/dnode/vnode/src/vnd/vnodeQuery.c | 4 +- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 2 +- source/libs/executor/src/executil.c | 4 +- source/libs/executor/src/executor.c | 12 ++-- source/libs/executor/src/executorimpl.c | 16 ++--- source/libs/executor/src/filloperator.c | 6 +- source/libs/executor/src/groupoperator.c | 2 +- source/libs/executor/src/scanoperator.c | 18 +++--- source/libs/executor/src/tfill.c | 2 +- source/libs/function/src/builtins.c | 3 +- source/libs/function/src/builtinsimpl.c | 10 +-- .../libs/function/src/detail/tavgfunction.c | 3 +- source/libs/index/src/indexComm.c | 4 +- source/libs/qcom/src/queryUtil.c | 4 +- source/libs/scalar/inc/sclvector.h | 2 +- source/libs/scalar/src/sclfunc.c | 2 +- source/libs/scalar/src/sclvector.c | 20 +++--- source/libs/stream/src/stream.c | 2 +- source/libs/stream/src/streamCheckpoint.c | 2 +- source/libs/stream/src/streamDispatch.c | 8 +-- source/libs/stream/src/streamExec.c | 4 +- source/libs/stream/src/streamMeta.c | 8 +-- source/libs/stream/src/streamRecover.c | 6 +- source/libs/sync/src/syncIndexMgr.c | 12 ++-- source/libs/sync/src/syncRaftCfg.c | 4 +- source/libs/sync/src/syncRaftEntry.c | 2 +- source/libs/tdb/src/db/tdbBtree.c | 62 +++++++++---------- source/libs/tdb/src/db/tdbPCache.c | 2 +- source/libs/tdb/src/db/tdbPage.c | 2 +- source/libs/tdb/src/db/tdbPager.c | 10 +-- source/libs/tdb/src/inc/tdbInt.h | 2 +- source/libs/wal/src/walRead.c | 22 +++---- source/libs/wal/src/walWrite.c | 18 +++--- source/os/src/osString.c | 6 +- source/util/src/talgo.c | 3 +- source/util/src/tcompression.c | 10 +-- source/util/src/tsched.c | 16 ++--- utils/test/c/sml_test.c | 2 +- 87 files changed, 410 insertions(+), 391 deletions(-) diff --git a/include/os/osString.h b/include/os/osString.h index 4c3fbe46c3..095af6d1c9 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -62,7 +62,7 @@ typedef int32_t TdUcs4; int32_t taosUcs4len(TdUcs4 *ucs4); int64_t taosStr2int64(const char *str); -void taosConvInit(void); +int32_t taosConvInit(); void taosConvDestroy(); int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs); bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len); diff --git a/include/util/tlog.h b/include/util/tlog.h index 7c5d89b680..1785fd2c5c 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -84,7 +84,8 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons ; bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); -#define tAssert(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +#define tAssertS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +#define tAssert(condition) tAssertS(condition, "assert info not provided") // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 7564d91330..d61693ddb3 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -407,7 +407,9 @@ void taos_init_imp(void) { initQueryModuleMsgHandle(); - taosConvInit(); + if (taosConvInit() != 0) { + tAssertS(0, "failed to init conv"); + } rpcInit(); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index e6584f4a00..fd2ae288ca 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1679,7 +1679,7 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i } else if (jsonInnerType == TSDB_DATA_TYPE_BOOL) { len += (VARSTR_HEADER_SIZE + 5); } else { - ASSERT(0); + tAssert(0); } } } else if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { @@ -1785,7 +1785,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int sprintf(varDataVal(dst), "%s", (*((char*)jsonInnerData) == 1) ? "true" : "false"); varDataSetLen(dst, strlen(varDataVal(dst))); } else { - ASSERT(0); + tAssert(0); } offset1[j] = len; @@ -1879,7 +1879,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 colLength[i] = htonl(colLength[i]); if (colLength[i] >= dataLen) { tscError("invalid colLength %d, dataLen %d", colLength[i], dataLen); - ASSERT(0); + tAssert(0); } if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 9f3c78aba2..f670951d49 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -575,7 +575,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { (*numOfRows) = pResultInfo->numOfRows; return 0; } else { - ASSERT(0); + tAssert(0); return -1; } } diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index a4e943da32..e5a0e66559 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -785,7 +785,7 @@ static int64_t smlGetTimeValue(const char *value, int32_t len, int8_t type) { case TSDB_TIME_PRECISION_NANO: break; default: - ASSERT(0); + tAssert(0); } if (ts >= (double)INT64_MAX || ts < 0) { return -1; @@ -873,7 +873,7 @@ static int32_t smlParseTS(SSmlHandle *info, const char *data, int32_t len, SArra } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { ts = smlParseOpenTsdbTime(info, data, len); } else { - ASSERT(0); + tAssert(0); } uDebug("SML:0x%" PRIx64 " smlParseTS:%" PRId64, info->id, ts); @@ -2206,7 +2206,7 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) { } else if (info->protocol == TSDB_SML_JSON_PROTOCOL) { ret = smlParseJSONString(info, (cJSON *)data, tinfo, cols); } else { - ASSERT(0); + tAssert(0); } if (ret != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlParseTelnetLine failed", info->id); @@ -2421,7 +2421,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { code = smlParseTelnetLine(info, tmp, len); } else { - ASSERT(0); + tAssert(0); } if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, tmp); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index ade0c95227..56c9b97952 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -806,7 +806,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* tmq) { taosTmrReset(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, pRefId, tmqMgmt.timer, &tmq->commitTimer); } else if (*pTaskType == TMQ_DELAYED_TASK__REPORT) { } else { - ASSERT(0); + tAssert(0); } taosFreeQitem(pTaskType); } @@ -1209,7 +1209,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead)); } else { - ASSERT(0); + tAssert(0); } taosMemoryFree(pMsg->pData); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index dfd0b68039..c5cbc961ef 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -59,7 +59,7 @@ int32_t getJsonValueLen(const char* data) { } else if (tTagIsJson(data)) { // json string dataLen = ((STag*)(data))->len; } else { - ASSERT(0); + tAssert(0); } return dataLen; } @@ -2137,7 +2137,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_MEDIUMBLOB: uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type); - ASSERT(0); + tAssert(0); break; default: if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { @@ -2171,7 +2171,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB } } else { uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type); - ASSERT(0); + tAssert(0); } break; } diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index fc49c03379..b5c17b556d 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -89,7 +89,7 @@ typedef struct { SET_BIT2(PB, IDX, VAL); \ break; \ default: \ - ASSERT(0); \ + tAssert(0); \ break; \ } \ } \ @@ -135,7 +135,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { nkv += tPutI16v(NULL, -pTColumn->colId); nIdx++; } else { - ASSERT(0); + tAssert(0); } pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL; @@ -174,7 +174,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { ntp = sizeof(SRow) + BIT2_SIZE(pTSchema->numOfCols - 1) + ntp; break; default: - ASSERT(0); + tAssert(0); break; } if (maxIdx <= UINT8_MAX) { @@ -302,7 +302,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { pv = pf + pTSchema->flen; break; default: - ASSERT(0); + tAssert(0); break; } @@ -559,7 +559,7 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { pIter->pv = pIter->pf + pTSchema->flen; break; default: - ASSERT(0); + tAssert(0); break; } } @@ -649,7 +649,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { pIter->cv = COL_VAL_NONE(pTColumn->colId, pTColumn->type); goto _exit; } else { - ASSERT(0); + tAssert(0); } } else { pIter->cv = COL_VAL_NONE(pTColumn->colId, pTColumn->type); @@ -673,7 +673,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { bv = GET_BIT2(pIter->pb, pIter->iTColumn - 1); break; default: - ASSERT(0); + tAssert(0); break; } @@ -773,7 +773,7 @@ static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const c printf("%s:%d type:%d vlen:%d, val:%" PRIi8 "\n", tag, ln, (int32_t)type, vlen, *(int8_t *)val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1581,7 +1581,7 @@ static FORCE_INLINE void tColDataGetValue3(SColData *pColData, int32_t iVal, SCo *pColVal = COL_VAL_NULL(pColData->cid, pColData->type); break; default: - ASSERT(0); + tAssert(0); } } static FORCE_INLINE void tColDataGetValue4(SColData *pColData, int32_t iVal, SColVal *pColVal) { // HAS_VALUE @@ -1608,7 +1608,7 @@ static FORCE_INLINE void tColDataGetValue5(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - ASSERT(0); + tAssert(0); } } static FORCE_INLINE void tColDataGetValue6(SColData *pColData, int32_t iVal, @@ -1621,7 +1621,7 @@ static FORCE_INLINE void tColDataGetValue6(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - ASSERT(0); + tAssert(0); } } static FORCE_INLINE void tColDataGetValue7(SColData *pColData, int32_t iVal, @@ -1637,7 +1637,7 @@ static FORCE_INLINE void tColDataGetValue7(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - ASSERT(0); + tAssert(0); } } static void (*tColDataGetValueImpl[])(SColData *pColData, int32_t iVal, SColVal *pColVal) = { @@ -1681,7 +1681,7 @@ uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal) { v = GET_BIT2(pColData->pBitMap, iVal); break; default: - ASSERT(0); + tAssert(0); break; } return v; @@ -1759,7 +1759,7 @@ static FORCE_INLINE void tColDataCalcSMABool(SColData *pColData, int64_t *sum, i CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1791,7 +1791,7 @@ static FORCE_INLINE void tColDataCalcSMATinyInt(SColData *pColData, int64_t *sum CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1823,7 +1823,7 @@ static FORCE_INLINE void tColDataCalcSMATinySmallInt(SColData *pColData, int64_t CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1855,7 +1855,7 @@ static FORCE_INLINE void tColDataCalcSMAInt(SColData *pColData, int64_t *sum, in CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1887,7 +1887,7 @@ static FORCE_INLINE void tColDataCalcSMABigInt(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1919,7 +1919,7 @@ static FORCE_INLINE void tColDataCalcSMAFloat(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1951,7 +1951,7 @@ static FORCE_INLINE void tColDataCalcSMADouble(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -1983,7 +1983,7 @@ static FORCE_INLINE void tColDataCalcSMAUTinyInt(SColData *pColData, int64_t *su CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -2015,7 +2015,7 @@ static FORCE_INLINE void tColDataCalcSMATinyUSmallInt(SColData *pColData, int64_ CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -2047,7 +2047,7 @@ static FORCE_INLINE void tColDataCalcSMAUInt(SColData *pColData, int64_t *sum, i CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } @@ -2079,7 +2079,7 @@ static FORCE_INLINE void tColDataCalcSMAUBigInt(SColData *pColData, int64_t *sum CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - ASSERT(0); + tAssert(0); break; } } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 00929a1836..e7bab05bd3 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -28,6 +28,8 @@ #undef TD_MSG_SEG_CODE_ #include "tmsgdef.h" +#include "tlog.h" + int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { if (pMsg == NULL) { terrno = TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP; @@ -54,7 +56,7 @@ int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) { pIter->len += sizeof(SSubmitReq); } else { if (pIter->len >= pIter->totalLen) { - ASSERT(0); + tAssert(0); } pIter->len += (sizeof(SSubmitBlk) + pIter->dataLen + pIter->schemaLen); @@ -5677,7 +5679,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) { } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { - ASSERT(0); + tAssert(0); } tEndEncode(pCoder); @@ -5719,7 +5721,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tDecodeSSchemaWrapperEx(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { - ASSERT(0); + tAssert(0); } tEndDecode(pCoder); @@ -6347,7 +6349,7 @@ int32_t tEncodeSTqOffsetVal(SEncoder *pEncoder, const STqOffsetVal *pOffsetVal) } else if (pOffsetVal->type < 0) { // do nothing } else { - ASSERT(0); + tAssert(0); } return 0; } @@ -6362,7 +6364,7 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) { } else if (pOffsetVal->type < 0) { // do nothing } else { - ASSERT(0); + tAssert(0); } return 0; } @@ -6379,7 +6381,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts); } else { - ASSERT(0); + tAssert(0); } return 0; } @@ -6393,7 +6395,7 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { } else if (pLeft->type == TMQ_OFFSET__SNAPSHOT_META) { return pLeft->uid == pRight->uid; } else { - ASSERT(0); + tAssert(0); /*ASSERT(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/ /*pLeft->type == TMQ_OFFSET__RESET_LATEST);*/ /*return true;*/ diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 52ebd7f879..8e0ca1efa7 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "trow.h" +#include "tlog.h" const uint8_t tdVTypeByte[2][3] = {{ // 2 bits @@ -75,7 +76,7 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) { return; } if (!pVal->val) { - ASSERT(0); + tAssert(0); printf("BadVal "); return; } @@ -248,7 +249,7 @@ bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) { } else if (TD_IS_KV_ROW(pIter->pRow)) { tdSTSRowIterGetKvVal(pIter, pCol->colId, &pIter->kvIdx, pVal); } else { - ASSERT(0); + tAssert(0); } ++pIter->colIdx; @@ -489,7 +490,7 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) { if (!pBitmap || colIdx < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -511,7 +512,7 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa *pValType = ((*pDestByte) & 0x03); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -520,7 +521,7 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) { if (!pBitmap || colIdx < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -554,7 +555,7 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal *pValType = ((*pDestByte) & 0x01); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -563,7 +564,7 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { if (!pBitmap || colIdx < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -606,7 +607,7 @@ int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { // *pDestByte |= (valType); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -629,7 +630,7 @@ int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int32_ output->val = POINTER_SHIFT(pRow, offset); } #else - ASSERT(0); + tAssert(0); if (offset < 0) { terrno = TSDB_CODE_INVALID_PARA; output->valType = TD_VTYPE_NONE; @@ -679,7 +680,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp return terrno; } #else - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; #endif @@ -706,7 +707,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp if (!pBuilder->hasNone) pBuilder->hasNone = true; return TSDB_CODE_SUCCESS; default: - ASSERT(0); + tAssert(0); break; } @@ -721,7 +722,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val, bool isCopyVarData, int8_t colType, int16_t colIdx, int32_t offset, col_id_t colId) { if ((offset < (int32_t)sizeof(SKvRowIdx)) || (colIdx < 1)) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -809,7 +810,7 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou pBuilder->nCols = nCols; pBuilder->nBoundCols = nBoundCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -831,7 +832,7 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { pBuilder->pBuf = (STSRow *)pBuf; if (!pBuilder->pBuf) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -868,7 +869,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { TD_ROW_SET_NCOLS(pBuilder->pBuf, pBuilder->nBoundCols); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -879,7 +880,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) { pBuilder->pBuf = (STSRow *)pBuf; if (!pBuilder->pBuf) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -899,7 +900,7 @@ int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) { #endif break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -919,7 +920,7 @@ int32_t tdSRowSetTpInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t flen) { pBuilder->flen = flen; pBuilder->nCols = nCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -938,7 +939,7 @@ int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, pBuilder->nCols = nCols; pBuilder->nBoundCols = nBoundCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -967,7 +968,7 @@ int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValT tdGetBitmapValTypeI(pBitmap, colIdx, pValType); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return TSDB_CODE_FAILED; } @@ -986,7 +987,7 @@ bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode) int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) { if (!pBitmap || colIdx < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -1013,7 +1014,7 @@ int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) { // *pDestByte |= (valType); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -1030,7 +1031,7 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int tdSetBitmapValTypeI(pBitmap, colIdx, valType); break; default: - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_PARA; return TSDB_CODE_FAILED; } @@ -1076,7 +1077,7 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV } else if (TD_IS_KV_ROW(pRow)) { tdSKvRowGetVal(pRow, pTColumn->colId, iCol - 1, &cv); } else { - ASSERT(0); + tAssert(0); } if (tdValTypeIsNone(cv.valType)) { diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index a106a09a69..e88bc8f2b0 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -23,6 +23,8 @@ #define _DEFAULT_SOURCE #include "ttime.h" +#include "tlog.h" + /* * mktime64 - Converts date to seconds. * Converts Gregorian date to seconds since 1970-01-01 00:00:00. @@ -452,7 +454,7 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } return utime * 1000000; default: - ASSERT(0); + tAssert(0); return utime; } } // end from milli @@ -468,7 +470,7 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } return utime * 1000; default: - ASSERT(0); + tAssert(0); return utime; } } // end from micro @@ -481,12 +483,12 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre case TSDB_TIME_PRECISION_NANO: return utime; default: - ASSERT(0); + tAssert(0); return utime; } } // end from nano default: { - ASSERT(0); + tAssert(0); return utime; // only to pass windows compilation } } // end switch fromPrecision diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 188677656a..6963803df0 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -201,7 +201,12 @@ int mainWindows(int argc, char **argv) { return -1; } - taosConvInit(); + if (taosConvInit() != 0) { + dError("failed to init conv"); + taosCloseLog(); + taosCleanupArgs(); + return -1; + } if (global.dumpConfig) { dmDumpCfg(); diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 12b75add4b..009bdf8a34 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -161,8 +161,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { smPutNodeMsgToWriteQueue(pMgmt, pMsg); break; default: - tAssert(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), - TMSG_INFO(pMsg->msgType), qtype); + tAssertS(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + TMSG_INFO(pMsg->msgType), qtype); } return 0; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 45bf4df77f..6c467d26c7 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -134,8 +134,8 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) { SMqConsumerRecoverMsg *pRecoverMsg = pMsg->pCont; SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pRecoverMsg->consumerId); - tAssert(pConsumer != NULL, "receive consumer recover msg, consumer id %" PRId64 ", status %s", - pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); + tAssertS(pConsumer != NULL, "receive consumer recover msg, consumer id %" PRId64 ", status %s", + pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); mInfo("receive consumer recover msg, consumer id %" PRId64 ", status %s", pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); @@ -383,7 +383,8 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { return -1; } - tAssert(strcmp(req.cgroup, pConsumer->cgroup) == 0, "cgroup:%s not match consumer:%s", req.cgroup, pConsumer->cgroup); + tAssertS(strcmp(req.cgroup, pConsumer->cgroup) == 0, "cgroup:%s not match consumer:%s", req.cgroup, + pConsumer->cgroup); atomic_store_32(&pConsumer->hbStatus, 0); @@ -432,7 +433,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); // txn guarantees pSub is created - tAsser(pSub); + tAssert(pSub != NULL); taosRLockLatch(&pSub->lock); SMqSubTopicEp topicEp = {0}; @@ -440,7 +441,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { // 2.1 fetch topic schema SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic); - ASSERT(pTopic); + tAssertS(pTopic != NULL, "failed to acquire topic:%s", topic); taosRLockLatch(&pTopic->lock); tstrncpy(topicEp.db, pTopic->db, TSDB_DB_FNAME_LEN); topicEp.schema.nCols = pTopic->schema.nCols; @@ -776,8 +777,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, taosWLockLatch(&pOldConsumer->lock); if (pNewConsumer->updateType == CONSUMER_UPDATE__MODIFY) { - ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); - ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); if (taosArrayGetSize(pNewConsumer->rebNewTopics) == 0 && taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0) { pOldConsumer->status = MQ_CONSUMER_STATUS__READY; @@ -799,8 +800,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->status = MQ_CONSUMER_STATUS__MODIFY; } } else if (pNewConsumer->updateType == CONSUMER_UPDATE__LOST) { - ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); - ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); int32_t sz = taosArrayGetSize(pOldConsumer->currentTopics); /*pOldConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));*/ @@ -813,8 +814,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->status = MQ_CONSUMER_STATUS__LOST; } else if (pNewConsumer->updateType == CONSUMER_UPDATE__RECOVER) { - ASSERT(taosArrayGetSize(pOldConsumer->currentTopics) == 0); - ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->currentTopics) == 0); + tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); int32_t sz = taosArrayGetSize(pOldConsumer->assignedTopics); for (int32_t i = 0; i < sz; i++) { @@ -831,15 +832,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; } else if (pNewConsumer->updateType == CONSUMER_UPDATE__ADD) { - ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1); - ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0); + tAssert(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1); + tAssert(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0); char *addedTopic = strdup(taosArrayGetP(pNewConsumer->rebNewTopics, 0)); // not exist in current topic #if 1 for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->currentTopics); i++) { char *topic = taosArrayGetP(pOldConsumer->currentTopics, i); - ASSERT(strcmp(topic, addedTopic) != 0); + tAssert(strcmp(topic, addedTopic) != 0); } #endif @@ -880,15 +881,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, atomic_add_fetch_32(&pOldConsumer->epoch, 1); } else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) { - ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0); - ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1); + tAssert(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0); + tAssert(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1); char *removedTopic = taosArrayGetP(pNewConsumer->rebRemovedTopics, 0); // not exist in new topic #if 1 for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->rebNewTopics); i++) { char *topic = taosArrayGetP(pOldConsumer->rebNewTopics, i); - ASSERT(strcmp(topic, removedTopic) != 0); + tAssert(strcmp(topic, removedTopic) != 0); } #endif @@ -914,7 +915,7 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, } } // must find the topic - ASSERT(i < sz); + tAssert(i < sz); // set status if (taosArrayGetSize(pOldConsumer->rebNewTopics) == 0 && taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0) { diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 61b5be414e..b8a78d0d74 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -112,9 +112,9 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER) for (int32_t i = 0; i < pDb->cfg.numOfRetensions; ++i) { - 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))) { + if (tAssertS(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); diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index b5c2fb05b3..74ed4f9db0 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -489,7 +489,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) { tlen += tEncodeSMqConsumerEp(buf, pConsumerEp); cnt++; } - ASSERT(cnt == sz); + tAssert(cnt == sz); tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp); tlen += taosEncodeString(buf, pSub->dbName); return tlen; diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index af1a29def0..5dbbe740e3 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -115,13 +115,13 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream if (pStream->fixedSinkVgId == 0) { SDbObj* pDb = mndAcquireDb(pMnode, pStream->targetDb); - ASSERT(pDb); + tAssert(pDb != NULL); if (pDb->cfg.numOfVgroups > 1) { isShuffle = true; pTask->outputType = TASK_OUTPUT__SHUFFLE_DISPATCH; pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) { - ASSERT(0); + tAssert(0); return -1; } } @@ -170,7 +170,7 @@ int32_t mndAssignTaskToVg(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, co plan->execNode.epSet = pTask->epSet; if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_QRY_INVALID_INPUT; return -1; } @@ -195,7 +195,7 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, plan->execNode.epSet = pTask->epSet; if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_QRY_INVALID_INPUT; return -1; } diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index e6a6e6ae5b..ce8cdb7bcc 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -558,13 +558,13 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea SNode *pAst = NULL; if (nodesStringToNode(streamObj.ast, &pAst) < 0) { - ASSERT(0); + tAssert(0); return -1; } // extract output schema from ast if (qExtractResultSchema(pAst, (int32_t *)&streamObj.outputSchema.nCols, &streamObj.outputSchema.pSchema) != 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -579,13 +579,13 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea }; if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) { - ASSERT(0); + tAssert(0); return -1; } // save physcial plan if (nodesNodeToString((SNode *)pPlan, false, &streamObj.physicalPlan, NULL) != 0) { - ASSERT(0); + tAssert(0); return -1; } if (pAst != NULL) nodesDestroyNode(pAst); @@ -822,14 +822,14 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { mError("stream:%s, failed to drop task since %s", pStream->name, terrstr()); sdbRelease(pMnode->pSdb, pStream); - ASSERT(0); + tAssert(0); goto _OVER; } // drop stream if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) { sdbRelease(pMnode->pSdb, pStream); - ASSERT(0); + tAssert(0); goto _OVER; } } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c611cfb6e1..28955bd45e 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1176,7 +1176,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pTopic->ast, &pAst) != 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1221,7 +1221,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName SNode *pAst = NULL; if (nodesStringToNode(pStream->ast, &pAst) != 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -2091,7 +2091,7 @@ static int32_t mndCheckDropStbForTopic(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pTopic->ast, &pAst) != 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -2138,7 +2138,7 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pStream->ast, &pAst) != 0) { - ASSERT(0); + tAssert(0); return -1; } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 7ee688d220..74c753d480 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -325,13 +325,13 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, // deserialize ast if (nodesStringToNode(pObj->ast, &pAst) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ goto FAIL; } // extract output schema from ast if (qExtractResultSchema(pAst, (int32_t *)&pObj->outputSchema.nCols, &pObj->outputSchema.pSchema) != 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ goto FAIL; } @@ -346,13 +346,13 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, // using ast and param to build physical plan if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ goto FAIL; } // save physcial plan if (nodesNodeToString((SNode *)pPlan, false, &pObj->physicalPlan, NULL) != 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ goto FAIL; } @@ -793,7 +793,7 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) { ASSERT(pTask->nodeId > 0); SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->nodeId); if (pVgObj == NULL) { - ASSERT(0); + tAssert(0); taosRUnLockLatch(&pStream->lock); mndReleaseStream(pMnode, pStream); mndTransDrop(pTrans); @@ -853,7 +853,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { SMDropStreamReq dropReq = {0}; if (tDeserializeSMDropStreamReq(pReq->pCont, pReq->contLen, &dropReq) < 0) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_INVALID_MSG; return -1; } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 55e073a8a4..898844063e 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -155,7 +155,7 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SM int32_t vgId = pRebVg->pVgEp->vgId; SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId); if (pVgObj == NULL) { - ASSERT(0); + tAssert(0); taosMemoryFree(buf); return -1; } @@ -492,7 +492,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu taosArrayPush(pConsumerNew->rebNewTopics, &topic); mndReleaseConsumer(pMnode, pConsumerOld); if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) { - ASSERT(0); + tAssert(0); tDeleteSMqConsumerObj(pConsumerNew); taosMemoryFree(pConsumerNew); goto REB_FAIL; @@ -515,7 +515,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu taosArrayPush(pConsumerNew->rebRemovedTopics, &topic); mndReleaseConsumer(pMnode, pConsumerOld); if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) { - ASSERT(0); + tAssert(0); tDeleteSMqConsumerObj(pConsumerNew); taosMemoryFree(pConsumerNew); goto REB_FAIL; diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index e271eedd17..66c791c405 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -499,7 +499,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * if (code < 0) { sdbRelease(pSdb, pVgroup); mndTransDrop(pTrans); - ASSERT(0); + tAssert(0); return -1; } void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len); @@ -717,7 +717,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { // TODO check if rebalancing if (mndDropSubByTopic(pMnode, pTrans, dropReq.name) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ mError("topic:%s, failed to drop since %s", pTopic->name, terrstr()); mndTransDrop(pTrans); mndReleaseTopic(pMnode, pTopic); diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index b133226ed3..5950e0e7b2 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -263,7 +263,7 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) { case TDMT_STREAM_TASK_DROP: return sndProcessTaskDropReq(pSnode, pReq, len); default: - ASSERT(0); + tAssert(0); } return 0; } @@ -317,7 +317,7 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) { case TDMT_STREAM_RECOVER_FINISH_RSP: return sndProcessTaskRecoverFinishRsp(pSnode, pMsg); default: - ASSERT(0); + tAssert(0); } return 0; } diff --git a/source/dnode/vnode/src/meta/metaEntry.c b/source/dnode/vnode/src/meta/metaEntry.c index 72f7365a1e..0a6e91f511 100644 --- a/source/dnode/vnode/src/meta/metaEntry.c +++ b/source/dnode/vnode/src/meta/metaEntry.c @@ -51,7 +51,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) { } else if (pME->type == TSDB_TSMA_TABLE) { if (tEncodeTSma(pCoder, pME->smaEntry.tsma) < 0) return -1; } else { - ASSERT(0); + tAssert(0); } tEndEncode(pCoder); @@ -99,7 +99,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { } if (tDecodeTSma(pCoder, pME->smaEntry.tsma, true) < 0) return -1; } else { - ASSERT(0); + tAssert(0); } tEndDecode(pCoder); diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 6a4dcf6ead..0409db35d9 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -161,7 +161,7 @@ int32_t metaSnapWriterClose(SMetaSnapWriter** ppWriter, int8_t rollback) { SMetaSnapWriter* pWriter = *ppWriter; if (rollback) { - ASSERT(0); + tAssert(0); } else { code = metaCommit(pWriter->pMeta, pWriter->pMeta->txn); if (code) goto _err; @@ -524,7 +524,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in } else { SArray* pTagVals = NULL; if (tTagToValArray((const STag*)p, &pTagVals) != 0) { - ASSERT(0); + tAssert(0); } int16_t nCols = taosArrayGetSize(pTagVals); for (int j = 0; j < nCols; ++j) { @@ -568,7 +568,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in ret = buildNormalChildTableInfo(&req, pBuf, contLen); *type = TDMT_VND_CREATE_TABLE; } else { - ASSERT(0); + tAssert(0); } tDecoderClear(&dc); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 0b00f036de..339a9f7e2b 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -46,7 +46,7 @@ static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) { pInfo->suid = 0; pInfo->skmVer = pEntry->ntbEntry.schemaRow.version; } else { - ASSERT(0); + tAssert(0); } } @@ -558,7 +558,7 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) { ctime = pME->ntbEntry.ctime; ttlDays = pME->ntbEntry.ttlDays; } else { - ASSERT(0); + tAssert(0); } if (ttlDays <= 0) return; @@ -1401,7 +1401,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) { } else if (pME->type == TSDB_NORMAL_TABLE) { pSW = &pME->ntbEntry.schemaRow; } else { - ASSERT(0); + tAssert(0); } skmDbKey.uid = pME->uid; diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index a272f5fc97..6186bac7a7 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -250,7 +250,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS } else if (smaType == TSDB_SMA_TYPE_TIME_RANGE) { // TODO } else { - ASSERT(0); + tAssert(0); } } return TSDB_CODE_SUCCESS; @@ -342,7 +342,7 @@ static int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) { smaDebug("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " succeed", vid, refId, smaMgmt.rsetId); } } else { - ASSERT(0); + tAssert(0); } } return 0; diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 2a769b68fe..c48677c311 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -100,7 +100,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty pKeepCfg->precision = pCfg->precision; switch (type) { case TSDB_TYPE_TSMA: - ASSERT(0); + tAssert(0); break; case TSDB_TYPE_RSMA_L0: SMA_SET_KEEP_CFG(pVnode, 0); @@ -112,7 +112,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty SMA_SET_KEEP_CFG(pVnode, 2); break; default: - ASSERT(0); + tAssert(0); break; } return 0; @@ -145,7 +145,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback) { } else if (i == TSDB_RETENTION_L2) { SMA_OPEN_RSMA_IMPL(pVnode, 2); } else { - ASSERT(0); + tAssert(0); } } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 6bd2ae3435..f3c8ff885c 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -1038,7 +1038,7 @@ static int32_t tdExecuteRSmaAsync(SSma *pSma, const void *pMsg, int32_t inputTyp } } } else { - ASSERT(0); + tAssert(0); } tdReleaseRSmaInfo(pSma, pRSmaInfo); @@ -1567,7 +1567,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { } } } else { - ASSERT(0); + tAssert(0); } if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) { diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c index 34f884f9f9..4139883e91 100644 --- a/source/dnode/vnode/src/sma/smaSnapshot.c +++ b/source/dnode/vnode/src/sma/smaSnapshot.c @@ -430,7 +430,7 @@ int32_t rsmaSnapWrite(SRSmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData) } else if (pHdr->type == SNAP_DATA_QTASK) { code = rsmaSnapWriteQTaskInfo(pWriter, pData, nData); } else { - ASSERT(0); + tAssert(0); } if (code < 0) goto _err; diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index a2c9484693..6df72d5c0a 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -136,7 +136,7 @@ static int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t version, const char * " dstTb:%s dstVg:%d", SMA_VID(pSma), pCfg->indexName, pCfg->indexUid, pCfg->tableUid, pCfg->dstTbUid, pReq.name, pCfg->dstVgId); } else { - ASSERT(0); + tAssert(0); } return 0; diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 191fc1b49c..c9ad88188d 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -92,21 +92,21 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo); if (tqMetaOpen(pTq) < 0) { - ASSERT(0); + tAssert(0); } pTq->pOffsetStore = tqOffsetOpen(pTq); if (pTq->pOffsetStore == NULL) { - ASSERT(0); + tAssert(0); } pTq->pStreamMeta = streamMetaOpen(path, pTq, (FTaskExpand*)tqExpandTask, pTq->pVnode->config.vgId); if (pTq->pStreamMeta == NULL) { - ASSERT(0); + tAssert(0); } if (streamLoadTasks(pTq->pStreamMeta) < 0) { - ASSERT(0); + tAssert(0); } return pTq; @@ -348,7 +348,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m SDecoder decoder; tDecoderInit(&decoder, msg, msgLen); if (tDecodeSTqOffset(&decoder, &offset) < 0) { - ASSERT(0); + tAssert(0); return -1; } tDecoderClear(&decoder); @@ -363,7 +363,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m offset.val.version += 1; } } else { - ASSERT(0); + tAssert(0); } STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, offset.subKey); if (pOffset != NULL && tqOffsetLessOrEqual(&offset, pOffset)) { @@ -371,7 +371,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m } if (tqOffsetWrite(pTq->pOffsetStore, &offset) < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -736,7 +736,7 @@ int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgL } if (tqMetaDeleteHandle(pTq, pReq->subKey) < 0) { - ASSERT(0); + tAssert(0); } return 0; } @@ -802,7 +802,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL // TODO version should be assigned and refed during preprocess SWalRef* pRef = walRefCommittedVer(pTq->pVnode->pWal); if (pRef == NULL) { - ASSERT(0); + tAssert(0); return -1; } int64_t ver = pRef->refVer; @@ -862,7 +862,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL tqDebug("try to persist handle %s consumer %" PRId64, req.subKey, pHandle->consumerId); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { // TODO - ASSERT(0); + tAssert(0); } } else { /*ASSERT(pExec->consumerId == req.oldConsumerId);*/ @@ -873,7 +873,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL taosMemoryFree(req.qmsg); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { // TODO - ASSERT(0); + tAssert(0); } // close handle } @@ -997,7 +997,7 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { int32_t len; tEncodeSize(tEncodeSStreamTaskCheckRsp, &rsp, len, code); if (code < 0) { - ASSERT(0); + tAssert(0); } void* buf = rpcMallocCont(sizeof(SMsgHead) + len); ((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId); @@ -1095,7 +1095,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { // check param int64_t fillVer1 = pTask->startVer; if (fillVer1 <= 0) { - ASSERT(0); + tAssert(0); streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 093186ebbb..282433d1b5 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -87,7 +87,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs uint64_t ts = 0; tqDebug("vgId:%d, tmq task start to execute", pTq->pVnode->config.vgId); if (qExecTask(task, &pDataBlock, &ts) < 0) { - ASSERT(0); + tAssert(0); } tqDebug("vgId:%d, tmq task executed, get %p", pTq->pVnode->config.vgId, pDataBlock); @@ -105,7 +105,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs } if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) { - ASSERT(0); + tAssert(0); return -1; } ASSERT(pRsp->rspOffset.type != 0); @@ -148,7 +148,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta uint64_t ts = 0; tqDebug("tmqsnap task start to execute"); if (qExecTask(task, &pDataBlock, &ts) < 0) { - ASSERT(0); + tAssert(0); } tqDebug("tmqsnap task execute end, get %p", pDataBlock); @@ -216,7 +216,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) { - ASSERT(0); + tAssert(0); } ASSERT(pRsp->rspOffset.type != 0); diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index f476f58b56..2cbe70fd38 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -71,17 +71,17 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) { int32_t tqMetaOpen(STQ* pTq) { if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0) < 0) { - ASSERT(0); + tAssert(0); return -1; } if (tdbTbOpen("tq.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pExecStore, 0) < 0) { - ASSERT(0); + tAssert(0); return -1; } if (tdbTbOpen("tq.check.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pCheckStore, 0) < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -135,19 +135,19 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) { if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - ASSERT(0); + tAssert(0); } if (tdbTbDelete(pTq->pCheckStore, key, (int)strlen(key), txn) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } return 0; @@ -156,7 +156,7 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) { int32_t tqMetaRestoreCheckInfo(STQ* pTq) { TBC* pCur = NULL; if (tdbTbcOpen(pTq->pCheckStore, &pCur, NULL) < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -204,33 +204,33 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) { void* buf = taosMemoryCalloc(1, vlen); if (buf == NULL) { - ASSERT(0); + tAssert(0); } SEncoder encoder; tEncoderInit(&encoder, buf, vlen); if (tEncodeSTqHandle(&encoder, pHandle) < 0) { - ASSERT(0); + tAssert(0); } TXN* txn; if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - ASSERT(0); + tAssert(0); } if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) { - ASSERT(0); + tAssert(0); } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } tEncoderClear(&encoder); @@ -243,19 +243,19 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) { if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - ASSERT(0); + tAssert(0); } if (tdbTbDelete(pTq->pExecStore, key, (int)strlen(key), txn) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - ASSERT(0); + tAssert(0); } return 0; @@ -264,7 +264,7 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) { int32_t tqMetaRestoreHandle(STQ* pTq) { TBC* pCur = NULL; if (tdbTbcOpen(pTq->pExecStore, &pCur, NULL) < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -284,7 +284,7 @@ int32_t tqMetaRestoreHandle(STQ* pTq) { handle.pRef = walOpenRef(pTq->pVnode->pWal); if (handle.pRef == NULL) { - ASSERT(0); + tAssert(0); return -1; } walRefVer(handle.pRef, handle.snapshotVer); diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c index dd56c165fd..fd74b15ad6 100644 --- a/source/dnode/vnode/src/tq/tqOffset.c +++ b/source/dnode/vnode/src/tq/tqOffset.c @@ -40,25 +40,25 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) { if (code == 0) { break; } else { - ASSERT(0); + tAssert(0); // TODO handle error } } int32_t size = htonl(head.size); void* memBuf = taosMemoryCalloc(1, size); if ((code = taosReadFile(pFile, memBuf, size)) != size) { - ASSERT(0); + tAssert(0); // TODO handle error } STqOffset offset; SDecoder decoder; tDecoderInit(&decoder, memBuf, size); if (tDecodeSTqOffset(&decoder, &offset) < 0) { - ASSERT(0); + tAssert(0); } tDecoderClear(&decoder); if (taosHashPut(pStore->pHash, offset.subKey, strlen(offset.subKey), &offset, sizeof(STqOffset)) < 0) { - ASSERT(0); + tAssert(0); // TODO } taosMemoryFree(memBuf); @@ -85,7 +85,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) { } char* fname = tqOffsetBuildFName(pStore->pTq->path, 0); if (tqOffsetRestoreFromFile(pStore, fname) < 0) { - ASSERT(0); + tAssert(0); } taosMemoryFree(fname); return pStore; @@ -124,7 +124,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { const char* sysErrStr = strerror(errno); tqError("vgId:%d, cannot open file %s when commit offset since %s", pStore->pTq->pVnode->config.vgId, fname, sysErrStr); - ASSERT(0); + tAssert(0); return -1; } taosMemoryFree(fname); @@ -138,7 +138,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { tEncodeSize(tEncodeSTqOffset, pOffset, bodyLen, code); ASSERT(code == 0); if (code < 0) { - ASSERT(0); + tAssert(0); taosHashCancelIterate(pStore->pHash, pIter); return -1; } @@ -154,7 +154,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { // write file int64_t writeLen; if ((writeLen = taosWriteFile(pFile, buf, totLen)) != totLen) { - ASSERT(0); + tAssert(0); tqError("write offset incomplete, len %d, write len %" PRId64, bodyLen, writeLen); taosHashCancelIterate(pStore->pHash, pIter); taosMemoryFree(buf); diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c index b63ff8af1d..ed656412f2 100644 --- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c +++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c @@ -61,7 +61,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) { int64_t sz = 0; if (taosStatFile(fname, &sz, NULL) < 0) { - ASSERT(0); + tAssert(0); } taosMemoryFree(fname); @@ -73,7 +73,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) { void* abuf = POINTER_SHIFT(buf, sizeof(SSnapDataHdr)); int64_t contLen = taosReadFile(pFile, abuf, sz); if (contLen != sz) { - ASSERT(0); + tAssert(0); return -1; } buf->size = sz; @@ -122,14 +122,14 @@ int32_t tqOffsetWriterClose(STqOffsetWriter** ppWriter, int8_t rollback) { if (rollback) { if (taosRemoveFile(pWriter->fname) < 0) { - ASSERT(0); + tAssert(0); } } else { if (taosRenameFile(pWriter->fname, fname) < 0) { - ASSERT(0); + tAssert(0); } if (tqOffsetRestoreFromFile(pTq->pOffsetStore, fname) < 0) { - ASSERT(0); + tAssert(0); } } taosMemoryFree(fname); @@ -150,10 +150,10 @@ int32_t tqOffsetSnapWrite(STqOffsetWriter* pWriter, uint8_t* pData, uint32_t nDa if (pFile) { int64_t contLen = taosWriteFile(pFile, pHdr->data, size); if (contLen != size) { - ASSERT(0); + tAssert(0); } } else { - ASSERT(0); + tAssert(0); return -1; } return 0; diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index f89bc20362..1a84858785 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -27,7 +27,7 @@ static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubm while (pSubmit != NULL) { ASSERT(pSubmit->ver == pHandle->pushHandle.processedVer + 1); if (tqLogScanExec(pTq, &pHandle->execHandle, pSubmit->data, pRsp, 0) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ } // update processed atomic_store_64(&pHandle->pushHandle.processedVer, pSubmit->ver); @@ -161,7 +161,7 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_ tqLogScanExec(pTq, &pHandle->execHandle, pReq, &rsp, workerId); } else { // TODO - ASSERT(0); + tAssert(0); } if (rsp.blockNum == 0) { @@ -263,7 +263,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) SSDataBlock* pDataBlock = NULL; uint64_t ts = 0; if (qExecTask(task, &pDataBlock, &ts) < 0) { - ASSERT(0); + tAssert(0); } if (pDataBlock == NULL) { @@ -296,7 +296,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) void* key = taosArrayGetP(cachedKeys, i); size_t kLen = *(size_t*)taosArrayGet(cachedKeyLens, i); if (taosHashRemove(pTq->pPushMgr, key, kLen) != 0) { - ASSERT(0); + tAssert(0); } } taosArrayDestroyP(cachedKeys, (FDelete)taosMemoryFree); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index c3a4cefc66..1d9ffe4b90 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -177,7 +177,7 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) { } realTbSuid = req.suid; } else { - ASSERT(0); + tAssert(0); } end: @@ -206,7 +206,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { - ASSERT(0); + tAssert(0); *fetchOffset = offset; code = -1; goto END; @@ -220,7 +220,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea if (IS_META_MSG(pHead->msgType)) { code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { - ASSERT(0); + tAssert(0); *fetchOffset = offset; code = -1; goto END; @@ -238,7 +238,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea } code = walSkipFetchBody(pHandle->pWalReader, *ppCkHead); if (code < 0) { - ASSERT(0); + tAssert(0); *fetchOffset = offset; code = -1; goto END; @@ -340,7 +340,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { memset(&ret->data, 0, sizeof(SSDataBlock)); int32_t code = tqRetrieveDataBlock(&ret->data, pReader); if (code != 0 || ret->data.info.rows == 0) { - ASSERT(0); + tAssert(0); continue; } ret->fetchType = FETCH_TYPE__DATA; @@ -453,7 +453,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { if (pReader->pSchema == NULL) { tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table", pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer); - /*ASSERT(0);*/ + /*tAssert(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -464,7 +464,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { if (pReader->pSchemaWrapper == NULL) { tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->msgIter.uid, pReader->cachedSchemaVer); - /*ASSERT(0);*/ + /*tAssert(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -566,7 +566,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas if (pReader->pSchema == NULL) { tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table", pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer); - /*ASSERT(0);*/ + /*tAssert(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -577,7 +577,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas if (pReader->pSchemaWrapper == NULL) { tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->msgIter.uid, pReader->cachedSchemaVer); - /*ASSERT(0);*/ + /*tAssert(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -790,7 +790,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { // TODO handle delete table from stb } } else { - ASSERT(0); + tAssert(0); } } while (1) { diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 5907be576a..294dd7504c 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -335,7 +335,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code); if (code < 0) { // - ASSERT(0); + tAssert(0); } SEncoder encoder; void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead)); @@ -572,7 +572,7 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code); if (code < 0) { // - ASSERT(0); + tAssert(0); } SEncoder encoder; void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead)); diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c index b1f00bdf74..5e82665190 100644 --- a/source/dnode/vnode/src/tq/tqStreamStateSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c @@ -168,7 +168,7 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) { if (rollback) { tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn); - ASSERT(0); + tAssert(0); } else { code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn); if (code) goto _err; diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c index 305378bc93..012702daed 100644 --- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c @@ -168,7 +168,7 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) { if (rollback) { tdbAbort(pWriter->pTq->pMetaStore, pWriter->txn); - ASSERT(0); + tAssert(0); } else { code = tdbCommit(pWriter->pTq->pMetaStore, pWriter->txn); if (code) goto _err; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 7309ea3407..7cc7d8a6eb 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -525,7 +525,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) { return code; default: - ASSERT(0); + tAssert(0); break; } @@ -723,7 +723,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { return code; default: - ASSERT(0); + tAssert(0); break; } @@ -822,7 +822,7 @@ static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow) { return code; } default: - ASSERT(0); + tAssert(0); break; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 906e3b2638..e0fe7183b9 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -1137,7 +1137,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) { } } } else { - ASSERT(0); + tAssert(0); } // compare with min in RB Tree diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c index 3c944584de..e177a0b513 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile.c @@ -135,7 +135,7 @@ int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) { tPutSmaFile(hdr, pSet->pSmaF); break; default: - ASSERT(0); + tAssert(0); } taosCalcChecksumAppend(0, hdr, TSDB_FHDR_SIZE); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index a4581f5472..d768eed09e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -260,7 +260,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) // do nothing i += 1; } else { - ASSERT(0); + tAssert(0); } } } @@ -1446,7 +1446,7 @@ static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlock index += step; } - ASSERT(0); + tAssert(0); return -1; } @@ -1991,7 +1991,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader tRowMergerClear(&merge); return code; } else { - ASSERT(0); + tAssert(0); return TSDB_CODE_SUCCESS; } } else { // desc order @@ -3174,7 +3174,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 } else if (pKey->ts == pFirst->ts) { return pFirst->version >= pKey->version; } else { - ASSERT(0); + tAssert(0); } } else { TSDBKEY* pCurrent = taosArrayGet(pDelList, *index); diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index c6e1ed99f1..2235cef836 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -106,7 +106,7 @@ _exit: _err: tsdbError("vgId:%d, tsdb do retention failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); - ASSERT(0); + tAssert(0); // tsdbFSRollback(pTsdb->pFS); return code; } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index f4bdeeb387..d274551601 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -239,7 +239,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { pReader->pIter = NULL; } else { - ASSERT(0); + tAssert(0); } } @@ -935,7 +935,7 @@ static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, i code = tBlockDataAppendRow(&pWriter->dWriter.bData, &trow, NULL, id.uid); if (code) goto _err; } else { - ASSERT(0); + tAssert(0); } if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) { @@ -1368,7 +1368,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { STsdb* pTsdb = pWriter->pTsdb; if (rollback) { - ASSERT(0); + tAssert(0); // code = tsdbFSRollback(pWriter->pTsdb->pFS); // if (code) goto _err; } else { diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 55703002b8..03107e725e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -544,7 +544,7 @@ int32_t tsdbFidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int64_t now) { } else if (pKeepCfg->precision == TSDB_TIME_PRECISION_NANO) { now = now * 1000000000l; } else { - ASSERT(0); + tAssert(0); } key = now - pKeepCfg->keep0 * tsTickPerMin[pKeepCfg->precision]; @@ -585,7 +585,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * *pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type); } } else { - ASSERT(0); + tAssert(0); } } @@ -614,7 +614,7 @@ void tsdbRowIterInit(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema) { pIter->pTSchema = NULL; pIter->i = 0; } else { - ASSERT(0); + tAssert(0); } } @@ -797,7 +797,7 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { - ASSERT(0); + tAssert(0); } } @@ -1123,7 +1123,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NULL(pColData->cid, pColData->type)); if (code) goto _exit; } else { - ASSERT(0); + tAssert(0); } } else { cv.flag = CV_FLAG_VALUE; @@ -1211,7 +1211,7 @@ static int32_t tBlockDataAppendKVRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NULL(pColData->cid, pColData->type)); if (code) goto _exit; } else { - ASSERT(0); + tAssert(0); } iTColumn++; @@ -1253,7 +1253,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS code = tBlockDataAppendKVRow(pBlockData, pRow->pTSRow, pTSchema); if (code) goto _err; } else { - ASSERT(0); + tAssert(0); } } else { code = tBlockDataAppendBlockRow(pBlockData, pRow->pBlockData, pRow->iRow); @@ -1348,7 +1348,7 @@ int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlock pRow2 = NULL; } } else { - ASSERT(0); + tAssert(0); } } diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 1199127f6d..f317b4d946 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -89,7 +89,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { } else if (mer1.me.type == TSDB_NORMAL_TABLE) { schema = mer1.me.ntbEntry.schemaRow; } else { - ASSERT(0); + tAssert(0); } metaRsp.numOfTags = schemaTag.nCols; @@ -210,7 +210,7 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { cfgRsp.pComment = strdup(mer1.me.ntbEntry.comment); } } else { - ASSERT(0); + tAssert(0); } cfgRsp.numOfTags = schemaTag.nCols; diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index a34744a1da..8833db09cd 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -321,7 +321,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot * vnodeBegin(pVnode); } else { - ASSERT(0); + tAssert(0); } _exit: diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index fc3cfbd0f6..9df6078ef3 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1416,7 +1416,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pCaseNode->node.aliasName); pExp->pExpr->_optrRoot.pRootNode = pNode; } else { - ASSERT(0); + tAssert(0); } } @@ -1572,7 +1572,7 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray } else if (p->info.colId < pmInfo->colId) { i++; } else { - ASSERT(0); + tAssert(0); } } } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 6fca2858dc..47b38ba02c 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -130,7 +130,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { - ASSERT(0); + tAssert(0); } return TSDB_CODE_SUCCESS; @@ -869,7 +869,7 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) { if (pOperator->numOfDownstream > 1) { qError("unexpected stream, multiple downstream"); - ASSERT(0); + tAssert(0); return -1; } return 0; @@ -926,7 +926,7 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) { if (pOperator->numOfDownstream > 1) { qError("unexpected stream, multiple downstream"); - ASSERT(0); + tAssert(0); return -1; } return 0; @@ -1038,7 +1038,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT pInfo->tqReader->pWalReader->curVersion != pOffset->version) { qError("prepare scan ver %" PRId64 " actual ver %" PRId64 ", last %" PRId64, pOffset->version, pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version); - ASSERT(0); + tAssert(0); } #endif if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { @@ -1091,7 +1091,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT if (tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &pTableScanInfo->base.cond, pList, num, pTableScanInfo->pResBlock, &pTableScanInfo->base.dataReader, NULL) < 0 || pTableScanInfo->base.dataReader == NULL) { - ASSERT(0); + tAssert(0); } } @@ -1107,7 +1107,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ts, pTableScanInfo->currentTable, numOfTables); /*}*/ } else { - ASSERT(0); + tAssert(0); } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { SStreamRawScanInfo* pInfo = pOperator->info; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 043cc396b5..3eaafa0bc8 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -571,7 +571,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { // do nothing } else { - ASSERT(0); + tAssert(0); } return TSDB_CODE_SUCCESS; @@ -1579,7 +1579,7 @@ void destroyOperatorInfo(SOperatorInfo* pOperator) { // each operator should be set their own function to return total cost buffer int32_t optrDefaultBufFn(SOperatorInfo* pOperator) { if (pOperator->blocking) { - ASSERT(0); + tAssert(0); return 0; } else { return 0; @@ -2090,7 +2090,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) { pOperator = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo); } else { - ASSERT(0); + tAssert(0); } if (pOperator != NULL) { @@ -2182,7 +2182,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC == type) { pOptr = createTimeSliceOperatorInfo(ops[0], pPhyNode, pTaskInfo); } else { - ASSERT(0); + tAssert(0); } taosMemoryFree(ops); @@ -2219,13 +2219,13 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { *ppNode = (STableScanPhysiNode*)pNode; return 0; } else { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_APP_ERROR; return -1; } } else { if (LIST_LENGTH(pNode->pChildren) != 1) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_APP_ERROR; return -1; } @@ -2244,7 +2244,7 @@ int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHa STableScanPhysiNode* pNode = NULL; if (extractTableScanNode(plan->pNode, &pNode) < 0) { - ASSERT(0); + tAssert(0); } tsdbReaderClose(pTableScanInfo->dataReader); @@ -2252,7 +2252,7 @@ int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHa STableListInfo info = {0}; pTableScanInfo->dataReader = doCreateDataReader(pNode, pHandle, &info, NULL); if (pTableScanInfo->dataReader == NULL) { - ASSERT(0); + tAssert(0); qError("failed to create data reader"); return TSDB_CODE_APP_ERROR; } diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 8d5af64777..3dbe8fda94 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -680,7 +680,7 @@ void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillS pFillInfo->pLinearInfo->winIndex = 0; } break; default: - ASSERT(0); + tAssert(0); break; } } @@ -811,7 +811,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS } } break; default: - ASSERT(0); + tAssert(0); break; } ASSERT(pFillInfo->pos != FILL_POS_INVALID); @@ -1269,7 +1269,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { pInfo->srcRowIndex = 0; } break; default: - ASSERT(0); + tAssert(0); break; } } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 2cd1bd7dec..9ffa327317 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -662,7 +662,7 @@ static int compareDataGroupInfo(const void* group1, const void* group2) { const SDataGroupInfo* pGroupInfo2 = group2; if (pGroupInfo1->groupId == pGroupInfo2->groupId) { - ASSERT(0); + tAssert(0); return 0; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 0f35d3778d..de61d2255a 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1533,7 +1533,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { qError("submit msg messed up when initing stream submit block %p", pSubmit); pInfo->tqReader->pMsg = NULL; pTaskInfo->streamInfo.pReq = NULL; - ASSERT(0); + tAssert(0); } } @@ -1592,7 +1592,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (ret.fetchType == FETCH_TYPE__DATA) { blockDataCleanup(pInfo->pRes); if (setBlockIntoRes(pInfo, &ret.data, true) < 0) { - ASSERT(0); + tAssert(0); } if (pInfo->pRes->info.rows > 0) { pOperator->status = OP_EXEC_RECV; @@ -1600,7 +1600,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return pInfo->pRes; } } else if (ret.fetchType == FETCH_TYPE__META) { - ASSERT(0); + tAssert(0); // pTaskInfo->streamInfo.lastStatus = ret.offset; // pTaskInfo->streamInfo.metaBlk = ret.meta; // return NULL; @@ -1627,7 +1627,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return NULL; #endif } else { - ASSERT(0); + tAssert(0); return NULL; } } @@ -1701,26 +1701,26 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { }; char tmp[100] = "abcdefg1"; if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) { - ASSERT(0); + tAssert(0); } key.ts = 2; char tmp2[100] = "abcdefg2"; if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) { - ASSERT(0); + tAssert(0); } key.groupId = 5; key.ts = 1; char tmp3[100] = "abcdefg3"; if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) { - ASSERT(0); + tAssert(0); } char* val2 = NULL; int32_t sz; if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) { - ASSERT(0); + tAssert(0); } printf("stream read %s %d\n", val2, sz); streamFreeVal(val2); @@ -2001,7 +2001,7 @@ FETCH_NEXT_BLOCK: goto NEXT_SUBMIT_BLK; } else { - ASSERT(0); + tAssert(0); return NULL; } } diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index d30c1fbfa1..f83a76380d 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -272,7 +272,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SRowVa saveColData(pRowVal->pRowVal, i, p, isNull); } else { - ASSERT(0); + tAssert(0); } } } diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 07e480ee1d..49763d4547 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -20,6 +20,7 @@ #include "scalar.h" #include "taoserror.h" #include "ttime.h" +#include "tlog.h" static int32_t buildFuncErrMsg(char* pErrBuf, int32_t len, int32_t errCode, const char* pFormat, ...) { va_list vArgList; @@ -1354,7 +1355,7 @@ static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { } else if (IS_FLOAT_TYPE(colType)) { resType = TSDB_DATA_TYPE_DOUBLE; } else { - ASSERT(0); + tAssert(0); } } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 111da6d6ba..7854e22691 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -2535,7 +2535,7 @@ static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv, int pDiffInfo->prev.d64 = *(double*)pv; break; default: - ASSERT(0); + tAssert(0); } pDiffInfo->prevTs = ts; } @@ -2615,7 +2615,7 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo break; } default: - ASSERT(0); + tAssert(0); } } @@ -2951,7 +2951,7 @@ static STuplePos doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf } else { // other tuple save policy if (streamStateFuncPut(pHandle->pState, pKey, pBuf, length) < 0) { - ASSERT(0); + tAssert(0); } p.streamTupleKey = *pKey; } @@ -4079,7 +4079,7 @@ static bool checkStateOp(int8_t op, SColumnInfoData* pCol, int32_t index, SVaria break; } default: { - ASSERT(0); + tAssert(0); } } return false; @@ -5104,7 +5104,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { } default: - ASSERT(0); + tAssert(0); } // the last interpolated time window value diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index 1c74d22a82..ab64c250e1 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -18,6 +18,7 @@ #include "tdatablock.h" #include "tfunctionInt.h" #include "tglobal.h" +#include "tlog.h" #define SET_VAL(_info, numOfElem, res) \ do { \ @@ -620,7 +621,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { break; } default: - ASSERT(0); + tAssert(0); } } else { numOfElem = doAddNumericVector(pCol, type, pInput, pAvgRes); diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index e3f140047a..9a6be3fa9e 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -367,7 +367,7 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) { tlen = taosEncodeBinary(dst, src, strlen(src)); break; default: - ASSERT(0); + tAssert(0); break; } *dst = (char*)*dst - tlen; @@ -459,7 +459,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { *dst = (char*)*dst - tlen; break; default: - ASSERT(0); + tAssert(0); break; } return tlen; diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index c74882cf23..f887709765 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -393,7 +393,7 @@ char* parseTagDatatoJson(void* p) { } else if (pTagVal->nData == 0) { value = cJSON_CreateString(""); } else { - ASSERT(0); + tAssert(0); } cJSON_AddItemToObject(json, tagJsonKey, value); @@ -412,7 +412,7 @@ char* parseTagDatatoJson(void* p) { } cJSON_AddItemToObject(json, tagJsonKey, value); } else { - ASSERT(0); + tAssert(0); } } string = cJSON_PrintUnformatted(json); diff --git a/source/libs/scalar/inc/sclvector.h b/source/libs/scalar/inc/sclvector.h index e633b39223..66d6c8201e 100644 --- a/source/libs/scalar/inc/sclvector.h +++ b/source/libs/scalar/inc/sclvector.h @@ -98,7 +98,7 @@ static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType) } else if (srcType == TSDB_DATA_TYPE_NULL) { p = NULL; } else { - ASSERT(0); + tAssert(0); } return p; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 1de8a35308..08b04bb8ad 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2598,7 +2598,7 @@ static bool checkStateOp(int8_t op, SColumnInfoData *pCol, int32_t index, SScala break; } default: { - ASSERT(0); + tAssert(0); } } return false; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index a1995bdf50..89f1abc1d8 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -85,7 +85,7 @@ void convertNumberToNumber(const void *inData, void *outData, int8_t inType, int break; } default: { - ASSERT(0); + tAssert(0); } } } @@ -179,7 +179,7 @@ _getBigintValue_fn_t getVectorBigintValueFn(int32_t srcType) { } else if (srcType == TSDB_DATA_TYPE_NULL) { p = NULL; } else { - ASSERT(0); + tAssert(0); } return p; } @@ -409,7 +409,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { int32_t convertType = pCtx->inType; if (pCtx->inType == TSDB_DATA_TYPE_JSON) { if (*data == TSDB_DATA_TYPE_NULL) { - ASSERT(0); + tAssert(0); } else if (*data == TSDB_DATA_TYPE_NCHAR) { data += CHAR_BYTES; convertType = TSDB_DATA_TYPE_NCHAR; @@ -543,11 +543,11 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t if (IS_NUMERIC_TYPE(type)) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { - ASSERT(0); + tAssert(0); // convertNcharToDouble(*pLeftData, pLeftOut); // *pLeftData = pLeftOut; } else if (typeLeft == TSDB_DATA_TYPE_BINARY) { - ASSERT(0); + tAssert(0); // convertBinaryToDouble(*pLeftData, pLeftOut); // *pLeftData = pLeftOut; } else if (typeLeft != type) { @@ -556,11 +556,11 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (typeRight == TSDB_DATA_TYPE_NCHAR) { - ASSERT(0); + tAssert(0); // convertNcharToDouble(*pRightData, pRightOut); // *pRightData = pRightOut; } else if (typeRight == TSDB_DATA_TYPE_BINARY) { - ASSERT(0); + tAssert(0); // convertBinaryToDouble(*pRightData, pRightOut); // *pRightData = pRightOut; } else if (typeRight != type) { @@ -577,7 +577,7 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t *freeRight = true; } } else { - ASSERT(0); + tAssert(0); } return true; @@ -1602,7 +1602,7 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight); if (isJsonnull) { - ASSERT(0); + tAssert(0); } if (!pLeftData || !pRightData) { @@ -1913,7 +1913,7 @@ _bin_scalar_fn_t getBinScalarOperatorFn(int32_t binFunctionId) { case OP_TYPE_JSON_CONTAINS: return vectorJsonContains; default: - ASSERT(0); + tAssert(0); return NULL; } } diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 79549675a3..4869ecf6de 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -224,7 +224,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i ASSERT(old == TASK_OUTPUT_STATUS__WAIT); if (pRsp->inputStatus == TASK_INPUT_STATUS__BLOCKED) { // TODO: init recover timer - ASSERT(0); + tAssert(0); return 0; } // continue dispatch diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index efd19074da..627fca21d1 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -170,7 +170,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre return 0; } if (code < 0) { - ASSERT(0); + tAssert(0); return -1; } } diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 4e0b0630bc..0ef8cce84e 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -139,7 +139,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) int32_t len; tEncodeSize(tEncodeStreamRetrieveReq, &req, len, code); if (code < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -163,7 +163,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) }; if (tmsgSendReq(&pEpInfo->epSet, &rpcMsg) < 0) { - ASSERT(0); + tAssert(0); goto CLEAR; } buf = NULL; @@ -488,7 +488,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } return code; } else { - ASSERT(0); + tAssert(0); } return 0; } @@ -514,7 +514,7 @@ int32_t streamDispatch(SStreamTask* pTask) { int32_t code = 0; if (streamDispatchAllBlocks(pTask, pBlock) < 0) { - ASSERT(0); + tAssert(0); code = -1; streamQueueProcessFail(pTask->outputQueue); atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 6a83a9a4da..ad8fc1399c 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -43,7 +43,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)data; qSetMultiStreamInput(exec, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else { - ASSERT(0); + tAssert(0); } // exec @@ -108,7 +108,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { SSDataBlock* output = NULL; uint64_t ts = 0; if (qExecTask(exec, &output, &ts) < 0) { - ASSERT(0); + tAssert(0); } if (output == NULL) { finished = true; diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index afad78c5e5..3f915eff42 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -107,7 +107,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg, tDecoderClear(&decoder); if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) { - ASSERT(0); + tAssert(0); goto FAIL; } @@ -117,7 +117,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg, if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), msg, msgLen, pMeta->txn) < 0) { taosHashRemove(pMeta->pTasks, &pTask->taskId, sizeof(int32_t)); - ASSERT(0); + tAssert(0); goto FAIL; } @@ -153,7 +153,7 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) { tEncoderClear(&encoder); if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), buf, len, pMeta->txn) < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -257,7 +257,7 @@ int32_t streamMetaAbort(SStreamMeta* pMeta) { int32_t streamLoadTasks(SStreamMeta* pMeta) { TBC* pCur = NULL; if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { - ASSERT(0); + tAssert(0); return -1; } diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index 6889a870d1..fed90ad371 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -40,7 +40,7 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) { }; if (tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &rpcMsg) < 0) { - /*ASSERT(0);*/ + /*tAssert(0);*/ } } else if (pTask->taskLevel == TASK_LEVEL__AGG) { @@ -149,7 +149,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* if (pRsp->reqId != pTask->checkReqId) return -1; streamTaskLaunchRecover(pTask, version); } else { - ASSERT(0); + tAssert(0); } } else { streamRecheckOneDownstream(pTask, pRsp); @@ -199,7 +199,7 @@ int32_t streamBuildSourceRecover2Req(SStreamTask* pTask, SStreamRecoverStep2Req* int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver) { void* exec = pTask->exec.executor; if (qStreamSourceRecoverStep2(exec, ver) < 0) { - ASSERT(0); + tAssert(0); } return streamScanExec(pTask, 100); } diff --git a/source/libs/sync/src/syncIndexMgr.c b/source/libs/sync/src/syncIndexMgr.c index 7933258e53..29b6ce42de 100644 --- a/source/libs/sync/src/syncIndexMgr.c +++ b/source/libs/sync/src/syncIndexMgr.c @@ -72,7 +72,7 @@ void syncIndexMgrSetIndex(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftId, } // maybe config change - // ASSERT(0); + // tAssert(0); char host[128]; uint16_t port; @@ -114,7 +114,7 @@ void syncIndexMgrSetStartTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaft } // maybe config change - // ASSERT(0); + // tAssert(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -129,7 +129,7 @@ int64_t syncIndexMgrGetStartTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pR return startTime; } } - ASSERT(0); + tAssert(0); return -1; } @@ -142,7 +142,7 @@ void syncIndexMgrSetRecvTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftI } // maybe config change - // ASSERT(0); + // tAssert(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -170,7 +170,7 @@ void syncIndexMgrSetTerm(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftId, S } // maybe config change - // ASSERT(0); + // tAssert(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -184,6 +184,6 @@ SyncTerm syncIndexMgrGetTerm(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftI return term; } } - ASSERT(0); + tAssert(0); return -1; } diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index c609bfba93..f26dddcf77 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -140,7 +140,7 @@ int32_t raftCfgIndexCreateFile(const char *path) { const char *sysErrStr = strerror(errno); sError("create raft cfg index file error, err:%d %X, msg:%s, syserr:%d, sysmsg:%s", err, err, errStr, sysErr, sysErrStr); - ASSERT(0); + tAssert(0); return -1; } @@ -198,7 +198,7 @@ int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { if (strlen(s) + 1 > CONFIG_FILE_LEN) { sError("too long config str:%s", s); - ASSERT(0); + tAssert(0); } snprintf(buf, sizeof(buf), "%s", s); diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 988a86cc67..81f3506331 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -370,7 +370,7 @@ int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, code = 0; } else { - ASSERT(0); + tAssert(0); code = -1; } diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 8c62f89b64..84ed8f9aef 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -188,7 +188,7 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tAssert(0); return -1; } @@ -200,14 +200,14 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in } else if (c == 0) { // dup key not allowed tdbError("unable to insert dup key. pKey: %p, kLen: %d, btc: %p, pTxn: %p", pKey, kLen, &btc, pTxn); - // ASSERT(0); + // tAssert(0); return -1; } } ret = tdbBtcUpsert(&btc, pKey, kLen, pVal, vLen, 1); if (ret < 0) { - ASSERT(0); + tAssert(0); tdbBtcClose(&btc); return -1; } @@ -229,7 +229,7 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) { ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tAssert(0); return -1; } @@ -260,7 +260,7 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i // move the cursor ret = tdbBtcMoveTo(&btc, pKey, nKey, &c); if (ret < 0) { - ASSERT(0); + tAssert(0); tdbBtcClose(&btc); return -1; } @@ -276,7 +276,7 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i ret = tdbBtcUpsert(&btc, pKey, nKey, pData, nData, c); if (ret < 0) { - ASSERT(0); + tAssert(0); tdbBtcClose(&btc); return -1; } @@ -305,7 +305,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL ret = tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (ret < 0) { tdbBtcClose(&btc); - ASSERT(0); + tAssert(0); } if (btc.idx < 0 || cret) { @@ -321,7 +321,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTKey = tdbRealloc(*ppKey, cd.kLen); if (pTKey == NULL) { tdbBtcClose(&btc); - ASSERT(0); + tAssert(0); return -1; } *ppKey = pTKey; @@ -333,7 +333,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTVal = tdbRealloc(*ppVal, cd.vLen); if (pTVal == NULL) { tdbBtcClose(&btc); - ASSERT(0); + tAssert(0); return -1; } *ppVal = pTVal; @@ -398,7 +398,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { // Try to create a new database ret = tdbPagerAllocPage(pBt->pPager, &pgno); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -556,7 +556,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx ret = tdbPagerFetchPage(pBt->pPager, &pgno, pOlds + i, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = 0}), pTxn); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -718,7 +718,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx iarg.flags = flags; ret = tdbPagerFetchPage(pBt->pPager, &pgno, pNews + iNew, tdbBtreeInitPage, &iarg, pTxn); if (ret < 0) { - ASSERT(0); + tAssert(0); } ret = tdbPagerWrite(pBt->pPager, pNews[iNew]); @@ -1212,7 +1212,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo ret = tdbBtreeEncodePayload(pPage, pCell, nHeader, pKey, kLen, pVal, vLen, &nPayload, pTxn, pBt); if (ret < 0) { // TODO - ASSERT(0); + tAssert(0); return 0; } @@ -1573,7 +1573,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1589,7 +1589,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { return 0; } } else { - ASSERT(0); + tAssert(0); #if 0 // move from a position int iPage = 0; @@ -1617,7 +1617,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1642,7 +1642,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1657,7 +1657,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { return 0; } } else { - ASSERT(0); + tAssert(0); #if 0 int iPage = 0; @@ -1690,7 +1690,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1748,7 +1748,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToNext(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1794,7 +1794,7 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToPrev(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1837,7 +1837,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -1910,7 +1910,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { ret = tdbPagerFetchPage(pBtc->pBt->pPager, &pgno, &pBtc->pPage, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBtc->pBt, .flags = 0}), pBtc->pTxn); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -2003,7 +2003,7 @@ int tdbBtcDelete(SBTC *pBtc) { ret = tdbPageUpdateCell(pPage, idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { tdbOsFree(pCell); - ASSERT(0); + tAssert(0); return -1; } tdbOsFree(pCell); @@ -2018,7 +2018,7 @@ int tdbBtcDelete(SBTC *pBtc) { ret = tdbBtreeBalance(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } } @@ -2041,7 +2041,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int szBuf = kLen + nData + 14; pBuf = tdbRealloc(pBtc->pBt->pBuf, pBtc->pBt->pageSize > szBuf ? szBuf : pBtc->pBt->pageSize); if (pBuf == NULL) { - ASSERT(0); + tAssert(0); return -1; } pBtc->pBt->pBuf = pBuf; @@ -2050,7 +2050,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // encode cell ret = tdbBtreeEncodeCell(pBtc->pPage, pKey, kLen, pData, nData, pCell, &szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -2072,7 +2072,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int ret = tdbPageUpdateCell(pBtc->pPage, pBtc->idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); } if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } @@ -2080,7 +2080,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int if (pBtc->pPage->nOverflow > 0) { ret = tdbBtreeBalance(pBtc); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } } @@ -2105,7 +2105,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { // TODO - ASSERT(0); + tAssert(0); return 0; } @@ -2114,7 +2114,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { // for empty tree, just return with an invalid position if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) return 0; } else { - ASSERT(0); + tAssert(0); #if 0 SPage *pPage; int idx; diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index b67fe562eb..cd6afe2b91 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -271,7 +271,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) ret = tdbPageCreate(pCache->szPage, &pPage, pTxn->xMalloc, pTxn->xArg); if (ret < 0 || pPage == NULL) { // TODO - ASSERT(0); + tAssert(0); return NULL; } diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index ac2725d8ec..c1732e0ac6 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -387,7 +387,7 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { pPage->pPageMethods->setFreeCellInfo(pCell, szCell, cellFree); TDB_PAGE_FCELL_SET(pPage, pCell - pPage->pData); } else { - ASSERT(0); + tAssert(0); } } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index f638ec25a3..5dc2fcca39 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -632,7 +632,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa loadPage = 0; ret = tdbPagerAllocPage(pPager, &pgno); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } } @@ -651,7 +651,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa if (!TDB_PAGE_INITIALIZED(pPage)) { ret = tdbPagerInitPage(pPager, pPage, initPage, arg, loadPage); if (ret < 0) { - ASSERT(0); + tAssert(0); return -1; } } @@ -732,7 +732,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage nRead = tdbOsPRead(pPager->fd, pPage->pData, pPage->pageSize, ((i64)pPage->pageSize) * (pgno - 1)); tdbTrace("tdbttl pager:%p, pgno:%d, nRead:%" PRId64, pPager, pgno, nRead); if (nRead < pPage->pageSize) { - ASSERT(0); + tAssert(0); return -1; } } else { @@ -741,7 +741,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage ret = (*initPage)(pPage, arg, init); if (ret < 0) { - ASSERT(0); + tAssert(0); TDB_UNLOCK_PAGE(pPage); return -1; } @@ -760,7 +760,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage } } } else { - ASSERT(0); + tAssert(0); return -1; } diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 055a8a1062..743a1f27b0 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -310,7 +310,7 @@ static inline int tdbTryLockPage(tdb_spinlock_t *pLock) { } else if (ret == EBUSY) { return P_LOCK_BUSY; } else { - ASSERT(0); + tAssert(0); return P_LOCK_FAIL; } } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index ed02d29e3b..27c3c4e694 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -241,7 +241,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curInvalid || pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { - ASSERT(0); + tAssert(0); pRead->curVersion = fetchVer; pRead->curInvalid = 1; return -1; @@ -262,7 +262,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - ASSERT(0); + tAssert(0); pRead->curInvalid = 1; return -1; } @@ -299,7 +299,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } pRead->curInvalid = 1; - ASSERT(0); + tAssert(0); return -1; } @@ -308,7 +308,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { pRead->pHead->head.version, ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - ASSERT(0); + tAssert(0); return -1; } @@ -316,7 +316,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - ASSERT(0); + tAssert(0); return -1; } @@ -335,7 +335,7 @@ static int32_t walSkipFetchBodyNew(SWalReader *pRead) { if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); pRead->curInvalid = 1; - ASSERT(0); + tAssert(0); return -1; } @@ -384,7 +384,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - ASSERT(0); + tAssert(0); pRead->curInvalid = 1; return -1; } @@ -447,7 +447,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { if (pReadHead->bodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, pReadHead->bodyLen)) { if (pReadHead->bodyLen < 0) { - ASSERT(0); + tAssert(0); terrno = TAOS_SYSTEM_ERROR(errno); wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s", pRead->pWal->cfg.vgId, pReadHead->version, ver, tstrerror(terrno)); @@ -457,12 +457,12 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } pRead->curInvalid = 1; - ASSERT(0); + tAssert(0); return -1; } if (pReadHead->version != ver) { - ASSERT(0); + tAssert(0); wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pReadHead->version, ver); pRead->curInvalid = 1; @@ -471,7 +471,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { } if (walValidBodyCksum(*ppHead) != 0) { - ASSERT(0); + tAssert(0); wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); pRead->curInvalid = 1; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index a5c7bf1abd..5d6f9168ec 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -138,21 +138,21 @@ int32_t walRollback(SWal *pWal, int64_t ver) { TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); if (pIdxFile == NULL) { - ASSERT(0); + tAssert(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } int64_t idxOff = walGetVerIdxOffset(pWal, ver); code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET); if (code < 0) { - ASSERT(0); + tAssert(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } // read idx file and get log file pos SWalIdxEntry entry; if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) { - ASSERT(0); + tAssert(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } @@ -179,7 +179,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { ASSERT(taosValidFile(pLogFile)); int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead)); if (size != sizeof(SWalCkHead)) { - ASSERT(0); + tAssert(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } @@ -188,12 +188,12 @@ int32_t walRollback(SWal *pWal, int64_t ver) { ASSERT(code == 0); if (code != 0) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - ASSERT(0); + tAssert(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } if (head.head.version != ver) { - ASSERT(0); + tAssert(0); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pWal->mutex); return -1; @@ -202,14 +202,14 @@ int32_t walRollback(SWal *pWal, int64_t ver) { // truncate old files code = taosFtruncateFile(pLogFile, entry.offset); if (code < 0) { - ASSERT(0); + tAssert(0); terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } code = taosFtruncateFile(pIdxFile, idxOff); if (code < 0) { - ASSERT(0); + tAssert(0); terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; @@ -386,7 +386,7 @@ int32_t walEndSnapshot(SWal *pWal) { walBuildIdxName(pWal, pInfo->firstVer, fnameStr); wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr); if (taosRemoveFile(fnameStr) < 0 && errno != ENOENT) { - ASSERT(0); + tAssert(0); } } taosArrayClear(pWal->toDeleteFiles); diff --git a/source/os/src/osString.c b/source/os/src/osString.c index e2d8ce95db..f03778de2f 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -143,15 +143,17 @@ SConv *gConv = NULL; int32_t convUsed = 0; int32_t gConvMaxNum = 0; -void taosConvInit(void) { +int32_t taosConvInit(void) { gConvMaxNum = 512; gConv = taosMemoryCalloc(gConvMaxNum, sizeof(SConv)); for (int32_t i = 0; i < gConvMaxNum; ++i) { gConv[i].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); if ((iconv_t)-1 == gConv[i].conv || (iconv_t)0 == gConv[i].conv) { - ASSERT(0); + return -1; } } + + return 0; } void taosConvDestroy() { diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c index 4d6875d263..a1d86a8bc9 100644 --- a/source/util/src/talgo.c +++ b/source/util/src/talgo.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "talgo.h" +#include "tlog.h" #define doswap(__left, __right, __size, __buf) \ do { \ @@ -200,7 +201,7 @@ void *taosbsearch(const void *key, const void *base, int32_t nmemb, int32_t size } else if (flags == TD_LT) { return (c > 0) ? p : (midx > 0 ? p - size : NULL); } else { - ASSERT(0); + tAssert(0); return NULL; } } diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 18305e594b..f20b6af358 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1416,7 +1416,7 @@ static int32_t tCompTimestampEnd(SCompressor *pCmprsor, const uint8_t **ppData, *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - ASSERT(0); + tAssert(0); } return code; @@ -1659,7 +1659,7 @@ static int32_t tCompIntEnd(SCompressor *pCmprsor, const uint8_t **ppData, int32_ *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - ASSERT(0); + tAssert(0); } return code; @@ -1812,7 +1812,7 @@ static int32_t tCompFloatEnd(SCompressor *pCmprsor, const uint8_t **ppData, int3 *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - ASSERT(0); + tAssert(0); } return code; @@ -1965,7 +1965,7 @@ static int32_t tCompDoubleEnd(SCompressor *pCmprsor, const uint8_t **ppData, int *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - ASSERT(0); + tAssert(0); } return code; @@ -2059,7 +2059,7 @@ static int32_t tCompBoolEnd(SCompressor *pCmprsor, const uint8_t **ppData, int32 *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - ASSERT(0); + tAssert(0); } return code; diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 467f26b362..a34520aaaf 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -137,7 +137,7 @@ void *taosProcessSchedQueue(void *scheduler) { while (1) { if ((ret = tsem_wait(&pSched->fullSem)) != 0) { uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } if (atomic_load_8(&pSched->stop)) { break; @@ -145,7 +145,7 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } msg = pSched->queue[pSched->fullSlot]; @@ -154,12 +154,12 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } if ((ret = tsem_post(&pSched->emptySem)) != 0) { uFatal("post %s emptySem failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } if (msg.fp) @@ -187,12 +187,12 @@ int taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = tsem_wait(&pSched->emptySem)) != 0) { uFatal("wait %s emptySem failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } pSched->queue[pSched->emptySlot] = *pMsg; @@ -200,12 +200,12 @@ int taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } if ((ret = tsem_post(&pSched->fullSem)) != 0) { uFatal("post %s fullSem failed(%s)", pSched->label, strerror(errno)); - ASSERT(0); + tAssert(0); } return ret; } diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 47b7adbf18..b16a334552 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1045,7 +1045,7 @@ int smlProcess_18784_Test() { // ASSERT_EQ(grade, 0); // ASSERT_EQ(fuel_consumption, 25); }else{ -// ASSERT(0); +// tAssert(0); } rowIndex++; } From d5126d469a4c0f59293590f9bbcada25298dd51c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 18:42:48 +0800 Subject: [PATCH 18/66] refact: replcase ASSERT with tAssert --- include/common/tdatablock.h | 16 +- include/common/trow.h | 2 +- include/libs/qcom/query.h | 4 +- include/libs/stream/tstream.h | 6 +- include/os/osDef.h | 6 - include/util/tcoding.h | 8 +- source/client/src/clientHb.c | 2 +- source/client/src/clientImpl.c | 16 +- source/client/src/clientMain.c | 12 +- source/client/src/clientMsgHandler.c | 2 +- source/client/src/clientRawBlockWrite.c | 12 +- source/client/src/clientSml.c | 8 +- source/client/src/clientStmt.c | 2 +- source/client/src/clientTmq.c | 10 +- source/common/src/tdatablock.c | 70 +++--- source/common/src/tdataformat.c | 32 +-- source/common/src/tmsg.c | 10 +- source/common/src/trow.c | 18 +- source/common/src/ttime.c | 6 +- source/common/test/dataformatTest.cpp | 6 +- source/dnode/mgmt/test/sut/src/client.cpp | 2 +- source/dnode/mgmt/test/sut/src/sut.cpp | 2 +- source/dnode/mnode/impl/src/mndScheduler.c | 34 +-- source/dnode/mnode/impl/src/mndSma.c | 2 +- source/dnode/mnode/impl/src/mndStream.c | 8 +- source/dnode/mnode/impl/src/mndSubscribe.c | 44 ++-- source/dnode/mnode/impl/src/mndTopic.c | 2 +- source/dnode/mnode/impl/test/trans/trans1.cpp | 4 +- source/dnode/snode/src/snode.c | 8 +- source/dnode/vnode/src/meta/metaCache.c | 10 +- source/dnode/vnode/src/meta/metaOpen.c | 2 +- source/dnode/vnode/src/meta/metaQuery.c | 4 +- source/dnode/vnode/src/meta/metaSnapshot.c | 10 +- source/dnode/vnode/src/meta/metaTable.c | 24 +- source/dnode/vnode/src/sma/smaCommit.c | 4 +- source/dnode/vnode/src/sma/smaEnv.c | 4 +- source/dnode/vnode/src/sma/smaFS.c | 4 +- source/dnode/vnode/src/sma/smaOpen.c | 6 +- source/dnode/vnode/src/sma/smaRollup.c | 24 +- source/dnode/vnode/src/sma/smaSnapshot.c | 4 +- source/dnode/vnode/src/sma/smaTimeRange.c | 2 +- source/dnode/vnode/src/sma/smaUtil.c | 18 +- source/dnode/vnode/src/tq/tq.c | 70 +++--- source/dnode/vnode/src/tq/tqExec.c | 12 +- source/dnode/vnode/src/tq/tqMeta.c | 8 +- source/dnode/vnode/src/tq/tqOffset.c | 2 +- source/dnode/vnode/src/tq/tqOffsetSnapshot.c | 2 +- source/dnode/vnode/src/tq/tqPush.c | 6 +- source/dnode/vnode/src/tq/tqRead.c | 20 +- source/dnode/vnode/src/tq/tqSink.c | 4 +- source/dnode/vnode/src/tq/tqSnapshot.c | 2 +- source/dnode/vnode/src/tq/tqStreamStateSnap.c | 2 +- source/dnode/vnode/src/tq/tqStreamTaskSnap.c | 2 +- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 4 +- source/dnode/vnode/src/tsdb/tsdbCommit.c | 40 ++-- source/dnode/vnode/src/tsdb/tsdbDiskData.c | 12 +- source/dnode/vnode/src/tsdb/tsdbFS.c | 50 ++--- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 14 +- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 4 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 62 +++--- .../dnode/vnode/src/tsdb/tsdbReaderWriter.c | 54 ++--- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 26 +-- source/dnode/vnode/src/tsdb/tsdbUtil.c | 70 +++--- source/dnode/vnode/src/tsdb/tsdbWrite.c | 4 +- source/dnode/vnode/src/vnd/vnodeBufPool.c | 10 +- source/dnode/vnode/src/vnd/vnodeCfg.c | 2 +- source/dnode/vnode/src/vnd/vnodeModule.c | 2 +- source/dnode/vnode/src/vnd/vnodeQuery.c | 2 +- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 4 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 6 +- source/dnode/vnode/src/vnd/vnodeSync.c | 4 +- source/libs/catalog/src/ctgDbg.c | 2 +- source/libs/catalog/src/ctgRemote.c | 4 +- source/libs/command/src/command.c | 2 +- source/libs/command/src/explain.c | 2 +- source/libs/executor/inc/executil.h | 2 +- source/libs/executor/src/cachescanoperator.c | 4 +- source/libs/executor/src/dataDeleter.c | 8 +- source/libs/executor/src/dataDispatcher.c | 14 +- source/libs/executor/src/exchangeoperator.c | 4 +- source/libs/executor/src/executil.c | 26 +-- source/libs/executor/src/executor.c | 84 +++---- source/libs/executor/src/executorimpl.c | 34 +-- source/libs/executor/src/filloperator.c | 14 +- source/libs/executor/src/groupoperator.c | 24 +- source/libs/executor/src/joinoperator.c | 16 +- source/libs/executor/src/projectoperator.c | 10 +- source/libs/executor/src/scanoperator.c | 58 ++--- source/libs/executor/src/sortoperator.c | 12 +- source/libs/executor/src/tfill.c | 4 +- source/libs/executor/src/timewindowoperator.c | 64 +++--- source/libs/executor/src/tlinearhash.c | 21 +- source/libs/executor/src/tsimplehash.c | 6 +- source/libs/executor/src/tsort.c | 6 +- source/libs/function/src/builtins.c | 2 +- source/libs/function/src/builtinsimpl.c | 36 +-- .../libs/function/src/detail/tavgfunction.c | 4 +- source/libs/function/src/detail/tminmax.c | 4 +- source/libs/function/src/tpercentile.c | 3 +- source/libs/function/src/udfd.c | 2 +- source/libs/parser/src/parInsertUtil.c | 18 +- source/libs/qworker/src/qworker.c | 2 +- source/libs/scalar/src/scalar.c | 2 +- source/libs/scalar/src/sclfunc.c | 16 +- source/libs/scalar/src/sclvector.c | 12 +- .../libs/scalar/test/scalar/scalarTests.cpp | 2 +- source/libs/stream/src/stream.c | 8 +- source/libs/stream/src/streamCheckpoint.c | 2 +- source/libs/stream/src/streamData.c | 14 +- source/libs/stream/src/streamDispatch.c | 24 +- source/libs/stream/src/streamExec.c | 12 +- source/libs/stream/src/streamMeta.c | 6 +- source/libs/stream/src/streamRecover.c | 4 +- source/libs/stream/src/streamState.c | 2 +- source/libs/stream/src/streamUpdate.c | 6 +- source/libs/sync/src/syncAppendEntries.c | 12 +- source/libs/sync/src/syncAppendEntriesReply.c | 6 +- source/libs/sync/src/syncCommit.c | 10 +- source/libs/sync/src/syncElection.c | 10 +- source/libs/sync/src/syncMain.c | 78 +++---- source/libs/sync/src/syncPipeline.c | 116 +++++----- source/libs/sync/src/syncRaftCfg.c | 72 +++--- source/libs/sync/src/syncRaftEntry.c | 14 +- source/libs/sync/src/syncRaftLog.c | 18 +- source/libs/sync/src/syncRaftStore.c | 34 +-- source/libs/sync/src/syncReplication.c | 10 +- source/libs/sync/src/syncRequestVote.c | 4 +- source/libs/sync/src/syncRequestVoteReply.c | 4 +- source/libs/sync/src/syncSnapshot.c | 30 +-- source/libs/sync/src/syncUtil.c | 4 +- .../sync/test/syncAppendEntriesBatchTest.cpp | 2 +- source/libs/sync/test/syncEncodeTest.cpp | 2 +- source/libs/sync/test/syncEntryCacheTest.cpp | 18 +- source/libs/sync/test/syncHashCacheTest.cpp | 44 ++-- .../libs/sync/test/syncRaftCfgIndexTest.cpp | 2 +- .../sync/test/sync_test_lib/src/syncBatch.c | 28 +-- .../libs/sync/test/sync_test_lib/src/syncIO.c | 40 ++-- .../test/sync_test_lib/src/syncMainDebug.c | 6 +- .../test/sync_test_lib/src/syncMessageDebug.c | 206 +++++++++--------- .../test/sync_test_lib/src/syncRaftCfgDebug.c | 4 +- .../sync_test_lib/src/syncRaftEntryDebug.c | 2 +- source/libs/tdb/src/db/tdbBtree.c | 86 ++++---- source/libs/tdb/src/db/tdbDb.c | 4 +- source/libs/tdb/src/db/tdbPCache.c | 16 +- source/libs/tdb/src/db/tdbPage.c | 68 +++--- source/libs/tdb/src/db/tdbPager.c | 14 +- source/libs/tdb/src/db/tdbTable.c | 2 +- source/libs/tdb/src/db/tdbTxn.c | 2 +- source/libs/tdb/src/inc/tdbInt.h | 4 +- source/libs/tdb/src/inc/tdbUtil.h | 4 +- source/libs/tdb/test/tdbExOVFLTest.cpp | 13 +- source/libs/tdb/test/tdbTest.cpp | 5 +- source/libs/tfs/src/tfs.c | 2 +- source/libs/transport/src/tmsgcb.c | 2 +- source/libs/wal/src/walMeta.c | 30 +-- source/libs/wal/src/walRead.c | 12 +- source/libs/wal/src/walRef.c | 4 +- source/libs/wal/src/walSeek.c | 8 +- source/libs/wal/src/walWrite.c | 34 +-- source/libs/wal/test/walMetaTest.cpp | 48 ++-- source/os/src/osMemory.c | 2 +- source/util/src/tarray.c | 4 +- source/util/src/tbloomfilter.c | 2 +- source/util/src/tcache.c | 16 +- source/util/src/tcompression.c | 12 +- source/util/src/tencode.c | 4 +- source/util/src/thash.c | 16 +- source/util/src/tlog.c | 4 +- source/util/src/tpagedbuf.c | 6 +- source/util/src/tscalablebf.c | 2 +- source/util/src/tskiplist.c | 10 +- source/util/test/hashTest.cpp | 22 +- utils/test/c/sml_test.c | 57 ++--- 173 files changed, 1432 insertions(+), 1431 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index e1d3b01611..3e2ae85853 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -112,10 +112,10 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u if (pColAgg != NULL) { if (pColAgg->numOfNull == totalRows) { - ASSERT(pColumnInfoData->nullbitmap == NULL); + tAssert(pColumnInfoData->nullbitmap == NULL); return true; } else if (pColAgg->numOfNull == 0) { - ASSERT(pColumnInfoData->nullbitmap == NULL); + tAssert(pColumnInfoData->nullbitmap == NULL); return false; } } @@ -157,40 +157,40 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui } static FORCE_INLINE void colDataAppendInt8(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int8_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || + tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int8_t*)p = *(int8_t*)v; } static FORCE_INLINE void colDataAppendInt16(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int16_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT || + tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_USMALLINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int16_t*)p = *(int16_t*)v; } static FORCE_INLINE void colDataAppendInt32(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int32_t* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT); + tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int32_t*)p = *(int32_t*)v; } static FORCE_INLINE void colDataAppendInt64(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int64_t* v) { int32_t type = pColumnInfoData->info.type; - ASSERT(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int64_t*)p = *(int64_t*)v; } static FORCE_INLINE void colDataAppendFloat(SColumnInfoData* pColumnInfoData, uint32_t currentRow, float* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT); + tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(float*)p = *(float*)v; } static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, uint32_t currentRow, double* v) { - ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE); + tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(double*)p = *(double*)v; } diff --git a/include/common/trow.h b/include/common/trow.h index 6a71a8844e..87cd356624 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -214,7 +214,7 @@ static FORCE_INLINE SKvRowIdx *tdKvRowColIdxAt(STSRow *pRow, col_id_t idx) { } static FORCE_INLINE int16_t tdKvRowColIdAt(STSRow *pRow, col_id_t idx) { - ASSERT(idx >= 0); + tAssert(idx >= 0); if (idx == 0) { return PRIMARYKEY_TIMESTAMP_COL_ID; } diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 91ec5f52e5..a1d9a3dc4c 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -90,8 +90,8 @@ typedef struct STbVerInfo { } STbVerInfo; /* - * ASSERT(sizeof(SCTableMeta) == 24) - * ASSERT(tableType == TSDB_CHILD_TABLE) + * tAssert(sizeof(SCTableMeta) == 24) + * tAssert(tableType == TSDB_CHILD_TABLE) * The cached child table meta info. For each child table, 24 bytes are required to keep the essential table info. */ typedef struct SCTableMeta { diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 16cf960724..44f8008ff1 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -188,13 +188,13 @@ SStreamQueue* streamQueueOpen(); void streamQueueClose(SStreamQueue* queue); static FORCE_INLINE void streamQueueProcessSuccess(SStreamQueue* queue) { - ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + tAssert(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); queue->qItem = NULL; atomic_store_8(&queue->status, STREAM_QUEUE__SUCESS); } static FORCE_INLINE void streamQueueProcessFail(SStreamQueue* queue) { - ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + tAssert(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); atomic_store_8(&queue->status, STREAM_QUEUE__FAILED); } @@ -206,7 +206,7 @@ static FORCE_INLINE void* streamQueueCurItem(SStreamQueue* queue) { static FORCE_INLINE void* streamQueueNextItem(SStreamQueue* queue) { int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING); if (dequeueFlag == STREAM_QUEUE__FAILED) { - ASSERT(queue->qItem != NULL); + tAssert(queue->qItem != NULL); return streamQueueCurItem(queue); } else { queue->qItem = NULL; diff --git a/include/os/osDef.h b/include/os/osDef.h index 0bf9c6184e..c18728c9a7 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -120,12 +120,6 @@ void syslog(int unused, const char *format, ...); #define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b))) #define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2)) -#ifndef NDEBUG -#define ASSERT(x) assert(x) -#else -#define ASSERT(x) -#endif - #ifndef UNUSED #define UNUSED(x) ((void)(x)) #endif diff --git a/include/util/tcoding.h b/include/util/tcoding.h index 38eb0d8fc6..d1114ce15a 100644 --- a/include/util/tcoding.h +++ b/include/util/tcoding.h @@ -18,6 +18,8 @@ #include "os.h" +#include "tlog.h" + #ifdef __cplusplus extern "C" { #endif @@ -212,7 +214,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU16(void **buf, uint16_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; - ASSERT(i < 3); + tAssert(i < 3); } if (buf != NULL) { @@ -260,7 +262,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU32(void **buf, uint32_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); value >>= 7; i++; - ASSERT(i < 5); + tAssert(i < 5); } if (buf != NULL) { @@ -308,7 +310,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU64(void **buf, uint64_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; - ASSERT(i < 10); + tAssert(i < 10); } if (buf != NULL) { diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 47ed2cf035..d0b5703224 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -376,7 +376,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { desc.subPlanNum = 0; } desc.subPlanNum = taosArrayGetSize(desc.subDesc); - ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); + tAssert(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); } else { desc.subDesc = NULL; } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index fd2ae288ca..cca3120011 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -446,7 +446,7 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra } void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols) { - ASSERT(pSchema != NULL && numOfCols > 0); + tAssert(pSchema != NULL && numOfCols > 0); pResInfo->numOfCols = numOfCols; if (pResInfo->fields != NULL) { @@ -457,7 +457,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t } pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); - ASSERT(numOfCols == pResInfo->numOfCols); + tAssert(numOfCols == pResInfo->numOfCols); for (int32_t i = 0; i < pResInfo->numOfCols; ++i) { pResInfo->fields[i].bytes = pSchema[i].bytes; @@ -1617,8 +1617,8 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int char* pStart = pCol->offset[j] + pCol->pData; int32_t len = taosUcs4ToMbs((TdUcs4*)varDataVal(pStart), varDataLen(pStart), varDataVal(p)); - ASSERT(len <= bytes); - ASSERT((p + len) < (pResultInfo->convertBuf[i] + colLength[i])); + tAssert(len <= bytes); + tAssert((p + len) < (pResultInfo->convertBuf[i] + colLength[i])); varDataSetLen(p, len); pCol->offset[j] = (p - pResultInfo->convertBuf[i]); @@ -1636,7 +1636,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) { int32_t cols = *(int32_t*)(p + sizeof(int32_t) * 3); - ASSERT(numOfCols == cols); + tAssert(numOfCols == cols); return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) * 3 + sizeof(uint64_t) + numOfCols * (sizeof(int8_t) + sizeof(int32_t)); @@ -1739,7 +1739,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int for (int32_t i = 0; i < numOfCols; ++i) { int32_t colLen = htonl(colLength[i]); int32_t colLen1 = htonl(colLength1[i]); - ASSERT(colLen < dataLen); + tAssert(colLen < dataLen); if (pResultInfo->fields[i].type == TSDB_DATA_TYPE_JSON) { int32_t* offset = (int32_t*)pStart; @@ -1852,7 +1852,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 int32_t cols = *(int32_t*)p; p += sizeof(int32_t); - ASSERT(rows == numOfRows && cols == numOfCols); + tAssert(rows == numOfRows && cols == numOfCols); int32_t hasColumnSeg = *(int32_t*)p; p += sizeof(int32_t); @@ -1868,7 +1868,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 int32_t bytes = *(int32_t*)p; p += sizeof(int32_t); - /*ASSERT(type == pFields[i].type && bytes == pFields[i].bytes);*/ + /*tAssert(type == pFields[i].type && bytes == pFields[i].bytes);*/ } int32_t* colLength = (int32_t*)p; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index f670951d49..1c8f83d018 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -981,8 +981,8 @@ static void fetchCallback(void *pResult, void *param, int32_t code) { } void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { - ASSERT(res != NULL && fp != NULL); - ASSERT(TD_RES_QUERY(res)); + tAssert(res != NULL && fp != NULL); + tAssert(TD_RES_QUERY(res)); SRequestObj *pRequest = res; pRequest->body.fetchFp = fp; @@ -1025,8 +1025,8 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { } void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { - ASSERT(res != NULL && fp != NULL); - ASSERT(TD_RES_QUERY(res)); + tAssert(res != NULL && fp != NULL); + tAssert(TD_RES_QUERY(res)); SRequestObj *pRequest = res; SReqResultInfo *pResultInfo = &pRequest->body.resInfo; @@ -1039,8 +1039,8 @@ void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { } const void *taos_get_raw_block(TAOS_RES *res) { - ASSERT(res != NULL); - ASSERT(TD_RES_QUERY(res)); + tAssert(res != NULL); + tAssert(TD_RES_QUERY(res)); SRequestObj *pRequest = res; return pRequest->body.resInfo.pData; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 85027ff371..564ec3a7c1 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -454,7 +454,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { (*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS); int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); + tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); blockDataDestroy(pBlock); return TSDB_CODE_SUCCESS; diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 150194aa27..a08c1a59b2 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -373,7 +373,7 @@ _exit: } static char* processAutoCreateTable(STaosxRsp* rsp) { - ASSERT(rsp->createTableNum != 0); + tAssert(rsp->createTableNum != 0); SDecoder* decoder = taosMemoryCalloc(rsp->createTableNum, sizeof(SDecoder)); SVCreateTbReq* pCreateReq = taosMemoryCalloc(rsp->createTableNum, sizeof(SVCreateTbReq)); @@ -389,7 +389,7 @@ static char* processAutoCreateTable(STaosxRsp* rsp) { goto _exit; } - ASSERT(pCreateReq[iReq].type == TSDB_CHILD_TABLE); + tAssert(pCreateReq[iReq].type == TSDB_CHILD_TABLE); } string = buildCreateCTableJson(pCreateReq, rsp->createTableNum); @@ -494,7 +494,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { char* buf = NULL; if (vAlterTbReq.tagType == TSDB_DATA_TYPE_JSON) { - ASSERT(tTagIsJson(vAlterTbReq.pTagVal) == true); + tAssert(tTagIsJson(vAlterTbReq.pTagVal) == true); buf = parseTagDatatoJson(vAlterTbReq.pTagVal); } else { buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); @@ -1750,7 +1750,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { } // pSW->pSchema should be same as pTableMeta->schema - // ASSERT(pSW->nCols == pTableMeta->tableInfo.numOfColumns); + // tAssert(pSW->nCols == pTableMeta->tableInfo.numOfColumns); uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid); uint64_t uid = pTableMeta->uid; int16_t sver = pTableMeta->sversion; @@ -1975,7 +1975,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) goto end; } - ASSERT(pCreateReq.type == TSDB_CHILD_TABLE); + tAssert(pCreateReq.type == TSDB_CHILD_TABLE); if (strcmp(tbName, pCreateReq.name) == 0) { schemaLen = *lenTmp; schemaData = *dataTmp; @@ -2053,7 +2053,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) } // pSW->pSchema should be same as pTableMeta->schema - // ASSERT(pSW->nCols == pTableMeta->tableInfo.numOfColumns); + // tAssert(pSW->nCols == pTableMeta->tableInfo.numOfColumns); uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid); uint64_t uid = pTableMeta->uid; int16_t sver = pTableMeta->sversion; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index e5a0e66559..09b8110b9e 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1287,7 +1287,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } } else { size_t tmp = taosArrayGetSize(metaArray); - ASSERT(tmp <= INT16_MAX); + tAssert(tmp <= INT16_MAX); int16_t size = tmp; taosArrayPush(metaArray, &kv); taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES); @@ -1364,8 +1364,8 @@ static int32_t smlKvTimeArrayCompare(const void *key1, const void *key2) { SArray *s2 = *(SArray **)key2; SSmlKv *kv1 = (SSmlKv *)taosArrayGetP(s1, 0); SSmlKv *kv2 = (SSmlKv *)taosArrayGetP(s2, 0); - ASSERT(kv1->type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(kv2->type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(kv1->type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(kv2->type == TSDB_DATA_TYPE_TIMESTAMP); if (kv1->i < kv2->i) { return -1; } else if (kv1->i > kv2->i) { @@ -2331,7 +2331,7 @@ static int32_t smlInsertData(SSmlHandle *info) { SSmlSTableMeta **pMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); - ASSERT(NULL != pMeta && NULL != *pMeta); + tAssert(NULL != pMeta && NULL != *pMeta); // use tablemeta of stable to save vgid and uid of child table (*pMeta)->tableMeta->vgId = vg.vgId; diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 82ea9e0d8f..24d5255c34 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -389,7 +389,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { if (NULL == pStmt->sql.pTableCache || taosHashGetSize(pStmt->sql.pTableCache) <= 0) { if (pStmt->bInfo.inExecCache) { - ASSERT(taosHashGetSize(pStmt->exec.pBlockHash) == 1); + tAssert(taosHashGetSize(pStmt->exec.pBlockHash) == 1); pStmt->bInfo.needParse = false; tscDebug("reuse stmt block for tb %s in execBlock", pStmt->bInfo.tbFName); return TSDB_CODE_SUCCESS; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 56c9b97952..0e92397c1c 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -418,7 +418,7 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) { static void tmqCommitRspCountDown(SMqCommitCbParamSet* pParamSet) { int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1); - ASSERT(waitingRspNum >= 0); + tAssert(waitingRspNum >= 0); if (waitingRspNum == 0) { tmqCommitDone(pParamSet); } @@ -529,7 +529,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT int32_t tmqCommitMsgImpl(tmq_t* tmq, const TAOS_RES* msg, int8_t async, tmq_commit_cb* userCb, void* userParam) { char* topic; int32_t vgId; - ASSERT(msg != NULL); + tAssert(msg != NULL); if (TD_RES_TMQ(msg)) { SMqRspObj* pRspObj = (SMqRspObj*)msg; topic = pRspObj->topic; @@ -916,9 +916,9 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { const char* user = conf->user == NULL ? TSDB_DEFAULT_USER : conf->user; const char* pass = conf->pass == NULL ? TSDB_DEFAULT_PASS : conf->pass; - ASSERT(user); - ASSERT(pass); - ASSERT(conf->groupId[0]); + tAssert(user); + tAssert(pass); + tAssert(conf->groupId[0]); pTmq->clientTopics = taosArrayInit(0, sizeof(SMqClientTopic)); pTmq->mqueue = taosOpenQueue(); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index c5cbc961ef..6d2bf53391 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -22,7 +22,7 @@ #define MALLOC_ALIGN_BYTES 256 int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) { - ASSERT(pColumnInfoData != NULL); + tAssert(pColumnInfoData != NULL); if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { return pColumnInfoData->varmeta.length; } else { @@ -65,7 +65,7 @@ int32_t getJsonValueLen(const char* data) { } int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull) { - ASSERT(pColumnInfoData != NULL); + tAssert(pColumnInfoData != NULL); if (isNull) { // There is a placehold for each NULL value of binary or nchar type. @@ -144,7 +144,7 @@ int32_t colDataReserve(SColumnInfoData* pColumnInfoData, size_t newSize) { static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t currentRow, const char* pData, int32_t itemLen, int32_t numOfRows) { - ASSERT(pColumnInfoData->info.bytes >= itemLen); + tAssert(pColumnInfoData->info.bytes >= itemLen); size_t start = 1; // the first item @@ -177,7 +177,7 @@ static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t curren int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows) { - ASSERT(pData != NULL && pColumnInfoData != NULL); + tAssert(pData != NULL && pColumnInfoData != NULL); int32_t len = pColumnInfoData->info.bytes; if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { @@ -236,7 +236,7 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity, const SColumnInfoData* pSource, int32_t numOfRow2) { - ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); + tAssert(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); if (numOfRow2 == 0) { return numOfRow1; } @@ -316,13 +316,13 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows, const SDataBlockInfo* pBlockInfo) { - ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); + tAssert(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); if (numOfRows <= 0) { return numOfRows; } if (pBlockInfo != NULL) { - ASSERT(pBlockInfo->capacity >= numOfRows); + tAssert(pBlockInfo->capacity >= numOfRows); } if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { @@ -418,7 +418,7 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) { // Actual data rows pluses the corresponding meta data must fit in one memory buffer of the given page size. int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex, int32_t pageSize) { - ASSERT(pBlock != NULL && stopIndex != NULL); + tAssert(pBlock != NULL && stopIndex != NULL); size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); int32_t numOfRows = pBlock->info.rows; @@ -433,7 +433,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd if (!hasVarCol) { size_t rowSize = blockDataGetRowSize(pBlock); int32_t capacity = payloadSize / (rowSize + numOfCols * bitmapChar / 8.0); - ASSERT(capacity > 0); + tAssert(capacity > 0); *stopIndex = startIndex + capacity - 1; if (*stopIndex >= numOfRows) { @@ -465,7 +465,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd if (size > pageSize) { // pageSize must be able to hold one row *stopIndex = j - 1; - ASSERT(*stopIndex >= startIndex); + tAssert(*stopIndex >= startIndex); return TSDB_CODE_SUCCESS; } @@ -536,7 +536,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3 * @return */ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) { - ASSERT(pBlock != NULL); + tAssert(pBlock != NULL); // write the number of rows *(uint32_t*)buf = pBlock->info.rows; @@ -608,7 +608,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) { } pCol->varmeta.length = colLength; - ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen); + tAssert(pCol->varmeta.length <= pCol->varmeta.allocLen); } memcpy(pCol->pData, pStart, colLength); @@ -655,7 +655,7 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) } pCol->varmeta.length = colLength; - ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen); + tAssert(pCol->varmeta.length <= pCol->varmeta.allocLen); } if (!colDataIsNNull_s(pCol, 0, pBlock->info.rows)) { @@ -669,7 +669,7 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) } size_t blockDataGetRowSize(SSDataBlock* pBlock) { - ASSERT(pBlock != NULL); + tAssert(pBlock != NULL); if (pBlock->info.rowSize == 0) { size_t rowSize = 0; @@ -698,7 +698,7 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols) { } double blockDataGetSerialRowSize(const SSDataBlock* pBlock) { - ASSERT(pBlock != NULL); + tAssert(pBlock != NULL); double rowSize = 0; size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); @@ -901,7 +901,7 @@ static int32_t* createTupleIndex(size_t rows) { static void destroyTupleIndex(int32_t* index) { taosMemoryFreeClear(index); } int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { - ASSERT(pDataBlock != NULL && pOrderInfo != NULL); + tAssert(pDataBlock != NULL && pOrderInfo != NULL); if (pDataBlock->info.rows <= 1) { return TSDB_CODE_SUCCESS; } @@ -1145,7 +1145,7 @@ void blockDataCleanup(SSDataBlock* pDataBlock) { void blockDataEmpty(SSDataBlock* pDataBlock) { SDataBlockInfo* pInfo = &pDataBlock->info; - ASSERT(pInfo->rows <= pDataBlock->info.capacity); + tAssert(pInfo->rows <= pDataBlock->info.capacity); if (pInfo->capacity == 0) { return; } @@ -1163,13 +1163,13 @@ void blockDataEmpty(SSDataBlock* pDataBlock) { // todo temporarily disable it static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) { - ASSERT(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/); + tAssert(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/); if (numOfRows <= pBlockInfo->capacity) { return TSDB_CODE_SUCCESS; } // todo temp disable it - // ASSERT(pColumn->info.bytes != 0); + // tAssert(pColumn->info.bytes != 0); int32_t existedRows = pBlockInfo->rows; @@ -1191,7 +1191,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* int32_t oldLen = BitmapLen(existedRows); pColumn->nullbitmap = tmp; memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen); - ASSERT(pColumn->info.bytes); + tAssert(pColumn->info.bytes); // make sure the allocated memory is MALLOC_ALIGN_BYTES aligned tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes); @@ -1209,7 +1209,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* // todo remove it soon #if defined LINUX - ASSERT((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0); + tAssert((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0); #endif if (clearPayload) { @@ -1303,7 +1303,7 @@ void* blockDataDestroy(SSDataBlock* pBlock) { } int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { - ASSERT(src != NULL); + tAssert(src != NULL); dst->info = src->info; dst->info.rows = 0; @@ -1339,7 +1339,7 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { } int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) { - ASSERT(src != NULL && dst != NULL); + tAssert(src != NULL && dst != NULL); blockDataCleanup(dst); int32_t code = blockDataEnsureCapacity(dst, src->info.rows); @@ -1496,7 +1496,7 @@ SSDataBlock* createDataBlock() { } int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData) { - ASSERT(pBlock != NULL && pColInfoData != NULL); + tAssert(pBlock != NULL && pColInfoData != NULL); if (pBlock->pDataBlock == NULL) { pBlock->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData)); if (pBlock->pDataBlock == NULL) { @@ -1512,7 +1512,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat } // todo disable it temporarily - // ASSERT(pColInfoData->info.type != 0); + // tAssert(pColInfoData->info.type != 0); if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { pBlock->info.hasVarCol = true; } @@ -1531,7 +1531,7 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId) } SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) { - ASSERT(pBlock != NULL); + tAssert(pBlock != NULL); if (index >= taosArrayGetSize(pBlock->pDataBlock)) { return NULL; } @@ -1545,7 +1545,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { int32_t payloadSize = pageSize - blockDataGetSerialMetaSize(numOfCols); int32_t rowSize = pBlock->info.rowSize; int32_t nRows = payloadSize / rowSize; - ASSERT(nRows >= 1); + tAssert(nRows >= 1); // the true value must be less than the value of nRows int32_t additional = 0; @@ -1559,7 +1559,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { } int32_t newRows = (payloadSize - additional) / rowSize; - ASSERT(newRows <= nRows && newRows >= 1); + tAssert(newRows <= nRows && newRows >= 1); return newRows; } @@ -2217,7 +2217,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB } char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) { - ASSERT(stbFullName[0] != 0); + tAssert(stbFullName[0] != 0); SArray* tags = taosArrayInit(0, sizeof(void*)); if (tags == NULL) { return NULL; @@ -2255,7 +2255,7 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) { taosMemoryFree(pTag); taosArrayDestroy(tags); - ASSERT(rname.ctbShortName && rname.ctbShortName[0]); + tAssert(rname.ctbShortName && rname.ctbShortName[0]); return rname.ctbShortName; } @@ -2273,7 +2273,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { int32_t* rows = (int32_t*)data; *rows = pBlock->info.rows; data += sizeof(int32_t); - ASSERT(*rows > 0); + tAssert(*rows > 0); int32_t* cols = (int32_t*)data; *cols = numOfCols; @@ -2333,7 +2333,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { *actualLen = dataLen; *groupId = pBlock->info.id.groupId; - ASSERT(dataLen > 0); + tAssert(dataLen > 0); uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols); @@ -2345,7 +2345,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { int32_t version = *(int32_t*)pStart; pStart += sizeof(int32_t); - ASSERT(version == 1); + tAssert(version == 1); // total length sizeof(int32_t) int32_t dataLen = *(int32_t*)pStart; @@ -2393,7 +2393,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { for (int32_t i = 0; i < numOfCols; ++i) { colLen[i] = htonl(colLen[i]); - ASSERT(colLen[i] >= 0); + tAssert(colLen[i] >= 0); SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { @@ -2428,6 +2428,6 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { } pBlock->info.rows = numOfRows; - ASSERT(pStart - pData == dataLen); + tAssert(pStart - pData == dataLen); return pStart; } diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index b5c17b556d..8699d35a9d 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -98,9 +98,9 @@ typedef struct { int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { int32_t code = 0; - ASSERT(taosArrayGetSize(aColVal) > 0); - ASSERT(((SColVal *)aColVal->pData)[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID); - ASSERT(((SColVal *)aColVal->pData)[0].type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(taosArrayGetSize(aColVal) > 0); + tAssert(((SColVal *)aColVal->pData)[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID); + tAssert(((SColVal *)aColVal->pData)[0].type == TSDB_DATA_TYPE_TIMESTAMP); // scan --------------- uint8_t flag = 0; @@ -353,8 +353,8 @@ _exit: } void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { - ASSERT(iCol < pTSchema->numOfCols); - ASSERT(pRow->sver == pTSchema->version); + tAssert(iCol < pTSchema->numOfCols); + tAssert(pRow->sver == pTSchema->version); STColumn *pTColumn = pTSchema->columns + iCol; @@ -512,7 +512,7 @@ struct SRowIter { }; int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { - ASSERT(pRow->sver == pTSchema->version); + tAssert(pRow->sver == pTSchema->version); int32_t code = 0; @@ -897,7 +897,7 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { isLarge = 1; } - ASSERT(szTag <= INT16_MAX); + tAssert(szTag <= INT16_MAX); // build tag (*ppTag) = (STag *)taosMemoryCalloc(szTag, 1); @@ -1142,7 +1142,7 @@ int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, c pBuilder->nCols++; - ASSERT(pCol->offset < pBuilder->flen); + tAssert(pCol->offset < pBuilder->flen); return 0; } @@ -1179,8 +1179,8 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version) { pTSchema->version = version; // timestamp column - ASSERT(aSchema[0].type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(aSchema[0].colId == PRIMARYKEY_TIMESTAMP_COL_ID); + tAssert(aSchema[0].type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(aSchema[0].colId == PRIMARYKEY_TIMESTAMP_COL_ID); pTSchema->columns[0].colId = aSchema[0].colId; pTSchema->columns[0].type = aSchema[0].type; pTSchema->columns[0].flags = aSchema[0].flags; @@ -1245,7 +1245,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, SColVal *pColVa pColData->nData += pColVal->value.nData; } } else { - ASSERT(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal); + tAssert(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal); code = tRealloc(&pColData->pData, pColData->nData + tDataTypes[pColData->type].bytes); if (code) goto _exit; memcpy(pColData->pData + pColData->nData, &pColVal->value.val, tDataTypes[pColData->type].bytes); @@ -1562,7 +1562,7 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, SColVal *pCo {tColDataAppendValue70, tColDataAppendValue71, tColDataAppendValue72}, // HAS_VALUE|HAS_NULL|HAS_NONE }; int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) { - ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type); + tAssert(pColData->cid == pColVal->cid && pColData->type == pColVal->type); return tColDataAppendValueImpl[pColData->flag][pColVal->flag](pColData, pColVal); } @@ -1651,7 +1651,7 @@ static void (*tColDataGetValueImpl[])(SColData *pColData, int32_t iVal, SColVal tColDataGetValue7 // HAS_VALUE | HAS_NULL | HAS_NONE }; void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) { - ASSERT(iVal >= 0 && iVal < pColData->nVal && pColData->flag); + tAssert(iVal >= 0 && iVal < pColData->nVal && pColData->flag); tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal); } @@ -1691,9 +1691,9 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest) { int32_t code = 0; int32_t size; - ASSERT(pColDataSrc->nVal > 0); - ASSERT(pColDataDest->cid == pColDataSrc->cid); - ASSERT(pColDataDest->type == pColDataSrc->type); + tAssert(pColDataSrc->nVal > 0); + tAssert(pColDataDest->cid == pColDataSrc->cid); + tAssert(pColDataDest->type == pColDataSrc->type); pColDataDest->smaOn = pColDataSrc->smaOn; pColDataDest->nVal = pColDataSrc->nVal; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index e7bab05bd3..3dd8be66a5 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -38,7 +38,7 @@ int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { pIter->totalLen = htonl(pMsg->length); pIter->numOfBlocks = htonl(pMsg->numOfBlocks); - ASSERT(pIter->totalLen > 0); + tAssert(pIter->totalLen > 0); pIter->len = 0; pIter->pMsg = pMsg; if (pIter->totalLen <= sizeof(SSubmitReq)) { @@ -50,7 +50,7 @@ int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { } int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) { - ASSERT(pIter->len >= 0); + tAssert(pIter->len >= 0); if (pIter->len == 0) { pIter->len += sizeof(SSubmitReq); @@ -60,7 +60,7 @@ int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) { } pIter->len += (sizeof(SSubmitBlk) + pIter->dataLen + pIter->schemaLen); - ASSERT(pIter->len > 0); + tAssert(pIter->len > 0); } if (pIter->len > pIter->totalLen) { @@ -308,7 +308,7 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq) } } - ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); + tAssert(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); taosArrayPush(pReq->query->queryDesc, &desc); } @@ -6396,7 +6396,7 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { return pLeft->uid == pRight->uid; } else { tAssert(0); - /*ASSERT(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/ + /*tAssert(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/ /*pLeft->type == TMQ_OFFSET__RESET_LATEST);*/ /*return true;*/ } diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 8e0ca1efa7..769ff4bb42 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -61,7 +61,7 @@ void tdSRowPrint(STSRow *row, STSchema *pSchema, const char *tag) { if (!tdSTSRowIterNext(&iter, &sVal)) { break; } - ASSERT(sVal.valType == 0 || sVal.valType == 1 || sVal.valType == 2); + tAssert(sVal.valType == 0 || sVal.valType == 1 || sVal.valType == 2); tdSCellValPrint(&sVal, cols[iter.colIdx - 1].type); } printf("\n"); @@ -331,7 +331,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { void *varBuf = NULL; bool isAlloc = false; - ASSERT(nColVal > 1); + tAssert(nColVal > 1); for (int32_t iColumn = 0; iColumn < pTSchema->numOfCols; ++iColumn) { pTColumn = &pTSchema->columns[iColumn]; @@ -342,9 +342,9 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { } if (iColumn == 0) { - ASSERT(pColVal->cid == pTColumn->colId); - ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); + tAssert(pColVal->cid == pTColumn->colId); + tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); } else { if (IS_VAR_DATA_TYPE(pTColumn->type)) { if (pColVal && COL_VAL_IS_VALUE(pColVal)) { @@ -616,7 +616,7 @@ int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int32_t offset, int16_t colIdx) { #ifdef TD_SUPPORT_BITMAP - ASSERT(colIdx < tdRowGetNCols(pRow) - 1); + tAssert(colIdx < tdRowGetNCols(pRow) - 1); if (tdGetBitmapValType(pBitmap, colIdx, &output->valType, 0) != TSDB_CODE_SUCCESS) { output->valType = TD_VTYPE_NONE; return terrno; @@ -843,7 +843,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { TD_ROW_SET_INFO(pBuilder->pBuf, 0); TD_ROW_SET_TYPE(pBuilder->pBuf, pBuilder->rowType); - ASSERT(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); + tAssert(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); uint32_t len = 0; switch (pBuilder->rowType) { @@ -885,7 +885,7 @@ int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) { return terrno; } - ASSERT(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); + tAssert(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); uint32_t len = 0; switch (pBuilder->rowType) { @@ -1070,7 +1070,7 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV SCellVal cv = {0}; SValue value = {0}; - ASSERT((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0)); + tAssert((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0)); if (TD_IS_TP_ROW(pRow)) { tdSTpRowGetVal(pRow, pTColumn->colId, pTColumn->type, pTSchema->flen, pTColumn->offset, iCol - 1, &cv); diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index e88bc8f2b0..39261771d4 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -433,9 +433,9 @@ char getPrecisionUnit(int32_t precision) { } int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPrecision) { - ASSERT(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || + tAssert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || fromPrecision == TSDB_TIME_PRECISION_NANO); - ASSERT(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || + tAssert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || toPrecision == TSDB_TIME_PRECISION_NANO); switch (fromPrecision) { @@ -830,7 +830,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio } } - ASSERT(pInterval->offset >= 0); + tAssert(pInterval->offset >= 0); if (pInterval->offset > 0) { start = taosTimeAdd(start, pInterval->offset, pInterval->offsetUnit, precision); diff --git a/source/common/test/dataformatTest.cpp b/source/common/test/dataformatTest.cpp index b05ae602f8..0dbc314b7c 100644 --- a/source/common/test/dataformatTest.cpp +++ b/source/common/test/dataformatTest.cpp @@ -111,7 +111,7 @@ STSchema *genSTSchema(int16_t nCols) { } break; default: - ASSERT(0); + tAssert(0); break; } } @@ -197,7 +197,7 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) { sscanf(data[i], "%" PRIu64, &colVal.value.u64); } break; default: - ASSERT(0); + tAssert(0); } taosArrayPush(*pArray, &colVal); } @@ -297,7 +297,7 @@ void debugPrintTSRow(STSRow2 *row, STSchema *pTSchema, const char *tags, int32_t } static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) { - ASSERT(rawVal); + tAssert(rawVal); if (COL_VAL_IS_NONE(cv)) { EXPECT_STRCASEEQ(rawVal, NONE_CSTR); diff --git a/source/dnode/mgmt/test/sut/src/client.cpp b/source/dnode/mgmt/test/sut/src/client.cpp index a27a511651..076ecdd168 100644 --- a/source/dnode/mgmt/test/sut/src/client.cpp +++ b/source/dnode/mgmt/test/sut/src/client.cpp @@ -55,7 +55,7 @@ void TestClient::DoInit() { // rpcInit.spi = 1; clientRpc = rpcOpen(&rpcInit); - ASSERT(clientRpc); + tAssert(clientRpc); tsem_init(&this->sem, 0, 0); } diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index b54590ce82..f644e5e67b 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -105,7 +105,7 @@ int32_t Testbase::SendShowReq(int8_t showType, const char* tb, const char* db) { tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq); SRpcMsg* pRsp = SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); - ASSERT(pRsp->pCont != nullptr); + tAssert(pRsp->pCont != nullptr); if (pRsp->contLen == 0) return -1; if (pRsp->code != 0) return -1; diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 5dbbe740e3..c5e9f2af36 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -140,9 +140,9 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream for (int32_t j = 0; j < sinkLvSize; j++) { SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j); if (pLastLevelTask->nodeId == pVgInfo->vgId) { - ASSERT(pVgInfo->vgId > 0); + tAssert(pVgInfo->vgId > 0); pVgInfo->taskId = pLastLevelTask->taskId; - ASSERT(pVgInfo->taskId != 0); + tAssert(pVgInfo->taskId != 0); break; } } @@ -152,7 +152,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; SArray* pArray = taosArrayGetP(pStream->tasks, 0); // one sink only - ASSERT(taosArrayGetSize(pArray) == 1); + tAssert(taosArrayGetSize(pArray) == 1); SStreamTask* lastLevelTask = taosArrayGetP(pArray, 0); pTask->fixedEpDispatcher.taskId = lastLevelTask->taskId; pTask->fixedEpDispatcher.nodeId = lastLevelTask->nodeId; @@ -222,7 +222,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { void* pIter = NULL; SArray* tasks = taosArrayGetP(pStream->tasks, 0); - ASSERT(taosArrayGetSize(pStream->tasks) == 1); + tAssert(taosArrayGetSize(pStream->tasks) == 1); while (1) { SVgObj* pVgroup = NULL; @@ -257,7 +257,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { pTask->tbSink.stbUid = pStream->targetStbUid; memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN); pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema); - ASSERT(pTask->tbSink.pSchemaWrapper); + tAssert(pTask->tbSink.pSchemaWrapper); } sdbRelease(pSdb, pVgroup); } @@ -265,7 +265,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { } int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) { - ASSERT(pStream->fixedSinkVgId != 0); + tAssert(pStream->fixedSinkVgId != 0); SArray* tasks = taosArrayGetP(pStream->tasks, 0); SStreamTask* pTask = tNewSStreamTask(pStream->uid); if (pTask == NULL) { @@ -275,7 +275,7 @@ int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) { pTask->fillHistory = pStream->fillHistory; mndAddTaskToTaskSet(tasks, pTask); - ASSERT(pStream->fixedSinkVg.vgId == pStream->fixedSinkVgId); + tAssert(pStream->fixedSinkVg.vgId == pStream->fixedSinkVgId); pTask->nodeId = pStream->fixedSinkVgId; #if 0 @@ -311,13 +311,13 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { return -1; } int32_t planTotLevel = LIST_LENGTH(pPlan->pSubplans); - ASSERT(planTotLevel <= 2); + tAssert(planTotLevel <= 2); pStream->tasks = taosArrayInit(planTotLevel, sizeof(void*)); bool hasExtraSink = false; bool externalTargetDB = strcmp(pStream->sourceDb, pStream->targetDb) != 0; SDbObj* pDbObj = mndAcquireDb(pMnode, pStream->targetDb); - ASSERT(pDbObj != NULL); + tAssert(pDbObj != NULL); bool multiTarget = pDbObj->cfg.numOfVgroups > 1; sdbRelease(pSdb, pDbObj); @@ -351,7 +351,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - ASSERT(plan->subplanType == SUBPLAN_TYPE_MERGE); + tAssert(plan->subplanType == SUBPLAN_TYPE_MERGE); pInnerTask = tNewSStreamTask(pStream->uid); if (pInnerTask == NULL) { @@ -409,7 +409,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 1); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); + tAssert(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; while (1) { @@ -471,9 +471,9 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { taosArrayPush(pStream->tasks, &taskOneLevel); SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); - ASSERT(LIST_LENGTH(inner->pNodeList) == 1); + tAssert(LIST_LENGTH(inner->pNodeList) == 1); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); + tAssert(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; while (1) { @@ -550,8 +550,8 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); } - ASSERT(pSub->unassignedVgs); - ASSERT(taosHashGetSize(pSub->consumerHash) == 0); + tAssert(pSub->unassignedVgs); + tAssert(taosHashGetSize(pSub->consumerHash) == 0); void* pIter = NULL; while (1) { @@ -590,9 +590,9 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib sdbRelease(pSdb, pVgroup); } - ASSERT(pSub->unassignedVgs->size > 0); + tAssert(pSub->unassignedVgs->size > 0); - ASSERT(taosHashGetSize(pSub->consumerHash) == 0); + tAssert(taosHashGetSize(pSub->consumerHash) == 0); qDestroyQueryPlan(pPlan); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index ce8cdb7bcc..182d766a2e 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -488,7 +488,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea memcpy(smaObj.db, pDb->name, TSDB_DB_FNAME_LEN); smaObj.createdTime = taosGetTimestampMs(); smaObj.uid = mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); - ASSERT(smaObj.uid != 0); + tAssert(smaObj.uid != 0); char resultTbName[TSDB_TABLE_FNAME_LEN + 16] = {0}; snprintf(resultTbName, TSDB_TABLE_FNAME_LEN + 16, "%s_td_tsma_rst_tb", pCreate->name); memcpy(smaObj.dstTbName, resultTbName, TSDB_TABLE_FNAME_LEN); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 74c753d480..56c0c20346 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -360,7 +360,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, if (pCreate->numOfTags) { pObj->tagSchema.pSchema = taosMemoryCalloc(pCreate->numOfTags, sizeof(SSchema)); } - ASSERT(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags)); + tAssert(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags)); for (int32_t i = 0; i < pCreate->numOfTags; i++) { SField *pField = taosArrayGet(pCreate->pTags, i); pObj->tagSchema.pSchema[i].colId = pObj->outputSchema.nCols + i + 1; @@ -378,7 +378,7 @@ FAIL: int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) { if (pTask->taskLevel == TASK_LEVEL__AGG) { - ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); + tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); } SEncoder encoder; tEncoderInit(&encoder, NULL, 0); @@ -544,7 +544,7 @@ _OVER: } static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) { - ASSERT(pTask->nodeId != 0); + tAssert(pTask->nodeId != 0); // vnode /*if (pTask->nodeId > 0) {*/ @@ -790,7 +790,7 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) { int32_t sz = taosArrayGetSize(pLevel); for (int32_t j = 0; j < sz; j++) { SStreamTask *pTask = taosArrayGetP(pLevel, j); - ASSERT(pTask->nodeId > 0); + tAssert(pTask->nodeId > 0); SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->nodeId); if (pVgObj == NULL) { tAssert(0); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 898844063e..a55c0c1996 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -96,8 +96,8 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic, pSub->subType = pTopic->subType; pSub->withMeta = pTopic->withMeta; - ASSERT(pSub->unassignedVgs->size == 0); - ASSERT(taosHashGetSize(pSub->consumerHash) == 0); + tAssert(pSub->unassignedVgs->size == 0); + tAssert(taosHashGetSize(pSub->consumerHash) == 0); if (mndSchedInitSubEp(pMnode, pTopic, pSub) < 0) { tDeleteSubscribeObj(pSub); @@ -105,8 +105,8 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic, return NULL; } - ASSERT(pSub->unassignedVgs->size > 0); - ASSERT(taosHashGetSize(pSub->consumerHash) == 0); + tAssert(pSub->unassignedVgs->size > 0); + tAssert(taosHashGetSize(pSub->consumerHash) == 0); return pSub; } @@ -144,7 +144,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscri static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SMqSubscribeObj *pSub, const SMqRebOutputVg *pRebVg) { - ASSERT(pRebVg->oldConsumerId != pRebVg->newConsumerId); + tAssert(pRebVg->oldConsumerId != pRebVg->newConsumerId); void *buf; int32_t tlen; @@ -218,11 +218,11 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR int32_t actualRemoved = 0; for (int32_t i = 0; i < removedNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i); - ASSERT(consumerId > 0); + tAssert(consumerId > 0); SMqConsumerEp *pConsumerEp = taosHashGet(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); - ASSERT(pConsumerEp); + tAssert(pConsumerEp); if (pConsumerEp) { - ASSERT(consumerId == pConsumerEp->consumerId); + tAssert(consumerId == pConsumerEp->consumerId); actualRemoved++; int32_t consumerVgNum = taosArrayGetSize(pConsumerEp->vgs); for (int32_t j = 0; j < consumerVgNum; j++) { @@ -241,7 +241,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pOutput->removedConsumers, &consumerId); } } - ASSERT(removedNum == actualRemoved); + tAssert(removedNum == actualRemoved); // if previously no consumer, there are vgs not assigned { @@ -278,7 +278,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; - ASSERT(pConsumerEp->consumerId > 0); + tAssert(pConsumerEp->consumerId > 0); int32_t consumerVgNum = taosArrayGetSize(pConsumerEp->vgs); // all old consumers still existing are touched // TODO optimize: touch only consumer whose vgs changed @@ -325,7 +325,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR int32_t consumerNum = taosArrayGetSize(pInput->pRebInfo->newConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->newConsumers, i); - ASSERT(consumerId > 0); + tAssert(consumerId > 0); SMqConsumerEp newConsumerEp; newConsumerEp.consumerId = consumerId; newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); @@ -344,13 +344,13 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; - ASSERT(pConsumerEp->consumerId > 0); + tAssert(pConsumerEp->consumerId > 0); // push until equal minVg while (taosArrayGetSize(pConsumerEp->vgs) < minVgCnt) { // iter hash and find one vg pRemovedIter = taosHashIterate(pHash, pRemovedIter); - ASSERT(pRemovedIter); + tAssert(pRemovedIter); pRebVg = (SMqRebOutputVg *)pRemovedIter; // push taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); @@ -361,7 +361,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } } - ASSERT(pIter == NULL); + tAssert(pIter == NULL); // 7. handle unassigned vg if (taosHashGetSize(pOutput->pSub->consumerHash) != 0) { // if has consumer, assign all left vg @@ -377,9 +377,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } while (1) { pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); - ASSERT(pIter); + tAssert(pIter); pConsumerEp = (SMqConsumerEp *)pIter; - ASSERT(pConsumerEp->consumerId > 0); + tAssert(pConsumerEp->consumerId > 0); if (taosArrayGetSize(pConsumerEp->vgs) == minVgCnt) { break; } @@ -404,7 +404,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pHash, pIter); if (pIter == NULL) break; pRebOutput = (SMqRebOutputVg *)pIter; - ASSERT(pRebOutput->newConsumerId == -1); + tAssert(pRebOutput->newConsumerId == -1); taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp); taosArrayPush(pOutput->rebVgs, pRebOutput); mInfo("mq rebalance: unassign vgId:%d (second scan)", pRebOutput->pVgEp->vgId); @@ -482,7 +482,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu consumerNum = taosArrayGetSize(pOutput->newConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pOutput->newConsumers, i); - ASSERT(consumerId > 0); + tAssert(consumerId > 0); SMqConsumerObj *pConsumerOld = mndAcquireConsumer(pMnode, consumerId); SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumerOld->consumerId, pConsumerOld->cgroup); pConsumerNew->updateType = CONSUMER_UPDATE__ADD; @@ -505,7 +505,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu consumerNum = taosArrayGetSize(pOutput->removedConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pOutput->removedConsumers, i); - ASSERT(consumerId > 0); + tAssert(consumerId > 0); SMqConsumerObj *pConsumerOld = mndAcquireConsumer(pMnode, consumerId); SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumerOld->consumerId, pConsumerOld->cgroup); pConsumerNew->updateType = CONSUMER_UPDATE__REMOVE; @@ -572,7 +572,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { char cgroup[TSDB_CGROUP_LEN]; mndSplitSubscribeKey(pRebInfo->key, topic, cgroup, true); SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic); - /*ASSERT(pTopic);*/ + /*tAssert(pTopic);*/ if (pTopic == NULL) { mError("mq rebalance %s failed since topic %s not exist, abort", pRebInfo->key, topic); continue; @@ -581,7 +581,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { rebOutput.pSub = mndCreateSub(pMnode, pTopic, pRebInfo->key); memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); - ASSERT(taosHashGetSize(rebOutput.pSub->consumerHash) == 0); + tAssert(taosHashGetSize(rebOutput.pSub->consumerHash) == 0); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); @@ -601,7 +601,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { // if add more consumer to balanced subscribe, // possibly no vg is changed - /*ASSERT(taosArrayGetSize(rebOutput.rebVgs) != 0);*/ + /*tAssert(taosArrayGetSize(rebOutput.rebVgs) != 0);*/ if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) { mError("mq rebalance persist rebalance output error, possibly vnode splitted or dropped"); diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 66c791c405..e582eac2a7 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -384,7 +384,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * topicObj.subType = pCreate->subType; topicObj.withMeta = pCreate->withMeta; if (topicObj.withMeta) { - ASSERT(topicObj.subType != TOPIC_SUB_TYPE__COLUMN); + tAssert(topicObj.subType != TOPIC_SUB_TYPE__COLUMN); } if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) { diff --git a/source/dnode/mnode/impl/test/trans/trans1.cpp b/source/dnode/mnode/impl/test/trans/trans1.cpp index 92a442aa5e..f783788a0f 100644 --- a/source/dnode/mnode/impl/test/trans/trans1.cpp +++ b/source/dnode/mnode/impl/test/trans/trans1.cpp @@ -32,7 +32,7 @@ class MndTestTrans1 : public ::testing::Test { void* buffer = taosMemoryMalloc(size); int32_t readLen = taosReadFile(pFile, buffer, size); if (readLen < 0 || readLen == size) { - ASSERT(1); + tAssert(1); } taosCloseFile(&pFile); @@ -41,7 +41,7 @@ class MndTestTrans1 : public ::testing::Test { pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); int32_t writeLen = taosWriteFile(pFile, buffer, readLen); if (writeLen < 0 || writeLen == readLen) { - ASSERT(1); + tAssert(1); } taosMemoryFree(buffer); taosFsyncFile(pFile); diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 5950e0e7b2..072727507d 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -61,8 +61,8 @@ FAIL: } int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) { - ASSERT(pTask->taskLevel == TASK_LEVEL__AGG); - ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); + tAssert(pTask->taskLevel == TASK_LEVEL__AGG); + tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); pTask->refCnt = 1; pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE; @@ -91,7 +91,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); - ASSERT(pTask->exec.executor); + tAssert(pTask->exec.executor); return 0; } @@ -149,7 +149,7 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) { } tDecoderClear(&decoder); - ASSERT(pTask->taskLevel == TASK_LEVEL__AGG); + tAssert(pTask->taskLevel == TASK_LEVEL__AGG); // 2.save task code = streamMetaAddTask(pSnode->pMeta, -1, pTask); diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 6a704d0425..2611c37fd4 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -205,7 +205,7 @@ _exit: int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { int32_t code = 0; - // ASSERT(metaIsWLocked(pMeta)); + // tAssert(metaIsWLocked(pMeta)); // search SMetaCache* pCache = pMeta->pCache; @@ -216,7 +216,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { } if (*ppEntry) { // update - ASSERT(pInfo->suid == (*ppEntry)->info.suid); + tAssert(pInfo->suid == (*ppEntry)->info.suid); if (pInfo->version > (*ppEntry)->info.version) { (*ppEntry)->info.version = pInfo->version; (*ppEntry)->info.skmVer = pInfo->skmVer; @@ -335,7 +335,7 @@ _exit: int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) { int32_t code = 0; - // ASSERT(metaIsWLocked(pMeta)); + // tAssert(metaIsWLocked(pMeta)); // search SMetaCache* pCache = pMeta->pCache; @@ -435,7 +435,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK return TSDB_CODE_SUCCESS; } else { // do some book mark work after acquiring the filter result from cache STagFilterResEntry** pEntry = taosHashGet(pMeta->pCache->sTagFilterResCache.pTableEntry, &suid, sizeof(uint64_t)); - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); *acquireRes = 1; const char* p = taosLRUCacheValue(pMeta->pCache->sTagFilterResCache.pUidResCache, pHandle); @@ -522,7 +522,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int pBuf[0] = suid; memcpy(&pBuf[1], pKey, keyLen); - ASSERT(sizeof(uint64_t) + keyLen == 24); + tAssert(sizeof(uint64_t) + keyLen == 24); // add to cache. taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, TAOS_LRU_PRIORITY_LOW); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 1b5f742559..f03998987a 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -358,7 +358,7 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL return -1; } - ASSERT(pTagIdxKey1->type == pTagIdxKey2->type); + tAssert(pTagIdxKey1->type == pTagIdxKey2->type); // check NULL, NULL is always the smallest if (pTagIdxKey1->isNull && !pTagIdxKey2->isNull) { diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index cfdb4ab8d1..7b851bb9f8 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -662,7 +662,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv goto _exit; } - ASSERT(c); + tAssert(c); if (c < 0) { tdbTbcMoveToPrev(pSkmDbC); @@ -686,7 +686,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv } } - ASSERT(sver > 0); + tAssert(sver > 0); skmDbKey.uid = suid ? suid : uid; skmDbKey.sver = sver; diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index 0409db35d9..f487651b0e 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -100,7 +100,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { break; } - ASSERT(pData && nData); + tAssert(pData && nData); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData); if (*ppData == NULL) { @@ -352,7 +352,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) { int64_t* uid = taosArrayGet(ctx->idList, i); SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t)); - ASSERT(idData); + tAssert(idData); idData->index = i; metaDebug("tmqsnap init idVersion uid:%" PRIi64 " version:%" PRIi64 " index:%d", *uid, idData->version, idData->index); @@ -469,7 +469,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - ASSERT(idInfo); + tAssert(idInfo); *uid = *uidTmp; ret = MoveToPosition(ctx, idInfo->version, *uidTmp); @@ -503,7 +503,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in (ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)) { STableInfoForChildTable* data = (STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t)); - ASSERT(data); + tAssert(data); SVCreateTbReq req = {0}; req.type = TSDB_CHILD_TABLE; @@ -589,7 +589,7 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx) { int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - ASSERT(idInfo); + tAssert(idInfo); int32_t ret = MoveToPosition(ctx, idInfo->version, *uidTmp); if (ret != 0) { diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 339a9f7e2b..904be38794 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -342,10 +342,10 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(ret == 0 && c == 0); + tAssert(ret == 0 && c == 0); ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); - ASSERT(ret == 0); + tAssert(ret == 0); oStbEntry.pBuf = taosMemoryMalloc(nData); memcpy(oStbEntry.pBuf, pData, nData); @@ -770,7 +770,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -780,7 +780,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -789,7 +789,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - ASSERT(ret == 0); + tAssert(ret == 0); if (entry.type != TSDB_NORMAL_TABLE) { terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION; @@ -809,7 +809,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl if (iCol >= pSchema->nCols) break; pColumn = &pSchema->pSchema[iCol]; - ASSERT(pAlterTbReq->colName); + tAssert(pAlterTbReq->colName); if (strcmp(pColumn->name, pAlterTbReq->colName) == 0) break; iCol++; } @@ -961,7 +961,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -974,7 +974,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA /* get ctbEntry */ tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); ctbEntry.pBuf = taosMemoryMalloc(nData); @@ -1072,7 +1072,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaUpdateTagIdx(pMeta, &ctbEntry); } - ASSERT(ctbEntry.ctbEntry.pTags); + tAssert(ctbEntry.ctbEntry.pTags); SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid}; tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags, ((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn); @@ -1127,7 +1127,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -1137,7 +1137,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - ASSERT(c == 0); + tAssert(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -1146,7 +1146,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - ASSERT(ret == 0); + tAssert(ret == 0); entry.version = version; metaWLock(pMeta); diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c index 9748963722..6940a2acc3 100644 --- a/source/dnode/vnode/src/sma/smaCommit.c +++ b/source/dnode/vnode/src/sma/smaCommit.c @@ -317,7 +317,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { } } pRSmaStat->commitAppliedVer = pSma->pVnode->state.applied; - ASSERT(pRSmaStat->commitAppliedVer > 0); + tAssert(pRSmaStat->commitAppliedVer > 0); // step 2: wait for all triggered fetch tasks to finish nLoops = 0; @@ -361,7 +361,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { // lock taosWLockLatch(SMA_ENV_LOCK(pEnv)); - ASSERT(RSMA_INFO_HASH(pRSmaStat)); + tAssert(RSMA_INFO_HASH(pRSmaStat)); void *pIter = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL); diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index 6186bac7a7..5192e3cb34 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -193,7 +193,7 @@ static void tRSmaInfoHashFreeNode(void *data) { } static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pSma) { - ASSERT(pSmaStat != NULL); + tAssert(pSmaStat != NULL); if (*pSmaStat) { // no lock return TSDB_CODE_SUCCESS; @@ -360,7 +360,7 @@ int32_t tdLockSma(SSma *pSma) { } int32_t tdUnLockSma(SSma *pSma) { - ASSERT(SMA_LOCKED(pSma)); + tAssert(SMA_LOCKED(pSma)); pSma->locked = false; int code = taosThreadMutexUnlock(&pSma->mutex); if (code != 0) { diff --git a/source/dnode/vnode/src/sma/smaFS.c b/source/dnode/vnode/src/sma/smaFS.c index 8db36be741..f4843eb498 100644 --- a/source/dnode/vnode/src/sma/smaFS.c +++ b/source/dnode/vnode/src/sma/smaFS.c @@ -90,7 +90,7 @@ int32_t tdRSmaFSRef(SSma *pSma, SRSmaStat *pStat, int64_t version) { taosRLockLatch(RSMA_FS_LOCK(pStat)); if ((pTaskF = taosArraySearch(aQTaskInf, &version, tdQTaskInfCmprFn1, TD_EQ))) { oldVal = atomic_fetch_add_32(&pTaskF->nRef, 1); - ASSERT(oldVal > 0); + tAssert(oldVal > 0); } taosRUnLockLatch(RSMA_FS_LOCK(pStat)); return oldVal; @@ -117,7 +117,7 @@ void tdRSmaFSUnRef(SSma *pSma, SRSmaStat *pStat, int64_t version) { taosWLockLatch(RSMA_FS_LOCK(pStat)); if ((idx = taosArraySearchIdx(aQTaskInf, &version, tdQTaskInfCmprFn1, TD_EQ)) >= 0) { - ASSERT(idx < taosArrayGetSize(aQTaskInf)); + tAssert(idx < taosArrayGetSize(aQTaskInf)); pTaskF = taosArrayGet(aQTaskInf, idx); if (atomic_sub_fetch_32(&pTaskF->nRef, 1) <= 0) { tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), pTaskF->version, tfsGetPrimaryPath(pVnode->pTfs), qTaskFullName); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index c48677c311..06a48148ad 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -72,7 +72,7 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p goto end; } - ASSERT(level >= TSDB_RETENTION_L1 && level <= TSDB_RETENTION_L2); + tAssert(level >= TSDB_RETENTION_L1 && level <= TSDB_RETENTION_L2); freqDuration = convertTimeFromPrecisionToUnit((r + level)->freq, precision, TIME_UNIT_MINUTE); keepDuration = convertTimeFromPrecisionToUnit((r + level)->keep, precision, TIME_UNIT_MINUTE); @@ -121,7 +121,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty int32_t smaOpen(SVnode *pVnode, int8_t rollback) { STsdbCfg *pCfg = &pVnode->config.tsdbCfg; - ASSERT(!pVnode->pSma); + tAssert(!pVnode->pSma); SSma *pSma = taosMemoryCalloc(1, sizeof(SSma)); if (!pSma) { @@ -182,7 +182,7 @@ int32_t smaClose(SSma *pSma) { * @return int32_t */ int32_t tdRSmaRestore(SSma *pSma, int8_t type, int64_t committedVer) { - ASSERT(VND_IS_RSMA(pSma->pVnode)); + tAssert(VND_IS_RSMA(pSma->pVnode)); return tdRSmaProcessRestoreImpl(pSma, type, committedVer); } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index f3c8ff885c..1918c85e91 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -161,7 +161,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree) { } static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) { - ASSERT(*pStore == NULL); + tAssert(*pStore == NULL); *pStore = taosMemoryCalloc(1, sizeof(STbUidStore)); if (*pStore == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -264,7 +264,7 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui return TSDB_CODE_SUCCESS; } - ASSERT(ppStore != NULL); + tAssert(ppStore != NULL); if (!(*ppStore)) { if (tdUidStoreInit(ppStore) < 0) { @@ -332,7 +332,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat } pItem->level = idx == 0 ? TSDB_RETENTION_L1 : TSDB_RETENTION_L2; - ASSERT(pItem->level > 0); + tAssert(pItem->level > 0); SRSmaRef rsmaRef = {.refId = pStat->refId, .suid = pRSmaInfo->suid}; taosHashPut(smaMgmt.refHash, &pItem, POINTER_BYTES, &rsmaRef, sizeof(rsmaRef)); @@ -882,7 +882,7 @@ static int32_t tdCloneQTaskInfo(SSma *pSma, qTaskInfo_t dstTaskInfo, qTaskInfo_t .vnode = pVnode, .initTqReader = 1, }; - ASSERT(!dstTaskInfo); + tAssert(!dstTaskInfo); dstTaskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], &handle); if (!dstTaskInfo) { terrno = TSDB_CODE_RSMA_QTASKINFO_CREATE; @@ -928,8 +928,8 @@ static int32_t tdRSmaInfoClone(SSma *pSma, SRSmaInfo *pInfo) { terrstr()); goto _err; } - ASSERT(mr.me.type == TSDB_SUPER_TABLE); - ASSERT(mr.me.uid == pInfo->suid); + tAssert(mr.me.type == TSDB_SUPER_TABLE); + tAssert(mr.me.uid == pInfo->suid); if (TABLE_IS_ROLLUP(mr.me.flags)) { param = &mr.me.stbEntry.rsmaParam; for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { @@ -992,7 +992,7 @@ static SRSmaInfo *tdAcquireRSmaInfoBySuid(SSma *pSma, int64_t suid) { } tdRefRSmaInfo(pSma, pRSmaInfo); taosRUnLockLatch(SMA_ENV_LOCK(pEnv)); - ASSERT(pRSmaInfo->suid == suid); + tAssert(pRSmaInfo->suid == suid); return pRSmaInfo; } taosRUnLockLatch(SMA_ENV_LOCK(pEnv)); @@ -1133,8 +1133,8 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) { goto _err; } tDecoderClear(&mr.coder); - ASSERT(mr.me.type == TSDB_SUPER_TABLE); - ASSERT(mr.me.uid == suid); + tAssert(mr.me.type == TSDB_SUPER_TABLE); + tAssert(mr.me.uid == suid); if (TABLE_IS_ROLLUP(mr.me.flags)) { ++nRsmaTables; SRSmaParam *param = &mr.me.stbEntry.rsmaParam; @@ -1345,8 +1345,8 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { #if 0 SRSmaInfo *qInfo = tdAcquireRSmaInfoBySuid(pSma, pRSmaInfo->suid); SRSmaInfoItem *qItem = RSMA_INFO_ITEM(qInfo, pItem->level - 1); - ASSERT(qItem->level == pItem->level); - ASSERT(qItem->fetchLevel == pItem->fetchLevel); + tAssert(qItem->level == pItem->level); + tAssert(qItem->fetchLevel == pItem->fetchLevel); #endif if (atomic_load_8(&pRSmaInfo->assigned) == 0) { tsem_post(&(pStat->notEmpty)); @@ -1536,7 +1536,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { if (oldStat == 0 || ((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) { int32_t oldVal = atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1); - ASSERT(oldVal >= 0); + tAssert(oldVal >= 0); tdRSmaFetchAllResult(pSma, pInfo); if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) { atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0); diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c index 4139883e91..8d97a4a664 100644 --- a/source/dnode/vnode/src/sma/smaSnapshot.c +++ b/source/dnode/vnode/src/sma/smaSnapshot.c @@ -184,7 +184,7 @@ static int32_t rsmaSnapReadQTaskInfo(SRSmaSnapReader* pReader, uint8_t** ppBuf) goto _err; } - ASSERT(!(*ppBuf)); + tAssert(!(*ppBuf)); // alloc *ppBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + size); if (!(*ppBuf)) { @@ -451,7 +451,7 @@ static int32_t rsmaSnapWriteQTaskInfo(SRSmaSnapWriter* pWriter, uint8_t* pData, if (qWriter && qWriter->pWriteH) { SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; int64_t size = pHdr->size; - ASSERT(size == (nData - sizeof(SSnapDataHdr))); + tAssert(size == (nData - sizeof(SSnapDataHdr))); int64_t contLen = taosWriteFile(qWriter->pWriteH, pHdr->data, size); if (contLen != size) { code = TAOS_SYSTEM_ERROR(errno); diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index 6df72d5c0a..b480f9344b 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -218,7 +218,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char } #if 0 - ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); + tAssert(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); #endif SRpcMsg submitReqMsg = { diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c index 4d09d690d6..7316b7ef97 100644 --- a/source/dnode/vnode/src/sma/smaUtil.c +++ b/source/dnode/vnode/src/sma/smaUtil.c @@ -46,7 +46,7 @@ static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo) { } int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); int64_t nwrite = taosWriteFile(pTFile->pFile, buf, nbyte); if (nwrite < nbyte) { @@ -58,7 +58,7 @@ int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { } int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); int64_t loffset = taosLSeekFile(TD_TFILE_PFILE(pTFile), offset, whence); if (loffset < 0) { @@ -70,12 +70,12 @@ int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { } int64_t tdGetTFileSize(STFile *pTFile, int64_t *size) { - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); return taosFStatFile(pTFile->pFile, size, NULL); } int64_t tdReadTFile(STFile *pTFile, void *buf, int64_t nbyte) { - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); int64_t nread = taosReadFile(pTFile->pFile, buf, nbyte); if (nread < 0) { @@ -108,7 +108,7 @@ int32_t tdLoadTFileHeader(STFile *pTFile, STFInfo *pInfo) { char buf[TD_FILE_HEAD_SIZE] = "\0"; uint32_t _version; - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); if (tdSeekTFile(pTFile, 0, SEEK_SET) < 0) { return -1; @@ -133,7 +133,7 @@ void tdUpdateTFileMagic(STFile *pTFile, void *pCksm) { } int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) { - ASSERT(TD_TFILE_OPENED(pTFile)); + tAssert(TD_TFILE_OPENED(pTFile)); int64_t toffset; @@ -146,7 +146,7 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) toffset, nbyte, toffset + nbyte); #endif - ASSERT(pTFile->info.fsize == toffset); + tAssert(pTFile->info.fsize == toffset); if (offset) { *offset = toffset; @@ -162,7 +162,7 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) } int32_t tdOpenTFile(STFile *pTFile, int flags) { - ASSERT(!TD_TFILE_OPENED(pTFile)); + tAssert(!TD_TFILE_OPENED(pTFile)); pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), flags); if (pTFile->pFile == NULL) { @@ -245,7 +245,7 @@ int32_t tdInitTFile(STFile *pTFile, const char *dname, const char *fname) { } int32_t tdCreateTFile(STFile *pTFile, bool updateHeader, int8_t fType) { - ASSERT(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); + tAssert(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { if (errno == ENOENT) { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c9ad88188d..c0a9a1ab92 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -166,17 +166,17 @@ int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) { SMqDataRsp* pRsp = &pPushEntry->dataRsp; - ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); - ASSERT(!pRsp->withSchema); - ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); + tAssert(!pRsp->withSchema); + tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { /*if (pRsp->blockNum > 0) {*/ - /*ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);*/ + /*tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version);*/ /*} else {*/ - ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); + tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); /*}*/ } @@ -223,17 +223,17 @@ int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) { } int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp) { - ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); - ASSERT(!pRsp->withSchema); - ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); + tAssert(!pRsp->withSchema); + tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { if (pRsp->blockNum > 0) { - ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); + tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); } else { - ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version); + tAssert(pRsp->rspOffset.version >= pRsp->reqOffset.version); } } @@ -279,20 +279,20 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con } int32_t tqSendTaosxRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const STaosxRsp* pRsp) { - ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); if (pRsp->withSchema) { - ASSERT(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum); + tAssert(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum); } else { - ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); + tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); } if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { if (pRsp->blockNum > 0) { - ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); + tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); } else { - ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version); + tAssert(pRsp->rspOffset.version >= pRsp->reqOffset.version); } } @@ -434,7 +434,7 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su } #endif - ASSERT(subType == TOPIC_SUB_TYPE__COLUMN); + tAssert(subType == TOPIC_SUB_TYPE__COLUMN); pRsp->withSchema = false; return 0; @@ -473,7 +473,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { // 1.find handle STqHandle* pHandle = taosHashGet(pTq->pHandle, req.subKey, strlen(req.subKey)); - /*ASSERT(pHandle);*/ + /*tAssert(pHandle);*/ if (pHandle == NULL) { tqError("tmq poll: no consumer handle for consumer:%" PRId64 ", in vgId:%d, subkey %s", consumerId, TD_VID(pTq->pVnode), req.subKey); @@ -599,7 +599,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } // for taosx - ASSERT(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN); + tAssert(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN); SMqMetaRsp metaRsp = {0}; @@ -690,8 +690,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } } else { - ASSERT(pHandle->fetchMeta); - ASSERT(IS_META_MSG(pHead->msgType)); + tAssert(pHandle->fetchMeta); + tAssert(IS_META_MSG(pHead->msgType)); tqDebug("fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType); tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer); metaRsp.resMsgType = pHead->msgType; @@ -823,12 +823,12 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL pHandle->execHandle.task = qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, NULL); - ASSERT(pHandle->execHandle.task); + tAssert(pHandle->execHandle.task); void* scanner = NULL; qExtractStreamScanner(pHandle->execHandle.task, &scanner); - ASSERT(scanner); + tAssert(scanner); pHandle->execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner); - ASSERT(pHandle->execHandle.pExecReader); + tAssert(pHandle->execHandle.pExecReader); } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) { pHandle->pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); pHandle->execHandle.pExecReader = tqOpenReader(pTq->pVnode); @@ -865,7 +865,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL tAssert(0); } } else { - /*ASSERT(pExec->consumerId == req.oldConsumerId);*/ + /*tAssert(pExec->consumerId == req.oldConsumerId);*/ // TODO handle qmsg and exec modification atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); @@ -883,7 +883,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { if (pTask->taskLevel == TASK_LEVEL__AGG) { - ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); + tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); } pTask->refCnt = 1; @@ -921,7 +921,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle); - ASSERT(pTask->exec.executor); + tAssert(pTask->exec.executor); } else if (pTask->taskLevel == TASK_LEVEL__AGG) { pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask, false, -1, -1); @@ -934,7 +934,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); - ASSERT(pTask->exec.executor); + tAssert(pTask->exec.executor); } // sink @@ -946,12 +946,12 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { pTask->tbSink.vnode = pTq->pVnode; pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline; - ASSERT(pTask->tbSink.pSchemaWrapper); - ASSERT(pTask->tbSink.pSchemaWrapper->pSchema); + tAssert(pTask->tbSink.pSchemaWrapper); + tAssert(pTask->tbSink.pSchemaWrapper->pSchema); pTask->tbSink.pTSchema = tdGetSTSChemaFromSSChema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, 1); - ASSERT(pTask->tbSink.pTSchema); + tAssert(pTask->tbSink.pTSchema); } streamSetupTrigger(pTask); @@ -1090,7 +1090,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { if (pTask == NULL) { return -1; } - ASSERT(pReq->taskId == pTask->taskId); + tAssert(pReq->taskId == pTask->taskId); // check param int64_t fillVer1 = pTask->startVer; @@ -1290,7 +1290,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { } int32_t ref = atomic_sub_fetch_32(pRef, 1); - ASSERT(ref >= 0); + tAssert(ref >= 0); if (ref == 0) { blockDataDestroy(pDelBlock); taosMemoryFree(pRef); diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 282433d1b5..16d9f8f981 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -29,7 +29,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); - ASSERT(actualLen <= dataStrLen); + tAssert(actualLen <= dataStrLen); taosArrayPush(pRsp->blockDataLen, &actualLen); taosArrayPush(pRsp->blockData, &buf); return 0; @@ -62,7 +62,7 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pOffset) { const STqExecHandle* pExec = &pHandle->execHandle; - ASSERT(pExec->subType == TOPIC_SUB_TYPE__COLUMN); + tAssert(pExec->subType == TOPIC_SUB_TYPE__COLUMN); qTaskInfo_t task = pExec->task; @@ -108,7 +108,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs tAssert(0); return -1; } - ASSERT(pRsp->rspOffset.type != 0); + tAssert(pRsp->rspOffset.type != 0); if (pRsp->withTbName) { if (pRsp->rspOffset.type == TMQ_OFFSET__LOG) { @@ -118,7 +118,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs pRsp->withTbName = false; } } - ASSERT(pRsp->withSchema == false); + tAssert(pRsp->withSchema == false); return 0; } @@ -219,13 +219,13 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta tAssert(0); } - ASSERT(pRsp->rspOffset.type != 0); + tAssert(pRsp->rspOffset.type != 0); return 0; } int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp* pRsp) { STqExecHandle* pExec = &pHandle->execHandle; - ASSERT(pExec->subType != TOPIC_SUB_TYPE__COLUMN); + tAssert(pExec->subType != TOPIC_SUB_TYPE__COLUMN); SArray* pBlocks = taosArrayInit(0, sizeof(SSDataBlock)); SArray* pSchemas = taosArrayInit(0, sizeof(void*)); diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 2cbe70fd38..3614418d5f 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -197,7 +197,7 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) { int32_t code; int32_t vlen; tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code); - ASSERT(code == 0); + tAssert(code == 0); tqDebug("tq save %s(%d) consumer %" PRId64 " vgId:%d", pHandle->subKey, (int32_t)strlen(pHandle->subKey), pHandle->consumerId, TD_VID(pTq->pVnode)); @@ -300,12 +300,12 @@ int32_t tqMetaRestoreHandle(STQ* pTq) { if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { handle.execHandle.task = qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, NULL); - ASSERT(handle.execHandle.task); + tAssert(handle.execHandle.task); void* scanner = NULL; qExtractStreamScanner(handle.execHandle.task, &scanner); - ASSERT(scanner); + tAssert(scanner); handle.execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner); - ASSERT(handle.execHandle.pExecReader); + tAssert(handle.execHandle.pExecReader); } else if (handle.execHandle.subType == TOPIC_SUB_TYPE__DB) { handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode); diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c index fd74b15ad6..0dd0a73ca4 100644 --- a/source/dnode/vnode/src/tq/tqOffset.c +++ b/source/dnode/vnode/src/tq/tqOffset.c @@ -136,7 +136,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { int32_t bodyLen; int32_t code; tEncodeSize(tEncodeSTqOffset, pOffset, bodyLen, code); - ASSERT(code == 0); + tAssert(code == 0); if (code < 0) { tAssert(0); taosHashCancelIterate(pStore->pHash, pIter); diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c index ed656412f2..6ef3fa0fd6 100644 --- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c +++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c @@ -146,7 +146,7 @@ int32_t tqOffsetSnapWrite(STqOffsetWriter* pWriter, uint8_t* pData, uint32_t nDa TdFilePtr pFile = taosOpenFile(pWriter->fname, TD_FILE_CREATE | TD_FILE_WRITE); SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; int64_t size = pHdr->size; - ASSERT(size == nData - sizeof(SSnapDataHdr)); + tAssert(size == nData - sizeof(SSnapDataHdr)); if (pFile) { int64_t contLen = taosWriteFile(pFile, pHdr->data, size); if (contLen != size) { diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index 1a84858785..21feb4b99e 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -25,7 +25,7 @@ void tqTmrRspFunc(void* param, void* tmrId) { static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubmit** ppSubmit, SMqDataRsp* pRsp) { SStreamDataSubmit* pSubmit = *ppSubmit; while (pSubmit != NULL) { - ASSERT(pSubmit->ver == pHandle->pushHandle.processedVer + 1); + tAssert(pSubmit->ver == pHandle->pushHandle.processedVer + 1); if (tqLogScanExec(pTq, &pHandle->execHandle, pSubmit->data, pRsp, 0) < 0) { /*tAssert(0);*/ } @@ -169,8 +169,8 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_ continue; } - ASSERT(taosArrayGetSize(rsp.blockData) == rsp.blockNum); - ASSERT(taosArrayGetSize(rsp.blockDataLen) == rsp.blockNum); + tAssert(taosArrayGetSize(rsp.blockData) == rsp.blockNum); + tAssert(taosArrayGetSize(rsp.blockDataLen) == rsp.blockNum); rsp.rspOffset = fetchOffset; diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 1d9ffe4b90..97512a0e4d 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -297,11 +297,11 @@ void tqCloseReader(STqReader* pReader) { int32_t tqSeekVer(STqReader* pReader, int64_t ver) { if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - ASSERT(pReader->pWalReader->curInvalid); - ASSERT(pReader->pWalReader->curVersion == ver); + tAssert(pReader->pWalReader->curInvalid); + tAssert(pReader->pWalReader->curVersion == ver); return -1; } - ASSERT(pReader->pWalReader->curVersion == ver); + tAssert(pReader->pWalReader->curVersion == ver); return 0; } @@ -317,7 +317,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version); - ASSERT(ret->offset.version >= 0); + tAssert(ret->offset.version >= 0); return -1; } void* body = pReader->pWalReader->pHead->head.body; @@ -351,7 +351,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { if (fromProcessedMsg) { ret->offset.type = TMQ_OFFSET__LOG; ret->offset.version = pReader->ver; - ASSERT(pReader->ver >= 0); + tAssert(pReader->ver >= 0); ret->fetchType = FETCH_TYPE__SEP; tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version); return 0; @@ -434,7 +434,7 @@ bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) { } if (pHandle->pBlock == NULL) return false; - ASSERT(pHandle->tbIdHash == NULL); + tAssert(pHandle->tbIdHash == NULL); void* ret = taosHashGet(filterOutUids, &pHandle->msgIter.uid, sizeof(int64_t)); if (ret == NULL) { return true; @@ -670,7 +670,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas break; } - ASSERT(sVal.valType != TD_VTYPE_NONE); + tAssert(sVal.valType != TD_VTYPE_NONE); if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) { goto FAIL; @@ -731,7 +731,7 @@ int tqReaderAddTbUidList(STqReader* pReader, const SArray* tbUidList) { } int tqReaderRemoveTbUidList(STqReader* pReader, const SArray* tbUidList) { - ASSERT(pReader->tbIdHash != NULL); + tAssert(pReader->tbIdHash != NULL); for (int32_t i = 0; i < taosArrayGetSize(tbUidList); i++) { int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i); @@ -749,7 +749,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { STqHandle* pExec = (STqHandle*)pIter; if (pExec->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { int32_t code = qUpdateQualifiedTableId(pExec->execHandle.task, tbUidList, isAdd); - ASSERT(code == 0); + tAssert(code == 0); } else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__DB) { if (!isAdd) { int32_t sz = taosArrayGetSize(tbUidList); @@ -799,7 +799,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { SStreamTask* pTask = *(SStreamTask**)pIter; if (pTask->taskLevel == TASK_LEVEL__SOURCE) { int32_t code = qUpdateQualifiedTableId(pTask->exec.executor, tbUidList, isAdd); - ASSERT(code == 0); + tAssert(code == 0); } } return 0; diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 294dd7504c..b89c8d6e3a 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -19,7 +19,7 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBlock* pDataBlock, SBatchDeleteReq* deleteReq) { - ASSERT(pDataBlock->info.type == STREAM_DELETE_RESULT); + tAssert(pDataBlock->info.type == STREAM_DELETE_RESULT); int32_t totRow = pDataBlock->info.rows; SColumnInfoData* pStartTsCol = taosArrayGet(pDataBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTsCol = taosArrayGet(pDataBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -559,7 +559,7 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data tqDebug("vgId:%d, task %d write into table, block num: %d", TD_VID(pVnode), pTask->taskId, (int32_t)pRes->size); - ASSERT(pTask->tbSink.pTSchema); + tAssert(pTask->tbSink.pTSchema); deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq)); SSubmitReq* submitReq = tqBlockToSubmit(pVnode, pRes, pTask->tbSink.pTSchema, pTask->tbSink.pSchemaWrapper, true, pTask->tbSink.stbUid, pTask->tbSink.stbFullName, &deleteReq); diff --git a/source/dnode/vnode/src/tq/tqSnapshot.c b/source/dnode/vnode/src/tq/tqSnapshot.c index d811d943ed..95f4ae3446 100644 --- a/source/dnode/vnode/src/tq/tqSnapshot.c +++ b/source/dnode/vnode/src/tq/tqSnapshot.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - ASSERT(pVal && vLen); + tAssert(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c index 5e82665190..6309f7ebc5 100644 --- a/source/dnode/vnode/src/tq/tqStreamStateSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - ASSERT(pVal && vLen); + tAssert(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c index 012702daed..bddc11f61f 100644 --- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - ASSERT(pVal && vLen); + tAssert(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index b87e5d5503..b435a0a266 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -22,7 +22,7 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pReader, const int32_t* slotIds, void** pRes) { - ASSERT(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock)); + tAssert(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock)); int32_t numOfRows = pBlock->info.rows; if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) { @@ -66,7 +66,7 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea pBlock->info.rows += allNullRow ? 0 : 1; } else { - ASSERT(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); + tAssert(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index e0fe7183b9..ab9f405e00 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -152,7 +152,7 @@ _exit: int32_t tsdbPrepareCommit(STsdb *pTsdb) { taosThreadRwlockWrlock(&pTsdb->rwLock); - ASSERT(pTsdb->imem == NULL); + tAssert(pTsdb->imem == NULL); pTsdb->imem = pTsdb->mem; pTsdb->mem = NULL; taosThreadRwlockUnlock(&pTsdb->rwLock); @@ -387,7 +387,7 @@ static int32_t tsdbCommitterNextTableData(SCommitter *pCommitter) { int32_t code = 0; int32_t lino = 0; - ASSERT(pCommitter->dReader.pBlockIdx); + tAssert(pCommitter->dReader.pBlockIdx); pCommitter->dReader.iBlockIdx++; if (pCommitter->dReader.iBlockIdx < taosArrayGetSize(pCommitter->dReader.aBlockIdx)) { @@ -397,7 +397,7 @@ static int32_t tsdbCommitterNextTableData(SCommitter *pCommitter) { code = tsdbReadDataBlk(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock); TSDB_CHECK_CODE(code, lino, _exit); - ASSERT(pCommitter->dReader.mBlock.nItem > 0); + tAssert(pCommitter->dReader.mBlock.nItem > 0); } else { pCommitter->dReader.pBlockIdx = NULL; } @@ -441,7 +441,7 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) { pIter->r.row = *pRow; break; } - ASSERT(pIter->iTbDataP < taosArrayGetSize(pCommitter->aTbDataP)); + tAssert(pIter->iTbDataP < taosArrayGetSize(pCommitter->aTbDataP)); tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter); // disk @@ -506,7 +506,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { tsdbFidKeyRange(pCommitter->commitFid, pCommitter->minutes, pCommitter->precision, &pCommitter->minKey, &pCommitter->maxKey); #if 0 - ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey); + tAssert(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey); #endif pCommitter->nextKey = TSKEY_MAX; @@ -542,7 +542,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { SSttFile fStt = {.commitID = pCommitter->commitID}; SDFileSet wSet = {.fid = pCommitter->commitFid, .pHeadF = &fHead, .pDataF = &fData, .pSmaF = &fSma}; if (pRSet) { - ASSERT(pRSet->nSttF <= pCommitter->sttTrigger); + tAssert(pRSet->nSttF <= pCommitter->sttTrigger); fData = *pRSet->pDataF; fSma = *pRSet->pSmaF; wSet.diskId = pRSet->diskId; @@ -821,7 +821,7 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo int32_t lino = 0; memset(pCommitter, 0, sizeof(*pCommitter)); - ASSERT(pTsdb->imem && "last tsdb commit incomplete"); + tAssert(pTsdb->imem && "last tsdb commit incomplete"); pCommitter->pTsdb = pTsdb; pCommitter->commitID = pInfo->info.state.commitID; @@ -987,7 +987,7 @@ static int32_t tsdbCommitDel(SCommitter *pCommitter) { STbData *pTbData; SDelIdx *pDelIdx; - ASSERT(nTbData > 0); + tAssert(nTbData > 0); pTbData = (STbData *)taosArrayGetP(pCommitter->aTbDataP, iTbData); pDelIdx = (iDelIdx < nDelIdx) ? (SDelIdx *)taosArrayGet(pCommitter->aDelIdx, iDelIdx) : NULL; @@ -1148,7 +1148,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) { tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pCommitter->pIter); pCommitter->pIter = NULL; } else { - ASSERT(c); + tAssert(c); } } } @@ -1178,7 +1178,7 @@ static int32_t tsdbCommitAheadBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) tBlockDataClear(pBlockData); while (pRowInfo) { - ASSERT(pRowInfo->row.type == 0); + tAssert(pRowInfo->row.type == 0); code = tsdbCommitterUpdateRowSchema(pCommitter, id.suid, id.uid, TSDBROW_SVERSION(&pRowInfo->row)); TSDB_CHECK_CODE(code, lino, _exit); @@ -1246,7 +1246,7 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) pRow = NULL; } } else if (c > 0) { - ASSERT(pRowInfo->row.type == 0); + tAssert(pRowInfo->row.type == 0); code = tsdbCommitterUpdateRowSchema(pCommitter, id.suid, id.uid, TSDBROW_SVERSION(&pRowInfo->row)); TSDB_CHECK_CODE(code, lino, _exit); @@ -1266,7 +1266,7 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) } } } else { - ASSERT(0 && "dup rows not allowed"); + tAssert(0 && "dup rows not allowed"); } if (pBDataW->nRow >= pCommitter->maxRow) { @@ -1309,14 +1309,14 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, TABLEID id) { SBlockIdx *pBlockIdx = pCommitter->dReader.pBlockIdx; - ASSERT(pBlockIdx == NULL || tTABLEIDCmprFn(pBlockIdx, &id) >= 0); + tAssert(pBlockIdx == NULL || tTABLEIDCmprFn(pBlockIdx, &id) >= 0); if (pBlockIdx && pBlockIdx->suid == id.suid && pBlockIdx->uid == id.uid) { int32_t iBlock = 0; SDataBlk block; SDataBlk *pDataBlk = █ SRowInfo *pRowInfo = tsdbGetCommitRow(pCommitter); - ASSERT(pRowInfo->suid == id.suid && pRowInfo->uid == id.uid); + tAssert(pRowInfo->suid == id.suid && pRowInfo->uid == id.uid); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pDataBlk, tGetDataBlk); while (pDataBlk && pRowInfo) { @@ -1394,8 +1394,8 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id) } if (!pBuilder->suid && !pBuilder->uid) { - ASSERT(pCommitter->skmTable.suid == id.suid); - ASSERT(pCommitter->skmTable.uid == id.uid); + tAssert(pCommitter->skmTable.suid == id.suid); + tAssert(pCommitter->skmTable.uid == id.uid); code = tDiskDataBuilderInit(pBuilder, pCommitter->skmTable.pTSchema, &id, pCommitter->cmprAlg, 0); TSDB_CHECK_CODE(code, lino, _exit); } @@ -1411,8 +1411,8 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id) } if (!pBData->suid && !pBData->uid) { - ASSERT(pCommitter->skmTable.suid == id.suid); - ASSERT(pCommitter->skmTable.uid == id.uid); + tAssert(pCommitter->skmTable.suid == id.suid); + tAssert(pCommitter->skmTable.uid == id.uid); TABLEID tid = {.suid = id.suid, .uid = id.suid ? 0 : id.uid}; code = tBlockDataInit(pBData, &tid, pCommitter->skmTable.pTSchema, NULL, 0); TSDB_CHECK_CODE(code, lino, _exit); @@ -1527,7 +1527,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) { } } else { SBlockData *pBData = &pCommitter->dWriter.bData; - ASSERT(pBData->nRow == 0); + tAssert(pBData->nRow == 0); while (pRowInfo) { STSchema *pTSchema = NULL; @@ -1582,7 +1582,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) { SRowInfo *pRowInfo; TABLEID id = {0}; while ((pRowInfo = tsdbGetCommitRow(pCommitter)) != NULL) { - ASSERT(pRowInfo->suid != id.suid || pRowInfo->uid != id.uid); + tAssert(pRowInfo->suid != id.suid || pRowInfo->uid != id.uid); id.suid = pRowInfo->suid; id.uid = pRowInfo->uid; diff --git a/source/dnode/vnode/src/tsdb/tsdbDiskData.c b/source/dnode/vnode/src/tsdb/tsdbDiskData.c index b46a003638..091d14ccea 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDiskData.c +++ b/source/dnode/vnode/src/tsdb/tsdbDiskData.c @@ -92,7 +92,7 @@ static int32_t tDiskColBuilderInit(SDiskColBuilder *pBuilder, int16_t cid, int8_ static int32_t tGnrtDiskCol(SDiskColBuilder *pBuilder, SDiskCol *pDiskCol) { int32_t code = 0; - ASSERT(pBuilder->flag && pBuilder->flag != HAS_NONE); + tAssert(pBuilder->flag && pBuilder->flag != HAS_NONE); *pDiskCol = (SDiskCol){(SBlockCol){.cid = pBuilder->cid, .type = pBuilder->type, @@ -489,7 +489,7 @@ int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TAB uint8_t calcSma) { int32_t code = 0; - ASSERT(pId->suid || pId->uid); + tAssert(pId->suid || pId->uid); pBuilder->suid = pId->suid; pBuilder->uid = pId->uid; @@ -560,8 +560,8 @@ int32_t tDiskDataBuilderClear(SDiskDataBuilder *pBuilder) { int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, TABLEID *pId) { int32_t code = 0; - ASSERT(pBuilder->suid || pBuilder->uid); - ASSERT(pId->suid == pBuilder->suid); + tAssert(pBuilder->suid || pBuilder->uid); + tAssert(pId->suid == pBuilder->suid); TSDBKEY kRow = TSDBROW_KEY(pRow); if (tsdbKeyCmprFn(&pBuilder->bi.minTKey, &kRow) > 0) pBuilder->bi.minTKey = kRow; @@ -569,7 +569,7 @@ int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTS // uid if (pBuilder->uid && pBuilder->uid != pId->uid) { - ASSERT(pBuilder->suid); + tAssert(pBuilder->suid); for (int32_t iRow = 0; iRow < pBuilder->nRow; iRow++) { code = tCompress(pBuilder->pUidC, &pBuilder->uid, sizeof(int64_t)); if (code) return code; @@ -623,7 +623,7 @@ int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTS int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, const SDiskData **ppDiskData, const SBlkInfo **ppBlkInfo) { int32_t code = 0; - ASSERT(pBuilder->nRow); + tAssert(pBuilder->nRow); *ppDiskData = NULL; *ppBlkInfo = NULL; diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 72d9c4f69e..6379c6b648 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -82,7 +82,7 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) { } } - ASSERT(n + sizeof(TSCKSUM) == nData); + tAssert(n + sizeof(TSCKSUM) == nData); _exit: return code; @@ -512,7 +512,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe // stt if (sameDisk) { if (pSetNew->nSttF > pSetOld->nSttF) { - ASSERT(pSetNew->nSttF == pSetOld->nSttF + 1); + tAssert(pSetNew->nSttF == pSetOld->nSttF + 1); pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile)); if (pSetOld->aSttF[pSetOld->nSttF] == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -522,7 +522,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe pSetOld->aSttF[pSetOld->nSttF]->nRef = 1; pSetOld->nSttF++; } else if (pSetNew->nSttF < pSetOld->nSttF) { - ASSERT(pSetNew->nSttF == 1); + tAssert(pSetNew->nSttF == 1); for (int32_t iStt = 0; iStt < pSetOld->nSttF; iStt++) { SSttFile *pSttFile = pSetOld->aSttF[iStt]; nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1); @@ -561,8 +561,8 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe *pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt]; pSetOld->aSttF[iStt]->nRef = 1; } else { - ASSERT(pSetOld->aSttF[iStt]->size == pSetOld->aSttF[iStt]->size); - ASSERT(pSetOld->aSttF[iStt]->offset == pSetOld->aSttF[iStt]->offset); + tAssert(pSetOld->aSttF[iStt]->size == pSetOld->aSttF[iStt]->size); + tAssert(pSetOld->aSttF[iStt]->offset == pSetOld->aSttF[iStt]->offset); } } } @@ -634,7 +634,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) { } } } else { - ASSERT(pTsdb->fs.pDelFile == NULL); + tAssert(pTsdb->fs.pDelFile == NULL); } // aDFileSet @@ -783,7 +783,7 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) { code = tsdbSaveFSToFile(&pTsdb->fs, current); TSDB_CHECK_CODE(code, lino, _exit); - ASSERT(!rollback); + tAssert(!rollback); } // scan and fix FS @@ -801,7 +801,7 @@ int32_t tsdbFSClose(STsdb *pTsdb) { int32_t code = 0; if (pTsdb->fs.pDelFile) { - ASSERT(pTsdb->fs.pDelFile->nRef == 1); + tAssert(pTsdb->fs.pDelFile->nRef == 1); taosMemoryFree(pTsdb->fs.pDelFile); } @@ -809,20 +809,20 @@ int32_t tsdbFSClose(STsdb *pTsdb) { SDFileSet *pSet = (SDFileSet *)taosArrayGet(pTsdb->fs.aDFileSet, iSet); // head - ASSERT(pSet->pHeadF->nRef == 1); + tAssert(pSet->pHeadF->nRef == 1); taosMemoryFree(pSet->pHeadF); // data - ASSERT(pSet->pDataF->nRef == 1); + tAssert(pSet->pDataF->nRef == 1); taosMemoryFree(pSet->pDataF); // sma - ASSERT(pSet->pSmaF->nRef == 1); + tAssert(pSet->pSmaF->nRef == 1); taosMemoryFree(pSet->pSmaF); // stt for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { - ASSERT(pSet->aSttF[iStt]->nRef == 1); + tAssert(pSet->aSttF[iStt]->nRef == 1); taosMemoryFree(pSet->aSttF[iStt]); } } @@ -939,7 +939,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { *pDFileSet->pSmaF = *pSet->pSmaF; // stt if (pSet->nSttF > pDFileSet->nSttF) { - ASSERT(pSet->nSttF == pDFileSet->nSttF + 1); + tAssert(pSet->nSttF == pDFileSet->nSttF + 1); pDFileSet->aSttF[pDFileSet->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile)); if (pDFileSet->aSttF[pDFileSet->nSttF] == NULL) { @@ -949,7 +949,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { *pDFileSet->aSttF[pDFileSet->nSttF] = *pSet->aSttF[pSet->nSttF - 1]; pDFileSet->nSttF++; } else if (pSet->nSttF < pDFileSet->nSttF) { - ASSERT(pSet->nSttF == 1); + tAssert(pSet->nSttF == 1); for (int32_t iStt = 1; iStt < pDFileSet->nSttF; iStt++) { taosMemoryFree(pDFileSet->aSttF[iStt]); } @@ -966,7 +966,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { } } - ASSERT(pSet->nSttF == 1); + tAssert(pSet->nSttF == 1); SDFileSet fSet = {.diskId = pSet->diskId, .fid = pSet->fid, .nSttF = 1}; // head @@ -1041,7 +1041,7 @@ int32_t tsdbFSRef(STsdb *pTsdb, STsdbFS *pFS) { pFS->pDelFile = pTsdb->fs.pDelFile; if (pFS->pDelFile) { nRef = atomic_fetch_add_32(&pFS->pDelFile->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); } SDFileSet fSet; @@ -1050,17 +1050,17 @@ int32_t tsdbFSRef(STsdb *pTsdb, STsdbFS *pFS) { fSet = *pSet; nRef = atomic_fetch_add_32(&pSet->pHeadF->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); nRef = atomic_fetch_add_32(&pSet->pDataF->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); nRef = atomic_fetch_add_32(&pSet->pSmaF->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { nRef = atomic_fetch_add_32(&pSet->aSttF[iStt]->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); } if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) { @@ -1079,7 +1079,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { if (pFS->pDelFile) { nRef = atomic_sub_fetch_32(&pFS->pDelFile->nRef, 1); - ASSERT(nRef >= 0); + tAssert(nRef >= 0); if (nRef == 0) { tsdbDelFileName(pTsdb, pFS->pDelFile, fname); (void)taosRemoveFile(fname); @@ -1092,7 +1092,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // head nRef = atomic_sub_fetch_32(&pSet->pHeadF->nRef, 1); - ASSERT(nRef >= 0); + tAssert(nRef >= 0); if (nRef == 0) { tsdbHeadFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pHeadF, fname); (void)taosRemoveFile(fname); @@ -1101,7 +1101,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // data nRef = atomic_sub_fetch_32(&pSet->pDataF->nRef, 1); - ASSERT(nRef >= 0); + tAssert(nRef >= 0); if (nRef == 0) { tsdbDataFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pDataF, fname); (void)taosRemoveFile(fname); @@ -1110,7 +1110,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // sma nRef = atomic_sub_fetch_32(&pSet->pSmaF->nRef, 1); - ASSERT(nRef >= 0); + tAssert(nRef >= 0); if (nRef == 0) { tsdbSmaFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pSmaF, fname); (void)taosRemoveFile(fname); @@ -1120,7 +1120,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // stt for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { nRef = atomic_sub_fetch_32(&pSet->aSttF[iStt]->nRef, 1); - ASSERT(nRef >= 0); + tAssert(nRef >= 0); if (nRef == 0) { tsdbSttFileName(pTsdb, pSet->diskId, pSet->fid, pSet->aSttF[iStt], fname); (void)taosRemoveFile(fname); diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 0a7f59e429..371ec2fecd 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -168,7 +168,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid goto _err; } - ASSERT(pPool != NULL); + tAssert(pPool != NULL); // do delete SDelData *pDelData = (SDelData *)vnodeBufPoolMalloc(pPool, sizeof(*pDelData)); if (pDelData == NULL) { @@ -180,7 +180,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid pDelData->eKey = eKey; pDelData->pNext = NULL; if (pTbData->pHead == NULL) { - ASSERT(pTbData->pTail == NULL); + tAssert(pTbData->pTail == NULL); pTbData->pHead = pTbData->pTail = pDelData; } else { pTbData->pTail->pNext = pDelData; @@ -265,7 +265,7 @@ void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDa bool tsdbTbDataIterNext(STbDataIter *pIter) { pIter->pRow = NULL; if (pIter->backward) { - ASSERT(pIter->pNode != pIter->pTbData->sl.pTail); + tAssert(pIter->pNode != pIter->pTbData->sl.pTail); if (pIter->pNode == pIter->pTbData->sl.pHead) { return false; @@ -276,7 +276,7 @@ bool tsdbTbDataIterNext(STbDataIter *pIter) { return false; } } else { - ASSERT(pIter->pNode != pIter->pTbData->sl.pHead); + tAssert(pIter->pNode != pIter->pTbData->sl.pHead); if (pIter->pNode == pIter->pTbData->sl.pTail) { return false; @@ -334,7 +334,7 @@ static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid SVBufPool *pPool = pMemTable->pTsdb->pVnode->inUse; int8_t maxLevel = pMemTable->pTsdb->pVnode->config.tsdbCfg.slLevel; - ASSERT(pPool != NULL); + tAssert(pPool != NULL); pTbData = vnodeBufPoolMalloc(pPool, sizeof(*pTbData) + SL_NODE_SIZE(maxLevel) * 2); if (pTbData == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -477,7 +477,7 @@ static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListN // node level = tsdbMemSkipListRandLevel(&pTbData->sl); - ASSERT(pPool != NULL); + tAssert(pPool != NULL); pNode = (SMemSkipListNode *)vnodeBufPoolMalloc(pPool, SL_NODE_SIZE(level)); if (pNode == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -620,7 +620,7 @@ int32_t tsdbGetNRowsInTbData(STbData *pTbData) { return pTbData->sl.size; } void tsdbRefMemTable(SMemTable *pMemTable) { int32_t nRef = atomic_fetch_add_32(&pMemTable->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); } void tsdbUnrefMemTable(SMemTable *pMemTable) { diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 01fbcf657f..80500f7c68 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -561,7 +561,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead pMTree->pLoadInfo = pBlockLoadInfo; pMTree->destroyLoadInfo = destroyLoadInfo; - ASSERT(pMTree->pLoadInfo != NULL); + tAssert(pMTree->pLoadInfo != NULL); for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file struct SLDataIter *pIter = NULL; @@ -607,7 +607,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) { tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter); pMTree->pIter = NULL; } else { - ASSERT(c); + tAssert(c); } } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index d768eed09e..42e39c7fa2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -396,7 +396,7 @@ static void destroyAllBlockScanInfo(SHashObj* pTableMap) { } static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) { - ASSERT(pWindow != NULL); + tAssert(pWindow != NULL); return pWindow->skey > pWindow->ekey; } @@ -595,7 +595,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->type = pCond->type; pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows); pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket - ASSERT(pCond->numOfCols > 0); + tAssert(pCond->numOfCols > 0); if (pReader->pResBlock == NULL) { pReader->freeBlock = true; @@ -782,7 +782,7 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ colDataAppendNULL(pColInfoData, rowIndex); } else { varDataSetLen(pSup->buildBuf[colIndex], pColVal->value.nData); - ASSERT(pColVal->value.nData <= pColInfoData->info.bytes); + tAssert(pColVal->value.nData <= pColInfoData->info.bytes); if (pColVal->value.nData > 0) { // pData may be null, if nData is 0 memcpy(varDataVal(pSup->buildBuf[colIndex]), pColVal->value.pData, pColVal->value.nData); } @@ -796,7 +796,7 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { if (taosArrayGetSize(pBlockIter->blockList) == 0) { - ASSERT(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); + tAssert(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); return NULL; } @@ -810,7 +810,7 @@ int32_t binarySearchForTs(char* pValue, int num, TSKEY key, int order) { int32_t midPos = -1; int32_t numOfRows; - ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); + tAssert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); TSKEY* keyList = (TSKEY*)pValue; int32_t firstPos = 0; @@ -974,7 +974,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t step = asc? 1:-1; // make sure it is aligned to 8bit - ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); + tAssert((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); // 1. copy data in a batch model memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); @@ -1183,7 +1183,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - ASSERT(pBlockInfo != NULL); + tAssert(pBlockInfo != NULL); SDataBlk* pBlock = getCurrentBlock(pBlockIter); code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData); @@ -1221,7 +1221,7 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) { } static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) { - ASSERT(numOfTables >= 1); + tAssert(numOfTables >= 1); pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); @@ -1329,7 +1329,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte sup.numOfTables += 1; } - ASSERT(numOfBlocks == cnt); + tAssert(numOfBlocks == cnt); // since there is only one table qualified, blocks are not sorted if (sup.numOfTables == 1) { @@ -1351,7 +1351,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %s", pReader, cnt, sup.numOfTables, pReader->idStr); - ASSERT(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); + tAssert(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); SMultiwayMergeTreeInfo* pTree = NULL; uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); @@ -1432,7 +1432,7 @@ static bool getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBl } static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pFBlockInfo) { - ASSERT(pBlockIter != NULL && pFBlockInfo != NULL); + tAssert(pBlockIter != NULL && pFBlockInfo != NULL); int32_t step = ASCENDING_TRAVERSE(pBlockIter->order) ? 1 : -1; int32_t index = pBlockIter->index; @@ -1463,7 +1463,7 @@ static int32_t setFileBlockActiveInBlockIter(SDataBlockIter* pBlockIter, int32_t taosArrayInsert(pBlockIter->blockList, pBlockIter->index, &fblock); SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index); - ASSERT(pBlockInfo->uid == fblock.uid && pBlockInfo->tbBlockIdx == fblock.tbBlockIdx); + tAssert(pBlockInfo->uid == fblock.uid && pBlockInfo->tbBlockIdx == fblock.tbBlockIdx); } doSetCurrentBlock(pBlockIter, ""); @@ -1510,7 +1510,7 @@ static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, cons return true; } } else { // it must be the last point - ASSERT(p->version == 0); + tAssert(p->version == 0); } } } else { // (p->ts > pBlock->maxKey.ts) { @@ -1925,7 +1925,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, } doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); - ASSERT(mergeBlockData); + tAssert(mergeBlockData); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -1959,7 +1959,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader // row in last file block TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); int64_t ts = getCurrentKeyInLastBlock(pLastBlockReader); - ASSERT(ts >= key); + tAssert(ts >= key); if (ASCENDING_TRAVERSE(pReader->order)) { if (key < ts) { // imem, mem are all empty, file blocks (data blocks and last block) exist @@ -2012,7 +2012,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - ASSERT(pRow != NULL && piRow != NULL); + tAssert(pRow != NULL && piRow != NULL); int64_t tsLast = INT64_MIN; if (hasDataInLastBlock(pLastBlockReader)) { @@ -2236,7 +2236,7 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea if (pReader->pReadSnap->pMem != NULL) { d = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pMem, pReader->suid, pBlockScanInfo->uid); if (d != NULL) { - ASSERT(pBlockScanInfo->iter.iter == NULL); + tAssert(pBlockScanInfo->iter.iter == NULL); code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL); @@ -2351,7 +2351,7 @@ static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLas bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { if (pBlockData->nRow > 0) { - ASSERT(pBlockData->nRow == pDumpInfo->totalRows); + tAssert(pBlockData->nRow == pDumpInfo->totalRows); } return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); @@ -2566,7 +2566,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* int32_t code = 0; SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); - ASSERT(pReader->pReadSnap != NULL); + tAssert(pReader->pReadSnap != NULL); SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile; if (pDelFile && taosArrayGetSize(pReader->pDelIdx) > 0) { @@ -2773,7 +2773,7 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus uint64_t uid = pOrderedCheckInfo->tableUidList[pOrderedCheckInfo->currentIndex]; pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid)); - ASSERT(pStatus->pTableIter != NULL); + tAssert(pStatus->pTableIter != NULL); return true; } @@ -2847,7 +2847,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); if (pBlockInfo == NULL) { // build data block from last data file - ASSERT(pBlockIter->numOfBlocks == 0); + tAssert(pBlockIter->numOfBlocks == 0); code = buildComposedDataBlock(pReader); } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid); @@ -2866,7 +2866,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { if (hasDataInLastBlock(pLastBlockReader) && !ASCENDING_TRAVERSE(pReader->order)) { // only return the rows in last block int64_t tsLast = getCurrentKeyInLastBlock(pLastBlockReader); - ASSERT(tsLast >= pBlock->maxKey.ts); + tAssert(tsLast >= pBlock->maxKey.ts); tBlockDataReset(&pReader->status.fileBlockData); tsdbDebug("load data in last block firstly, due to desc scan data, %s", pReader->idStr); @@ -3112,7 +3112,7 @@ SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_ } bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order, SVersionRange* pVerRange) { - ASSERT(pKey != NULL); + tAssert(pKey != NULL); if (pDelList == NULL) { return false; } @@ -3123,7 +3123,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 if (asc) { if (*index >= num - 1) { TSDBKEY* last = taosArrayGetLast(pDelList); - ASSERT(pKey->ts >= last->ts); + tAssert(pKey->ts >= last->ts); if (pKey->ts > last->ts) { return false; @@ -3700,13 +3700,13 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e } } while (1); - ASSERT(pBlock->info.rows <= capacity); + tAssert(pBlock->info.rows <= capacity); return TSDB_CODE_SUCCESS; } // TODO refactor: with createDataBlockScanInfo int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t num) { - ASSERT(pReader != NULL); + tAssert(pReader != NULL); int32_t size = taosHashGetSize(pReader->status.pTableMap); STableBlockScanInfo** p = NULL; @@ -3715,7 +3715,7 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n } // todo handle the case where size is less than the value of num - ASSERT(size >= num); + tAssert(size >= num); taosHashClear(pReader->status.pTableMap); @@ -4067,7 +4067,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { } static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) { - ASSERT(pReader != NULL); + tAssert(pReader != NULL); *rows = pReader->pResBlock->info.rows; *uid = pReader->pResBlock->info.id.uid; *pWindow = pReader->pResBlock->info.window; @@ -4130,7 +4130,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockS SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter); SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - ASSERT(pReader->pResBlock->info.id.uid == pFBlock->uid); + tAssert(pReader->pResBlock->info.id.uid == pFBlock->uid); SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); if (tDataBlkHasSma(pBlock)) { @@ -4180,7 +4180,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockS } else if (pAgg->colId < pSup->colId[j]) { i += 1; } else if (pSup->colId[j] < pAgg->colId) { - ASSERT(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); + tAssert(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg; j += 1; } @@ -4412,7 +4412,7 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6 } sversion = mr.me.stbEntry.schemaRow.version; } else { - ASSERT(mr.me.type == TSDB_NORMAL_TABLE); + tAssert(mr.me.type == TSDB_NORMAL_TABLE); sversion = mr.me.ntbEntry.schemaRow.version; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index c7bce6182a..3390f6abae 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -54,7 +54,7 @@ static int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsd taosMemoryFree(pFD); goto _exit; } - ASSERT(pFD->szFile % szPage == 0); + tAssert(pFD->szFile % szPage == 0); pFD->szFile = pFD->szFile / szPage; *ppFD = pFD; @@ -103,7 +103,7 @@ _exit: static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { int32_t code = 0; - ASSERT(pgno <= pFD->szFile); + tAssert(pgno <= pFD->szFile); // seek int64_t offset = PAGE_OFFSET(pgno, pFD->szPage); @@ -175,8 +175,8 @@ static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage); int64_t bOffset = fOffset % pFD->szPage; - ASSERT(pgno && pgno <= pFD->szFile); - ASSERT(bOffset < szPgCont); + tAssert(pgno && pgno <= pFD->szFile); + tAssert(bOffset < szPgCont); while (n < size) { if (pFD->pgno != pgno) { @@ -284,7 +284,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS } // stt - ASSERT(pWriter->fStt[pSet->nSttF - 1].size == 0); + tAssert(pWriter->fStt[pSet->nSttF - 1].size == 0); flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC; tsdbSttFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fStt[pSet->nSttF - 1], fname); code = tsdbOpenFile(fname, szPage, flag, &pWriter->pSttFD); @@ -404,7 +404,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx) { for (int32_t iBlockIdx = 0; iBlockIdx < taosArrayGetSize(aBlockIdx); iBlockIdx++) { n += tPutBlockIdx(pWriter->aBuf[0] + n, taosArrayGet(aBlockIdx, iBlockIdx)); } - ASSERT(n == size); + tAssert(n == size); // write code = tsdbWriteFile(pWriter->pHeadFD, pHeadFile->size, pWriter->aBuf[0], size); @@ -431,7 +431,7 @@ int32_t tsdbWriteDataBlk(SDataFWriter *pWriter, SMapData *mDataBlk, SBlockIdx *p int64_t size; int64_t n; - ASSERT(mDataBlk->nItem > 0); + tAssert(mDataBlk->nItem > 0); // alloc size = tPutMapData(NULL, mDataBlk); @@ -547,7 +547,7 @@ int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, SBlock int8_t cmprAlg, int8_t toLast) { int32_t code = 0; - ASSERT(pBlockData->nRow > 0); + tAssert(pBlockData->nRow > 0); if (toLast) { pBlkInfo->offset = pWriter->fStt[pWriter->wSet.nSttF - 1].size; @@ -666,7 +666,7 @@ int32_t tsdbWriteDiskData(SDataFWriter *pWriter, const SDiskData *pDiskData, SBl SDiskCol *pDiskCol = (SDiskCol *)taosArrayGet(pDiskData->aDiskCol, iDiskCol); n += tPutBlockCol(pWriter->aBuf[0] + n, pDiskCol); } - ASSERT(n == pDiskData->hdr.szBlkCol); + tAssert(n == pDiskData->hdr.szBlkCol); code = tsdbWriteFile(pFD, pBlkInfo->offset + pBlkInfo->szBlock, pWriter->aBuf[0], pDiskData->hdr.szBlkCol); TSDB_CHECK_CODE(code, lino, _exit); @@ -953,7 +953,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) { goto _err; } } - ASSERT(n == size); + tAssert(n == size); return code; @@ -990,7 +990,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) { goto _err; } } - ASSERT(n == size); + tAssert(n == size); return code; @@ -1018,7 +1018,7 @@ int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *m code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - ASSERT(n == size); + tAssert(n == size); return code; @@ -1031,7 +1031,7 @@ int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pDataBlk, SArray *aCol int32_t code = 0; SSmaInfo *pSmaInfo = &pDataBlk->smaInfo; - ASSERT(pSmaInfo->size > 0); + tAssert(pSmaInfo->size > 0); taosArrayClear(aColumnDataAgg); @@ -1054,7 +1054,7 @@ int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pDataBlk, SArray *aCol goto _err; } } - ASSERT(n == pSmaInfo->size); + tAssert(n == pSmaInfo->size); return code; _err: @@ -1080,20 +1080,20 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo SDiskDataHdr hdr; uint8_t *p = pReader->aBuf[0] + tGetDiskDataHdr(pReader->aBuf[0], &hdr); - ASSERT(hdr.delimiter == TSDB_FILE_DLMT); - ASSERT(pBlockData->suid == hdr.suid); + tAssert(hdr.delimiter == TSDB_FILE_DLMT); + tAssert(pBlockData->suid == hdr.suid); pBlockData->uid = hdr.uid; pBlockData->nRow = hdr.nRow; // uid if (hdr.uid == 0) { - ASSERT(hdr.szUid); + tAssert(hdr.szUid); code = tsdbDecmprData(p, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid, sizeof(int64_t) * hdr.nRow, &pReader->aBuf[1]); if (code) goto _err; } else { - ASSERT(!hdr.szUid); + tAssert(!hdr.szUid); } p += hdr.szUid; @@ -1109,7 +1109,7 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (code) goto _err; p += hdr.szKey; - ASSERT(p - pReader->aBuf[0] == pBlkInfo->szKey); + tAssert(p - pReader->aBuf[0] == pBlkInfo->szKey); // read and decode columns if (pBlockData->nColData == 0) goto _exit; @@ -1135,7 +1135,7 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (n < hdr.szBlkCol) { n += tGetBlockCol(pReader->aBuf[0] + n, pBlockCol); } else { - ASSERT(n == hdr.szBlkCol); + tAssert(n == hdr.szBlkCol); pBlockCol = NULL; } } @@ -1147,8 +1147,8 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (code) goto _err; } } else { - ASSERT(pBlockCol->type == pColData->type); - ASSERT(pBlockCol->flag && pBlockCol->flag != HAS_NONE); + tAssert(pBlockCol->type == pColData->type); + tAssert(pBlockCol->flag && pBlockCol->flag != HAS_NONE); if (pBlockCol->flag == HAS_NULL) { // add a lot of NULL @@ -1210,7 +1210,7 @@ int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData code = tsdbReadBlockDataImpl(pReader, &pDataBlk->aSubBlock[0], pBlockData, -1); if (code) goto _err; - ASSERT(pDataBlk->nSubBlock == 1); + tAssert(pDataBlk->nSubBlock == 1); return code; @@ -1349,7 +1349,7 @@ int32_t tsdbWriteDelData(SDelFWriter *pWriter, SArray *aDelData, SDelIdx *pDelId for (int32_t iDelData = 0; iDelData < taosArrayGetSize(aDelData); iDelData++) { n += tPutDelData(pWriter->aBuf[0] + n, taosArrayGet(aDelData, iDelData)); } - ASSERT(n == size); + tAssert(n == size); // write code = tsdbWriteFile(pWriter->pWriteH, pWriter->fDel.size, pWriter->aBuf[0], size); @@ -1388,7 +1388,7 @@ int32_t tsdbWriteDelIdx(SDelFWriter *pWriter, SArray *aDelIdx) { for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) { n += tPutDelIdx(pWriter->aBuf[0] + n, taosArrayGet(aDelIdx, iDelIdx)); } - ASSERT(n == size); + tAssert(n == size); // write code = tsdbWriteFile(pWriter->pWriteH, pWriter->fDel.size, pWriter->aBuf[0], size); @@ -1509,7 +1509,7 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData goto _err; } } - ASSERT(n == size); + tAssert(n == size); return code; @@ -1547,7 +1547,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) { } } - ASSERT(n == size); + tAssert(n == size); return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index d274551601..99b2bc06ab 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -110,8 +110,8 @@ static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) { code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData); if (code) goto _err; - ASSERT(pIter->pBlockIdx->suid == pIter->bData.suid); - ASSERT(pIter->pBlockIdx->uid == pIter->bData.uid); + tAssert(pIter->pBlockIdx->suid == pIter->bData.suid); + tAssert(pIter->pBlockIdx->uid == pIter->bData.uid); for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) { int64_t rowVer = pIter->bData.aVersion[pIter->iRow]; @@ -251,7 +251,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { tRBTreePut(&pReader->rbt, (SRBTreeNode*)pReader->pIter); pReader->pIter = NULL; } else { - ASSERT(c); + tAssert(c); } } } @@ -272,7 +272,7 @@ _err: static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; - ASSERT(pReader->bData.nRow); + tAssert(pReader->bData.nRow); int32_t aBufN[5] = {0}; code = tCmprBlockData(&pReader->bData, TWO_STAGE_COMP, NULL, NULL, pReader->aBuf, aBufN); @@ -674,7 +674,7 @@ extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, static int32_t tsdbSnapNextTableData(STsdbSnapWriter* pWriter) { int32_t code = 0; - ASSERT(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow); + tAssert(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow); if (pWriter->dReader.iBlockIdx < taosArrayGetSize(pWriter->dReader.aBlockIdx)) { pWriter->dReader.pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->dReader.aBlockIdx, pWriter->dReader.iBlockIdx); @@ -750,7 +750,7 @@ static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWriter) { int32_t c = 1; if (pWriter->dReader.pBlockIdx) { c = tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &pWriter->id); - ASSERT(c >= 0); + tAssert(c >= 0); } if (c == 0) { @@ -806,7 +806,7 @@ static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) { int32_t code = 0; STsdb* pTsdb = pWriter->pTsdb; - ASSERT(pWriter->dWriter.pWriter == NULL); + tAssert(pWriter->dWriter.pWriter == NULL); pWriter->fid = fid; pWriter->id = (TABLEID){0}; @@ -820,7 +820,7 @@ static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) { code = tsdbReadBlockIdx(pWriter->dReader.pReader, pWriter->dReader.aBlockIdx); if (code) goto _err; } else { - ASSERT(pWriter->dReader.pReader == NULL); + tAssert(pWriter->dReader.pReader == NULL); taosArrayClear(pWriter->dReader.aBlockIdx); } pWriter->dReader.iBlockIdx = 0; // point to the next one @@ -867,7 +867,7 @@ _err: static int32_t tsdbSnapWriteCloseFile(STsdbSnapWriter* pWriter) { int32_t code = 0; - ASSERT(pWriter->dWriter.pWriter); + tAssert(pWriter->dWriter.pWriter); code = tsdbSnapWriteTableDataEnd(pWriter); if (code) goto _err; @@ -925,7 +925,7 @@ static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, i TSDBROW trow = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow); TSDBKEY tKey = TSDBROW_KEY(&trow); - ASSERT(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid); + tAssert(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid); int32_t c = tsdbKeyCmprFn(&key, &tKey); if (c < 0) { @@ -1086,7 +1086,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 code = tDecmprBlockData(pHdr->data, pHdr->size, pBlockData, pWriter->aBuf); if (code) goto _err; - ASSERT(pBlockData->nRow > 0); + tAssert(pBlockData->nRow > 0); // Loop to handle each row for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) { @@ -1095,7 +1095,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 if (pWriter->dWriter.pWriter == NULL || pWriter->fid != fid) { if (pWriter->dWriter.pWriter) { - ASSERT(fid > pWriter->fid); + tAssert(fid > pWriter->fid); code = tsdbSnapWriteCloseFile(pWriter); if (code) goto _err; @@ -1177,7 +1177,7 @@ static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32 SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; TABLEID id = *(TABLEID*)pHdr->data; - ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData); + tAssert(pHdr->size + sizeof(SSnapDataHdr) == nData); // Move write data < id code = tsdbSnapMoveWriteDelData(pWriter, &id); diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 03107e725e..12ce42242b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -97,7 +97,7 @@ _exit: } void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) { - ASSERT(idx >= 0 && idx < pMapData->nItem); + tAssert(idx >= 0 && idx < pMapData->nItem); tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem); } @@ -379,7 +379,7 @@ int32_t tPutBlockCol(uint8_t *p, void *ph) { int32_t n = 0; SBlockCol *pBlockCol = (SBlockCol *)ph; - ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); + tAssert(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); n += tPutI16v(p ? p + n : p, pBlockCol->cid); n += tPutI8(p ? p + n : p, pBlockCol->type); @@ -417,7 +417,7 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) { n += tGetI8(p + n, &pBlockCol->flag); n += tGetI32v(p + n, &pBlockCol->szOrigin); - ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); + tAssert(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); pBlockCol->szBitmap = 0; pBlockCol->szOffset = 0; @@ -570,7 +570,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * STColumn *pTColumn = &pTSchema->columns[iCol]; SValue value; - ASSERT(iCol > 0); + tAssert(iCol > 0); if (pRow->type == 0) { tTSRowGetVal(pRow->pTSRow, pTSchema, iCol, pColVal); @@ -607,7 +607,7 @@ int32_t tsdbRowCmprFn(const void *p1, const void *p2) { void tsdbRowIterInit(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema) { pIter->pRow = pRow; if (pRow->type == 0) { - ASSERT(pTSchema); + tAssert(pTSchema); pIter->pTSchema = pTSchema; pIter->i = 1; } else if (pRow->type == 1) { @@ -661,7 +661,7 @@ int32_t tRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRo // ts pTColumn = &pTSchema->columns[jCol++]; - ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = key.ts}); if (taosArrayPush(pMerger->pArray, pColVal) == NULL) { @@ -704,7 +704,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { STColumn *pTColumn; int32_t iCol, jCol = 1; - ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); + tAssert(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); for (iCol = 1; iCol < pMerger->pTSchema->numOfCols && jCol < pTSchema->numOfCols; ++iCol) { pTColumn = &pMerger->pTSchema->columns[iCol]; @@ -728,7 +728,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { - ASSERT(0 && "dup versions not allowed"); + tAssert(0 && "dup versions not allowed"); } } @@ -754,7 +754,7 @@ int32_t tRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { // ts pTColumn = &pTSchema->columns[0]; - ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = key.ts}); if (taosArrayPush(pMerger->pArray, pColVal) == NULL) { @@ -782,7 +782,7 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) { TSDBKEY key = TSDBROW_KEY(pRow); SColVal *pColVal = &(SColVal){0}; - ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); + tAssert(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); for (int32_t iCol = 1; iCol < pMerger->pTSchema->numOfCols; iCol++) { tsdbRowGetColVal(pRow, pMerger->pTSchema, iCol, pColVal); @@ -828,7 +828,7 @@ static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aS int64_t version1 = 0; int64_t version2 = 0; - ASSERT(n1 > 0 && n2 > 0); + tAssert(n1 > 0 && n2 > 0); taosArrayClear(aSkyline); @@ -955,7 +955,7 @@ void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear) { int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid) { int32_t code = 0; - ASSERT(pId->suid || pId->uid); + tAssert(pId->suid || pId->uid); pBlockData->suid = pId->suid; pBlockData->uid = pId->uid; @@ -1007,7 +1007,7 @@ void tBlockDataReset(SBlockData *pBlockData) { } void tBlockDataClear(SBlockData *pBlockData) { - ASSERT(pBlockData->suid || pBlockData->uid); + tAssert(pBlockData->suid || pBlockData->uid); pBlockData->nRow = 0; for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { @@ -1095,7 +1095,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NONE(pColData->cid, pColData->type)); if (code) goto _exit; } else { - ASSERT(pTColumn->type == pColData->type); + tAssert(pTColumn->type == pColData->type); SColVal cv = {.cid = pTColumn->colId, .type = pTColumn->type}; @@ -1171,7 +1171,7 @@ static int32_t tBlockDataAppendKVRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NONE(pColData->cid, pColData->type)); if (code) goto _exit; } else { - ASSERT(pTColumn->type == pColData->type); + tAssert(pTColumn->type == pColData->type); SColVal cv = {.cid = pTColumn->colId, .type = pTColumn->type}; TDRowValT vt = TD_VTYPE_NONE; // default is NONE @@ -1226,11 +1226,11 @@ _exit: int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) { int32_t code = 0; - ASSERT(pBlockData->suid || pBlockData->uid); + tAssert(pBlockData->suid || pBlockData->uid); // uid if (pBlockData->uid == 0) { - ASSERT(uid); + tAssert(uid); code = tRealloc((uint8_t **)&pBlockData->aUid, sizeof(int64_t) * (pBlockData->nRow + 1)); if (code) goto _err; pBlockData->aUid[pBlockData->nRow] = uid; @@ -1310,10 +1310,10 @@ _exit: int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlockData *pBlockData) { int32_t code = 0; - ASSERT(pBlockData->suid == pBlockData1->suid); - ASSERT(pBlockData->uid == pBlockData1->uid); - ASSERT(pBlockData1->nRow > 0); - ASSERT(pBlockData2->nRow > 0); + tAssert(pBlockData->suid == pBlockData1->suid); + tAssert(pBlockData->uid == pBlockData1->uid); + tAssert(pBlockData1->nRow > 0); + tAssert(pBlockData2->nRow > 0); tBlockDataClear(pBlockData); @@ -1383,12 +1383,12 @@ _exit: } SColData *tBlockDataGetColDataByIdx(SBlockData *pBlockData, int32_t idx) { - ASSERT(idx >= 0 && idx < pBlockData->nColData); + tAssert(idx >= 0 && idx < pBlockData->nColData); return (SColData *)taosArrayGet(pBlockData->aColData, idx); } void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData) { - ASSERT(cid != PRIMARYKEY_TIMESTAMP_COL_ID); + tAssert(cid != PRIMARYKEY_TIMESTAMP_COL_ID); int32_t lidx = 0; int32_t ridx = pBlockData->nColData - 1; @@ -1427,7 +1427,7 @@ int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData); - ASSERT(pColData->flag); + tAssert(pColData->flag); if (pColData->flag == HAS_NONE) continue; @@ -1508,7 +1508,7 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin // SDiskDataHdr n += tGetDiskDataHdr(pIn + n, &hdr); - ASSERT(hdr.delimiter == TSDB_FILE_DLMT); + tAssert(hdr.delimiter == TSDB_FILE_DLMT); pBlockData->suid = hdr.suid; pBlockData->uid = hdr.uid; @@ -1516,12 +1516,12 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin // uid if (hdr.uid == 0) { - ASSERT(hdr.szUid); + tAssert(hdr.szUid); code = tsdbDecmprData(pIn + n, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid, sizeof(int64_t) * hdr.nRow, &aBuf[0]); if (code) goto _exit; } else { - ASSERT(!hdr.szUid); + tAssert(!hdr.szUid); } n += hdr.szUid; @@ -1544,7 +1544,7 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin while (nt < hdr.szBlkCol) { SBlockCol blockCol = {0}; nt += tGetBlockCol(pIn + n + nt, &blockCol); - ASSERT(nt <= hdr.szBlkCol); + tAssert(nt <= hdr.szBlkCol); SColData *pColData; code = tBlockDataAddColData(pBlockData, &pColData); @@ -1632,7 +1632,7 @@ int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, ui int32_t *szOut, uint8_t **ppBuf) { int32_t code = 0; - ASSERT(szIn > 0 && ppOut); + tAssert(szIn > 0 && ppOut); if (cmprAlg == NO_COMPRESSION) { code = tRealloc(ppOut, nOut + szIn); @@ -1647,7 +1647,7 @@ int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, ui if (code) goto _exit; if (cmprAlg == TWO_STAGE_COMP) { - ASSERT(ppBuf); + tAssert(ppBuf); code = tRealloc(ppBuf, size); if (code) goto _exit; } @@ -1672,7 +1672,7 @@ int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, if (code) goto _exit; if (cmprAlg == NO_COMPRESSION) { - ASSERT(szIn == szOut); + tAssert(szIn == szOut); memcpy(*ppOut, pIn, szOut); } else { if (cmprAlg == TWO_STAGE_COMP) { @@ -1687,7 +1687,7 @@ int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, goto _exit; } - ASSERT(size == szOut); + tAssert(size == szOut); } _exit: @@ -1698,7 +1698,7 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol uint8_t **ppBuf) { int32_t code = 0; - ASSERT(pColData->flag && (pColData->flag != HAS_NONE) && (pColData->flag != HAS_NULL)); + tAssert(pColData->flag && (pColData->flag != HAS_NONE) && (pColData->flag != HAS_NULL)); pBlockCol->szBitmap = 0; pBlockCol->szOffset = 0; @@ -1744,8 +1744,8 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in uint8_t **ppBuf) { int32_t code = 0; - ASSERT(pColData->cid == pBlockCol->cid); - ASSERT(pColData->type == pBlockCol->type); + tAssert(pColData->cid == pBlockCol->cid); + tAssert(pColData->type == pBlockCol->type); pColData->smaOn = pBlockCol->smaOn; pColData->flag = pBlockCol->flag; pColData->nVal = nVal; diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c index 49d5eaac43..dbc36369f2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbWrite.c +++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c @@ -32,7 +32,7 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp * int32_t affectedrows = 0; int32_t numOfRows = 0; - ASSERT(pTsdb->mem != NULL); + tAssert(pTsdb->mem != NULL); // scan and convert if (tsdbScanAndConvertSubmitMsg(pTsdb, pMsg) < 0) { @@ -97,7 +97,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, tb_uid_t uid, STSRow *ro } int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); // STsdbMeta * pMeta = pTsdb->tsdbMeta; SSubmitMsgIter msgIter = {0}; SSubmitBlk *pBlock = NULL; diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c index dcc323f778..e26f56cded 100644 --- a/source/dnode/vnode/src/vnd/vnodeBufPool.c +++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c @@ -72,7 +72,7 @@ int vnodeOpenBufPool(SVnode *pVnode) { SVBufPool *pPool = NULL; int64_t size = pVnode->config.szBuf / VNODE_BUFPOOL_SEGMENTS; - ASSERT(pVnode->pPool == NULL); + tAssert(pVnode->pPool == NULL); for (int i = 0; i < 3; i++) { // create pool @@ -110,14 +110,14 @@ int vnodeCloseBufPool(SVnode *pVnode) { void vnodeBufPoolReset(SVBufPool *pPool) { for (SVBufPoolNode *pNode = pPool->pTail; pNode->prev; pNode = pPool->pTail) { - ASSERT(pNode->pnext == &pPool->pTail); + tAssert(pNode->pnext == &pPool->pTail); pNode->prev->pnext = &pPool->pTail; pPool->pTail = pNode->prev; pPool->size = pPool->size - sizeof(*pNode) - pNode->size; taosMemoryFree(pNode); } - ASSERT(pPool->size == pPool->ptr - pPool->node.data); + tAssert(pPool->size == pPool->ptr - pPool->node.data); pPool->size = 0; pPool->ptr = pPool->node.data; @@ -126,7 +126,7 @@ void vnodeBufPoolReset(SVBufPool *pPool) { void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) { SVBufPoolNode *pNode; void *p = NULL; - ASSERT(pPool != NULL); + tAssert(pPool != NULL); if (pPool->lock) taosThreadSpinLock(pPool->lock); if (pPool->node.size >= pPool->ptr - pPool->node.data + size) { @@ -172,7 +172,7 @@ void vnodeBufPoolFree(SVBufPool *pPool, void *p) { void vnodeBufPoolRef(SVBufPool *pPool) { int32_t nRef = atomic_fetch_add_32(&pPool->nRef, 1); - ASSERT(nRef > 0); + tAssert(nRef > 0); } void vnodeBufPoolUnRef(SVBufPool *pPool) { diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 5adb2eb359..6e67f02a32 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -195,7 +195,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { } for (int32_t i = 0; i < nRetention; ++i) { SJson *pNodeRetention = tjsonGetArrayItem(pNodeRetentions, i); - ASSERT(pNodeRetention != NULL); + tAssert(pNodeRetention != NULL); tjsonGetNumberValue(pNodeRetention, "freq", (pCfg->tsdbCfg.retentions)[i].freq, code); tjsonGetNumberValue(pNodeRetention, "freqUnit", (pCfg->tsdbCfg.retentions)[i].freqUnit, code); tjsonGetNumberValue(pNodeRetention, "keep", (pCfg->tsdbCfg.retentions)[i].keep, code); diff --git a/source/dnode/vnode/src/vnd/vnodeModule.c b/source/dnode/vnode/src/vnd/vnodeModule.c index 782ffd788d..ff5e500ebd 100644 --- a/source/dnode/vnode/src/vnd/vnodeModule.c +++ b/source/dnode/vnode/src/vnd/vnodeModule.c @@ -115,7 +115,7 @@ void vnodeCleanup() { int vnodeScheduleTask(int (*execute)(void*), void* arg) { SVnodeTask* pTask; - ASSERT(!vnodeGlobal.stop); + tAssert(!vnodeGlobal.stop); pTask = taosMemoryMalloc(sizeof(*pTask)); if (pTask == NULL) { diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index f317b4d946..20d181b63b 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -18,7 +18,7 @@ #define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \ do { \ int##vType##_t newVal = atomic_sub_fetch_##vType(&(pVar), (oVal)); \ - ASSERT(newVal >= 0); \ + tAssert(newVal >= 0); \ if (newVal < 0) { \ vWarn("vgId:%d %s, abnormal val:%" PRIi64 ", old val:%" PRIi64, TD_VID(pVnode), tags, newVal, (oVal)); \ } \ diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 8833db09cd..40cb871795 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -339,8 +339,8 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { SSnapDataHdr *pHdr = (SSnapDataHdr *)pData; SVnode *pVnode = pWriter->pVnode; - ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData); - ASSERT(pHdr->index == pWriter->index + 1); + tAssert(pHdr->size + sizeof(SSnapDataHdr) == nData); + tAssert(pHdr->index == pWriter->index + 1); pWriter->index = pHdr->index; vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d nData:%d", TD_VID(pVnode), pHdr->index, diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index d8c8a3e1b2..0d1d63826a 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -189,7 +189,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp vDebug("vgId:%d, start to process write request %s, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version); - ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); + tAssert(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); pVnode->state.applied = version; pVnode->state.applyTerm = pMsg->info.conn.applyTerm; @@ -849,7 +849,7 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock, } static int32_t vnodeDebugPrintSubmitMsg(SVnode *pVnode, SSubmitReq *pMsg, const char *tags) { - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); SSubmitMsgIter msgIter = {0}; SMeta *pMeta = pVnode->pMeta; SSubmitBlk *pBlock = NULL; @@ -1227,7 +1227,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq tDecoderInit(pCoder, pReq, len); tDecodeDeleteRes(pCoder, pRes); - ASSERT(taosArrayGetSize(pRes->uidList) == 0 || (pRes->skey != 0 && pRes->ekey != 0)); + tAssert(taosArrayGetSize(pRes->uidList) == 0 || (pRes->skey != 0 && pRes->ekey != 0)); for (int32_t iUid = 0; iUid < taosArrayGetSize(pRes->uidList); iUid++) { code = tsdbDeleteTableData(pVnode->pTsdb, version, pRes->suid, *(uint64_t *)taosArrayGet(pRes->uidList, iUid), diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index aa215a852f..11e46c23a7 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -122,7 +122,7 @@ static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize); bool wait = (code == 0 && vnodeIsBlockMsg(pLastMsg->msgType)); if (wait) { - ASSERT(!pVnode->blocked); + tAssert(!pVnode->blocked); pVnode->blocked = true; } taosThreadMutexUnlock(&pVnode->lock); @@ -221,7 +221,7 @@ static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak int32_t code = syncPropose(pVnode->sync, pMsg, isWeak); bool wait = (code == 0 && vnodeIsMsgBlock(pMsg->msgType)); if (wait) { - ASSERT(!pVnode->blocked); + tAssert(!pVnode->blocked); pVnode->blocked = true; } taosThreadMutexUnlock(&pVnode->lock); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index b6ff1c8b98..f595964dc4 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -22,7 +22,7 @@ extern SCatalogMgmt gCtgMgmt; SCtgDebug gCTGDebug = {0}; void ctgdUserCallback(SMetaData *pResult, void *param, int32_t code) { - ASSERT(*(int32_t *)param == 1); + tAssert(*(int32_t *)param == 1); taosMemoryFree(param); qDebug("async call result: %s", tstrerror(code)); diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 7cc6c90d30..849bbf8be9 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -40,7 +40,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu msgNum = taosArrayGetSize(batchRsp.pRsps); } - ASSERT(taskNum == msgNum || 0 == msgNum); + tAssert(taskNum == msgNum || 0 == msgNum); ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1)); @@ -62,7 +62,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu taskMsg.pData = pRsp->msg; taskMsg.len = pRsp->msgLen; - ASSERT(pRsp->msgIdx == *msgIdx); + tAssert(pRsp->msgIdx == *msgIdx); } else { pRsp = &rsp; pRsp->msgIdx = *msgIdx; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 5f1b87a138..29892c05cb 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -40,7 +40,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfCols = htonl(numOfCols); int32_t len = blockEncode(pBlock, (*pRsp)->data, numOfCols); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); + tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 253718048d..922bb2788d 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1666,7 +1666,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->numOfRows = htobe64((int64_t)rowNum); int32_t len = blockEncode(pBlock, rsp->data, taosArrayGetSize(pBlock->pDataBlock)); - ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); + tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); rsp->compLen = htonl(len); diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index 51150ede3c..e1dff38e2a 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -27,7 +27,7 @@ #define T_LONG_JMP(_obj, _c) \ do { \ - ASSERT((_c) != -1); \ + tAssert((_c) != -1); \ longjmp((_obj), (_c)); \ } while (0) diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 672bb09b14..b2b71fa928 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -163,7 +163,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { int32_t resultRows = pInfo->pBufferredRes->info.rows; // the results may be null, if last values are all null - ASSERT(resultRows == 0 || resultRows == taosArrayGetSize(pInfo->pUidList)); + tAssert(resultRows == 0 || resultRows == taosArrayGetSize(pInfo->pUidList)); pInfo->indexOfBufferedRes = 0; } @@ -235,7 +235,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { pInfo->pRes->info.id.groupId = pKeyInfo->groupId; if (taosArrayGetSize(pInfo->pUidList) > 0) { - ASSERT((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW); + tAssert((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW); pInfo->pRes->info.id.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0); code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, pInfo->pRes->info.rows, diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 12fb449238..03f8b496ce 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->dataLen = sizeof(SDeleterRes); - ASSERT(1 == pEntry->numOfRows); - ASSERT(3 == pEntry->numOfCols); + tAssert(1 == pEntry->numOfRows); + tAssert(3 == pEntry->numOfCols); pBuf->useSize = sizeof(SDataCacheEntry); @@ -81,7 +81,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp if (pRes->affectedRows) { pRes->skey = *(int64_t*)pColSKey->pData; pRes->ekey = *(int64_t*)pColEKey->pData; - ASSERT(pRes->skey <= pRes->ekey); + tAssert(pRes->skey <= pRes->ekey); } else { pRes->skey = pHandle->pDeleter->deleteTimeRange.skey; pRes->ekey = pHandle->pDeleter->deleteTimeRange.ekey; @@ -167,7 +167,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); + tAssert(NULL != pBuf); memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); taosFreeQitem(pBuf); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index c45226e02b..0176e18e2d 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pBuf->useSize = sizeof(SDataCacheEntry); pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); pBuf->useSize += pEntry->dataLen; @@ -162,15 +162,15 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDispatchBuf* pBuf = NULL; taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf); - ASSERT(NULL != pBuf); + tAssert(NULL != pBuf); memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); taosFreeQitem(pBuf); SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData; *pLen = pEntry->dataLen; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); *pQueryEnd = pDispatcher->queryEnd; qDebug("got data len %" PRId64 ", row num %d in sink", *pLen, @@ -193,8 +193,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; - ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen); atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen); diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 8423b77906..a2dfa533c3 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -373,7 +373,7 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { pRsp->useconds = htobe64(pRsp->useconds); pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); - ASSERT(pRsp != NULL); + tAssert(pRsp != NULL); qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%" PRId64 ", %p", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, pRsp->numOfRows, pExchangeInfo); } else { @@ -401,7 +401,7 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, sourceIndex); pDataInfo->startTime = taosGetTimestampUs(); - ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); + tAssert(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); SFetchRspHandleWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SFetchRspHandleWrapper)); pWrapper->exchangeId = pExchangeInfo->self; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9df6078ef3..0af7815558 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -160,7 +160,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); + tAssert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } bool hasRemainResults(SGroupResInfo* pGroupResInfo) { @@ -314,10 +314,10 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, return code; } - ASSERT(nodeType(pNew) == QUERY_NODE_VALUE); + tAssert(nodeType(pNew) == QUERY_NODE_VALUE); SValueNode* pValue = (SValueNode*)pNew; - ASSERT(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL); + tAssert(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL); *pQualified = pValue->datum.b; nodesDestroyNode(pNew); @@ -626,7 +626,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis #endif } else { void* tag = taosHashGet(tags, uid, sizeof(int64_t)); - ASSERT(tag); + tAssert(tag); STagVal tagVal = {0}; tagVal.cid = pColInfo->info.colId; @@ -1056,7 +1056,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, } if (!pTagCond) { // no tag condition exists, let's fetch all tables of this super table - ASSERT(pTagIndexCond == NULL); + tAssert(pTagIndexCond == NULL); vnodeGetCtbIdList(pVnode, pScanNode->suid, res); } else { // failed to find the result in the cache, let try to calculate the results @@ -1150,7 +1150,7 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, return code; } - ASSERT(nodeType(pNew) == QUERY_NODE_VALUE); + tAssert(nodeType(pNew) == QUERY_NODE_VALUE); SValueNode* pValue = (SValueNode*)pNew; if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL || pValue->isNull) { @@ -1364,7 +1364,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { if (!pFuncNode->pParameterList && (memcmp(pExprNode->_function.functionName, name, len) == 0) && pExprNode->_function.functionName[len] == 0) { pFuncNode->pParameterList = nodesMakeList(); - ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0); + tAssert(LIST_LENGTH(pFuncNode->pParameterList) == 0); SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); if (NULL == res) { // todo handle error } else { @@ -1758,7 +1758,7 @@ void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimit } uint64_t tableListGetSize(const STableListInfo* pTableList) { - ASSERT(taosArrayGetSize(pTableList->pTableList) == taosHashGetSize(pTableList->map)); + tAssert(taosArrayGetSize(pTableList->pTableList) == taosHashGetSize(pTableList->map)); return taosArrayGetSize(pTableList->pTableList); } @@ -1774,10 +1774,10 @@ STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) uint64_t getTableGroupId(const STableListInfo* pTableList, uint64_t tableUid) { int32_t* slot = taosHashGet(pTableList->map, &tableUid, sizeof(tableUid)); - ASSERT(pTableList->map != NULL && slot != NULL); + tAssert(pTableList->map != NULL && slot != NULL); STableKeyInfo* pKeyInfo = taosArrayGet(pTableList->pTableList, *slot); - ASSERT(pKeyInfo->uid == tableUid); + tAssert(pKeyInfo->uid == tableUid); return pKeyInfo->groupId; } @@ -1785,7 +1785,7 @@ uint64_t getTableGroupId(const STableListInfo* pTableList, uint64_t tableUid) { // TODO handle the group offset info, fix it, the rule of group output will be broken by this function int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t gid) { if (pTableList->map == NULL) { - ASSERT(taosArrayGetSize(pTableList->pTableList) == 0); + tAssert(taosArrayGetSize(pTableList->pTableList) == 0); pTableList->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); } @@ -1933,7 +1933,7 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) { int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group, bool groupSort) { int32_t code = TSDB_CODE_SUCCESS; - ASSERT(pTableListInfo->map != NULL); + tAssert(pTableListInfo->map != NULL); bool groupByTbname = groupbyTbname(group); size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList); @@ -1990,7 +1990,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags } int32_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList); - ASSERT(pTableListInfo->numOfOuputGroups == 1); + tAssert(pTableListInfo->numOfOuputGroups == 1); int64_t st1 = taosGetTimestampUs(); pTaskInfo->cost.extractListTime = (st1 - st) / 1000.0; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 47b38ba02c..630216fbdb 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -31,7 +31,7 @@ static void cleanupRefPool() { } static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { - ASSERT(pOperator != NULL); + tAssert(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -72,7 +72,7 @@ static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOf static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { { - ASSERT(pOperator != NULL); + tAssert(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -91,7 +91,7 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { } static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { - ASSERT(pOperator != NULL); + tAssert(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -109,18 +109,18 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu SStreamScanInfo* pInfo = pOperator->info; - ASSERT(pInfo->validBlockIndex == 0); - ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0); + tAssert(pInfo->validBlockIndex == 0); + tAssert(taosArrayGetSize(pInfo->pBlockLists) == 0); if (type == STREAM_INPUT__MERGED_SUBMIT) { - // ASSERT(numOfBlocks > 1); + // tAssert(numOfBlocks > 1); for (int32_t i = 0; i < numOfBlocks; i++) { SSubmitReq* pReq = *(void**)POINTER_SHIFT(input, i * sizeof(void*)); taosArrayPush(pInfo->pBlockLists, &pReq); } pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; } else if (type == STREAM_INPUT__DATA_SUBMIT) { - ASSERT(numOfBlocks == 1); + tAssert(numOfBlocks == 1); taosArrayPush(pInfo->pBlockLists, &input); pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; } else if (type == STREAM_INPUT__DATA_BLOCK) { @@ -413,7 +413,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, int32_t* tversion) { - ASSERT(tinfo != NULL && dbName != NULL && tableName != NULL); + tAssert(tinfo != NULL && dbName != NULL && tableName != NULL); SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if (pTaskInfo->schemaInfo.sw == NULL) { @@ -546,7 +546,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo blockIndex += 1; current += p->info.rows; - ASSERT(p->info.rows > 0); + tAssert(p->info.rows > 0); taosArrayPush(pResList, &p); if (current >= 4096) { @@ -776,7 +776,7 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) { *scanner = pOperator->info; return 0; } else { - ASSERT(pOperator->numOfDownstream == 1); + tAssert(pOperator->numOfDownstream == 1); pOperator = pOperator->pDownstream[0]; } } @@ -785,7 +785,7 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) { #if 0 int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); taosWriteQitem(pTaskInfo->streamInfo.inputQueue->queue, pItem); return 0; } @@ -793,7 +793,7 @@ int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) { int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.fillHistoryVer1 = ver; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE1; return 0; @@ -801,7 +801,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) { int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.fillHistoryVer2 = ver; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE2; return 0; @@ -809,7 +809,7 @@ int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver) { int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__NONE; return 0; } @@ -823,10 +823,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - ASSERT(pInfo->twAggSup.calTriggerSaved == 0); - ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); + tAssert(pInfo->twAggSup.calTriggerSaved == 0); + tAssert(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -839,10 +839,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - ASSERT(pInfo->twAggSup.calTriggerSaved == 0); - ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); + tAssert(pInfo->twAggSup.calTriggerSaved == 0); + tAssert(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -852,10 +852,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pInfo->twAggSup.deleteMark = INT64_MAX; } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { SStreamStateAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - ASSERT(pInfo->twAggSup.calTriggerSaved == 0); - ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); + tAssert(pInfo->twAggSup.calTriggerSaved == 0); + tAssert(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -890,34 +890,34 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { SStreamStateAggOperatorInfo* pInfo = pOperator->info; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } @@ -954,19 +954,19 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); return &pTaskInfo->streamInfo.metaRsp; } int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); return pTaskInfo->streamInfo.prepareStatus.uid; } int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal)); return 0; } @@ -1004,8 +1004,8 @@ int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* s int32_t qStreamScanMemData(qTaskInfo_t tinfo, const SSubmitReq* pReq) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); - ASSERT(pTaskInfo->streamInfo.pReq == NULL); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + tAssert(pTaskInfo->streamInfo.pReq == NULL); pTaskInfo->streamInfo.pReq = pReq; return 0; } @@ -1013,7 +1013,7 @@ int32_t qStreamScanMemData(qTaskInfo_t tinfo, const SSubmitReq* pReq) { int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SOperatorInfo* pOperator = pTaskInfo->pRoot; - ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); pTaskInfo->streamInfo.prepareStatus = *pOffset; pTaskInfo->streamInfo.returned = 0; if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) { @@ -1024,7 +1024,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT pOperator->status = OP_OPENED; // TODO add more check if (type != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - ASSERT(pOperator->numOfDownstream == 1); + tAssert(pOperator->numOfDownstream == 1); pOperator = pOperator->pDownstream[0]; } @@ -1044,7 +1044,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { return -1; } - ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); + tAssert(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { /*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/ int64_t uid = pOffset->uid; @@ -1082,7 +1082,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT } // TODO after dropping table, table may not found - ASSERT(found); + tAssert(found); if (pTableScanInfo->base.dataReader == NULL) { STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0); @@ -1139,7 +1139,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0); int32_t size = tableListGetSize(pTaskInfo->pTableInfoList); - ASSERT(size == 1); + tAssert(size == 1); tsdbReaderOpen(pInfo->vnode, &pTaskInfo->streamInfo.tableCond, pList, size, NULL, &pInfo->dataReader, NULL); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 3eaafa0bc8..759ba37fad 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -102,7 +102,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int void setOperatorCompleted(SOperatorInfo* pOperator) { pOperator->status = OP_EXEC_DONE; - ASSERT(pOperator->pTaskInfo != NULL); + tAssert(pOperator->pTaskInfo != NULL); pOperator->cost.totalCost = (taosGetTimestampUs() - pOperator->pTaskInfo->cost.start) / 1000.0; setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); @@ -202,7 +202,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR if (isIntervalQuery) { if (masterscan && p1 != NULL) { // the *p1 may be NULL in case of sliding+offset exists. pResult = getResultRowByPos(pResultBuf, p1, true); - ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset); + tAssert(pResult->pageId == p1->pageId && pResult->offset == p1->offset); } } else { // In case of group by column query, the required SResultRow object must be existInCurrentResusltRowInfo in the @@ -210,7 +210,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR if (p1 != NULL) { // todo pResult = getResultRowByPos(pResultBuf, p1, true); - ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset); + tAssert(pResult->pageId == p1->pageId && pResult->offset == p1->offset); } } @@ -223,7 +223,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR // allocate a new buffer page if (pResult == NULL) { - ASSERT(pSup->resultRowSize > 0); + tAssert(pSup->resultRowSize > 0); pResult = getNewResultRow(pResultBuf, &pSup->currentPageId, pSup->resultRowSize); // add a new result set for a new group @@ -463,9 +463,9 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int // todo: refactor this if (fmIsImplicitTsFunc(pCtx[i].functionId) && (j == pOneExpr->base.numOfParams - 1)) { pInput->pPTS = pInput->pData[j]; // in case of merge function, this is not always the ts column data. - // ASSERT(pInput->pPTS->info.type == TSDB_DATA_TYPE_TIMESTAMP); + // tAssert(pInput->pPTS->info.type == TSDB_DATA_TYPE_TIMESTAMP); } - ASSERT(pInput->pData[j] != NULL); + tAssert(pInput->pData[j] != NULL); } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { // todo avoid case: top(k, 12), 12 is the value parameter. // sum(11), 11 is also the value parameter. @@ -549,7 +549,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF da = pInput->pColumnDataAgg[paramIndex]; } - ASSERT(!IS_VAR_DATA_TYPE(type)); + tAssert(!IS_VAR_DATA_TYPE(type)); if (type == TSDB_DATA_TYPE_BIGINT) { int64_t v = pFuncParam->param.i; @@ -890,7 +890,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD if (pBlock->info.rows == totalRows) { pBlock->info.rows = numOfRows; } else { - ASSERT(pBlock->info.rows == numOfRows); + tAssert(pBlock->info.rows == numOfRows); } } @@ -1066,7 +1066,7 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - ASSERT(pBlock->info.rows > 0); + tAssert(pBlock->info.rows > 0); releaseBufPage(pBuf, page); break; } @@ -1100,7 +1100,7 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr // clear the existed group id pBlock->info.id.groupId = 0; - ASSERT(!pbInfo->mergeResultBlock); + tAssert(!pbInfo->mergeResultBlock); doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo); void* tbname = NULL; @@ -1662,7 +1662,7 @@ int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo } void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows) { - ASSERT(numOfRows != 0); + tAssert(numOfRows != 0); pResultInfo->capacity = numOfRows; pResultInfo->threshold = numOfRows * 0.75; @@ -2207,7 +2207,7 @@ static int32_t extractTbscanInStreamOpTree(SOperatorInfo* pOperator, STableScanI return extractTbscanInStreamOpTree(pOperator->pDownstream[0], ppInfo); } else { SStreamScanInfo* pInfo = pOperator->info; - ASSERT(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); + tAssert(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); *ppInfo = pInfo->pTableScanOp->info; return 0; } @@ -2449,7 +2449,7 @@ int32_t setOutputBuf(SStreamState* pState, STimeWindow* win, SResultRow** pResul return TSDB_CODE_OUT_OF_MEMORY; } *pResult = (SResultRow*)value; - ASSERT(*pResult); + tAssert(*pResult); // set time window for current result (*pResult)->win = (*win); setResultRowInitCtx(*pResult, pCtx, numOfOutput, rowEntryInfoOffset); @@ -2485,7 +2485,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat .groupId = pPos->groupId, }; int32_t code = streamStateGet(pState, &key, &pVal, &size); - ASSERT(code == 0); + tAssert(code == 0); SResultRow* pRow = (SResultRow*)pVal; doUpdateNumOfRows(pCtx, pRow, numOfExprs, rowEntryOffset); // no results, continue to check the next one @@ -2513,7 +2513,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - ASSERT(pBlock->info.rows > 0); + tAssert(pBlock->info.rows > 0); releaseOutputBuf(pState, &key, pRow); break; } @@ -2571,7 +2571,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta int32_t size = 0; void* pVal = NULL; int32_t code = streamStateSessionGet(pState, pKey, &pVal, &size); - ASSERT(code == 0); + tAssert(code == 0); if (code == -1) { // coverity scan pGroupResInfo->index += 1; @@ -2605,7 +2605,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - ASSERT(pBlock->info.rows > 0); + tAssert(pBlock->info.rows > 0); releaseOutputBuf(pState, NULL, pRow); break; } diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 3dbe8fda94..240c6f7e9f 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -496,7 +496,7 @@ void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupI SWinKey key = {.ts = ts, .groupId = groupId}; int32_t curVLen = 0; int32_t code = streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen); - ASSERT(code == TSDB_CODE_SUCCESS); + tAssert(code == TSDB_CODE_SUCCESS); pFillSup->cur.key = key.ts; } @@ -508,7 +508,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, void* curVal = NULL; int32_t curVLen = 0; int32_t code = streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); - ASSERT(code == TSDB_CODE_SUCCESS); + tAssert(code == TSDB_CODE_SUCCESS); pFillSup->cur.key = key.ts; pFillSup->cur.pRowVal = curVal; @@ -523,7 +523,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pFillSup->prev.pRowVal = preVal; code = streamStateCurNext(pState, pCur); - ASSERT(code == TSDB_CODE_SUCCESS); + tAssert(code == TSDB_CODE_SUCCESS); code = streamStateCurNext(pState, pCur); if (code != TSDB_CODE_SUCCESS) { @@ -764,7 +764,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS pFillSup->next.pRowVal = pFillSup->cur.pRowVal; pFillInfo->preRowKey = INT64_MIN; } else { - ASSERT(hasNextWindow(pFillSup)); + tAssert(hasNextWindow(pFillSup)); setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } @@ -798,7 +798,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS pFillInfo->pResRow = &pFillSup->prev; pFillInfo->pLinearInfo->hasNext = false; } else { - ASSERT(hasNextWindow(pFillSup)); + tAssert(hasNextWindow(pFillSup)); setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; pFillInfo->pLinearInfo->nextEnd = INT64_MIN; @@ -814,7 +814,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS tAssert(0); break; } - ASSERT(pFillInfo->pos != FILL_POS_INVALID); + tAssert(pFillInfo->pos != FILL_POS_INVALID); } static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId) { @@ -916,7 +916,7 @@ static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* static void keepResultInDiscBuf(SOperatorInfo* pOperator, uint64_t groupId, SResultRowData* pRow, int32_t len) { SWinKey key = {.groupId = groupId, .ts = pRow->key}; int32_t code = streamStateFillPut(pOperator->pTaskInfo->streamInfo.pState, &key, pRow->pRowVal, len); - ASSERT(code == TSDB_CODE_SUCCESS); + tAssert(code == TSDB_CODE_SUCCESS); } static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter* pFillSup, SSDataBlock* pRes) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 9ffa327317..de9f170092 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -195,7 +195,7 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData memcpy(pkey->pData, val, dataLen); } else if (IS_VAR_DATA_TYPE(pkey->type)) { memcpy(pkey->pData, val, varDataTLen(val)); - ASSERT(varDataTLen(val) <= pkey->bytes); + tAssert(varDataTLen(val) <= pkey->bytes); } else { memcpy(pkey->pData, val, pkey->bytes); } @@ -204,7 +204,7 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData } static int32_t buildGroupKeys(void* pKey, const SArray* pGroupColVals) { - ASSERT(pKey != NULL); + tAssert(pKey != NULL); size_t numOfGroupCols = taosArrayGetSize(pGroupColVals); char* isNull = (char*)pKey; @@ -224,7 +224,7 @@ static int32_t buildGroupKeys(void* pKey, const SArray* pGroupColVals) { } else if (IS_VAR_DATA_TYPE(pkey->type)) { varDataCopy(pStart, pkey->pData); pStart += varDataTLen(pkey->pData); - ASSERT(varDataTLen(pkey->pData) <= pkey->bytes); + tAssert(varDataTLen(pkey->pData) <= pkey->bytes); } else { memcpy(pStart, pkey->pData, pkey->bytes); pStart += pkey->bytes; @@ -535,7 +535,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { memcpy(data + (*columnLen), src, dataLen); int32_t v = (data + (*columnLen) + dataLen - (char*)pPage); - ASSERT(v > 0); + tAssert(v > 0); contentLen = dataLen; } else { @@ -543,7 +543,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { char* src = colDataGetData(pColInfoData, j); memcpy(data + (*columnLen), src, varDataTLen(src)); int32_t v = (data + (*columnLen) + varDataTLen(src) - (char*)pPage); - ASSERT(v > 0); + tAssert(v > 0); contentLen = varDataTLen(src); } @@ -557,13 +557,13 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { colDataSetNull_f(bitmap, (*rows)); } else { memcpy(data + (*columnLen), colDataGetData(pColInfoData, j), bytes); - ASSERT((data + (*columnLen) + bytes - (char*)pPage) <= getBufPageSize(pInfo->pBuf)); + tAssert((data + (*columnLen) + bytes - (char*)pPage) <= getBufPageSize(pInfo->pBuf)); } contentLen = bytes; } (*columnLen) += contentLen; - ASSERT(*columnLen >= 0); + tAssert(*columnLen >= 0); } (*rows) += 1; @@ -897,7 +897,7 @@ static bool hasRemainPartion(SStreamPartitionOperatorInfo* pInfo) { return pInfo static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { SStreamPartitionOperatorInfo* pInfo = pOperator->info; SSDataBlock* pDest = pInfo->binfo.pRes; - ASSERT(hasRemainPartion(pInfo)); + tAssert(hasRemainPartion(pInfo)); SPartitionDataInfo* pParInfo = (SPartitionDataInfo*)pInfo->parIte; blockDataCleanup(pDest); int32_t rows = taosArrayGetSize(pParInfo->rowIds); @@ -926,10 +926,10 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { taosArrayPush(pResBlock->pDataBlock, &data); blockDataEnsureCapacity(pResBlock, 1); projectApplyFunctions(pInfo->tbnameCalSup.pExprInfo, pResBlock, pTmpBlock, pInfo->tbnameCalSup.pCtx, 1, NULL); - ASSERT(pResBlock->info.rows == 1); - ASSERT(taosArrayGetSize(pResBlock->pDataBlock) == 1); + tAssert(pResBlock->info.rows == 1); + tAssert(taosArrayGetSize(pResBlock->pDataBlock) == 1); SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, 0); - ASSERT(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); + tAssert(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); void* pData = colDataGetVarData(pCol, 0); // TODO check tbname validity if (pData != (void*)-1) { @@ -955,7 +955,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { pDest->info.id.groupId = pParInfo->groupId; pOperator->resultInfo.totalRows += pDest->info.rows; pInfo->parIte = taosHashIterate(pInfo->pPartitions, pInfo->parIte); - ASSERT(pDest->info.rows > 0); + tAssert(pDest->info.rows > 0); printDataBlock(pDest, "stream partitionby"); return pDest; } diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index d460af971c..10a05d2ba3 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -59,12 +59,12 @@ static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDown rightTsCol = col2; } else { if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { - ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); + tAssert(col2->dataBlockId == pDownstream[1]->resultDataBlockId); leftTsCol = col1; rightTsCol = col2; } else { - ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); - ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); + tAssert(col1->dataBlockId == pDownstream[1]->resultDataBlockId); + tAssert(col2->dataBlockId == pDownstream[0]->resultDataBlockId); leftTsCol = col2; rightTsCol = col1; } @@ -72,7 +72,7 @@ static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDown setJoinColumnInfo(&pInfo->leftCol, leftTsCol); setJoinColumnInfo(&pInfo->rightCol, rightTsCol); } else { - ASSERT(false); + tAssert(false); }} SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, @@ -210,7 +210,7 @@ typedef struct SRowLocation { static int32_t mergeJoinGetBlockRowsEqualTs(SSDataBlock* pBlock, int16_t tsSlotId, int32_t startPos, int64_t timestamp, int32_t* pEndPos, SArray* rowLocations, SArray* createdBlocks) { int32_t numRows = pBlock->info.rows; - ASSERT(startPos < numRows); + tAssert(startPos < numRows); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, tsSlotId); int32_t i = startPos; @@ -248,7 +248,7 @@ static int32_t mergeJoinGetDownStreamRowsEqualTimeStamp(SOperatorInfo* pOperator SSDataBlock* startDataBlock, int32_t startPos, int64_t timestamp, SArray* rowLocations, SArray* createdBlocks) { - ASSERT(whichChild == 0 || whichChild == 1); + tAssert(whichChild == 0 || whichChild == 1); SJoinOperatorInfo* pJoinInfo = pOperator->info; int32_t endPos = -1; @@ -364,8 +364,8 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); *pRightTs = *(int64_t*)pRightVal; - ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - ASSERT(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); return true; } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 65bb40b195..f1829b466c 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -162,7 +162,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, SOperatorInfo* pOperator) { // remainGroupOffset == 0 // here check for a new group data, we need to handle the data of the previous group. - ASSERT(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1); + tAssert(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1); if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.id.groupId) { pLimitInfo->numOfOutputGroups += 1; @@ -618,7 +618,7 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) { for (int32_t k = 0; k < pSup->numOfExprs; ++k) { int32_t outputSlotId = pExpr[k].base.resSchema.slotId; - ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + tAssert(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, outputSlotId); int32_t type = pExpr[k].base.pParam[0].param.nType; @@ -659,7 +659,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc for (int32_t k = 0; k < numOfOutput; ++k) { int32_t outputSlotId = pExpr[k].base.resSchema.slotId; - ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + tAssert(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId); int32_t type = pExpr[k].base.pParam[0].param.nType; @@ -734,7 +734,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc } int32_t startOffset = createNewColModel ? 0 : pResult->info.rows; - ASSERT(pResult->info.capacity > 0); + tAssert(pResult->info.capacity > 0); colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows); colDataDestroy(&idata); @@ -804,7 +804,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc } int32_t startOffset = createNewColModel ? 0 : pResult->info.rows; - ASSERT(pResult->info.capacity > 0); + tAssert(pResult->info.capacity > 0); colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows); colDataDestroy(&idata); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index de61d2255a..f6b2b9c98b 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -348,7 +348,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca } } - ASSERT(*status == FUNC_DATA_REQUIRED_DATA_LOAD); + tAssert(*status == FUNC_DATA_REQUIRED_DATA_LOAD); // try to filter data block according to sma info if (pOperator->exprSupp.pFilterInfo != NULL && (!loadSMA)) { @@ -389,7 +389,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca return terrno; } - ASSERT(p == pBlock); + tAssert(p == pBlock); doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows); // restore the previous value @@ -638,7 +638,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { continue; } - ASSERT(pBlock->info.id.uid != 0); + tAssert(pBlock->info.id.uid != 0); pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid); uint32_t status = 0; @@ -665,7 +665,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid; pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey; - ASSERT(pBlock->info.id.uid != 0); + tAssert(pBlock->info.id.uid != 0); return pBlock; } return NULL; @@ -766,7 +766,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { int32_t num = 0; STableKeyInfo* pList = NULL; tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num); - ASSERT(pInfo->base.dataReader == NULL); + tAssert(pInfo->base.dataReader == NULL); int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num, pInfo->pResBlock, (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo)); @@ -777,7 +777,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { SSDataBlock* result = doGroupedTableScan(pOperator); if (result != NULL) { - ASSERT(result->info.id.uid != 0); + tAssert(result->info.id.uid != 0); return result; } @@ -959,7 +959,7 @@ static bool isSlidingWindow(SStreamScanInfo* pInfo) { static void setGroupId(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t groupColIndex, int32_t rowIndex) { SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, groupColIndex); uint64_t* groupCol = (uint64_t*)pColInfo->pData; - ASSERT(rowIndex < pBlock->info.rows); + tAssert(rowIndex < pBlock->info.rows); pInfo->groupId = groupCol[rowIndex]; } @@ -1013,7 +1013,7 @@ static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, if (!pPreRes || pPreRes->info.rows == 0) { return 0; } - ASSERT(pPreRes->info.rows == 1); + tAssert(pPreRes->info.rows == 1); return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); } @@ -1037,7 +1037,7 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ return false; } - ASSERT(taosArrayGetSize(pBlock->pDataBlock) >= 3); + tAssert(taosArrayGetSize(pBlock->pDataBlock) >= 3); SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1068,7 +1068,7 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ win.skey = TMIN(win.skey, startData[*pRowIndex]); continue; } - ASSERT(!(win.skey > startData[*pRowIndex] && win.ekey < endData[*pRowIndex]) || + tAssert(!(win.skey > startData[*pRowIndex] && win.ekey < endData[*pRowIndex]) || !(isInTimeWindow(&win, startData[*pRowIndex], 0) || isInTimeWindow(&win, endData[*pRowIndex], 0))); break; } @@ -1173,7 +1173,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr if (code != TSDB_CODE_SUCCESS) { return code; } - ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + tAssert(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1199,7 +1199,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr } SSessionKey endWin = {0}; getCurSessionWindow(pInfo->windowSup.pStreamAggSup, endData[i], endData[i], groupId, &endWin); - ASSERT(!IS_INVALID_SESSION_WIN_KEY(endWin)); + tAssert(!IS_INVALID_SESSION_WIN_KEY(endWin)); colDataAppend(pDestStartCol, i, (const char*)&startWin.win.skey, false); colDataAppend(pDestEndCol, i, (const char*)&endWin.win.ekey, false); @@ -1225,7 +1225,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; - ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t version = pSrcBlock->info.version - 1; @@ -1306,7 +1306,7 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t version = pSrcBlock->info.version - 1; @@ -1361,7 +1361,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { tdbFree(tbname); SSDataBlock* pSrcBlock = blockCopyOneRow(pBlock, 0); - ASSERT(pSrcBlock->info.rows == 1); + tAssert(pSrcBlock->info.rows == 1); SSDataBlock* pResBlock = createDataBlock(); pResBlock->info.rowSize = VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN; @@ -1370,10 +1370,10 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { blockDataEnsureCapacity(pResBlock, 1); projectApplyFunctions(pTbNameCalSup->pExprInfo, pResBlock, pSrcBlock, pTbNameCalSup->pCtx, 1, NULL); - ASSERT(pResBlock->info.rows == 1); - ASSERT(taosArrayGetSize(pResBlock->pDataBlock) == 1); + tAssert(pResBlock->info.rows == 1); + tAssert(taosArrayGetSize(pResBlock->pDataBlock) == 1); SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, 0); - ASSERT(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); + tAssert(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); void* pData = colDataGetData(pCol, 0); // TODO check tbname validation @@ -1419,7 +1419,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock blockDataEnsureCapacity(pInfo->pUpdateDataRes, pBlock->info.rows * 2); } SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); - ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); + tAssert(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* tsCol = (TSKEY*)pColDataInfo->pData; bool tableInserted = updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.id.uid); for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) { @@ -1578,7 +1578,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer); return NULL; } - ASSERT(pInfo->tqReader->pWalReader->curVersion == pTaskInfo->streamInfo.snapshotVer + 1); + tAssert(pInfo->tqReader->pWalReader->curVersion == pTaskInfo->streamInfo.snapshotVer + 1); } else { return NULL; } @@ -1607,8 +1607,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { } else if (ret.fetchType == FETCH_TYPE__NONE || (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) { pTaskInfo->streamInfo.lastStatus = ret.offset; - ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); - ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); + tAssert(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); + tAssert(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); char formatBuf[80]; tFormatOffset(formatBuf, 80, &ret.offset); qDebug("queue scan log return null, offset %s", formatBuf); @@ -2115,8 +2115,8 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { // fetchVer++; // } // } else{ - // ASSERT(pInfo->sContext->withMeta); - // ASSERT(IS_META_MSG(pHead->msgType)); + // tAssert(pInfo->sContext->withMeta); + // tAssert(IS_META_MSG(pHead->msgType)); // qDebug("tmqsnap fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType); // pTaskInfo->streamInfo.metaRsp.rspOffset.version = fetchVer; // pTaskInfo->streamInfo.metaRsp.rspOffset.type = TMQ_OFFSET__LOG; @@ -2289,11 +2289,11 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys } if (pHandle->initTqReader) { - ASSERT(pHandle->tqReader == NULL); + tAssert(pHandle->tqReader == NULL); pInfo->tqReader = tqOpenReader(pHandle->vnode); - ASSERT(pInfo->tqReader); + tAssert(pInfo->tqReader); } else { - ASSERT(pHandle->tqReader); + tAssert(pHandle->tqReader); pInfo->tqReader = pHandle->tqReader; } @@ -2805,7 +2805,7 @@ void destroyTableMergeScanOperatorInfo(void* param) { } int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); + tAssert(pOptr != NULL); // TODO: merge these two info into one struct STableMergeScanExecInfo* execInfo = taosMemoryCalloc(1, sizeof(STableMergeScanExecInfo)); STableMergeScanInfo* pInfo = pOptr->info; @@ -3052,7 +3052,7 @@ _error: void fillTableCountScanDataBlock(STableCountScanSupp* pSupp, char* dbName, char* stbName, int64_t count, SSDataBlock* pRes) { if (pSupp->dbNameSlotId != -1) { - ASSERT(strlen(dbName)); + tAssert(strlen(dbName)); SColumnInfoData* colInfoData = taosArrayGet(pRes->pDataBlock, pSupp->dbNameSlotId); char varDbName[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 005b794f0b..42f668eb48 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -138,7 +138,7 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + // tAssert(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -271,7 +271,7 @@ void destroySortOperatorInfo(void* param) { } int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); + tAssert(pOptr != NULL); SSortExecInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SSortOperatorInfo* pOperatorInfo = (SSortOperatorInfo*)pOptr->info; @@ -328,7 +328,7 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + // tAssert(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -447,7 +447,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) { SSDataBlock* pBlock = NULL; while (pInfo->pCurrSortHandle != NULL) { // beginSortGroup would fetch all child blocks of pInfo->currGroupId; - ASSERT(pInfo->childOpStatus != CHILD_OP_SAME_GROUP); + tAssert(pInfo->childOpStatus != CHILD_OP_SAME_GROUP); pBlock = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, pInfo->matchInfo.pList, pInfo); if (pBlock != NULL) { @@ -744,7 +744,7 @@ void destroyMultiwayMergeOperatorInfo(void* param) { } int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - ASSERT(pOptr != NULL); + tAssert(pOptr != NULL); SSortExecInfo* pSortExecInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)pOptr->info; @@ -774,7 +774,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode); int32_t rowSize = pInfo->binfo.pRes->info.rowSize; - ASSERT(rowSize < 100 * 1024 * 1024); + tAssert(rowSize < 100 * 1024 * 1024); int32_t numOfOutputCols = 0; code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index f83a76380d..8150424104 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -286,7 +286,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t bool ascFill = FILL_IS_ASC_FILL(pFillInfo); #if 0 - ASSERT(ascFill && (pFillInfo->currentKey >= pFillInfo->start) || (!ascFill && (pFillInfo->currentKey <= pFillInfo->start))); + tAssert(ascFill && (pFillInfo->currentKey >= pFillInfo->start) || (!ascFill && (pFillInfo->currentKey <= pFillInfo->start))); #endif while (pFillInfo->numOfCurrent < outputRows) { @@ -311,7 +311,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t return outputRows; } } else { - ASSERT(pFillInfo->currentKey == ts); + tAssert(pFillInfo->currentKey == ts); int32_t index = pBlock->info.rows; if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index d9a011a892..5202076ed4 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -312,7 +312,7 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr SFunctParam* pParam = &pCtx[k].param[0]; SColumnInfoData* pColInfo = taosArrayGet(pDataBlock, pParam->pCol->slotId); - ASSERT(pColInfo->info.type == pParam->pCol->type && curTs != windowKey); + tAssert(pColInfo->info.type == pParam->pCol->type && curTs != windowKey); double v1 = 0, v2 = 0, v = 0; if (prevRowIndex == -1) { @@ -520,7 +520,7 @@ static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, } static bool isResultRowInterpolated(SResultRow* pResult, SResultTsInterpType type) { - ASSERT(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); + tAssert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); if (type == RESULT_ROW_START_INTERP) { return pResult->startInterp == true; } else { @@ -543,7 +543,7 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB return; } - ASSERT(pBlock != NULL); + tAssert(pBlock != NULL); if (pBlock->pDataBlock == NULL) { // tscError("pBlock->pDataBlock == NULL"); return; @@ -602,7 +602,7 @@ static void saveDataBlockLastRow(SArray* pPrevKeys, const SSDataBlock* pBlock, S char* val = colDataGetData(pColInfo, i); if (IS_VAR_DATA_TYPE(pkey->type)) { memcpy(pkey->pData, val, varDataTLen(val)); - ASSERT(varDataTLen(val) <= pkey->bytes); + tAssert(varDataTLen(val) <= pkey->bytes); } else { memcpy(pkey->pData, val, pkey->bytes); } @@ -634,10 +634,10 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num } SResultRow* pr = getResultRowByPos(pInfo->aggSup.pResultBuf, p1, false); - ASSERT(pr->offset == p1->offset && pr->pageId == p1->pageId); + tAssert(pr->offset == p1->offset && pr->pageId == p1->pageId); if (pr->closed) { - ASSERT(isResultRowInterpolated(pr, RESULT_ROW_START_INTERP) && + tAssert(isResultRowInterpolated(pr, RESULT_ROW_START_INTERP) && isResultRowInterpolated(pr, RESULT_ROW_END_INTERP)); SListNode* pNode = tdListPopHead(pResultRowInfo->openWindow); taosMemoryFree(pNode); @@ -651,7 +651,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); } - ASSERT(!isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)); + tAssert(!isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)); SGroupKeys* pTsKey = taosArrayGet(pInfo->pPrevValues, 0); int64_t prevTs = *(int64_t*)pTsKey->pData; @@ -897,7 +897,7 @@ static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { } bool isOverdue(TSKEY ekey, STimeWindowAggSupp* pTwSup) { - ASSERT(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); + tAssert(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); return pTwSup->maxTs != INT64_MIN && ekey < pTwSup->maxTs - pTwSup->waterMark; } @@ -932,7 +932,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder); - ASSERT(forwardRows > 0); + tAssert(forwardRows > 0); // prev time window not interpolation yet. if (pInfo->timeWindowInterpo) { @@ -1387,7 +1387,7 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); uint64_t groupId = *(uint64_t*)key; - ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); + tAssert(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); SResultRowPosition* pPos = (SResultRowPosition*)pIte; int32_t code = saveWinResult(ts, pPos->pageId, pPos->offset, groupId, resWins); @@ -1536,7 +1536,7 @@ static void closeChildIntervalWindow(SOperatorInfo* pOperator, SArray* pChildren for (int32_t i = 0; i < size; i++) { SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); SStreamIntervalOperatorInfo* pChInfo = pChildOp->info; - ASSERT(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + tAssert(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); closeStreamIntervalWindow(pChInfo->aggSup.pResultRowHashTable, &pChInfo->twAggSup, &pChInfo->interval, NULL, NULL, NULL, pOperator); @@ -1756,7 +1756,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh .maxTs = INT64_MIN, }; - ASSERT(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); + tAssert(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); pInfo->win = pTaskInfo->window; pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; @@ -2241,7 +2241,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB return; } blockDataEnsureCapacity(pBlock, size - (*pIndex)); - ASSERT(3 <= taosArrayGetSize(pBlock->pDataBlock)); + tAssert(3 <= taosArrayGetSize(pBlock->pDataBlock)); SColumnInfoData* pStartTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pGroupId = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); @@ -2341,7 +2341,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p SResultRow* pResult = NULL; int32_t forwardRows = 0; - ASSERT(pSDataBlock->pDataBlock != NULL); + tAssert(pSDataBlock->pDataBlock != NULL); SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; @@ -2436,7 +2436,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p pInfo->delKey = key; } int32_t prevEndPos = (forwardRows - 1) * step + startPos; - ASSERT(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); + tAssert(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); if (startPos < 0) { @@ -2463,7 +2463,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); + tAssert(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2524,7 +2524,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->numOfDatapack++; printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv"); - ASSERT(pBlock->info.type != STREAM_INVERT); + tAssert(pBlock->info.type != STREAM_INVERT); if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || @@ -2614,7 +2614,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - ASSERT(IS_FINAL_OP(pInfo)); + tAssert(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2662,7 +2662,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, .deleteMarkSaved = 0, .calTriggerSaved = 0, }; - ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); + tAssert(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -2687,7 +2687,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, initStreamFunciton(pOperator->exprSupp.pCtx, pOperator->exprSupp.numOfExprs); - ASSERT(numOfCols > 0); + tAssert(numOfCols > 0); initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->pState = taosMemoryCalloc(1, sizeof(SStreamState)); @@ -2720,7 +2720,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, // semi interval operator does not catch result pInfo->isFinal = false; pOperator->name = "StreamSemiIntervalOperator"; - ASSERT(pInfo->aggSup.currentPageId == -1); + tAssert(pInfo->aggSup.currentPageId == -1); } if (!IS_FINAL_OP(pInfo) || numOfChild == 0) { @@ -2806,7 +2806,7 @@ int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* pSup->pCtx[i].saveHandle.pBuf = NULL; } - ASSERT(numOfCols > 0); + tAssert(numOfCols > 0); return TSDB_CODE_SUCCESS; } @@ -2985,7 +2985,7 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, TS static int32_t initSessionOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pResult, SqlFunctionCtx* pCtx, int32_t numOfOutput, int32_t* rowEntryInfoOffset) { - ASSERT(pWinInfo->sessionWin.win.skey <= pWinInfo->sessionWin.win.ekey); + tAssert(pWinInfo->sessionWin.win.skey <= pWinInfo->sessionWin.win.ekey); *pResult = (SResultRow*)pWinInfo->pOutputBuf; // set time window for current result (*pResult)->win = pWinInfo->sessionWin.win; @@ -3137,7 +3137,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData } void deleteWindow(SArray* pWinInfos, int32_t index, FDelete fp) { - ASSERT(index >= 0 && index < taosArrayGetSize(pWinInfos)); + tAssert(index >= 0 && index < taosArrayGetSize(pWinInfos)); if (fp) { void* ptr = taosArrayGet(pWinInfos, index); fp(ptr); @@ -3192,7 +3192,7 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) { int32_t iter = 0; while ((pIte = tSimpleHashIterate(pStUpdated, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); - ASSERT(keyLen == sizeof(SSessionKey)); + tAssert(keyLen == sizeof(SSessionKey)); taosArrayPush(pUpdated, key); } taosArraySort(pUpdated, sessionKeyCompareAsc); @@ -3253,7 +3253,7 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; int32_t numOfOutput = pSup->numOfExprs; int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren); - ASSERT(pInfo->pChildren); + tAssert(pInfo->pChildren); for (int32_t i = 0; i < size; i++) { SSessionKey* pWinKey = taosArrayGet(pWinArray, i); @@ -3354,7 +3354,7 @@ static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) { void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) { pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); + tAssert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroupResInfo* pGroupResInfo, @@ -4221,7 +4221,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { } else { if (pMiaInfo->groupId != pBlock->info.id.groupId) { // if there are unclosed time window, close it firstly. - ASSERT(pMiaInfo->curTs != INT64_MIN); + tAssert(pMiaInfo->curTs != INT64_MIN); finalizeResultRows(pIaInfo->aggSup.pResultBuf, &pResultRowInfo->cur, pSup, pRes, pTaskInfo); resetResultRow(pMiaInfo->pResultRow, pIaInfo->aggSup.resultRowSize - sizeof(SResultRow)); @@ -4391,7 +4391,7 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId); SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet( iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE)); - ASSERT(p1 != NULL); + tAssert(p1 != NULL); // finalizeResultRows(iaInfo->aggSup.pResultBuf, p1, pResultBlock, pTaskInfo); tSimpleHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE)); return TSDB_CODE_SUCCESS; @@ -4454,7 +4454,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder); - ASSERT(forwardRows > 0); + tAssert(forwardRows > 0); // prev time window not interpolation yet. if (iaInfo->timeWindowInterpo) { @@ -4785,7 +4785,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys int32_t code = TSDB_CODE_SUCCESS; int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &numOfCols); - ASSERT(numOfCols > 0); + tAssert(numOfCols > 0); SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); SInterval interval = { @@ -4805,7 +4805,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .deleteMark = INT64_MAX, }; - ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); + tAssert(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); pOperator->pTaskInfo = pTaskInfo; pInfo->interval = interval; diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c index 4204692514..8caa0b4e34 100644 --- a/source/libs/executor/src/tlinearhash.c +++ b/source/libs/executor/src/tlinearhash.c @@ -17,6 +17,7 @@ #include "taoserror.h" #include "tdef.h" #include "tpagedbuf.h" +#include "tlog.h" #define LHASH_CAP_RATIO 0.85 @@ -58,7 +59,7 @@ static int32_t doGetBucketIdFromHashVal(int32_t hashv, int32_t bits) { return ha static int32_t doGetAlternativeBucketId(int32_t bucketId, int32_t bits, int32_t numOfBuckets) { int32_t v = bucketId - (1ul << (bits - 1)); - ASSERT(v < numOfBuckets); + tAssert(v < numOfBuckets); return v; } @@ -84,11 +85,11 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t int32_t pageId = *(int32_t*)taosArrayGetLast(pBucket->pPageIdList); SFilePage* pPage = getBufPage(pHashObj->pBuf, pageId); - ASSERT(pPage != NULL); + tAssert(pPage != NULL); // put to current buf page size_t nodeSize = sizeof(SLHashNode) + keyLen + size; - ASSERT(nodeSize + sizeof(SFilePage) <= getBufPageSize(pHashObj->pBuf)); + tAssert(nodeSize + sizeof(SFilePage) <= getBufPageSize(pHashObj->pBuf)); if (pPage->num + nodeSize > getBufPageSize(pHashObj->pBuf)) { releaseBufPage(pHashObj->pBuf, pPage); @@ -122,7 +123,7 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t } static void doRemoveFromBucket(SFilePage* pPage, SLHashNode* pNode, SLHashBucket* pBucket) { - ASSERT(pPage != NULL && pNode != NULL && pBucket->size >= 1); + tAssert(pPage != NULL && pNode != NULL && pBucket->size >= 1); int32_t len = GET_LHASH_NODE_LEN(pNode); char* p = (char*)pNode + len; @@ -171,7 +172,7 @@ static void doTrimBucketPages(SLHashObj* pHashObj, SLHashBucket* pBucket) { setBufPageDirty(pFirst, true); setBufPageDirty(pLast, true); - ASSERT(pLast->num >= nodeSize + sizeof(SFilePage)); + tAssert(pLast->num >= nodeSize + sizeof(SFilePage)); pFirst->num += nodeSize; pLast->num -= nodeSize; @@ -300,7 +301,7 @@ void* tHashCleanup(SLHashObj* pHashObj) { } int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data, size_t size) { - ASSERT(pHashObj != NULL && key != NULL); + tAssert(pHashObj != NULL && key != NULL); if (pHashObj->bits == 0) { SLHashBucket* pBucket = pHashObj->pBucket[0]; @@ -336,7 +337,7 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data int32_t numOfBits = ceil(log(pHashObj->numOfBuckets) / log(2)); if (numOfBits > pHashObj->bits) { // printf("extend the bits from %d to %d, new bucket:%d\n", pHashObj->bits, numOfBits, newBucketId); - ASSERT(numOfBits == pHashObj->bits + 1); + tAssert(numOfBits == pHashObj->bits + 1); pHashObj->bits = numOfBits; } @@ -353,14 +354,14 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data char* pStart = p->data; while (pStart - ((char*)p) < p->num) { SLHashNode* pNode = (SLHashNode*)pStart; - ASSERT(pNode->keyLen > 0); + tAssert(pNode->keyLen > 0); char* k = GET_LHASH_NODE_KEY(pNode); int32_t hashv = pHashObj->hashFn(k, pNode->keyLen); int32_t v1 = doGetBucketIdFromHashVal(hashv, pHashObj->bits); if (v1 != splitBucketId) { // place it into the new bucket - ASSERT(v1 == newBucketId); + tAssert(v1 == newBucketId); // printf("move key:%d to 0x%x bucket, remain items:%d\n", *(int32_t*)k, v1, pBucket->size - 1); SLHashBucket* pNewBucket = pHashObj->pBucket[newBucketId]; @@ -384,7 +385,7 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data } char* tHashGet(SLHashObj* pHashObj, const void* key, size_t keyLen) { - ASSERT(pHashObj != NULL && key != NULL && keyLen > 0); + tAssert(pHashObj != NULL && key != NULL && keyLen > 0); int32_t hashv = pHashObj->hashFn(key, keyLen); int32_t bucketId = doGetBucketIdFromHashVal(hashv, pHashObj->bits); diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 484d917069..04694b0511 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -49,7 +49,7 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { } SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { - ASSERT(fn != NULL); + tAssert(fn != NULL); if (capacity == 0) { capacity = 4; @@ -66,7 +66,7 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { pHashObj->equalFp = memcmp; pHashObj->hashFp = fn; - ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); + tAssert((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *)); if (!pHashObj->hashList) { @@ -214,7 +214,7 @@ static FORCE_INLINE SHNode *doSearchInEntryList(SSHashObj *pHashObj, const void SHNode *pNode = pHashObj->hashList[index]; while (pNode) { const char* p = GET_SHASH_NODE_KEY(pNode, pNode->dataLen); - ASSERT(keyLen > 0); + tAssert(keyLen > 0); if (pNode->keyLen == keyLen && ((*(pHashObj->equalFp))(p, key, keyLen) == 0)) { break; diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 30911887bb..e93aa48a12 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -170,7 +170,7 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf* pBuf, SArray* pAllSource // The value of numOfRows must be greater than 0, which is guaranteed by the previous memory allocation int32_t numOfRows = (getBufPageSize(pBuf) - blockDataGetSerialMetaSize(taosArrayGetSize(pBlock->pDataBlock))) / rowSize; - ASSERT(numOfRows > 0); + tAssert(numOfRows > 0); return blockDataEnsureCapacity(pSource->src.pBlock, numOfRows); } @@ -735,7 +735,7 @@ int32_t tsortOpen(SSortHandle* pHandle) { int32_t numOfSources = taosArrayGetSize(pHandle->pOrderedSource); if (pHandle->pBuf != NULL) { - ASSERT(numOfSources <= getNumOfInMemBufPages(pHandle->pBuf)); + tAssert(numOfSources <= getNumOfInMemBufPages(pHandle->pBuf)); } if (numOfSources == 0) { @@ -808,7 +808,7 @@ STupleHandle* tsortNextTuple(SSortHandle* pHandle) { index = tMergeTreeGetChosenIndex(pHandle->pMergeTree); pSource = pHandle->cmpParam.pSources[index]; - ASSERT(pSource->src.pBlock != NULL); + tAssert(pSource->src.pBlock != NULL); pHandle->tupleHandle.rowIndex = pSource->src.rowIndex; pHandle->tupleHandle.pBlock = pSource->src.pBlock; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 49763d4547..ac8457805c 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1010,7 +1010,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - ASSERT(numOfBins >= 4); + tAssert(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 7854e22691..51c3a02cff 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -506,7 +506,7 @@ static int32_t getNumOfElems(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; if (pInput->colDataSMAIsSet && pInput->totalRows == pInput->numOfRows && !IS_VAR_DATA_TYPE(pInputCol->info.type)) { numOfElem = pInput->numOfRows - pInput->pColumnDataAgg[0]->numOfNull; - ASSERT(numOfElem >= 0); + tAssert(numOfElem >= 0); } else { if (pInputCol->hasNull) { for (int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { @@ -596,7 +596,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { if (pInput->colDataSMAIsSet) { numOfElem = pInput->numOfRows - pAgg->numOfNull; - ASSERT(numOfElem >= 0); + tAssert(numOfElem >= 0); if (IS_SIGNED_NUMERIC_TYPE(type)) { pSumRes->isum += pAgg->sum; @@ -661,7 +661,7 @@ int32_t sumInvertFunction(SqlFunctionCtx* pCtx) { if (pInput->colDataSMAIsSet) { numOfElem = pInput->numOfRows - pAgg->numOfNull; - ASSERT(numOfElem >= 0); + tAssert(numOfElem >= 0); if (IS_SIGNED_NUMERIC_TYPE(type)) { pSumRes->isum -= pAgg->sum; @@ -832,7 +832,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); - ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); + tAssert(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (nullList[j]) { colDataAppendNULL(pDstCol, rowIndex); } else { @@ -873,7 +873,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos) int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; SColumnInfoData* pDstCol = taosArrayGet(pCtx->pDstBlock->pDataBlock, dstSlotId); - ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); + tAssert(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (colDataIsNull_s(pSrcCol, rowIndex) == true) { colDataAppendNULL(pDstCol, pos); @@ -1142,7 +1142,7 @@ static void stddevTransferInfo(SStddevRes* pInput, SStddevRes* pOutput) { int32_t stddevFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SStddevRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -1838,7 +1838,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); @@ -2003,8 +2003,8 @@ static void firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowInde if (!pInfo->hasResult) { pInfo->pos = saveTupleData(pCtx, rowIndex, pSrcBlock, NULL); - ASSERT(pCtx->subsidiaries.buf != NULL); - ASSERT(pCtx->subsidiaries.rowLen > 0); + tAssert(pCtx->subsidiaries.buf != NULL); + tAssert(pCtx->subsidiaries.rowLen > 0); } else { updateTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos); } @@ -2044,7 +2044,7 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) { // All null data column, return directly. if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows)) { - ASSERT(pInputCol->hasNull == true); + tAssert(pInputCol->hasNull == true); // save selectivity value for column consisted of all null values firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); return TSDB_CODE_SUCCESS; @@ -2152,7 +2152,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { // All null data column, return directly. if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows)) { - ASSERT(pInputCol->hasNull == true); + tAssert(pInputCol->hasNull == true); // save selectivity value for column consisted of all null values firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); return TSDB_CODE_SUCCESS; @@ -2315,7 +2315,7 @@ static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, S static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuery) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SFirstLastRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3204,7 +3204,7 @@ static void spreadTransferInfo(SSpreadInfo* pInput, SSpreadInfo* pOutput) { int32_t spreadFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SSpreadInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3383,7 +3383,7 @@ static void elapsedTransferInfo(SElapsedInfo* pInput, SElapsedInfo* pOutput) { int32_t elapsedFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3553,7 +3553,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - ASSERT(numOfBins >= 4); + tAssert(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } @@ -3696,7 +3696,7 @@ static void histogramTransferInfo(SHistoFuncInfo* pInput, SHistoFuncInfo* pOutpu int32_t histogramFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -4881,10 +4881,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { int32_t i = pInput->startRowIndex; if (pCtx->start.key != INT64_MIN) { - // ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || + // tAssert((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC)); - ASSERT(last->key == INT64_MIN); + tAssert(last->key == INT64_MIN); for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index ab64c250e1..2645eff88a 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -316,7 +316,7 @@ bool avgFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { static int32_t calculateAvgBySMAInfo(SAvgRes* pRes, int32_t numOfRows, int32_t type, const SColumnDataAgg* pAgg) { int32_t numOfElem = numOfRows - pAgg->numOfNull; - ASSERT(numOfElem >= 0); + tAssert(numOfElem >= 0); pRes->count += numOfElem; if (IS_SIGNED_NUMERIC_TYPE(type)) { @@ -653,7 +653,7 @@ static void avgTransferInfo(SAvgRes* pInput, SAvgRes* pOutput) { int32_t avgFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); + tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); SAvgRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index b2cb36cba0..9e467747e1 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -720,7 +720,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { // data in current data block are qualified to the query if (pInput->colDataSMAIsSet) { numOfElems = pInput->numOfRows - pAgg->numOfNull; - ASSERT(pInput->numOfRows == pInput->totalRows && numOfElems >= 0); + tAssert(pInput->numOfRows == pInput->totalRows && numOfElems >= 0); if (numOfElems == 0) { goto _over; @@ -826,7 +826,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { } if (i >= end) { - ASSERT(numOfElems == 0); + tAssert(numOfElems == 0); goto _over; } diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index e5727f1472..a4c341d6d0 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -22,6 +22,7 @@ #include "tpagedbuf.h" #include "tpercentile.h" #include "ttypes.h" +#include "tlog.h" #define DEFAULT_NUM_OF_SLOT 1024 @@ -495,7 +496,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction) int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times - 1); SArray* list = taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId)); - ASSERT(list != NULL && list->size > 0); + tAssert(list != NULL && list->size > 0); for (int32_t f = 0; f < list->size; ++f) { SPageInfo *pgInfo = *(SPageInfo **)taosArrayGet(list, f); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 2f3db636c8..060101f596 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -392,7 +392,7 @@ void udfdProcessTeardownRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { SUdfdRpcSendRecvInfo *msgInfo = (SUdfdRpcSendRecvInfo *)pMsg->info.ahandle; - ASSERT(pMsg->info.ahandle != NULL); + tAssert(pMsg->info.ahandle != NULL); if (pEpSet) { if (!isEpsetEqual(&global.mgmtEp.epSet, pEpSet)) { diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 73cedfeb3d..9ca2766f25 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -80,7 +80,7 @@ static int32_t rowDataComparStable(const void* lhs, const void* rhs) { int32_t insGetExtendedRowSize(STableDataBlocks* pBlock) { STableComInfo* pTableInfo = &pBlock->pTableMeta->tableInfo; - ASSERT(pBlock->rowSize == pTableInfo->rowSize); + tAssert(pBlock->rowSize == pTableInfo->rowSize); return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); } @@ -98,7 +98,7 @@ void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo* spd, col_id_t i *colIdx = idx; } } else { - ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); + tAssert(idx == (spd->colIdxInfo + idx)->boundIdx); schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; if (TD_IS_TP_ROW_T(rowType)) { *toffset = (spd->cols + schemaIdx)->toffset; @@ -409,7 +409,7 @@ static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { if (pBlkRowMerger && (pBlkRowMerger->index >= 0)) { - ASSERT(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); + tAssert(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); return *(void**)taosArrayGet(pBlkRowMerger->rowArray, pBlkRowMerger->index); } return NULL; @@ -417,9 +417,9 @@ static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp, int32_t nDupRows, SBlockRowMerger** pBlkRowMerger, int32_t rowSize) { - ASSERT(nDupRows > 1); + tAssert(nDupRows > 1); SBlockKeyTuple* pStartKeyTp = pEndKeyTp - (nDupRows - 1); - ASSERT(pStartKeyTp->skey == pEndKeyTp->skey); + tAssert(pStartKeyTp->skey == pEndKeyTp->skey); // TODO: optimization if end row is all normal #if 0 @@ -583,7 +583,7 @@ static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* p } if ((j - i) > 1) { - ASSERT((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); + tAssert((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { return TSDB_CODE_FAILED; } @@ -651,7 +651,7 @@ int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return ret; } - ASSERT(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); + tAssert(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); // the maximum expanded size in byte when a row-wise data is converted to SDataRow format int64_t destSize = dataBuf->size + pOneTableBlock->size + sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + @@ -680,7 +680,7 @@ int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return code; } - ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); + tAssert(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); // erase the empty space reserved for binary data int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple); @@ -729,7 +729,7 @@ int32_t insAllocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { } int32_t insInitRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { - ASSERT(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); + tAssert(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); tdSRowInit(pBuilder, schemaVer); tdSRowSetExtendedInfo(pBuilder, pColInfo->numOfCols, pColInfo->numOfBound, pColInfo->flen, pColInfo->allNullLen, pColInfo->boundNullLen); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index c5db4105d7..15916f1d79 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -147,7 +147,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { size_t numOfResBlock = taosArrayGetSize(pResList); for (int32_t j = 0; j < numOfResBlock; ++j) { SSDataBlock *pRes = taosArrayGetP(pResList, j); - ASSERT(pRes->info.rows > 0); + tAssert(pRes->info.rows > 0); SInputData inputData = {.pData = pRes}; code = dsPutDataBlock(sinkHandle, &inputData, &qcontinue); diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index e3436c83c1..870e094ea3 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -327,7 +327,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t case QUERY_NODE_VALUE: { SValueNode *valueNode = (SValueNode *)node; - ASSERT(param->columnData == NULL); + tAssert(param->columnData == NULL); param->numOfRows = 1; int32_t code = sclCreateColumnInfoData(&valueNode->node.resType, 1, param); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 08b04bb8ad..9e9c9d79f9 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -361,7 +361,7 @@ static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarP SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; - ASSERT(pOutputData->info.type == TSDB_DATA_TYPE_BIGINT); + tAssert(pOutputData->info.type == TSDB_DATA_TYPE_BIGINT); int64_t *out = (int64_t *)pOutputData->pData; for (int32_t i = 0; i < pInput->numOfRows; ++i) { @@ -1729,37 +1729,37 @@ bool getTimePseudoFuncEnv(SFunctionNode *UNUSED_PARAM(pFunc), SFuncExecEnv *pEnv } int32_t qStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 0)); return TSDB_CODE_SUCCESS; } int32_t qEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 1)); return TSDB_CODE_SUCCESS; } int32_t winDurFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 2)); return TSDB_CODE_SUCCESS; } int32_t winStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 3)); return TSDB_CODE_SUCCESS; } int32_t winEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 4)); return TSDB_CODE_SUCCESS; } int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - ASSERT(inputNum == 1); + tAssert(inputNum == 1); char* p = colDataGetVarData(pInput->columnData, 0); colDataAppendNItems(pOutput->columnData, pOutput->numOfRows, p, pInput->numOfRows); @@ -2771,7 +2771,7 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - ASSERT(numOfBins >= 4); + tAssert(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 89f1abc1d8..dc26e17804 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -132,7 +132,7 @@ int64_t getVectorBigintValue_DOUBLE(void *src, int32_t index) { return (int64_t) int64_t getVectorBigintValue_BOOL(void *src, int32_t index) { return (int64_t) * ((bool *)src + index); } int64_t getVectorBigintValue_JSON(void *src, int32_t index) { - ASSERT(!colDataIsNull_var(((SColumnInfoData *)src), index)); + tAssert(!colDataIsNull_var(((SColumnInfoData *)src), index)); char *data = colDataGetVarData((SColumnInfoData *)src, index); double out = 0; if (*data == TSDB_DATA_TYPE_NULL) { @@ -384,11 +384,11 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { } else if (IS_FLOAT_TYPE(pCtx->outType)) { func = varToFloat; } else if (pCtx->outType == TSDB_DATA_TYPE_BINARY) { // nchar -> binary - ASSERT(pCtx->inType == TSDB_DATA_TYPE_NCHAR); + tAssert(pCtx->inType == TSDB_DATA_TYPE_NCHAR); func = ncharToVar; vton = true; } else if (pCtx->outType == TSDB_DATA_TYPE_NCHAR) { // binary -> nchar - ASSERT(pCtx->inType == TSDB_DATA_TYPE_VARCHAR); + tAssert(pCtx->inType == TSDB_DATA_TYPE_VARCHAR); func = varToNchar; vton = true; } else if (TSDB_DATA_TYPE_TIMESTAMP == pCtx->outType) { @@ -434,7 +434,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { memcpy(tmp, varDataVal(data), varDataLen(data)); tmp[varDataLen(data)] = 0; } else if (TSDB_DATA_TYPE_NCHAR == convertType) { - ASSERT(varDataLen(data) <= bufSize); + tAssert(varDataLen(data) <= bufSize); int len = taosUcs4ToMbs((TdUcs4 *)varDataVal(data), varDataLen(data), tmp); if (len < 0) { @@ -668,7 +668,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, } if (overflow) { - ASSERT(1 == pIn->numOfRows); + tAssert(1 == pIn->numOfRows); pOut->numOfRows = 0; @@ -1429,7 +1429,7 @@ void vectorAssign(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, } } - ASSERT(pRight->numOfQualified == 1 || pRight->numOfQualified == 0); + tAssert(pRight->numOfQualified == 1 || pRight->numOfQualified == 0); pOut->numOfQualified = pRight->numOfQualified * pOut->numOfRows; } diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index dae26d3d58..c176306545 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -94,7 +94,7 @@ void scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *s res->info.capacity = rows; res->info.rows = rows; SColumnInfoData *p = static_cast(taosArrayGet(res->pDataBlock, 0)); - ASSERT(p->pData != NULL && p->nullbitmap != NULL); + tAssert(p->pData != NULL && p->nullbitmap != NULL); taosArrayPush(pBlockList, &res); *dataBlockId = taosArrayGetSize(pBlockList) - 1; diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 4869ecf6de..4f5f918a5c 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -82,7 +82,7 @@ void streamSchedByTimer(void* param, void* tmrId) { int32_t streamSetupTrigger(SStreamTask* pTask) { if (pTask->triggerParam != 0) { int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); - ASSERT(ref == 2); + tAssert(ref == 2); pTask->timer = taosTmrStart(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer); pTask->triggerStatus = TASK_TRIGGER_STATUS__INACTIVE; } @@ -210,7 +210,7 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S } int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code) { - ASSERT(pRsp->inputStatus == TASK_OUTPUT_STATUS__NORMAL || pRsp->inputStatus == TASK_OUTPUT_STATUS__BLOCKED); + tAssert(pRsp->inputStatus == TASK_OUTPUT_STATUS__NORMAL || pRsp->inputStatus == TASK_OUTPUT_STATUS__BLOCKED); qDebug("task %d receive dispatch rsp, code: %x", pTask->taskId, code); @@ -221,7 +221,7 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i } int8_t old = atomic_exchange_8(&pTask->outputStatus, pRsp->inputStatus); - ASSERT(old == TASK_OUTPUT_STATUS__WAIT); + tAssert(old == TASK_OUTPUT_STATUS__WAIT); if (pRsp->inputStatus == TASK_INPUT_STATUS__BLOCKED) { // TODO: init recover timer tAssert(0); @@ -248,7 +248,7 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, S streamTaskEnqueueRetrieve(pTask, pReq, pRsp); - ASSERT(pTask->taskLevel != TASK_LEVEL__SINK); + tAssert(pTask->taskLevel != TASK_LEVEL__SINK); streamSchedExec(pTask); /*streamTryExec(pTask);*/ diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index 627fca21d1..cc11232493 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -125,7 +125,7 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask, int64_t checkpointId, i pTask->checkpointAlignCnt = taosArrayGetSize(pTask->childEpInfo); } - ASSERT(pTask->checkpointingId == checkpointId); + tAssert(pTask->checkpointingId == checkpointId); return atomic_sub_fetch_32(&pTask->checkpointAlignCnt, 1); } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index 2fea5b9eca..ab441e5e44 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -23,8 +23,8 @@ int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock } taosArraySetSize(pArray, blockNum); - ASSERT(pReq->blockNum == taosArrayGetSize(pReq->data)); - ASSERT(pReq->blockNum == taosArrayGetSize(pReq->dataLen)); + tAssert(pReq->blockNum == taosArrayGetSize(pReq->data)); + tAssert(pReq->blockNum == taosArrayGetSize(pReq->dataLen)); for (int32_t i = 0; i < blockNum; i++) { SRetrieveTableRsp* pRetrieve = taosArrayGetP(pReq->data, i); @@ -118,7 +118,7 @@ SStreamDataSubmit* streamSubmitRefClone(SStreamDataSubmit* pSubmit) { void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1); - ASSERT(ref >= 0); + tAssert(ref >= 0); if (ref == 0) { taosMemoryFree(pDataSubmit->data); taosMemoryFree(pDataSubmit->dataRef); @@ -126,7 +126,7 @@ void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { } SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) { - ASSERT(elem); + tAssert(elem); if (dst->type == STREAM_INPUT__DATA_BLOCK && elem->type == STREAM_INPUT__DATA_BLOCK) { SStreamDataBlock* pBlock = (SStreamDataBlock*)dst; SStreamDataBlock* pBlockSrc = (SStreamDataBlock*)elem; @@ -142,7 +142,7 @@ SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* return dst; } else if (dst->type == STREAM_INPUT__DATA_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) { SStreamMergedSubmit* pMerged = streamMergedSubmitNew(); - ASSERT(pMerged); + tAssert(pMerged); streamMergeSubmit(pMerged, (SStreamDataSubmit*)dst); streamMergeSubmit(pMerged, (SStreamDataSubmit*)elem); taosFreeQitem(dst); @@ -170,7 +170,7 @@ void streamFreeQitem(SStreamQueueItem* data) { for (int32_t i = 0; i < sz; i++) { int32_t* pRef = taosArrayGetP(pMerge->dataRefs, i); int32_t ref = atomic_sub_fetch_32(pRef, 1); - ASSERT(ref >= 0); + tAssert(ref >= 0); if (ref == 0) { void* dataStr = taosArrayGetP(pMerge->reqs, i); taosMemoryFree(dataStr); @@ -184,7 +184,7 @@ void streamFreeQitem(SStreamQueueItem* data) { SStreamRefDataBlock* pRefBlock = (SStreamRefDataBlock*)data; int32_t ref = atomic_sub_fetch_32(pRefBlock->dataRef, 1); - ASSERT(ref >= 0); + tAssert(ref >= 0); if (ref == 0) { blockDataDestroy(pRefBlock->pBlock); taosMemoryFree(pRefBlock->dataRef); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 0ef8cce84e..dffdfbaeb2 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -24,8 +24,8 @@ int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* p if (tEncodeI32(pEncoder, pReq->upstreamChildId) < 0) return -1; if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1; if (tEncodeI32(pEncoder, pReq->blockNum) < 0) return -1; - ASSERT(taosArrayGetSize(pReq->data) == pReq->blockNum); - ASSERT(taosArrayGetSize(pReq->dataLen) == pReq->blockNum); + tAssert(taosArrayGetSize(pReq->data) == pReq->blockNum); + tAssert(taosArrayGetSize(pReq->dataLen) == pReq->blockNum); for (int32_t i = 0; i < pReq->blockNum; i++) { int32_t len = *(int32_t*)taosArrayGet(pReq->dataLen, i); void* data = taosArrayGetP(pReq->data, i); @@ -45,7 +45,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { if (tDecodeI32(pDecoder, &pReq->upstreamChildId) < 0) return -1; if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1; if (tDecodeI32(pDecoder, &pReq->blockNum) < 0) return -1; - ASSERT(pReq->blockNum > 0); + tAssert(pReq->blockNum > 0); pReq->data = taosArrayInit(pReq->blockNum, sizeof(void*)); pReq->dataLen = taosArrayInit(pReq->blockNum, sizeof(int32_t)); for (int32_t i = 0; i < pReq->blockNum; i++) { @@ -54,7 +54,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { void* data; if (tDecodeI32(pDecoder, &len1) < 0) return -1; if (tDecodeBinaryAlloc(pDecoder, &data, &len2) < 0) return -1; - ASSERT(len1 == len2); + tAssert(len1 == len2); taosArrayPush(pReq->dataLen, &len1); taosArrayPush(pReq->data, &data); } @@ -129,7 +129,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) }; int32_t sz = taosArrayGetSize(pTask->childEpInfo); - ASSERT(sz > 0); + tAssert(sz > 0); for (int32_t i = 0; i < sz; i++) { req.reqId = tGenIdPI64(); SStreamChildEpInfo* pEpInfo = taosArrayGetP(pTask->childEpInfo, i); @@ -201,7 +201,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); - ASSERT(actualLen <= dataStrLen); + tAssert(actualLen <= dataStrLen); taosArrayPush(pReq->dataLen, &actualLen); taosArrayPush(pReq->data, &buf); @@ -357,7 +357,7 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S int32_t j; for (j = 0; j < vgSz; j++) { SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, j); - ASSERT(pVgInfo->vgId > 0); + tAssert(pVgInfo->vgId > 0); if (hashValue >= pVgInfo->hashBegin && hashValue <= pVgInfo->hashEnd) { if (streamAddBlockToDispatchMsg(pDataBlock, &pReqs[j]) < 0) { return -1; @@ -370,14 +370,14 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S break; } } - ASSERT(found); + tAssert(found); return 0; } int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pData) { int32_t code = -1; int32_t blockNum = taosArrayGetSize(pData->blocks); - ASSERT(blockNum != 0); + tAssert(blockNum != 0); if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) { SStreamDispatchReq req = { @@ -421,7 +421,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { int32_t rspCnt = atomic_load_32(&pTask->shuffleDispatcher.waitingRspCnt); - ASSERT(rspCnt == 0); + tAssert(rspCnt == 0); SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos; int32_t vgSz = taosArrayGetSize(vgInfo); @@ -494,7 +494,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } int32_t streamDispatch(SStreamTask* pTask) { - ASSERT(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH); + tAssert(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH); int8_t old = atomic_val_compare_exchange_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL, TASK_OUTPUT_STATUS__WAIT); @@ -508,7 +508,7 @@ int32_t streamDispatch(SStreamTask* pTask) { atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); return 0; } - ASSERT(pBlock->type == STREAM_INPUT__DATA_BLOCK); + tAssert(pBlock->type == STREAM_INPUT__DATA_BLOCK); qDebug("stream dispatching: task %d", pTask->taskId); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index ad8fc1399c..f2ceb83dc2 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -25,7 +25,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* const SStreamTrigger* pTrigger = (const SStreamTrigger*)data; qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) { - ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE); + tAssert(pTask->taskLevel == TASK_LEVEL__SOURCE); const SStreamDataSubmit* pSubmit = (const SStreamDataSubmit*)data; qDebug("task %d %p set submit input %p %p %d 1", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef); qSetMultiStreamInput(exec, pSubmit->data, 1, STREAM_INPUT__DATA_SUBMIT); @@ -51,7 +51,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { - /*ASSERT(false);*/ + /*tAssert(false);*/ qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId, terrstr()); } @@ -59,7 +59,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* if (pItem->type == STREAM_INPUT__DATA_RETRIEVE) { SSDataBlock block = {0}; const SStreamDataBlock* pRetrieveBlock = (const SStreamDataBlock*)data; - ASSERT(taosArrayGetSize(pRetrieveBlock->blocks) == 1); + tAssert(taosArrayGetSize(pRetrieveBlock->blocks) == 1); assignOneDataBlock(&block, taosArrayGet(pRetrieveBlock->blocks, 0)); block.info.type = STREAM_PULL_OVER; block.info.childId = pTask->selfChildId; @@ -89,7 +89,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* } int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { - ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE); + tAssert(pTask->taskLevel == TASK_LEVEL__SOURCE); void* exec = pTask->exec.executor; @@ -171,7 +171,7 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) { } if (pTask->taskLevel == TASK_LEVEL__SINK) { - ASSERT(((SStreamQueueItem*)pItem)->type == STREAM_INPUT__DATA_BLOCK); + tAssert(((SStreamQueueItem*)pItem)->type == STREAM_INPUT__DATA_BLOCK); streamTaskOutput(pTask, (SStreamDataBlock*)pItem); } @@ -222,7 +222,7 @@ int32_t streamExecForAll(SStreamTask* pTask) { } if (pTask->taskLevel == TASK_LEVEL__SINK) { - ASSERT(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK); + tAssert(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK); streamTaskOutput(pTask, input); continue; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 3f915eff42..04f687e75e 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -167,7 +167,7 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) { SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId) { SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t)); if (ppTask) { - ASSERT((*ppTask)->taskId == taskId); + tAssert((*ppTask)->taskId == taskId); return *ppTask; } else { return NULL; @@ -195,9 +195,9 @@ SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId) { void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask) { int32_t left = atomic_sub_fetch_32(&pTask->refCnt, 1); - ASSERT(left >= 0); + tAssert(left >= 0); if (left == 0) { - ASSERT(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING); + tAssert(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING); tFreeSStreamTask(pTask); } } diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index fed90ad371..ebfc455a10 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -140,7 +140,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* } if (!found) return -1; int32_t left = atomic_sub_fetch_32(&pTask->recoverTryingDownstream, 1); - ASSERT(left >= 0); + tAssert(left >= 0); if (left == 0) { taosArrayDestroy(pTask->checkReqIds); streamTaskLaunchRecover(pTask, version); @@ -247,7 +247,7 @@ int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask) { int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId) { if (pTask->taskLevel == TASK_LEVEL__AGG) { int32_t left = atomic_sub_fetch_32(&pTask->recoverWaitingUpstream, 1); - ASSERT(left >= 0); + tAssert(left >= 0); if (left == 0) { streamAggChildrenRecoverFinish(pTask); } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index af1d738de0..3ee6e6c27e 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -657,7 +657,7 @@ int32_t streamStateSessionClear(SStreamState* pState) { int32_t size = 0; int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); if (code == 0) { - ASSERT(size > 0); + tAssert(size > 0); memset(buf, 0, size); streamStateSessionPut(pState, &delKey, buf, size); } else { diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 1ce4a35dff..3361e5946c 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -301,7 +301,7 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) { } int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) { - ASSERT(pInfo); + tAssert(pInfo); SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); if (tStartEncode(&encoder) < 0) return -1; @@ -352,7 +352,7 @@ int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) } int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { - ASSERT(pInfo); + tAssert(pInfo); SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; @@ -394,7 +394,7 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { if (tDecodeI64(&decoder, &ts) < 0) return -1; taosHashPut(pInfo->pMap, &uid, sizeof(uint64_t), &ts, sizeof(TSKEY)); } - ASSERT(mapSize == taosHashGetSize(pInfo->pMap)); + tAssert(mapSize == taosHashGetSize(pInfo->pMap)); if (tDecodeI64(&decoder, &pInfo->scanWindow.skey) < 0) return -1; if (tDecodeI64(&decoder, &pInfo->scanWindow.ekey) < 0) return -1; diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index 1dc6905b88..47251c8587 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -117,10 +117,10 @@ int32_t syncNodeFollowerCommit(SSyncNode* ths, SyncIndex newCommitIndex) { // call back Wal int32_t code = ths->pLogStore->syncLogUpdateCommitIndex(ths->pLogStore, ths->commitIndex); - ASSERT(code == 0); + tAssert(code == 0); code = syncNodeDoCommit(ths, beginIndex, endIndex, ths->state); - ASSERT(code == 0); + tAssert(code == 0); } } @@ -134,7 +134,7 @@ SSyncRaftEntry* syncLogAppendEntriesToRaftEntry(const SyncAppendEntries* pMsg) { return NULL; } (void)memcpy(pEntry, pMsg->data, pMsg->dataLen); - ASSERT(pEntry->bytes == pMsg->dataLen); + tAssert(pEntry->bytes == pMsg->dataLen); return pEntry; } @@ -280,7 +280,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { if (pMsg->prevLogIndex >= startIndex) { SyncTerm myPreLogTerm = syncNodeGetPreTerm(ths, pMsg->prevLogIndex + 1); - // ASSERT(myPreLogTerm != SYNC_TERM_INVALID); + // tAssert(myPreLogTerm != SYNC_TERM_INVALID); if (myPreLogTerm == SYNC_TERM_INVALID) { syncLogRecvAppendEntries(ths, pMsg, "reject, pre-term invalid"); goto _SEND_RESPONSE; @@ -297,7 +297,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { bool hasAppendEntries = pMsg->dataLen > 0; if (hasAppendEntries) { SSyncRaftEntry* pAppendEntry = syncEntryBuildFromAppendEntries(pMsg); - ASSERT(pAppendEntry != NULL); + tAssert(pAppendEntry != NULL); SyncIndex appendIndex = pMsg->prevLogIndex + 1; @@ -352,7 +352,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { goto _IGNORE; } - ASSERT(pAppendEntry->index == appendIndex); + tAssert(pAppendEntry->index == appendIndex); // append code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 524abf3c2a..9ff02199b7 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -62,7 +62,7 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return -1; } - ASSERT(pMsg->term == ths->pRaftStore->currentTerm); + tAssert(pMsg->term == ths->pRaftStore->currentTerm); sTrace("vgId:%d received append entries reply. srcId:0x%016" PRIx64 ", term:%" PRId64 ", matchIndex:%" PRId64 "", pMsg->vgId, pMsg->srcId.addr, pMsg->term, pMsg->matchIndex); @@ -112,7 +112,7 @@ int32_t syncNodeOnAppendEntriesReplyOld(SSyncNode* ths, SyncAppendEntriesReply* return -1; } - ASSERT(pMsg->term == ths->pRaftStore->currentTerm); + tAssert(pMsg->term == ths->pRaftStore->currentTerm); if (pMsg->success) { SyncIndex oldMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId)); @@ -135,7 +135,7 @@ int32_t syncNodeOnAppendEntriesReplyOld(SSyncNode* ths, SyncAppendEntriesReply* // send next append entries SPeerState* pState = syncNodeGetPeerState(ths, &(pMsg->srcId)); - ASSERT(pState != NULL); + tAssert(pState != NULL); if (pMsg->lastSendIndex == pState->lastSendIndex) { int64_t timeNow = taosGetTimestampMs(); diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index 07b1101256..7d73a72272 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -84,7 +84,7 @@ void syncOneReplicaAdvance(SSyncNode* pSyncNode) { } void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { - ASSERT(false && "deprecated"); + tAssert(false && "deprecated"); if (pSyncNode == NULL) { sError("pSyncNode is NULL"); return; @@ -202,8 +202,8 @@ bool syncAgreeIndex(SSyncNode* pSyncNode, SRaftId* pRaftId, SyncIndex index) { } static inline int64_t syncNodeAbs64(int64_t a, int64_t b) { - ASSERT(a >= 0); - ASSERT(b >= 0); + tAssert(a >= 0); + tAssert(b >= 0); int64_t c = a > b ? a - b : b - a; return c; @@ -262,7 +262,7 @@ int32_t syncNodeDynamicQuorum(const SSyncNode* pSyncNode) { quorum += addQuorum; } - ASSERT(quorum <= pSyncNode->replicaNum); + tAssert(quorum <= pSyncNode->replicaNum); if (quorum < pSyncNode->quorum) { quorum = pSyncNode->quorum; @@ -290,7 +290,7 @@ bool syncAgree(SSyncNode* pSyncNode, SyncIndex index) { bool syncNodeAgreedUpon(SSyncNode* pNode, SyncIndex index) { int count = 0; SSyncIndexMgr* pMatches = pNode->pMatchIndex; - ASSERT(pNode->replicaNum == pMatches->replicaNum); + tAssert(pNode->replicaNum == pMatches->replicaNum); for (int i = 0; i < pNode->replicaNum; i++) { SyncIndex matchIndex = pMatches->index[i]; diff --git a/source/libs/sync/src/syncElection.c b/source/libs/sync/src/syncElection.c index 8d548114fb..39916e1905 100644 --- a/source/libs/sync/src/syncElection.c +++ b/source/libs/sync/src/syncElection.c @@ -43,7 +43,7 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) { for (int i = 0; i < pNode->peersNum; ++i) { SRpcMsg rpcMsg = {0}; ret = syncBuildRequestVote(&rpcMsg, pNode->vgId); - ASSERT(ret == 0); + tAssert(ret == 0); SyncRequestVote* pMsg = rpcMsg.pCont; pMsg->srcId = pNode->myRaftId; @@ -51,10 +51,10 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) { pMsg->term = pNode->pRaftStore->currentTerm; ret = syncNodeGetLastIndexTerm(pNode, &pMsg->lastLogIndex, &pMsg->lastLogTerm); - ASSERT(ret == 0); + tAssert(ret == 0); ret = syncNodeSendMsgById(&pNode->peersId[i], pNode, &rpcMsg); - ASSERT(ret == 0); + tAssert(ret == 0); } return ret; @@ -83,7 +83,7 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) { syncNodeVoteForSelf(pSyncNode); if (voteGrantedMajority(pSyncNode->pVotesGranted)) { // only myself, to leader - ASSERT(!pSyncNode->pVotesGranted->toLeader); + tAssert(!pSyncNode->pVotesGranted->toLeader); syncNodeCandidate2Leader(pSyncNode); pSyncNode->pVotesGranted->toLeader = true; return ret; @@ -102,7 +102,7 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) { } ret = syncNodeRequestVotePeers(pSyncNode); - ASSERT(ret == 0); + tAssert(ret == 0); syncNodeResetElectTimer(pSyncNode); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 59e5e968e7..e2887f7b12 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -571,7 +571,7 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho if (pSyncNode == NULL) { return -1; } - ASSERT(rid == pSyncNode->rid); + tAssert(rid == pSyncNode->rid); SSyncRaftEntry* pEntry = NULL; int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry); @@ -582,7 +582,7 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho syncNodeRelease(pSyncNode); return -1; } - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); pSnapshot->data = NULL; pSnapshot->lastApplyIndex = index; @@ -599,7 +599,7 @@ int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta) { if (pSyncNode == NULL) { return -1; } - ASSERT(rid == pSyncNode->rid); + tAssert(rid == pSyncNode->rid); sMeta->lastConfigIndex = pSyncNode->pRaftCfg->lastConfigIndex; sTrace("vgId:%d, get snapshot meta, lastConfigIndex:%" PRId64, pSyncNode->vgId, pSyncNode->pRaftCfg->lastConfigIndex); @@ -613,9 +613,9 @@ int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct if (pSyncNode == NULL) { return -1; } - ASSERT(rid == pSyncNode->rid); + tAssert(rid == pSyncNode->rid); - ASSERT(pSyncNode->pRaftCfg->configIndexCount >= 1); + tAssert(pSyncNode->pRaftCfg->configIndexCount >= 1); SyncIndex lastIndex = (pSyncNode->pRaftCfg->configIndexArr)[0]; for (int32_t i = 0; i < pSyncNode->pRaftCfg->configIndexCount; ++i) { @@ -634,7 +634,7 @@ int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct #endif SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex) { - ASSERT(pSyncNode->pRaftCfg->configIndexCount >= 1); + tAssert(pSyncNode->pRaftCfg->configIndexCount >= 1); SyncIndex lastIndex = (pSyncNode->pRaftCfg->configIndexArr)[0]; for (int32_t i = 0; i < pSyncNode->pRaftCfg->configIndexCount; ++i) { @@ -791,9 +791,9 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { } int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) { - ASSERT(pNode->pLogStore != NULL && "log store not created"); - ASSERT(pNode->pFsm != NULL && "pFsm not registered"); - ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); + tAssert(pNode->pLogStore != NULL && "log store not created"); + tAssert(pNode->pFsm != NULL && "pFsm not registered"); + tAssert(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { sError("vgId:%d, failed to get snapshot info since %s", pNode->vgId, terrstr()); @@ -1069,7 +1069,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // snapshot senders for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i); - // ASSERT(pSender != NULL); + // tAssert(pSender != NULL); (pSyncNode->senders)[i] = pSender; sSTrace(pSender, "snapshot sender create new while open, data:%p", pSender); } @@ -1136,7 +1136,7 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { SSnapshot snapshot; int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - ASSERT(code == 0); + tAssert(code == 0); if (snapshot.lastApplyIndex > pSyncNode->commitIndex) { pSyncNode->commitIndex = snapshot.lastApplyIndex; } @@ -1144,8 +1144,8 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { } int32_t syncNodeRestore(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->pLogStore != NULL && "log store not created"); - ASSERT(pSyncNode->pLogBuf != NULL && "ring log buffer not created"); + tAssert(pSyncNode->pLogStore != NULL && "log store not created"); + tAssert(pSyncNode->pLogBuf != NULL && "ring log buffer not created"); SyncIndex lastVer = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); SyncIndex commitIndex = pSyncNode->pLogStore->syncLogCommitIndex(pSyncNode->pLogStore); @@ -1157,7 +1157,7 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) { return -1; } - ASSERT(endIndex == lastVer + 1); + tAssert(endIndex == lastVer + 1); commitIndex = TMAX(pSyncNode->commitIndex, commitIndex); if (syncLogBufferCommit(pSyncNode->pLogBuf, pSyncNode, commitIndex) < 0) { @@ -1181,7 +1181,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode) { int32_t ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } @@ -1201,7 +1201,7 @@ void syncNodeStartOld(SSyncNode* pSyncNode) { int32_t ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - ASSERT(ret == 0); + tAssert(ret == 0); } int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { @@ -1212,11 +1212,11 @@ int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { // reset elect timer, long enough int32_t electMS = TIMER_MAX_MS; int32_t ret = syncNodeRestartElectTimer(pSyncNode, electMS); - ASSERT(ret == 0); + tAssert(ret == 0); ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } @@ -1255,7 +1255,7 @@ void syncNodeClose(SSyncNode* pSyncNode) { sNInfo(pSyncNode, "sync close, node:%p", pSyncNode); int32_t ret = raftStoreClose(pSyncNode->pRaftStore); - ASSERT(ret == 0); + tAssert(ret == 0); pSyncNode->pRaftStore = NULL; syncNodeLogReplMgrDestroy(pSyncNode); @@ -1498,7 +1498,7 @@ inline bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) { } } - ASSERT(b1 == b2); + tAssert(b1 == b2); return b1; } @@ -1812,7 +1812,7 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { SyncIndex lastIndex; SyncTerm lastTerm; int32_t code = syncNodeGetLastIndexTerm(pSyncNode, &lastIndex, &lastTerm); - ASSERT(code == 0); + tAssert(code == 0); pSyncNode->pNextIndex->index[i] = lastIndex + 1; } @@ -1868,8 +1868,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { } void syncNodeCandidate2Leader(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); - ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted)); + tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + tAssert(voteGrantedMajority(pSyncNode->pVotesGranted)); syncNodeBecomeLeader(pSyncNode, "candidate to leader"); sNTrace(pSyncNode, "state change syncNodeCandidate2Leader"); @@ -1880,14 +1880,14 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) { } SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - ASSERT(lastIndex >= 0); + tAssert(lastIndex >= 0); sInfo("vgId:%d, become leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64 "", pSyncNode->vgId, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, lastIndex); } void syncNodeCandidate2LeaderOld(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); - ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted)); + tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + tAssert(voteGrantedMajority(pSyncNode->pVotesGranted)); syncNodeBecomeLeader(pSyncNode, "candidate to leader"); // Raft 3.6.2 Committing entries from previous terms @@ -1911,7 +1911,7 @@ int32_t syncNodePeerStateInit(SSyncNode* pSyncNode) { } void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER); + tAssert(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER); pSyncNode->state = TAOS_SYNC_STATE_CANDIDATE; SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become candidate from follower. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1921,7 +1921,7 @@ void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { } void syncNodeLeader2Follower(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER); + tAssert(pSyncNode->state == TAOS_SYNC_STATE_LEADER); syncNodeBecomeFollower(pSyncNode, "leader to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become follower from leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1931,7 +1931,7 @@ void syncNodeLeader2Follower(SSyncNode* pSyncNode) { } void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); syncNodeBecomeFollower(pSyncNode, "candidate to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become follower from candidate. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1943,8 +1943,8 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { // just called by syncNodeVoteForSelf // need assert void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId) { - ASSERT(term == pSyncNode->pRaftStore->currentTerm); - ASSERT(!raftStoreHasVoted(pSyncNode->pRaftStore)); + tAssert(term == pSyncNode->pRaftStore->currentTerm); + tAssert(!raftStoreHasVoted(pSyncNode->pRaftStore)); raftStoreVote(pSyncNode->pRaftStore, pRaftId); } @@ -2084,7 +2084,7 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { .lastConfigIndex = SYNC_INDEX_INVALID}; if (code == 0) { - ASSERT(pPreEntry != NULL); + tAssert(pPreEntry != NULL); preTerm = pPreEntry->term; if (h) { @@ -2453,7 +2453,7 @@ static int32_t syncNodeAppendNoopOld(SSyncNode* ths) { SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); SyncTerm term = ths->pRaftStore->currentTerm; SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId); - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); LRUHandle* h = NULL; @@ -2663,7 +2663,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn int32_t code = syncNodeAppend(ths, pEntry); if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - ASSERT(false && "failed to append blocking msg"); + tAssert(false && "failed to append blocking msg"); } return code; } @@ -2819,7 +2819,7 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p // reset elect timer now! int32_t electMS = 1; int32_t ret = syncNodeRestartElectTimer(ths, electMS); - ASSERT(ret == 0); + tAssert(ret == 0); sNTrace(ths, "maybe leader transfer to %s:%d %" PRId64, pSyncLeaderTransfer->newNodeInfo.nodeFqdn, pSyncLeaderTransfer->newNodeInfo.nodePort, pSyncLeaderTransfer->newLeaderId.addr); @@ -2865,7 +2865,7 @@ bool syncNodeIsOptimizedOneReplica(SSyncNode* ths, SRpcMsg* pMsg) { } int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, uint64_t flag) { - ASSERT(false); + tAssert(false); if (beginIndex > endIndex) { return 0; } @@ -2909,8 +2909,8 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde sNTrace(ths, "miss cache index:%" PRId64, i); code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry); - // ASSERT(code == 0); - // ASSERT(pEntry != NULL); + // tAssert(code == 0); + // tAssert(pEntry != NULL); if (code != 0 || pEntry == NULL) { sNError(ths, "get log entry error"); sFatal("vgId:%d, get log entry %" PRId64 " error when commit since %s", ths->vgId, i, terrstr()); @@ -2957,7 +2957,7 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde // leader transfer if (pEntry->originalRpcType == TDMT_SYNC_LEADER_TRANSFER) { code = syncDoLeaderTransfer(ths, &rpcMsg, pEntry); - ASSERT(code == 0); + tAssert(code == 0); } #endif diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 5d6905f99e..4a69b263a4 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -43,15 +43,15 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt goto _out; } - ASSERT(index == pBuf->endIndex); + tAssert(index == pBuf->endIndex); SSyncRaftEntry* pExist = pBuf->entries[index % pBuf->size].pItem; - ASSERT(pExist == NULL); + tAssert(pExist == NULL); // initial log buffer with at least one item, e.g. commitIndex SSyncRaftEntry* pMatch = pBuf->entries[(index - 1 + pBuf->size) % pBuf->size].pItem; - ASSERT(pMatch != NULL && "no matched log entry"); - ASSERT(pMatch->index + 1 == index); + tAssert(pMatch != NULL && "no matched log entry"); + tAssert(pMatch->index + 1 == index); SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = pMatch->index, .prevLogTerm = pMatch->term}; pBuf->entries[index % pBuf->size] = tmp; @@ -82,20 +82,20 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S return -1; } - ASSERT(index - 1 == prevIndex); + tAssert(index - 1 == prevIndex); if (prevIndex >= pBuf->startIndex) { pEntry = pBuf->entries[(prevIndex + pBuf->size) % pBuf->size].pItem; - ASSERT(pEntry != NULL && "no log entry found"); + tAssert(pEntry != NULL && "no log entry found"); prevLogTerm = pEntry->term; return prevLogTerm; } if (pMgr && pMgr->startIndex <= prevIndex && prevIndex < pMgr->endIndex) { int64_t timeMs = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].timeMs; - ASSERT(timeMs != 0 && "no log entry found"); + tAssert(timeMs != 0 && "no log entry found"); prevLogTerm = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].term; - ASSERT(prevIndex == 0 || prevLogTerm != 0); + tAssert(prevIndex == 0 || prevLogTerm != 0); return prevLogTerm; } @@ -141,9 +141,9 @@ int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex } int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - ASSERT(pNode->pLogStore != NULL && "log store not created"); - ASSERT(pNode->pFsm != NULL && "pFsm not registered"); - ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); + tAssert(pNode->pLogStore != NULL && "log store not created"); + tAssert(pNode->pFsm != NULL && "pFsm not registered"); + tAssert(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { @@ -158,7 +158,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { } SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - ASSERT(lastVer >= commitIndex); + tAssert(lastVer >= commitIndex); SyncIndex toIndex = lastVer; // update match index pBuf->commitIndex = commitIndex; @@ -206,7 +206,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { // put a dummy record at commitIndex if present in log buffer if (takeDummy) { - ASSERT(index == pBuf->commitIndex); + tAssert(index == pBuf->commitIndex); SSyncRaftEntry* pDummy = syncEntryBuildDummy(commitTerm, commitIndex, pNode->vgId); if (pDummy == NULL) { @@ -264,7 +264,7 @@ int32_t syncLogBufferReInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) { FORCE_INLINE SyncTerm syncLogBufferGetLastMatchTerm(SSyncLogBuffer* pBuf) { SyncIndex index = pBuf->matchIndex; SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); return pEntry->term; } @@ -282,7 +282,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); SyncTerm term = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index + 1); - ASSERT(pEntry->term >= 0); + tAssert(pEntry->term >= 0); if (term == pEntry->term) { ret = 0; } @@ -308,7 +308,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt // check current in buffer SSyncRaftEntry* pExist = pBuf->entries[index % pBuf->size].pItem; if (pExist != NULL) { - ASSERT(pEntry->index == pExist->index); + tAssert(pEntry->index == pExist->index); if (pEntry->term != pExist->term) { (void)syncLogBufferRollback(pBuf, pNode, index); @@ -318,7 +318,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); SyncTerm existPrevTerm = pBuf->entries[index % pBuf->size].prevLogTerm; - ASSERT(pEntry->term == pExist->term && prevTerm == existPrevTerm); + tAssert(pEntry->term == pExist->term && prevTerm == existPrevTerm); ret = 0; goto _out; } @@ -343,14 +343,14 @@ _out: } int32_t syncLogStorePersist(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { - ASSERT(pEntry->index >= 0); + tAssert(pEntry->index >= 0); SyncIndex lastVer = pLogStore->syncLogLastIndex(pLogStore); if (lastVer >= pEntry->index && pLogStore->syncLogTruncate(pLogStore, pEntry->index) < 0) { sError("failed to truncate log store since %s. from index:%" PRId64 "", terrstr(), pEntry->index); return -1; } lastVer = pLogStore->syncLogLastIndex(pLogStore); - ASSERT(pEntry->index == lastVer + 1); + tAssert(pEntry->index == lastVer + 1); if (pLogStore->syncLogAppendEntry(pLogStore, pEntry) < 0) { sError("failed to append sync log entry since %s. index:%" PRId64 ", term:%" PRId64 "", terrstr(), pEntry->index, @@ -359,7 +359,7 @@ int32_t syncLogStorePersist(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { } lastVer = pLogStore->syncLogLastIndex(pLogStore); - ASSERT(pEntry->index == lastVer); + tAssert(pEntry->index == lastVer); return 0; } @@ -372,7 +372,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p while (pBuf->matchIndex + 1 < pBuf->endIndex) { int64_t index = pBuf->matchIndex + 1; - ASSERT(index >= 0); + tAssert(index >= 0); // try to proceed SSyncLogBufEntry* pBufEntry = &pBuf->entries[index % pBuf->size]; @@ -385,14 +385,14 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p goto _out; } - ASSERT(index == pEntry->index); + tAssert(index == pEntry->index); // match SSyncRaftEntry* pMatch = pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem; - ASSERT(pMatch != NULL); - ASSERT(pMatch->index == pBuf->matchIndex); - ASSERT(pMatch->index + 1 == pEntry->index); - ASSERT(prevLogIndex == pMatch->index); + tAssert(pMatch != NULL); + tAssert(pMatch->index == pBuf->matchIndex); + tAssert(pMatch->index + 1 == pEntry->index); + tAssert(prevLogIndex == pMatch->index); if (pMatch->term != prevLogTerm) { sInfo( @@ -419,7 +419,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p pEntry->index); goto _out; } - ASSERT(pEntry->index == pBuf->matchIndex); + tAssert(pEntry->index == pBuf->matchIndex); // update my match index matchIndex = pBuf->matchIndex; @@ -437,7 +437,7 @@ _out: } int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry) { - ASSERT(pFsm->FpCommitCb != NULL && "No commit cb registered for the FSM"); + tAssert(pFsm->FpCommitCb != NULL && "No commit cb registered for the FSM"); if ((pNode->replicaNum == 1) && pNode->restoreFinish && pNode->vgId != 1) { return 0; @@ -464,16 +464,16 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn (void)syncRespMgrGetAndDel(pNode->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); int32_t code = pFsm->FpCommitCb(pFsm, &rpcMsg, &cbMeta); - ASSERT(rpcMsg.pCont == NULL); + tAssert(rpcMsg.pCont == NULL); return code; } int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf) { - ASSERT(pBuf->startIndex <= pBuf->matchIndex); - ASSERT(pBuf->commitIndex <= pBuf->matchIndex); - ASSERT(pBuf->matchIndex < pBuf->endIndex); - ASSERT(pBuf->endIndex - pBuf->startIndex <= pBuf->size); - ASSERT(pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem); + tAssert(pBuf->startIndex <= pBuf->matchIndex); + tAssert(pBuf->commitIndex <= pBuf->matchIndex); + tAssert(pBuf->matchIndex < pBuf->endIndex); + tAssert(pBuf->endIndex - pBuf->startIndex <= pBuf->size); + tAssert(pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem); return 0; } @@ -541,7 +541,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm SyncIndex until = pBuf->commitIndex - (pBuf->size >> 4); for (SyncIndex index = pBuf->startIndex; index < until; index++) { SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); syncEntryDestroy(pEntry); memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); pBuf->startIndex = index + 1; @@ -567,7 +567,7 @@ _out: } int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { - ASSERT(pMgr->startIndex >= 0); + tAssert(pMgr->startIndex >= 0); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); } @@ -602,7 +602,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { int64_t pos = index % pMgr->size; - ASSERT(!pMgr->states[pos].barrier || (index == pMgr->startIndex || index + 1 == pMgr->endIndex)); + tAssert(!pMgr->states[pos].barrier || (index == pMgr->startIndex || index + 1 == pMgr->endIndex)); if (nowMs < pMgr->states[pos].timeMs + retryWaitMs) { break; @@ -618,7 +618,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { terrstr(), index, pDestId->addr); goto _out; } - ASSERT(barrier == pMgr->states[pos].barrier); + tAssert(barrier == pMgr->states[pos].barrier); pMgr->states[pos].timeMs = nowMs; pMgr->states[pos].term = term; pMgr->states[pos].acked = false; @@ -644,14 +644,14 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod SyncAppendEntriesReply* pMsg) { SSyncLogBuffer* pBuf = pNode->pLogBuf; SRaftId destId = pMsg->srcId; - ASSERT(pMgr->restored == false); + tAssert(pMgr->restored == false); char host[64]; uint16_t port; syncUtilU642Addr(destId.addr, host, sizeof(host), &port); if (pMgr->endIndex == 0) { - ASSERT(pMgr->startIndex == 0); - ASSERT(pMgr->matchIndex == 0); + tAssert(pMgr->startIndex == 0); + tAssert(pMgr->matchIndex == 0); if (pMsg->matchIndex < 0) { pMgr->restored = true; sInfo("vgId:%d, sync log repl mgr restored. peer: %s:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 @@ -698,7 +698,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1); if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { - ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + tAssert(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer %s:%d", pNode->vgId, host, port); return -1; @@ -707,13 +707,13 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod return 0; } - ASSERT(index + 1 >= firstVer); + tAssert(index + 1 >= firstVer); if (term == pMsg->lastMatchTerm) { index = index + 1; - ASSERT(index <= pNode->pLogBuf->matchIndex); + tAssert(index <= pNode->pLogBuf->matchIndex); } else { - ASSERT(index > firstVer); + tAssert(index > firstVer); } } @@ -765,8 +765,8 @@ int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { } int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) { - ASSERT(!pMgr->restored); - ASSERT(pMgr->startIndex >= 0); + tAssert(!pMgr->restored); + tAssert(pMgr->startIndex >= 0); int64_t retryMaxWaitMs = SYNC_LOG_REPL_RETRY_WAIT_MS * (1 << SYNC_MAX_RETRY_BACKOFF); int64_t nowMs = taosGetMonoTimestampMs(); @@ -785,7 +785,7 @@ int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode return -1; } - ASSERT(index >= 0); + tAssert(index >= 0); pMgr->states[index % pMgr->size].barrier = barrier; pMgr->states[index % pMgr->size].timeMs = nowMs; pMgr->states[index % pMgr->size].term = term; @@ -804,7 +804,7 @@ int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode } int32_t syncLogReplMgrReplicateAttemptedOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { - ASSERT(pMgr->restored); + tAssert(pMgr->restored); SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; int32_t batchSize = TMAX(1, pMgr->size / 20); int32_t count = 0; @@ -853,7 +853,7 @@ int32_t syncLogReplMgrReplicateAttemptedOnce(SSyncLogReplMgr* pMgr, SSyncNode* p } int32_t syncLogReplMgrProcessReplyInNormalMode(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) { - ASSERT(pMgr->restored == true); + tAssert(pMgr->restored == true); if (pMgr->startIndex <= pMsg->lastSendIndex && pMsg->lastSendIndex < pMgr->endIndex) { if (pMgr->startIndex < pMgr->matchIndex && pMgr->retryBackoff > 0) { int64_t firstSentMs = pMgr->states[pMgr->startIndex % pMgr->size].timeMs; @@ -883,7 +883,7 @@ SSyncLogReplMgr* syncLogReplMgrCreate() { pMgr->size = sizeof(pMgr->states) / sizeof(pMgr->states[0]); - ASSERT(pMgr->size == TSDB_SYNC_LOG_BUFFER_SIZE); + tAssert(pMgr->size == TSDB_SYNC_LOG_BUFFER_SIZE); return pMgr; @@ -902,10 +902,10 @@ void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) { int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) { for (int i = 0; i < TSDB_MAX_REPLICA; i++) { - ASSERT(pNode->logReplMgrs[i] == NULL); + tAssert(pNode->logReplMgrs[i] == NULL); pNode->logReplMgrs[i] = syncLogReplMgrCreate(); pNode->logReplMgrs[i]->peerId = i; - ASSERT(pNode->logReplMgrs[i] != NULL && "Out of memory."); + tAssert(pNode->logReplMgrs[i] != NULL && "Out of memory."); } return 0; } @@ -926,7 +926,7 @@ SSyncLogBuffer* syncLogBufferCreate() { pBuf->size = sizeof(pBuf->entries) / sizeof(pBuf->entries[0]); - ASSERT(pBuf->size == TSDB_SYNC_LOG_BUFFER_SIZE); + tAssert(pBuf->size == TSDB_SYNC_LOG_BUFFER_SIZE); if (taosThreadMutexAttrInit(&pBuf->attr) < 0) { sError("failed to init log buffer mutexattr due to %s", strerror(errno)); @@ -978,7 +978,7 @@ void syncLogBufferDestroy(SSyncLogBuffer* pBuf) { } int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex) { - ASSERT(pBuf->commitIndex < toIndex && toIndex <= pBuf->endIndex); + tAssert(pBuf->commitIndex < toIndex && toIndex <= pBuf->endIndex); sInfo("vgId:%d, rollback sync log buffer. toindex: %" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", @@ -997,7 +997,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex } pBuf->endIndex = toIndex; pBuf->matchIndex = TMIN(pBuf->matchIndex, index); - ASSERT(index + 1 == toIndex); + tAssert(index + 1 == toIndex); // trunc wal SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); @@ -1006,7 +1006,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex return -1; } lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - ASSERT(toIndex == lastVer + 1); + tAssert(toIndex == lastVer + 1); syncLogBufferValidate(pBuf); return 0; @@ -1015,7 +1015,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) { taosThreadMutexLock(&pBuf->mutex); SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - ASSERT(lastVer == pBuf->matchIndex); + tAssert(lastVer == pBuf->matchIndex); SyncIndex index = pBuf->endIndex - 1; (void)syncLogBufferRollback(pBuf, pNode, pBuf->matchIndex + 1); diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index f26dddcf77..322fd409de 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -23,7 +23,7 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { snprintf(pRaftCfgIndex->path, sizeof(pRaftCfgIndex->path), "%s", path); pRaftCfgIndex->pFile = taosOpenFile(pRaftCfgIndex->path, TD_FILE_READ | TD_FILE_WRITE); - ASSERT(pRaftCfgIndex->pFile != NULL); + tAssert(pRaftCfgIndex->pFile != NULL); taosLSeekFile(pRaftCfgIndex->pFile, 0, SEEK_SET); @@ -31,10 +31,10 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { char *pBuf = taosMemoryMalloc(bufLen); memset(pBuf, 0, bufLen); int64_t len = taosReadFile(pRaftCfgIndex->pFile, pBuf, bufLen); - ASSERT(len > 0); + tAssert(len > 0); int32_t ret = raftCfgIndexFromStr(pBuf, pRaftCfgIndex); - ASSERT(ret == 0); + tAssert(ret == 0); taosMemoryFree(pBuf); @@ -44,20 +44,20 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { int32_t raftCfgIndexClose(SRaftCfgIndex *pRaftCfgIndex) { if (pRaftCfgIndex != NULL) { int64_t ret = taosCloseFile(&(pRaftCfgIndex->pFile)); - ASSERT(ret == 0); + tAssert(ret == 0); taosMemoryFree(pRaftCfgIndex); } return 0; } int32_t raftCfgIndexPersist(SRaftCfgIndex *pRaftCfgIndex) { - ASSERT(pRaftCfgIndex != NULL); + tAssert(pRaftCfgIndex != NULL); char *s = raftCfgIndex2Str(pRaftCfgIndex); taosLSeekFile(pRaftCfgIndex->pFile, 0, SEEK_SET); int64_t ret = taosWriteFile(pRaftCfgIndex->pFile, s, strlen(s) + 1); - ASSERT(ret == strlen(s) + 1); + tAssert(ret == strlen(s) + 1); taosMemoryFree(s); taosFsyncFile(pRaftCfgIndex->pFile); @@ -65,7 +65,7 @@ int32_t raftCfgIndexPersist(SRaftCfgIndex *pRaftCfgIndex) { } int32_t raftCfgIndexAddConfigIndex(SRaftCfgIndex *pRaftCfgIndex, SyncIndex configIndex) { - ASSERT(pRaftCfgIndex->configIndexCount <= MAX_CONFIG_INDEX_COUNT); + tAssert(pRaftCfgIndex->configIndexCount <= MAX_CONFIG_INDEX_COUNT); (pRaftCfgIndex->configIndexArr)[pRaftCfgIndex->configIndexCount] = configIndex; ++(pRaftCfgIndex->configIndexCount); return 0; @@ -105,15 +105,15 @@ int32_t raftCfgIndexFromJson(const cJSON *pRoot, SRaftCfgIndex *pRaftCfgIndex) { cJSON *pIndexArr = cJSON_GetObjectItem(pJson, "configIndexArr"); int arraySize = cJSON_GetArraySize(pIndexArr); - ASSERT(arraySize == pRaftCfgIndex->configIndexCount); + tAssert(arraySize == pRaftCfgIndex->configIndexCount); memset(pRaftCfgIndex->configIndexArr, 0, sizeof(pRaftCfgIndex->configIndexArr)); for (int i = 0; i < arraySize; ++i) { cJSON *pIndexObj = cJSON_GetArrayItem(pIndexArr, i); - ASSERT(pIndexObj != NULL); + tAssert(pIndexObj != NULL); cJSON *pIndex = cJSON_GetObjectItem(pIndexObj, "index"); - ASSERT(cJSON_IsString(pIndex)); + tAssert(cJSON_IsString(pIndex)); (pRaftCfgIndex->configIndexArr)[i] = atoll(pIndex->valuestring); } @@ -122,10 +122,10 @@ int32_t raftCfgIndexFromJson(const cJSON *pRoot, SRaftCfgIndex *pRaftCfgIndex) { int32_t raftCfgIndexFromStr(const char *s, SRaftCfgIndex *pRaftCfgIndex) { cJSON *pRoot = cJSON_Parse(s); - ASSERT(pRoot != NULL); + tAssert(pRoot != NULL); int32_t ret = raftCfgIndexFromJson(pRoot, pRaftCfgIndex); - ASSERT(ret == 0); + tAssert(ret == 0); cJSON_Delete(pRoot); return 0; @@ -152,7 +152,7 @@ int32_t raftCfgIndexCreateFile(const char *path) { char *s = raftCfgIndex2Str(&raftCfgIndex); int64_t ret = taosWriteFile(pFile, s, strlen(s) + 1); - ASSERT(ret == strlen(s) + 1); + tAssert(ret == strlen(s) + 1); taosMemoryFree(s); taosCloseFile(&pFile); @@ -166,29 +166,29 @@ SRaftCfg *raftCfgOpen(const char *path) { snprintf(pCfg->path, sizeof(pCfg->path), "%s", path); pCfg->pFile = taosOpenFile(pCfg->path, TD_FILE_READ | TD_FILE_WRITE); - ASSERT(pCfg->pFile != NULL); + tAssert(pCfg->pFile != NULL); taosLSeekFile(pCfg->pFile, 0, SEEK_SET); char buf[CONFIG_FILE_LEN] = {0}; int len = taosReadFile(pCfg->pFile, buf, sizeof(buf)); - ASSERT(len > 0); + tAssert(len > 0); int32_t ret = raftCfgFromStr(buf, pCfg); - ASSERT(ret == 0); + tAssert(ret == 0); return pCfg; } int32_t raftCfgClose(SRaftCfg *pRaftCfg) { int64_t ret = taosCloseFile(&(pRaftCfg->pFile)); - ASSERT(ret == 0); + tAssert(ret == 0); taosMemoryFree(pRaftCfg); return 0; } int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { - ASSERT(pRaftCfg != NULL); + tAssert(pRaftCfg != NULL); char *s = raftCfg2Str(pRaftCfg); taosLSeekFile(pRaftCfg->pFile, 0, SEEK_SET); @@ -203,10 +203,10 @@ int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { snprintf(buf, sizeof(buf), "%s", s); int64_t ret = taosWriteFile(pRaftCfg->pFile, buf, sizeof(buf)); - ASSERT(ret == sizeof(buf)); + tAssert(ret == sizeof(buf)); // int64_t ret = taosWriteFile(pRaftCfg->pFile, s, strlen(s) + 1); - // ASSERT(ret == strlen(s) + 1); + // tAssert(ret == strlen(s) + 1); taosMemoryFree(s); taosFsyncFile(pRaftCfg->pFile); @@ -214,7 +214,7 @@ int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { } int32_t raftCfgAddConfigIndex(SRaftCfg *pRaftCfg, SyncIndex configIndex) { - ASSERT(pRaftCfg->configIndexCount <= MAX_CONFIG_INDEX_COUNT); + tAssert(pRaftCfg->configIndexCount <= MAX_CONFIG_INDEX_COUNT); (pRaftCfg->configIndexArr)[pRaftCfg->configIndexCount] = configIndex; ++(pRaftCfg->configIndexCount); return 0; @@ -247,27 +247,27 @@ int32_t syncCfgFromJson(const cJSON *pRoot, SSyncCfg *pSyncCfg) { const cJSON *pJson = pRoot; cJSON *pReplicaNum = cJSON_GetObjectItem(pJson, "replicaNum"); - ASSERT(cJSON_IsNumber(pReplicaNum)); + tAssert(cJSON_IsNumber(pReplicaNum)); pSyncCfg->replicaNum = cJSON_GetNumberValue(pReplicaNum); cJSON *pMyIndex = cJSON_GetObjectItem(pJson, "myIndex"); - ASSERT(cJSON_IsNumber(pMyIndex)); + tAssert(cJSON_IsNumber(pMyIndex)); pSyncCfg->myIndex = cJSON_GetNumberValue(pMyIndex); cJSON *pNodeInfoArr = cJSON_GetObjectItem(pJson, "nodeInfo"); int arraySize = cJSON_GetArraySize(pNodeInfoArr); - ASSERT(arraySize == pSyncCfg->replicaNum); + tAssert(arraySize == pSyncCfg->replicaNum); for (int i = 0; i < arraySize; ++i) { cJSON *pNodeInfo = cJSON_GetArrayItem(pNodeInfoArr, i); - ASSERT(pNodeInfo != NULL); + tAssert(pNodeInfo != NULL); cJSON *pNodePort = cJSON_GetObjectItem(pNodeInfo, "nodePort"); - ASSERT(cJSON_IsNumber(pNodePort)); + tAssert(cJSON_IsNumber(pNodePort)); ((pSyncCfg->nodeInfo)[i]).nodePort = cJSON_GetNumberValue(pNodePort); cJSON *pNodeFqdn = cJSON_GetObjectItem(pNodeInfo, "nodeFqdn"); - ASSERT(cJSON_IsString(pNodeFqdn)); + tAssert(cJSON_IsString(pNodeFqdn)); snprintf(((pSyncCfg->nodeInfo)[i]).nodeFqdn, sizeof(((pSyncCfg->nodeInfo)[i]).nodeFqdn), "%s", pNodeFqdn->valuestring); } @@ -332,13 +332,13 @@ int32_t raftCfgCreateFile(SSyncCfg *pCfg, SRaftCfgMeta meta, const char *path) { char buf[CONFIG_FILE_LEN] = {0}; memset(buf, 0, sizeof(buf)); - ASSERT(strlen(s) + 1 <= CONFIG_FILE_LEN); + tAssert(strlen(s) + 1 <= CONFIG_FILE_LEN); snprintf(buf, sizeof(buf), "%s", s); int64_t ret = taosWriteFile(pFile, buf, sizeof(buf)); - ASSERT(ret == sizeof(buf)); + tAssert(ret == sizeof(buf)); // int64_t ret = taosWriteFile(pFile, s, strlen(s) + 1); - // ASSERT(ret == strlen(s) + 1); + // tAssert(ret == strlen(s) + 1); taosMemoryFree(s); taosCloseFile(&pFile); @@ -366,31 +366,31 @@ int32_t raftCfgFromJson(const cJSON *pRoot, SRaftCfg *pRaftCfg) { cJSON *pIndexArr = cJSON_GetObjectItem(pJson, "configIndexArr"); int arraySize = cJSON_GetArraySize(pIndexArr); - ASSERT(arraySize == pRaftCfg->configIndexCount); + tAssert(arraySize == pRaftCfg->configIndexCount); memset(pRaftCfg->configIndexArr, 0, sizeof(pRaftCfg->configIndexArr)); for (int i = 0; i < arraySize; ++i) { cJSON *pIndexObj = cJSON_GetArrayItem(pIndexArr, i); - ASSERT(pIndexObj != NULL); + tAssert(pIndexObj != NULL); cJSON *pIndex = cJSON_GetObjectItem(pIndexObj, "index"); - ASSERT(cJSON_IsString(pIndex)); + tAssert(cJSON_IsString(pIndex)); (pRaftCfg->configIndexArr)[i] = atoll(pIndex->valuestring); } cJSON *pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); int32_t code = syncCfgFromJson(pJsonSyncCfg, &(pRaftCfg->cfg)); - ASSERT(code == 0); + tAssert(code == 0); return code; } int32_t raftCfgFromStr(const char *s, SRaftCfg *pRaftCfg) { cJSON *pRoot = cJSON_Parse(s); - ASSERT(pRoot != NULL); + tAssert(pRoot != NULL); int32_t ret = raftCfgFromJson(pRoot, pRaftCfg); - ASSERT(ret == 0); + tAssert(ret == 0); cJSON_Delete(pRoot); return 0; diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index 81f3506331..c746a85418 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -317,11 +317,11 @@ int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* p } SSkipListNode* pSkipListNode = tSkipListPut(pCache->pSkipList, pEntry); - ASSERT(pSkipListNode != NULL); + tAssert(pSkipListNode != NULL); ++(pCache->currentCount); pEntry->rid = taosAddRef(pCache->refMgr, pEntry); - ASSERT(pEntry->rid >= 0); + tAssert(pEntry->rid >= 0); sNTrace(pCache->pSyncNode, "raft cache add, type:%s,%d, type2:%s,%d, index:%" PRId64 ", bytes:%d", TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType, @@ -334,7 +334,7 @@ int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* p // not found, return 0 // error, return -1 int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { - ASSERT(ppEntry != NULL); + tAssert(ppEntry != NULL); SSyncRaftEntry* pEntry = NULL; int32_t code = raftEntryCacheGetEntryP(pCache, index, &pEntry); if (code == 1) { @@ -361,7 +361,7 @@ int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, int32_t arraySize = taosArrayGetSize(entryPArray); if (arraySize == 1) { SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); - ASSERT(*ppNode != NULL); + tAssert(*ppNode != NULL); *ppEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); taosAcquireRef(pCache->refMgr, (*ppEntry)->rid); code = 1; @@ -393,7 +393,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); + tAssert(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); syncEntryDestroy(pEntry); ++returnCnt; @@ -403,7 +403,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { tSkipListDestroy(pCache->pSkipList); pCache->pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); - ASSERT(pCache->pSkipList != NULL); + tAssert(pCache->pSkipList != NULL); } else { // clear count @@ -414,7 +414,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { // free entry while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); + tAssert(pNode != NULL); if (i++ >= count) { break; } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 018ac5bb7d..4a0109c4bd 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -51,16 +51,16 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { taosLRUCacheSetStrictCapacity(pLogStore->pCache, false); pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData)); - ASSERT(pLogStore->data != NULL); + tAssert(pLogStore->data != NULL); SSyncLogStoreData* pData = pLogStore->data; pData->pSyncNode = pSyncNode; pData->pWal = pSyncNode->pWal; - ASSERT(pData->pWal != NULL); + tAssert(pData->pWal != NULL); taosThreadMutexInit(&(pData->mutex), NULL); pData->pWalHandle = walOpenReader(pData->pWal, NULL); - ASSERT(pData->pWalHandle != NULL); + tAssert(pData->pWalHandle != NULL); pLogStore->syncLogUpdateCommitIndex = raftLogUpdateCommitIndex; pLogStore->syncLogCommitIndex = raftlogCommitIndex; @@ -103,7 +103,7 @@ void logStoreDestory(SSyncLogStore* pLogStore) { // log[m .. n] static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex) { - ASSERT(snapshotIndex >= 0); + tAssert(snapshotIndex >= 0); SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -217,7 +217,7 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr return -1; } - ASSERT(pEntry->index == index); + tAssert(pEntry->index == index); sNTrace(pData->pSyncNode, "write index:%" PRId64 ", type:%s, origin type:%s, elapsed:%" PRId64, pEntry->index, TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType), tsElapsed); @@ -275,14 +275,14 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR } *ppEntry = syncEntryBuild(pWalHandle->pHead->head.bodyLen); - ASSERT(*ppEntry != NULL); + tAssert(*ppEntry != NULL); (*ppEntry)->msgType = TDMT_SYNC_CLIENT_REQUEST; (*ppEntry)->originalRpcType = pWalHandle->pHead->head.msgType; (*ppEntry)->seqNum = pWalHandle->pHead->head.syncMeta.seqNum; (*ppEntry)->isWeak = pWalHandle->pHead->head.syncMeta.isWeek; (*ppEntry)->term = pWalHandle->pHead->head.syncMeta.term; (*ppEntry)->index = index; - ASSERT((*ppEntry)->dataLen == pWalHandle->pHead->head.bodyLen); + tAssert((*ppEntry)->dataLen == pWalHandle->pHead->head.bodyLen); memcpy((*ppEntry)->data, pWalHandle->pHead->head.body, pWalHandle->pHead->head.bodyLen); /* @@ -356,7 +356,7 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; - ASSERT(ppLastEntry != NULL); + tAssert(ppLastEntry != NULL); *ppLastEntry = NULL; if (walIsEmpty(pWal)) { @@ -364,7 +364,7 @@ static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** pp return -1; } else { SyncIndex lastIndex = raftLogLastIndex(pLogStore); - ASSERT(lastIndex >= SYNC_INDEX_BEGIN); + tAssert(lastIndex >= SYNC_INDEX_BEGIN); int32_t code = raftLogGetEntry(pLogStore, lastIndex, ppLastEntry); return code; } diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index e328ed3d31..85761c6b7e 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -34,34 +34,34 @@ SRaftStore *raftStoreOpen(const char *path) { snprintf(pRaftStore->path, sizeof(pRaftStore->path), "%s", path); if (!raftStoreFileExist(pRaftStore->path)) { ret = raftStoreInit(pRaftStore); - ASSERT(ret == 0); + tAssert(ret == 0); } char storeBuf[RAFT_STORE_BLOCK_SIZE] = {0}; pRaftStore->pFile = taosOpenFile(path, TD_FILE_READ | TD_FILE_WRITE); - ASSERT(pRaftStore->pFile != NULL); + tAssert(pRaftStore->pFile != NULL); int len = taosReadFile(pRaftStore->pFile, storeBuf, RAFT_STORE_BLOCK_SIZE); - ASSERT(len > 0); + tAssert(len > 0); ret = raftStoreDeserialize(pRaftStore, storeBuf, len); - ASSERT(ret == 0); + tAssert(ret == 0); return pRaftStore; } static int32_t raftStoreInit(SRaftStore *pRaftStore) { - ASSERT(pRaftStore != NULL); + tAssert(pRaftStore != NULL); pRaftStore->pFile = taosOpenFile(pRaftStore->path, TD_FILE_CREATE | TD_FILE_WRITE); - ASSERT(pRaftStore->pFile != NULL); + tAssert(pRaftStore->pFile != NULL); pRaftStore->currentTerm = 0; pRaftStore->voteFor.addr = 0; pRaftStore->voteFor.vgId = 0; int32_t ret = raftStorePersist(pRaftStore); - ASSERT(ret == 0); + tAssert(ret == 0); taosCloseFile(&pRaftStore->pFile); return 0; @@ -77,17 +77,17 @@ int32_t raftStoreClose(SRaftStore *pRaftStore) { } int32_t raftStorePersist(SRaftStore *pRaftStore) { - ASSERT(pRaftStore != NULL); + tAssert(pRaftStore != NULL); int32_t ret; char storeBuf[RAFT_STORE_BLOCK_SIZE] = {0}; ret = raftStoreSerialize(pRaftStore, storeBuf, sizeof(storeBuf)); - ASSERT(ret == 0); + tAssert(ret == 0); taosLSeekFile(pRaftStore->pFile, 0, SEEK_SET); ret = taosWriteFile(pRaftStore->pFile, storeBuf, sizeof(storeBuf)); - ASSERT(ret == RAFT_STORE_BLOCK_SIZE); + tAssert(ret == RAFT_STORE_BLOCK_SIZE); taosFsyncFile(pRaftStore->pFile); return 0; @@ -99,7 +99,7 @@ static bool raftStoreFileExist(char *path) { } int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { - ASSERT(pRaftStore != NULL); + tAssert(pRaftStore != NULL); cJSON *pRoot = cJSON_CreateObject(); @@ -121,7 +121,7 @@ int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { char *serialized = cJSON_Print(pRoot); int len2 = strlen(serialized); - ASSERT(len2 < len); + tAssert(len2 < len); memset(buf, 0, len); snprintf(buf, len, "%s", serialized); taosMemoryFree(serialized); @@ -131,17 +131,17 @@ int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { } int32_t raftStoreDeserialize(SRaftStore *pRaftStore, char *buf, size_t len) { - ASSERT(pRaftStore != NULL); + tAssert(pRaftStore != NULL); - ASSERT(len > 0 && len <= RAFT_STORE_BLOCK_SIZE); + tAssert(len > 0 && len <= RAFT_STORE_BLOCK_SIZE); cJSON *pRoot = cJSON_Parse(buf); cJSON *pCurrentTerm = cJSON_GetObjectItem(pRoot, "current_term"); - ASSERT(cJSON_IsString(pCurrentTerm)); + tAssert(cJSON_IsString(pCurrentTerm)); sscanf(pCurrentTerm->valuestring, "%" PRIu64 "", &(pRaftStore->currentTerm)); cJSON *pVoteForAddr = cJSON_GetObjectItem(pRoot, "vote_for_addr"); - ASSERT(cJSON_IsString(pVoteForAddr)); + tAssert(cJSON_IsString(pVoteForAddr)); sscanf(pVoteForAddr->valuestring, "%" PRIu64 "", &(pRaftStore->voteFor.addr)); cJSON *pVoteForVgid = cJSON_GetObjectItem(pRoot, "vote_for_vgid"); @@ -157,7 +157,7 @@ bool raftStoreHasVoted(SRaftStore *pRaftStore) { } void raftStoreVote(SRaftStore *pRaftStore, SRaftId *pRaftId) { - ASSERT(!syncUtilEmptyId(pRaftId)); + tAssert(!syncUtilEmptyId(pRaftId)); pRaftStore->voteFor = *pRaftId; raftStorePersist(pRaftStore); } diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 0f56921ec7..2ba59c4a4f 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -49,7 +49,7 @@ int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot) { - ASSERT(false && "deprecated"); + tAssert(false && "deprecated"); // next index SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId); @@ -92,10 +92,10 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } if (code == 0) { - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); code = syncBuildAppendEntries(&rpcMsg, (int32_t)(pEntry->bytes), pSyncNode->vgId); - ASSERT(code == 0); + tAssert(code == 0); pMsg = rpcMsg.pCont; memcpy(pMsg->data, pEntry, pEntry->bytes); @@ -103,7 +103,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { // no entry in log code = syncBuildAppendEntries(&rpcMsg, 0, pSyncNode->vgId); - ASSERT(code == 0); + tAssert(code == 0); pMsg = rpcMsg.pCont; } else { @@ -122,7 +122,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } // prepare msg - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); pMsg->srcId = pSyncNode->myRaftId; pMsg->destId = *pDestId; pMsg->term = pSyncNode->pRaftStore->currentTerm; diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c index 773befe1e4..cd0804196f 100644 --- a/source/libs/sync/src/syncRequestVote.c +++ b/source/libs/sync/src/syncRequestVote.c @@ -105,7 +105,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { syncNodeStepDown(ths, pMsg->term); // syncNodeUpdateTerm(ths, pMsg->term); } - ASSERT(pMsg->term <= ths->pRaftStore->currentTerm); + tAssert(pMsg->term <= ths->pRaftStore->currentTerm); bool grant = (pMsg->term == ths->pRaftStore->currentTerm) && logOK && ((!raftStoreHasVoted(ths->pRaftStore)) || (syncUtilSameId(&(ths->pRaftStore->voteFor), &(pMsg->srcId)))); @@ -124,7 +124,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { // send msg SRpcMsg rpcMsg = {0}; ret = syncBuildRequestVoteReply(&rpcMsg, ths->vgId); - ASSERT(ret == 0); + tAssert(ret == 0); SyncRequestVoteReply* pReply = rpcMsg.pCont; pReply->srcId = ths->myRaftId; diff --git a/source/libs/sync/src/syncRequestVoteReply.c b/source/libs/sync/src/syncRequestVoteReply.c index 563f475070..c65486e779 100644 --- a/source/libs/sync/src/syncRequestVoteReply.c +++ b/source/libs/sync/src/syncRequestVoteReply.c @@ -54,7 +54,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return -1; } - // ASSERT(!(pMsg->term > ths->pRaftStore->currentTerm)); + // tAssert(!(pMsg->term > ths->pRaftStore->currentTerm)); // no need this code, because if I receive reply.term, then I must have sent for that term. // if (pMsg->term > ths->pRaftStore->currentTerm) { // syncNodeUpdateTerm(ths, pMsg->term); @@ -67,7 +67,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { } syncLogRecvRequestVoteReply(ths, pMsg, ""); - ASSERT(pMsg->term == ths->pRaftStore->currentTerm); + tAssert(pMsg->term == ths->pRaftStore->currentTerm); // This tallies votes even when the current state is not Candidate, // but they won't be looked at, so it doesn't matter. diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index b8ecbe7515..b6981db13f 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -81,7 +81,7 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; } int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { - ASSERT(!snapshotSenderIsStart(pSender)); + tAssert(!snapshotSenderIsStart(pSender)); pSender->start = true; pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -139,7 +139,7 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { // close reader if (pSender->pReader != NULL) { int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); - ASSERT(ret == 0); + tAssert(ret == 0); pSender->pReader = NULL; } @@ -168,7 +168,7 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // read data int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, &(pSender->pCurrentBlock), &(pSender->blockLen)); - ASSERT(ret == 0); + tAssert(ret == 0); if (pSender->blockLen > 0) { // has read data } else { @@ -244,7 +244,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { } static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { - ASSERT(pMsg->ack == pSender->seq); + tAssert(pMsg->ack == pSender->seq); pSender->ack = pMsg->ack; ++(pSender->seq); } @@ -324,7 +324,7 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - ASSERT(ret == 0); + tAssert(ret == 0); pReceiver->pWriter = NULL; } @@ -341,7 +341,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - ASSERT(ret == 0); + tAssert(ret == 0); pReceiver->pWriter = NULL; } @@ -352,7 +352,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { } int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { - ASSERT(snapshotReceiverIsStart(pReceiver)); + tAssert(snapshotReceiverIsStart(pReceiver)); // update ack pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -366,10 +366,10 @@ int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapsh pReceiver->snapshotParam.end = pBeginMsg->lastIndex; // start writer - ASSERT(pReceiver->pWriter == NULL); + tAssert(pReceiver->pWriter == NULL); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, &(pReceiver->snapshotParam), &(pReceiver->pWriter)); - ASSERT(ret == 0); + tAssert(ret == 0); // event log sRTrace(pReceiver, "snapshot receiver start writer"); @@ -401,7 +401,7 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - ASSERT(ret == 0); + tAssert(ret == 0); pReceiver->pWriter = NULL; } @@ -414,7 +414,7 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { // when recv last snapshot block, apply data into snapshot static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - ASSERT(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); + tAssert(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); int32_t code = 0; if (pReceiver->pWriter != NULL) { @@ -472,14 +472,14 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap // apply data block // update progress static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - ASSERT(pMsg->seq == pReceiver->ack + 1); + tAssert(pMsg->seq == pReceiver->ack + 1); if (pReceiver->pWriter != NULL) { if (pMsg->dataLen > 0) { // apply data block int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); - ASSERT(code == 0); + tAssert(code == 0); } // update progress @@ -784,7 +784,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { // get sender SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - ASSERT(pSender != NULL); + tAssert(pSender != NULL); SSnapshot snapshot; pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); @@ -857,7 +857,7 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { // get sender SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - ASSERT(pSender != NULL); + tAssert(pSender != NULL); if (pMsg->startTime != pSender->startTime) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender/receiver start time not match"); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 7787438dfe..e2abb9b6db 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -120,7 +120,7 @@ static inline bool syncUtilCanPrint(char c) { char* syncUtilPrintBin(char* ptr, uint32_t len) { int64_t memLen = (int64_t)(len + 1); char* s = taosMemoryMalloc(memLen); - ASSERT(s != NULL); + tAssert(s != NULL); memset(s, 0, len + 1); memcpy(s, ptr, len); @@ -135,7 +135,7 @@ char* syncUtilPrintBin(char* ptr, uint32_t len) { char* syncUtilPrintBin2(char* ptr, uint32_t len) { uint32_t len2 = len * 4 + 1; char* s = taosMemoryMalloc(len2); - ASSERT(s != NULL); + tAssert(s != NULL); memset(s, 0, len2); char* p = s; diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp index 5534803c9c..b01caeee77 100644 --- a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -53,7 +53,7 @@ void test1() { int32_t retArrSize = pMsg->dataCount; for (int i = 0; i < retArrSize; ++i) { SSyncRaftEntry *pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); - ASSERT(pEntry->bytes == metaArr[i].contLen); + tAssert(pEntry->bytes == metaArr[i].contLen); syncEntryPrint(pEntry); } */ diff --git a/source/libs/sync/test/syncEncodeTest.cpp b/source/libs/sync/test/syncEncodeTest.cpp index 528cc1614d..a2810e1359 100644 --- a/source/libs/sync/test/syncEncodeTest.cpp +++ b/source/libs/sync/test/syncEncodeTest.cpp @@ -167,7 +167,7 @@ int main(int argc, char **argv) { pSyncNode->pLogStore->syncLogAppendEntry(pSyncNode->pLogStore, pEntry); int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, pEntry->index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); syncEntryLog2((char *)"==pEntry==", pEntry); diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index b86422b0b1..828f466d63 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -26,7 +26,7 @@ SSyncRaftEntry* createEntry(int i) { SSyncNode* createFakeNode() { SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(SSyncNode)); - ASSERT(pSyncNode != NULL); + tAssert(pSyncNode != NULL); memset(pSyncNode, 0, sizeof(SSyncNode)); return pSyncNode; @@ -34,10 +34,10 @@ SSyncNode* createFakeNode() { SRaftEntryCache* createCache(int maxCount) { SSyncNode* pSyncNode = createFakeNode(); - ASSERT(pSyncNode != NULL); + tAssert(pSyncNode != NULL); SRaftEntryCache* pCache = raftEntryCacheCreate(pSyncNode, maxCount); - ASSERT(pCache != NULL); + tAssert(pCache != NULL); return pCache; } @@ -73,12 +73,12 @@ void test2() { SSyncRaftEntry* pEntry = NULL; code = raftEntryCacheGetEntryP(pCache, index, &pEntry); - ASSERT(code == 1 && index == pEntry->index); + tAssert(code == 1 && index == pEntry->index); sTrace("get entry:%p for %" PRId64, pEntry, index); syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); code = raftEntryCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == 1 && index == pEntry->index); + tAssert(code == 1 && index == pEntry->index); sTrace("get entry:%p for %" PRId64, pEntry, index); syncEntryLog2((char*)"==test2 get entry 2==", pEntry); syncEntryDestory(pEntry); @@ -86,14 +86,14 @@ void test2() { // not found index = 8; code = raftEntryCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); sTrace("get entry:%p for %" PRId64, pEntry, index); sTrace("==test2 get entry 8 not found=="); // not found index = 9; code = raftEntryCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); sTrace("get entry:%p for %" PRId64, pEntry, index); sTrace("==test2 get entry 9 not found=="); } @@ -124,7 +124,7 @@ void test4() { int32_t testRefId = taosOpenRef(200, freeObj); SSyncRaftEntry* pEntry = createEntry(10); - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); int64_t rid = taosAddRef(testRefId, pEntry); sTrace("rid: %" PRId64, rid); @@ -153,7 +153,7 @@ void test5() { int32_t testRefId = taosOpenRef(5, freeObj); for (int i = 0; i < 100; i++) { SSyncRaftEntry* pEntry = createEntry(i); - ASSERT(pEntry != NULL); + tAssert(pEntry != NULL); int64_t rid = taosAddRef(testRefId, pEntry); sTrace("rid: %" PRId64, rid); diff --git a/source/libs/sync/test/syncHashCacheTest.cpp b/source/libs/sync/test/syncHashCacheTest.cpp index 14a29c9a1e..0f8998775f 100644 --- a/source/libs/sync/test/syncHashCacheTest.cpp +++ b/source/libs/sync/test/syncHashCacheTest.cpp @@ -26,7 +26,7 @@ SSyncRaftEntry* createEntry(int i) { SSyncNode* createFakeNode() { SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(SSyncNode)); - ASSERT(pSyncNode != NULL); + tAssert(pSyncNode != NULL); memset(pSyncNode, 0, sizeof(SSyncNode)); return pSyncNode; @@ -34,10 +34,10 @@ SSyncNode* createFakeNode() { SRaftEntryHashCache* createCache(int maxCount) { SSyncNode* pSyncNode = createFakeNode(); - ASSERT(pSyncNode != NULL); + tAssert(pSyncNode != NULL); SRaftEntryHashCache* pCache = raftCacheCreate(pSyncNode, maxCount); - ASSERT(pCache != NULL); + tAssert(pCache != NULL); return pCache; } @@ -48,7 +48,7 @@ void test1() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); + tAssert(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test1 write 5 entries==", pCache); @@ -56,14 +56,14 @@ void test1() { SyncIndex index; index = 1; code = raftCacheDelEntry(pCache, index); - ASSERT(code == 0); + tAssert(code == 0); index = 3; code = raftCacheDelEntry(pCache, index); - ASSERT(code == 0); + tAssert(code == 0); raftCacheLog2((char*)"==test1 delete 1,3==", pCache); code = raftCacheClear(pCache); - ASSERT(code == 0); + tAssert(code == 0); raftCacheLog2((char*)"==clear all==", pCache); } @@ -73,7 +73,7 @@ void test2() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); + tAssert(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test2 write 5 entries==", pCache); @@ -82,25 +82,25 @@ void test2() { index = 1; SSyncRaftEntry* pEntry; code = raftCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); syncEntryDestory(pEntry); syncEntryLog2((char*)"==test2 get entry 1==", pEntry); index = 2; code = raftCacheGetEntryP(pCache, index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); // not found index = 8; code = raftCacheGetEntry(pCache, index, &pEntry); - ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + tAssert(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); sTrace("==test2 get entry 8 not found=="); // not found index = 9; code = raftCacheGetEntryP(pCache, index, &pEntry); - ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + tAssert(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); sTrace("==test2 get entry pointer 9 not found=="); } @@ -110,13 +110,13 @@ void test3() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); + tAssert(code == 1); syncEntryDestory(pEntry); } for (int i = 6; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 0); + tAssert(code == 0); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test3 write 10 entries, max count is 5==", pCache); @@ -128,7 +128,7 @@ void test4() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - ASSERT(code == 1); + tAssert(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test4 write 5 entries==", pCache); @@ -137,7 +137,7 @@ void test4() { index = 3; SSyncRaftEntry* pEntry; code = raftCacheGetAndDel(pCache, index, &pEntry); - ASSERT(code == 0); + tAssert(code == 0); syncEntryLog2((char*)"==test4 get-and-del entry 3==", pEntry); raftCacheLog2((char*)"==test4 after get-and-del entry 3==", pCache); } @@ -150,19 +150,19 @@ static char* keyFn(const void* pData) { static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } void printSkipList(SSkipList* pSkipList) { - ASSERT(pSkipList != NULL); + tAssert(pSkipList != NULL); SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); + tAssert(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); syncEntryPrint2((char*)"", pEntry); } } void delSkipListFirst(SSkipList* pSkipList, int n) { - ASSERT(pSkipList != NULL); + tAssert(pSkipList != NULL); sTrace("delete first %d -------------", n); SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); @@ -182,7 +182,7 @@ SSyncRaftEntry* getLogEntry2(SSkipList* pSkipList, SyncIndex index) { arraySize = taosArrayGetSize(entryPArray); if (arraySize > 0) { SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); - ASSERT(*ppNode != NULL); + tAssert(*ppNode != NULL); pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); } taosArrayDestroy(entryPArray); @@ -200,7 +200,7 @@ SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { tSkipListCreateIterFromVal(pSkipList, (const char*)&index2, TSDB_DATA_TYPE_BINARY, TSDB_ORDER_ASC); if (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); + tAssert(pNode != NULL); pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); } @@ -211,7 +211,7 @@ SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { void test5() { SSkipList* pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); - ASSERT(pSkipList != NULL); + tAssert(pSkipList != NULL); sTrace("insert 9 - 5"); for (int i = 9; i >= 5; --i) { diff --git a/source/libs/sync/test/syncRaftCfgIndexTest.cpp b/source/libs/sync/test/syncRaftCfgIndexTest.cpp index e6d3f23b58..6595f1fd1b 100644 --- a/source/libs/sync/test/syncRaftCfgIndexTest.cpp +++ b/source/libs/sync/test/syncRaftCfgIndexTest.cpp @@ -52,7 +52,7 @@ const char* pFile = "./raft_config_index.json"; void test1() { int32_t code = raftCfgIndexCreateFile(pFile); - ASSERT(code == 0); + tAssert(code == 0); SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile); diff --git a/source/libs/sync/test/sync_test_lib/src/syncBatch.c b/source/libs/sync/test/sync_test_lib/src/syncBatch.c index cb4bed1e67..d3640680ff 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncBatch.c +++ b/source/libs/sync/test/sync_test_lib/src/syncBatch.c @@ -25,8 +25,8 @@ SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg** rpcMsgPArr, SRaftMeta* raftArr, int32_t arrSize, int32_t vgId) { - ASSERT(rpcMsgPArr != NULL); - ASSERT(arrSize > 0); + tAssert(rpcMsgPArr != NULL); + tAssert(arrSize > 0); int32_t dataLen = 0; int32_t raftMetaArrayLen = sizeof(SRaftMeta) * arrSize; @@ -100,9 +100,9 @@ SRpcMsg* syncClientRequestBatchRpcMsgArr(const SyncClientRequestBatch* pSyncMsg) SyncClientRequestBatch* syncClientRequestBatchFromRpcMsg(const SRpcMsg* pRpcMsg) { SyncClientRequestBatch* pSyncMsg = taosMemoryMalloc(pRpcMsg->contLen); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); memcpy(pSyncMsg, pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pRpcMsg->contLen == pSyncMsg->bytes); + tAssert(pRpcMsg->contLen == pSyncMsg->bytes); return pSyncMsg; } @@ -194,8 +194,8 @@ void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg) { // block3: entry Array SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId) { - ASSERT(entryPArr != NULL); - ASSERT(arrSize >= 0); + tAssert(entryPArr != NULL); + tAssert(arrSize >= 0); int32_t dataLen = 0; int32_t metaArrayLen = sizeof(SOffsetAndContLen) * arrSize; // @@ -229,7 +229,7 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, } // init entry array - ASSERT(metaArr[i].contLen == entryPArr[i]->bytes); + tAssert(metaArr[i].contLen == entryPArr[i]->bytes); memcpy(pData + metaArr[i].offset, entryPArr[i], metaArr[i].contLen); } @@ -247,19 +247,19 @@ void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg) { } void syncAppendEntriesBatchSerialize(const SyncAppendEntriesBatch* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesBatchDeserialize(const char* buf, uint32_t len, SyncAppendEntriesBatch* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncAppendEntriesBatch) + pMsg->dataLen); + tAssert(len == pMsg->bytes); + tAssert(pMsg->bytes == sizeof(SyncAppendEntriesBatch) + pMsg->dataLen); } char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncAppendEntriesBatchSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -270,9 +270,9 @@ char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint3 SyncAppendEntriesBatch* syncAppendEntriesBatchDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntriesBatch* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncAppendEntriesBatchDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -290,7 +290,7 @@ void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesB SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } diff --git a/source/libs/sync/test/sync_test_lib/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c index 2c24451713..41b0533451 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -48,11 +48,11 @@ static void syncIOTickPing(void *param, void *tmrId); int32_t syncIOStart(char *host, uint16_t port) { int32_t ret = 0; gSyncIO = syncIOCreate(host, port); - ASSERT(gSyncIO != NULL); + tAssert(gSyncIO != NULL); taosSeedRand(taosGetTimestampSec()); ret = syncIOStartInternal(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); sTrace("syncIOStart ok, gSyncIO:%p", gSyncIO); return ret; @@ -60,16 +60,16 @@ int32_t syncIOStart(char *host, uint16_t port) { int32_t syncIOStop() { int32_t ret = syncIOStopInternal(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); ret = syncIODestroy(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } int32_t syncIOSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) { - ASSERT(pEpSet->inUse == 0); - ASSERT(pEpSet->numOfEps == 1); + tAssert(pEpSet->inUse == 0); + tAssert(pEpSet->numOfEps == 1); int32_t ret = 0; { @@ -108,25 +108,25 @@ int32_t syncIOEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) { int32_t syncIOQTimerStart() { int32_t ret = syncIOStartQ(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } int32_t syncIOQTimerStop() { int32_t ret = syncIOStopQ(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } int32_t syncIOPingTimerStart() { int32_t ret = syncIOStartPing(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } int32_t syncIOPingTimerStop() { int32_t ret = syncIOStopPing(gSyncIO); - ASSERT(ret == 0); + tAssert(ret == 0); return ret; } @@ -152,7 +152,7 @@ static SSyncIO *syncIOCreate(char *host, uint16_t port) { static int32_t syncIODestroy(SSyncIO *io) { int32_t ret = 0; int8_t start = atomic_load_8(&io->isStart); - ASSERT(start == 0); + tAssert(start == 0); if (io->serverRpc != NULL) { rpcClose(io->serverRpc); @@ -265,7 +265,7 @@ static void *syncIOConsumerFunc(void *param) { if (pRpcMsg->msgType == TDMT_SYNC_PING) { if (io->FpOnSyncPing != NULL) { SyncPing *pSyncMsg = syncPingFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncPing(io->pSyncNode, pSyncMsg); syncPingDestroy(pSyncMsg); } @@ -273,7 +273,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { if (io->FpOnSyncPingReply != NULL) { SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncPingReply(io->pSyncNode, pSyncMsg); syncPingReplyDestroy(pSyncMsg); } @@ -286,7 +286,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { if (io->FpOnSyncRequestVote != NULL) { SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncRequestVote(io->pSyncNode, pSyncMsg); syncRequestVoteDestroy(pSyncMsg); } @@ -294,7 +294,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { if (io->FpOnSyncRequestVoteReply != NULL) { SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncRequestVoteReply(io->pSyncNode, pSyncMsg); syncRequestVoteReplyDestroy(pSyncMsg); } @@ -302,7 +302,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { if (io->FpOnSyncAppendEntries != NULL) { SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncAppendEntries(io->pSyncNode, pSyncMsg); syncAppendEntriesDestroy(pSyncMsg); } @@ -310,7 +310,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { if (io->FpOnSyncAppendEntriesReply != NULL) { SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncAppendEntriesReply(io->pSyncNode, pSyncMsg); syncAppendEntriesReplyDestroy(pSyncMsg); } @@ -318,7 +318,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { if (io->FpOnSyncTimeout != NULL) { SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncTimeout(io->pSyncNode, pSyncMsg); syncTimeoutDestroy(pSyncMsg); } @@ -326,7 +326,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) { if (io->FpOnSyncSnapshot != NULL) { SyncSnapshotSend *pSyncMsg = syncSnapshotSendFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncSnapshot(io->pSyncNode, pSyncMsg); syncSnapshotSendDestroy(pSyncMsg); } @@ -334,7 +334,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) { if (io->FpOnSyncSnapshotReply != NULL) { SyncSnapshotRsp *pSyncMsg = syncSnapshotRspFromRpcMsg2(pRpcMsg); - ASSERT(pSyncMsg != NULL); + tAssert(pSyncMsg != NULL); io->FpOnSyncSnapshotReply(io->pSyncNode, pSyncMsg); syncSnapshotRspDestroy(pSyncMsg); } diff --git a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c index 6b461da0e5..ec9de67ff5 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c @@ -223,7 +223,7 @@ int32_t syncNodePingSelf(SSyncNode* pSyncNode) { int32_t ret = 0; SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, &pSyncNode->myRaftId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, &pMsg->destId, pMsg); - ASSERT(ret == 0); + tAssert(ret == 0); syncPingDestroy(pMsg); return ret; @@ -235,7 +235,7 @@ int32_t syncNodePingPeers(SSyncNode* pSyncNode) { SRaftId* destId = &(pSyncNode->peersId[i]); SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, destId, pMsg); - ASSERT(ret == 0); + tAssert(ret == 0); syncPingDestroy(pMsg); } return ret; @@ -247,7 +247,7 @@ int32_t syncNodePingAll(SSyncNode* pSyncNode) { SRaftId* destId = &(pSyncNode->replicasId[i]); SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, destId, pMsg); - ASSERT(ret == 0); + tAssert(ret == 0); syncPingDestroy(pMsg); } return ret; diff --git a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c index 1ea7629601..fbc9b43d05 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c @@ -44,7 +44,7 @@ SyncPing* syncPingBuild3(const SRaftId* srcId, const SRaftId* destId, int32_t vg char* syncPingSerialize2(const SyncPing* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncPingSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -78,7 +78,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) { } pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); pMsg->bytes = bytes; if (tDecodeI32(&decoder, &pMsg->vgId) < 0) { @@ -115,7 +115,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) { taosMemoryFree(pMsg); return NULL; } - ASSERT(len == pMsg->dataLen); + tAssert(len == pMsg->dataLen); memcpy(pMsg->data, data, len); tEndDecode(&decoder); @@ -261,28 +261,28 @@ void syncPingDestroy(SyncPing* pMsg) { } void syncPingSerialize(const SyncPing* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPingDeserialize(const char* buf, uint32_t len, SyncPing* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncPing) + pMsg->dataLen); + tAssert(len == pMsg->bytes); + tAssert(pMsg->bytes == sizeof(SyncPing) + pMsg->dataLen); } SyncPing* syncPingDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPing* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncPingDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } SyncPing* syncPingFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPing* pMsg = syncPingDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -319,19 +319,19 @@ void syncPingReplyDestroy(SyncPingReply* pMsg) { } void syncPingReplySerialize(const SyncPingReply* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPingReplyDeserialize(const char* buf, uint32_t len, SyncPingReply* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncPingReply) + pMsg->dataLen); + tAssert(len == pMsg->bytes); + tAssert(pMsg->bytes == sizeof(SyncPingReply) + pMsg->dataLen); } char* syncPingReplySerialize2(const SyncPingReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncPingReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -342,9 +342,9 @@ char* syncPingReplySerialize2(const SyncPingReply* pMsg, uint32_t* len) { SyncPingReply* syncPingReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPingReply* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncPingReplyDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -403,7 +403,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) { } pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); pMsg->bytes = bytes; if (tDecodeI32(&decoder, &pMsg->vgId) < 0) { @@ -440,7 +440,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) { taosMemoryFree(pMsg); return NULL; } - ASSERT(len == pMsg->dataLen); + tAssert(len == pMsg->dataLen); memcpy(pMsg->data, data, len); tEndDecode(&decoder); @@ -462,7 +462,7 @@ void syncPingReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPingReply* pMsg) { SyncPingReply* syncPingReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPingReply* pMsg = syncPingReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -902,7 +902,7 @@ SyncTimeout* syncTimeoutBuild2(ESyncTimeoutType timeoutType, uint64_t logicClock char* syncTimeoutSerialize2(const SyncTimeout* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncTimeoutSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -917,21 +917,21 @@ void syncTimeoutDestroy(SyncTimeout* pMsg) { } void syncTimeoutSerialize(const SyncTimeout* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncTimeoutDeserialize(const char* buf, uint32_t len, SyncTimeout* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } SyncTimeout* syncTimeoutDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncTimeout* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncTimeoutDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -949,7 +949,7 @@ void syncTimeoutFromRpcMsg(const SRpcMsg* pRpcMsg, SyncTimeout* pMsg) { SyncTimeout* syncTimeoutFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncTimeout* pMsg = syncTimeoutDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1028,18 +1028,18 @@ void syncRequestVoteDestroy(SyncRequestVote* pMsg) { } void syncRequestVoteSerialize(const SyncRequestVote* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncRequestVoteDeserialize(const char* buf, uint32_t len, SyncRequestVote* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncRequestVoteSerialize2(const SyncRequestVote* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncRequestVoteSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1050,9 +1050,9 @@ char* syncRequestVoteSerialize2(const SyncRequestVote* pMsg, uint32_t* len) { SyncRequestVote* syncRequestVoteDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncRequestVote* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncRequestVoteDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1070,7 +1070,7 @@ void syncRequestVoteFromRpcMsg(const SRpcMsg* pRpcMsg, SyncRequestVote* pMsg) { SyncRequestVote* syncRequestVoteFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncRequestVote* pMsg = syncRequestVoteDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1179,18 +1179,18 @@ void syncRequestVoteReplyDestroy(SyncRequestVoteReply* pMsg) { } void syncRequestVoteReplySerialize(const SyncRequestVoteReply* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncRequestVoteReplyDeserialize(const char* buf, uint32_t len, SyncRequestVoteReply* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncRequestVoteReplySerialize2(const SyncRequestVoteReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncRequestVoteReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1201,9 +1201,9 @@ char* syncRequestVoteReplySerialize2(const SyncRequestVoteReply* pMsg, uint32_t* SyncRequestVoteReply* syncRequestVoteReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncRequestVoteReply* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncRequestVoteReplyDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1221,7 +1221,7 @@ void syncRequestVoteReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncRequestVoteReply SyncRequestVoteReply* syncRequestVoteReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncRequestVoteReply* pMsg = syncRequestVoteReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1328,19 +1328,19 @@ void syncAppendEntriesDestroy(SyncAppendEntries* pMsg) { } void syncAppendEntriesSerialize(const SyncAppendEntries* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesDeserialize(const char* buf, uint32_t len, SyncAppendEntries* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncAppendEntries) + pMsg->dataLen); + tAssert(len == pMsg->bytes); + tAssert(pMsg->bytes == sizeof(SyncAppendEntries) + pMsg->dataLen); } char* syncAppendEntriesSerialize2(const SyncAppendEntries* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncAppendEntriesSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1351,9 +1351,9 @@ char* syncAppendEntriesSerialize2(const SyncAppendEntries* pMsg, uint32_t* len) SyncAppendEntries* syncAppendEntriesDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntries* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncAppendEntriesDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1371,7 +1371,7 @@ void syncAppendEntriesFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntries* pMsg SyncAppendEntries* syncAppendEntriesFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntries* pMsg = syncAppendEntriesDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1498,18 +1498,18 @@ void syncAppendEntriesReplyDestroy(SyncAppendEntriesReply* pMsg) { } void syncAppendEntriesReplySerialize(const SyncAppendEntriesReply* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesReplyDeserialize(const char* buf, uint32_t len, SyncAppendEntriesReply* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncAppendEntriesReplySerialize2(const SyncAppendEntriesReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncAppendEntriesReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1520,9 +1520,9 @@ char* syncAppendEntriesReplySerialize2(const SyncAppendEntriesReply* pMsg, uint3 SyncAppendEntriesReply* syncAppendEntriesReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntriesReply* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncAppendEntriesReplyDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1540,7 +1540,7 @@ void syncAppendEntriesReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesR SyncAppendEntriesReply* syncAppendEntriesReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntriesReply* pMsg = syncAppendEntriesReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1654,18 +1654,18 @@ void syncHeartbeatDestroy(SyncHeartbeat* pMsg) { } void syncHeartbeatSerialize(const SyncHeartbeat* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncHeartbeatDeserialize(const char* buf, uint32_t len, SyncHeartbeat* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncHeartbeatSerialize2(const SyncHeartbeat* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncHeartbeatSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1676,9 +1676,9 @@ char* syncHeartbeatSerialize2(const SyncHeartbeat* pMsg, uint32_t* len) { SyncHeartbeat* syncHeartbeatDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncHeartbeat* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncHeartbeatDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1696,7 +1696,7 @@ void syncHeartbeatFromRpcMsg(const SRpcMsg* pRpcMsg, SyncHeartbeat* pMsg) { SyncHeartbeat* syncHeartbeatFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncHeartbeat* pMsg = syncHeartbeatDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1807,18 +1807,18 @@ void syncHeartbeatReplyDestroy(SyncHeartbeatReply* pMsg) { } void syncHeartbeatReplySerialize(const SyncHeartbeatReply* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncHeartbeatReplyDeserialize(const char* buf, uint32_t len, SyncHeartbeatReply* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncHeartbeatReplySerialize2(const SyncHeartbeatReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncHeartbeatReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1829,9 +1829,9 @@ char* syncHeartbeatReplySerialize2(const SyncHeartbeatReply* pMsg, uint32_t* len SyncHeartbeatReply* syncHeartbeatReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncHeartbeatReply* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncHeartbeatReplyDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -1849,7 +1849,7 @@ void syncHeartbeatReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncHeartbeatReply* pM SyncHeartbeatReply* syncHeartbeatReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncHeartbeatReply* pMsg = syncHeartbeatReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -1961,18 +1961,18 @@ void syncPreSnapshotDestroy(SyncPreSnapshot* pMsg) { } void syncPreSnapshotSerialize(const SyncPreSnapshot* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPreSnapshotDeserialize(const char* buf, uint32_t len, SyncPreSnapshot* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncPreSnapshotSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1983,9 +1983,9 @@ char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len) { SyncPreSnapshot* syncPreSnapshotDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPreSnapshot* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncPreSnapshotDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2003,7 +2003,7 @@ void syncPreSnapshotFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshot* pMsg) { SyncPreSnapshot* syncPreSnapshotFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPreSnapshot* pMsg = syncPreSnapshotDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -2108,18 +2108,18 @@ void syncPreSnapshotReplyDestroy(SyncPreSnapshotReply* pMsg) { } void syncPreSnapshotReplySerialize(const SyncPreSnapshotReply* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPreSnapshotReplyDeserialize(const char* buf, uint32_t len, SyncPreSnapshotReply* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncPreSnapshotReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2130,9 +2130,9 @@ char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* SyncPreSnapshotReply* syncPreSnapshotReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPreSnapshotReply* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncPreSnapshotReplyDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2150,7 +2150,7 @@ void syncPreSnapshotReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshotReply SyncPreSnapshotReply* syncPreSnapshotReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPreSnapshotReply* pMsg = syncPreSnapshotReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -2267,18 +2267,18 @@ void syncApplyMsgDestroy(SyncApplyMsg* pMsg) { } void syncApplyMsgSerialize(const SyncApplyMsg* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncApplyMsgDeserialize(const char* buf, uint32_t len, SyncApplyMsg* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncApplyMsgSerialize2(const SyncApplyMsg* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncApplyMsgSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2289,9 +2289,9 @@ char* syncApplyMsgSerialize2(const SyncApplyMsg* pMsg, uint32_t* len) { SyncApplyMsg* syncApplyMsgDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncApplyMsg* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncApplyMsgDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2412,19 +2412,19 @@ void syncSnapshotSendDestroy(SyncSnapshotSend* pMsg) { } void syncSnapshotSendSerialize(const SyncSnapshotSend* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncSnapshotSendDeserialize(const char* buf, uint32_t len, SyncSnapshotSend* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); - ASSERT(pMsg->bytes == sizeof(SyncSnapshotSend) + pMsg->dataLen); + tAssert(len == pMsg->bytes); + tAssert(pMsg->bytes == sizeof(SyncSnapshotSend) + pMsg->dataLen); } char* syncSnapshotSendSerialize2(const SyncSnapshotSend* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncSnapshotSendSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2435,9 +2435,9 @@ char* syncSnapshotSendSerialize2(const SyncSnapshotSend* pMsg, uint32_t* len) { SyncSnapshotSend* syncSnapshotSendDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncSnapshotSend* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncSnapshotSendDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2455,7 +2455,7 @@ void syncSnapshotSendFromRpcMsg(const SRpcMsg* pRpcMsg, SyncSnapshotSend* pMsg) SyncSnapshotSend* syncSnapshotSendFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncSnapshotSend* pMsg = syncSnapshotSendDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -2476,18 +2476,18 @@ void syncSnapshotRspDestroy(SyncSnapshotRsp* pMsg) { } void syncSnapshotRspSerialize(const SyncSnapshotRsp* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncSnapshotRspDeserialize(const char* buf, uint32_t len, SyncSnapshotRsp* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncSnapshotRspSerialize2(const SyncSnapshotRsp* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncSnapshotRspSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2498,9 +2498,9 @@ char* syncSnapshotRspSerialize2(const SyncSnapshotRsp* pMsg, uint32_t* len) { SyncSnapshotRsp* syncSnapshotRspDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncSnapshotRsp* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncSnapshotRspDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2518,7 +2518,7 @@ void syncSnapshotRspFromRpcMsg(const SRpcMsg* pRpcMsg, SyncSnapshotRsp* pMsg) { SyncSnapshotRsp* syncSnapshotRspFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncSnapshotRsp* pMsg = syncSnapshotRspDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -2639,18 +2639,18 @@ void syncLeaderTransferDestroy(SyncLeaderTransfer* pMsg) { } void syncLeaderTransferSerialize(const SyncLeaderTransfer* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncLeaderTransferDeserialize(const char* buf, uint32_t len, SyncLeaderTransfer* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncLeaderTransferSerialize2(const SyncLeaderTransfer* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncLeaderTransferSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2661,9 +2661,9 @@ char* syncLeaderTransferSerialize2(const SyncLeaderTransfer* pMsg, uint32_t* len SyncLeaderTransfer* syncLeaderTransferDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncLeaderTransfer* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncLeaderTransferDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2681,7 +2681,7 @@ void syncLeaderTransferFromRpcMsg(const SRpcMsg* pRpcMsg, SyncLeaderTransfer* pM SyncLeaderTransfer* syncLeaderTransferFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncLeaderTransfer* pMsg = syncLeaderTransferDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } @@ -2771,18 +2771,18 @@ void syncLocalCmdDestroy(SyncLocalCmd* pMsg) { } void syncLocalCmdSerialize(const SyncLocalCmd* pMsg, char* buf, uint32_t bufLen) { - ASSERT(pMsg->bytes <= bufLen); + tAssert(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncLocalCmdDeserialize(const char* buf, uint32_t len, SyncLocalCmd* pMsg) { memcpy(pMsg, buf, len); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); } char* syncLocalCmdSerialize2(const SyncLocalCmd* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - ASSERT(buf != NULL); + tAssert(buf != NULL); syncLocalCmdSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2793,9 +2793,9 @@ char* syncLocalCmdSerialize2(const SyncLocalCmd* pMsg, uint32_t* len) { SyncLocalCmd* syncLocalCmdDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncLocalCmd* pMsg = taosMemoryMalloc(bytes); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); syncLocalCmdDeserialize(buf, len, pMsg); - ASSERT(len == pMsg->bytes); + tAssert(len == pMsg->bytes); return pMsg; } @@ -2813,7 +2813,7 @@ void syncLocalCmdFromRpcMsg(const SRpcMsg* pRpcMsg, SyncLocalCmd* pMsg) { SyncLocalCmd* syncLocalCmdFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncLocalCmd* pMsg = syncLocalCmdDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - ASSERT(pMsg != NULL); + tAssert(pMsg != NULL); return pMsg; } diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c index 50ecc5d478..31e325424b 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c @@ -25,10 +25,10 @@ char *syncCfg2Str(SSyncCfg *pSyncCfg) { int32_t syncCfgFromStr(const char *s, SSyncCfg *pSyncCfg) { cJSON *pRoot = cJSON_Parse(s); - ASSERT(pRoot != NULL); + tAssert(pRoot != NULL); int32_t ret = syncCfgFromJson(pRoot, pSyncCfg); - ASSERT(ret == 0); + tAssert(ret == 0); cJSON_Delete(pRoot); return 0; diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c index 8179b24d29..7eb1bbe401 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c @@ -172,7 +172,7 @@ cJSON* raftEntryCache2Json(SRaftEntryCache* pCache) { SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - ASSERT(pNode != NULL); + tAssert(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); } diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 84ed8f9aef..09bbfae6ab 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -43,7 +43,7 @@ struct SBTree { #define TDB_BTREE_PAGE_IS_LEAF(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_LEAF) #define TDB_BTREE_PAGE_IS_OVFL(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_OVFL) #define TDB_BTREE_ASSERT_FLAG(flags) \ - ASSERT(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ + tAssert(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ TDB_FLAG_IS(flags, TDB_BTREE_ROOT | TDB_BTREE_LEAF) || TDB_FLAG_IS(flags, 0) || \ TDB_FLAG_IS(flags, TDB_BTREE_OVFL)) @@ -74,7 +74,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg SBTree *pBt; int ret; - ASSERT(keyLen != 0); + tAssert(keyLen != 0); *ppBt = NULL; @@ -148,7 +148,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg tdbPostCommit(pPager->pEnv, txn); } - ASSERT(pgno != 0); + tAssert(pgno != 0); pBt->root = pgno; /* // TODO: pBt->root @@ -362,7 +362,7 @@ static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2 int mlen; int cret; - ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -387,7 +387,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { { // 1. TODO: Search the main DB to check if the DB exists ret = tdbPagerOpenDB(pBt->pPager, &pgno, true, pBt); - ASSERT(ret == 0); + tAssert(ret == 0); } if (pgno != 0) { @@ -402,7 +402,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { return -1; } - ASSERT(pgno != 0); + tAssert(pgno != 0); pBt->root = pgno; return 0; } @@ -542,11 +542,11 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx nOlds = 3; } for (int i = 0; i < nOlds; i++) { - ASSERT(sIdx + i <= nCells); + tAssert(sIdx + i <= nCells); SPgno pgno; if (sIdx + i == nCells) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pParent)); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pParent)); pgno = ((SIntHdr *)(pParent->pData))->pgno; } else { pCell = tdbPageGetCell(pParent, sIdx + i); @@ -628,7 +628,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx // page is full, use a new page nNews++; - ASSERT(infoNews[nNews].size + cellBytes <= TDB_PAGE_USABLE_SIZE(pPage)); + tAssert(infoNews[nNews].size + cellBytes <= TDB_PAGE_USABLE_SIZE(pPage)); if (childNotLeaf) { // for non-child page, this cell is used as the right-most child, @@ -675,7 +675,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx szRCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); } - ASSERT(infoNews[iNew - 1].cnt > 0); + tAssert(infoNews[iNew - 1].cnt > 0); if (infoNews[iNew].size + szRCell >= infoNews[iNew - 1].size - szRCell) { break; @@ -762,8 +762,8 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx pCell = tdbPageGetCell(pPage, oIdx); szCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); - ASSERT(nNewCells <= infoNews[iNew].cnt); - ASSERT(iNew < nNews); + tAssert(nNewCells <= infoNews[iNew].cnt); + tAssert(iNew < nNews); if (nNewCells < infoNews[iNew].cnt) { tdbPageInsertCell(pNews[iNew], nNewCells, pCell, szCell, 0); @@ -802,14 +802,14 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } } } else { - ASSERT(childNotLeaf); - ASSERT(iNew < nNews - 1); + tAssert(childNotLeaf); + tAssert(iNew < nNews - 1); // set current new page right-most child ((SIntHdr *)pNews[iNew]->pData)->pgno = ((SPgno *)pCell)[0]; // insert to parent as divider cell - ASSERT(iNew < nNews - 1); + tAssert(iNew < nNews - 1); ((SPgno *)pCell)[0] = TDB_PAGE_PGNO(pNews[iNew]); tdbPageInsertCell(pParent, sIdx++, pCell, szCell, 0); @@ -824,7 +824,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } if (childNotLeaf) { - ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); + tAssert(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); ((SIntHdr *)(pNews[nNews - 1]->pData))->pgno = rPgno; SIntHdr *pIntHdr = (SIntHdr *)pParent->pData; @@ -1014,7 +1014,7 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const nLeft -= kLen; // pack partial val to local if any space left if (nLocal > nHeader + kLen + sizeof(SPgno)) { - ASSERT(pVal != NULL && vLen != 0); + tAssert(pVal != NULL && vLen != 0); memcpy(pCell + nHeader + kLen, pVal, nLocal - nHeader - kLen - sizeof(SPgno)); nLeft -= nLocal - nHeader - kLen - sizeof(SPgno); } @@ -1176,9 +1176,9 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo int nPayload; int ret; - ASSERT(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); - ASSERT(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); - ASSERT(pKey != NULL && kLen > 0); + tAssert(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); + tAssert(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); + tAssert(pKey != NULL && kLen > 0); nPayload = 0; nHeader = 0; @@ -1187,7 +1187,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo // 1. Encode Header part /* Encode SPgno if interior page */ if (!leaf) { - ASSERT(pPage->vLen == sizeof(SPgno)); + tAssert(pPage->vLen == sizeof(SPgno)); ((SPgno *)(pCell + nHeader))[0] = ((SPgno *)pVal)[0]; nHeader = nHeader + sizeof(SPgno); @@ -1230,7 +1230,7 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader, int vLen = pDecoder->vLen; if (pDecoder->pVal) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pPage)); nPayload = pDecoder->kLen; } else { nPayload = pDecoder->kLen + pDecoder->vLen; @@ -1431,7 +1431,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD // 1. Decode header part if (!leaf) { - ASSERT(pPage->vLen == sizeof(SPgno)); + tAssert(pPage->vLen == sizeof(SPgno)); pDecoder->pgno = ((SPgno *)(pCell + nHeader))[0]; pDecoder->pVal = (u8 *)(&(pDecoder->pgno)); @@ -1445,7 +1445,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD } if (pPage->vLen == TDB_VARIANT_LEN) { - ASSERT(leaf); + tAssert(leaf); nHeader += tdbGetVarInt(pCell + nHeader, &(pDecoder->vLen)); } else { pDecoder->vLen = pPage->vLen; @@ -1477,7 +1477,7 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell, int dropOfp, TXN * } if (pPage->vLen == TDB_VARIANT_LEN) { - ASSERT(leaf); + tAssert(leaf); nHeader += tdbGetVarInt(pCell + nHeader, &vLen); } else if (leaf) { vLen = pPage->vLen; @@ -1577,14 +1577,14 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { return -1; } - ASSERT(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); + tAssert(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); pBtc->iPage = 0; if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0) { pBtc->idx = 0; } else { // no any data, point to an invalid position - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); pBtc->idx = -1; return 0; } @@ -1595,7 +1595,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { int iPage = 0; for (; iPage < pBtc->iPage; iPage++) { - ASSERT(pBtc->idxStack[iPage] >= 0); + tAssert(pBtc->idxStack[iPage] >= 0); if (pBtc->idxStack[iPage]) break; } @@ -1652,7 +1652,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { pBtc->idx = TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage) ? nCells - 1 : nCells; } else { // no data at all, point to an invalid position - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); pBtc->idx = -1; return 0; } @@ -1663,7 +1663,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { // downward search for (; iPage < pBtc->iPage; iPage++) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pgStack[iPage]); if (pBtc->idxStack[iPage] != nCells) break; } @@ -1806,7 +1806,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { int ret; SCell *pCell; - ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx < 0) return -1; @@ -1825,7 +1825,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { tdbBtcMoveUpward(pBtc); pBtc->idx++; - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx <= TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { break; } @@ -1889,8 +1889,8 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { SPgno pgno; SCell *pCell; - ASSERT(pBtc->idx >= 0); - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + tAssert(pBtc->idx >= 0); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx < TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); @@ -1899,7 +1899,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; } - ASSERT(pgno); + tAssert(pgno); pBtc->pgStack[pBtc->iPage] = pBtc->pPage; pBtc->idxStack[pBtc->iPage] = pBtc->idx; @@ -1965,7 +1965,7 @@ int tdbBtcDelete(SBTC *pBtc) { int nKey; int ret; - ASSERT(idx >= 0 && idx < nCells); + tAssert(idx >= 0 && idx < nCells); // drop the cell on the leaf ret = tdbPagerWrite(pPager, pBtc->pPage); @@ -2014,7 +2014,7 @@ int tdbBtcDelete(SBTC *pBtc) { } } else { // delete the leaf page and do balance - ASSERT(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); + tAssert(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); ret = tdbBtreeBalance(pBtc); if (ret < 0) { @@ -2035,7 +2035,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int void *pBuf; int ret; - ASSERT(pBtc->idx >= 0); + tAssert(pBtc->idx >= 0); // alloc space szBuf = kLen + nData + 14; @@ -2063,11 +2063,11 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // insert or update if (insert) { - ASSERT(pBtc->idx <= nCells); + tAssert(pBtc->idx <= nCells); ret = tdbPageInsertCell(pBtc->pPage, pBtc->idx, pCell, szCell, 0); } else { - ASSERT(pBtc->idx < nCells); + tAssert(pBtc->idx < nCells); ret = tdbPageUpdateCell(pBtc->pPage, pBtc->idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); } @@ -2126,7 +2126,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { idx = pBtc->idxStack[iPage]; nCells = TDB_PAGE_TOTAL_CELLS(pPage); - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + tAssert(!TDB_BTREE_PAGE_IS_LEAF(pPage)); // check if key <= current position if (idx < nCells) { @@ -2164,7 +2164,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { lidx = 0; ridx = nCells - 1; - ASSERT(nCells > 0); + tAssert(nCells > 0); // compare first cell pBtc->idx = lidx; @@ -2229,7 +2229,7 @@ int tdbBtcClose(SBTC *pBtc) { if (pBtc->iPage < 0) return 0; for (;;) { - ASSERT(pBtc->pPage); + tAssert(pBtc->pPage); tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage, pBtc->pTxn); diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index c79279c658..053e0358e2 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -247,7 +247,7 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { // remove from the list for (ppPager = &pDb->pgrList; *ppPager && (*ppPager != pPager); ppPager = &((*ppPager)->pNext)) { } - ASSERT(*ppPager == pPager); + tAssert(*ppPager == pPager); *ppPager = pPager->pNext; // remove from hash @@ -255,7 +255,7 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { ppPager = &pDb->pgrHash[hash % pDb->nPgrHash]; for (; *ppPager && *ppPager != pPager; ppPager = &((*ppPager)->pHashNext)) { } - ASSERT(*ppPager == pPager); + tAssert(*ppPager == pPager); *ppPager = pPager->pNext; // decrease the counter diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index cd6afe2b91..c9268d89e3 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -195,10 +195,10 @@ SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) { void tdbPCacheRelease(SPCache *pCache, SPage *pPage, TXN *pTxn) { i32 nRef; - ASSERT(pTxn); + tAssert(pTxn); // nRef = tdbUnrefPage(pPage); - // ASSERT(nRef >= 0); + // tAssert(nRef >= 0); tdbPCacheLock(pCache); nRef = tdbUnrefPage(pPage); @@ -230,7 +230,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) SPage *pPage = NULL; SPage *pPageH = NULL; - ASSERT(pTxn); + tAssert(pTxn); // 1. Search the hash table pPage = pCache->pgHash[tdbPCachePageHash(pPgid) % pCache->nHash]; @@ -325,7 +325,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { if (pPage->pLruNext != NULL) { - ASSERT(tdbGetPageRef(pPage) == 0); + tAssert(tdbGetPageRef(pPage) == 0); pPage->pLruPrev->pLruNext = pPage->pLruNext; pPage->pLruNext->pLruPrev = pPage->pLruPrev; @@ -340,11 +340,11 @@ static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) { i32 nRef; - ASSERT(pPage->isLocal); - ASSERT(!pPage->isDirty); - ASSERT(tdbGetPageRef(pPage) == 0); + tAssert(pPage->isLocal); + tAssert(!pPage->isDirty); + tAssert(tdbGetPageRef(pPage) == 0); - ASSERT(pPage->pLruNext == NULL); + tAssert(pPage->pLruNext == NULL); tdbTrace("pCache:%p unpin page %p/%d/%d, nPages:%d", pCache, pPage, TDB_PAGE_PGNO(pPage), pPage->id, pCache->nPages); if (pPage->id < pCache->nPages) { diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index c1732e0ac6..9aafa458af 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -43,9 +43,9 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t) u8 *ptr; int size; - ASSERT(xMalloc); + tAssert(xMalloc); - ASSERT(TDB_IS_PGSIZE_VLD(pageSize)); + tAssert(TDB_IS_PGSIZE_VLD(pageSize)); *ppPage = NULL; size = pageSize + sizeof(*pPage); @@ -77,8 +77,8 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) u8 *ptr; tdbTrace("page/destroy: %p/%d %p", pPage, pPage->id, xFree); - ASSERT(!pPage->isDirty); - ASSERT(xFree); + tAssert(!pPage->isDirty); + tAssert(xFree); for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) { tdbTrace("tdbPage/destroy/free ovfl cell: %p/%p", pPage->apOvfl[iOvfl], pPage); @@ -105,7 +105,7 @@ void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - ASSERT((u8 *)pPage->pPageFtr == pPage->pFreeEnd); + tAssert((u8 *)pPage->pPageFtr == pPage->pFreeEnd); } void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) { @@ -118,8 +118,8 @@ void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - ASSERT(pPage->pFreeEnd >= pPage->pFreeStart); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart <= TDB_PAGE_NFREE(pPage)); + tAssert(pPage->pFreeEnd >= pPage->pFreeStart); + tAssert(pPage->pFreeEnd - pPage->pFreeStart <= TDB_PAGE_NFREE(pPage)); } int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl) { @@ -129,7 +129,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl int lidx; // local idx SCell *pNewCell; - ASSERT(szCell <= TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); + tAssert(szCell <= TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); @@ -173,7 +173,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl TDB_PAGE_CELL_OFFSET_AT_SET(pPage, lidx, pNewCell - pPage->pData); TDB_PAGE_NCELLS_SET(pPage, nCells + 1); - ASSERT(pPage->pFreeStart == pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)); + tAssert(pPage->pFreeStart == pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)); } for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -197,7 +197,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { nCells = TDB_PAGE_NCELLS(pPage); - ASSERT(idx >= 0 && idx < nCells + pPage->nOverflow); + tAssert(idx >= 0 && idx < nCells + pPage->nOverflow); iOvfl = 0; for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -225,7 +225,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { for (; iOvfl < pPage->nOverflow; iOvfl++) { pPage->aiOvfl[iOvfl]--; - ASSERT(pPage->aiOvfl[iOvfl] > 0); + tAssert(pPage->aiOvfl[iOvfl] > 0); } return 0; @@ -237,12 +237,12 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage, int deepCopyOvfl) { pToPage->pFreeStart = pToPage->pPageHdr + (pFromPage->pFreeStart - pFromPage->pPageHdr); pToPage->pFreeEnd = (u8 *)(pToPage->pPageFtr) - ((u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - ASSERT(pToPage->pFreeEnd >= pToPage->pFreeStart); + tAssert(pToPage->pFreeEnd >= pToPage->pFreeStart); memcpy(pToPage->pPageHdr, pFromPage->pPageHdr, pFromPage->pFreeStart - pFromPage->pPageHdr); memcpy(pToPage->pFreeEnd, pFromPage->pFreeEnd, (u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - ASSERT(TDB_PAGE_CCELLS(pToPage) == pToPage->pFreeEnd - pToPage->pData); + tAssert(TDB_PAGE_CCELLS(pToPage) == pToPage->pFreeEnd - pToPage->pData); delta = (pToPage->pPageHdr - pToPage->pData) - (pFromPage->pPageHdr - pFromPage->pData); if (delta != 0) { @@ -292,8 +292,8 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { *ppCell = NULL; nFree = TDB_PAGE_NFREE(pPage); - ASSERT(nFree >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)); - ASSERT(TDB_PAGE_CCELLS(pPage) == pPage->pFreeEnd - pPage->pData); + tAssert(nFree >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)); + tAssert(TDB_PAGE_CCELLS(pPage) == pPage->pFreeEnd - pPage->pData); // 1. Try to allocate from the free space block area if (pPage->pFreeEnd - pPage->pFreeStart >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)) { @@ -305,7 +305,7 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 2. Try to allocate from the page free list cellFree = TDB_PAGE_FCELL(pPage); - ASSERT(cellFree == 0 || cellFree >= pPage->pFreeEnd - pPage->pData); + tAssert(cellFree == 0 || cellFree >= pPage->pFreeEnd - pPage->pData); if (cellFree && pPage->pFreeEnd - pPage->pFreeStart >= TDB_PAGE_OFFSET_SIZE(pPage)) { SCell *pPrevFreeCell = NULL; int szPrevFreeCell; @@ -350,16 +350,16 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 3. Try to dfragment and allocate again tdbPageDefragment(pPage); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); - ASSERT(nFree == TDB_PAGE_NFREE(pPage)); - ASSERT(pPage->pFreeEnd - pPage->pData == TDB_PAGE_CCELLS(pPage)); + tAssert(pPage->pFreeEnd - pPage->pFreeStart == nFree); + tAssert(nFree == TDB_PAGE_NFREE(pPage)); + tAssert(pPage->pFreeEnd - pPage->pData == TDB_PAGE_CCELLS(pPage)); pPage->pFreeEnd -= szCell; pCell = pPage->pFreeEnd; TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); _alloc_finish: - ASSERT(pCell); + tAssert(pCell); pPage->pFreeStart += TDB_PAGE_OFFSET_SIZE(pPage); TDB_PAGE_NFREE_SET(pPage, nFree - szCell - TDB_PAGE_OFFSET_SIZE(pPage)); *ppCell = pCell; @@ -372,9 +372,9 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { u8 *dest; u8 *src; - ASSERT(pCell >= pPage->pFreeEnd); - ASSERT(pCell + szCell <= (u8 *)(pPage->pPageFtr)); - ASSERT(pCell == TDB_PAGE_CELL_AT(pPage, idx)); + tAssert(pCell >= pPage->pFreeEnd); + tAssert(pCell + szCell <= (u8 *)(pPage->pPageFtr)); + tAssert(pCell == TDB_PAGE_CELL_AT(pPage, idx)); nFree = TDB_PAGE_NFREE(pPage); @@ -414,7 +414,7 @@ static int tdbPageDefragment(SPage *pPage) { nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); - ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree); + tAssert(pPage->pFreeEnd - pPage->pFreeStart < nFree); // Loop to compact the page content // Here we use an O(n^2) algorithm to do the job since @@ -440,11 +440,11 @@ static int tdbPageDefragment(SPage *pPage) { } } - ASSERT(pCell != NULL); + tAssert(pCell != NULL); szCell = (*pPage->xCellSize)(pPage, pCell, 0, NULL, NULL); - ASSERT(pCell + szCell <= pNextCell); + tAssert(pCell + szCell <= pNextCell); if (pCell + szCell < pNextCell) { memmove(pNextCell - szCell, pCell, szCell); } @@ -454,7 +454,7 @@ static int tdbPageDefragment(SPage *pPage) { TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pNextCell - pPage->pData); } - ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); + tAssert(pPage->pFreeEnd - pPage->pFreeStart == nFree); TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); TDB_PAGE_FCELL_SET(pPage, 0); @@ -480,39 +480,39 @@ typedef struct { // cellNum static inline int getPageCellNum(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellNum; } static inline void setPageCellNum(SPage *pPage, int cellNum) { - ASSERT(cellNum < 65536); + tAssert(cellNum < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellNum = (u16)cellNum; } // cellBody static inline int getPageCellBody(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellBody; } static inline void setPageCellBody(SPage *pPage, int cellBody) { - ASSERT(cellBody < 65536); + tAssert(cellBody < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellBody = (u16)cellBody; } // cellFree static inline int getPageCellFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellFree; } static inline void setPageCellFree(SPage *pPage, int cellFree) { - ASSERT(cellFree < 65536); + tAssert(cellFree < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellFree = (u16)cellFree; } // nFree static inline int getPageNFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].nFree; } static inline void setPageNFree(SPage *pPage, int nFree) { - ASSERT(nFree < 65536); + tAssert(nFree < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].nFree = (u16)nFree; } // cell offset static inline int getPageCellOffset(SPage *pPage, int idx) { - ASSERT(idx >= 0 && idx < getPageCellNum(pPage)); + tAssert(idx >= 0 && idx < getPageCellNum(pPage)); return ((u16 *)pPage->pCellIdx)[idx]; } static inline void setPageCellOffset(SPage *pPage, int idx, int offset) { - ASSERT(offset < 65536); + tAssert(offset < 65536); ((u16 *)pPage->pCellIdx)[idx] = (u16)offset; } @@ -587,7 +587,7 @@ static inline void setLPageNFree(SPage *pPage, int nFree) { // cell offset static inline int getLPageCellOffset(SPage *pPage, int idx) { - ASSERT(idx >= 0 && idx < getLPageCellNum(pPage)); + tAssert(idx >= 0 && idx < getLPageCellNum(pPage)); return TDB_GET_U24(pPage->pCellIdx + 3 * idx); } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 5dc2fcca39..00f8b9451f 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -234,7 +234,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { int ret; SPage **ppPage; - // ASSERT(pPager->inTran); + // tAssert(pPager->inTran); if (pPage->isDirty) return 0; // ref page one more time so the page will not be release @@ -255,7 +255,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { return 0; } - ASSERT(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); + tAssert(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); pPage->pDirtyNext = *ppPage; *ppPage = pPage; */ @@ -324,7 +324,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) { while ((pNode = tRBTreeIterNext(&iter)) != NULL) { pPage = (SPage *)pNode; - ASSERT(pPage->nOverflow == 0); + tAssert(pPage->nOverflow == 0); ret = tdbPagerPWritePageToDB(pPager, pPage); if (ret < 0) { tdbError("failed to write page to db since %s", tstrerror(terrno)); @@ -637,7 +637,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa } } - ASSERT(pgno > 0); + tAssert(pgno > 0); // fetch a page container memcpy(&pgid, pPager->fid, TDB_FILE_ID_LEN); @@ -659,8 +659,8 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa // printf("thread %" PRId64 " pager fetch page %d pgno %d ppage %p\n", taosGetSelfPthreadId(), pPage->id, // TDB_PAGE_PGNO(pPage), pPage); - ASSERT(TDB_PAGE_INITIALIZED(pPage)); - ASSERT(pPage->pPager == pPager); + tAssert(TDB_PAGE_INITIALIZED(pPage)); + tAssert(pPage->pPager == pPager); *ppgno = pgno; *ppPage = pPage; @@ -702,7 +702,7 @@ int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno) { return -1; } - ASSERT(*ppgno != 0); + tAssert(*ppgno != 0); return 0; } diff --git a/source/libs/tdb/src/db/tdbTable.c b/source/libs/tdb/src/db/tdbTable.c index c5c2d6aebe..9eff5f9238 100644 --- a/source/libs/tdb/src/db/tdbTable.c +++ b/source/libs/tdb/src/db/tdbTable.c @@ -105,7 +105,7 @@ int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprF #endif - ASSERT(pPager != NULL); + tAssert(pPager != NULL); // pTb->pBt ret = tdbBtreeOpen(keyLen, valLen, pPager, tbname, pgno, keyCmprFn, pEnv, &(pTb->pBt)); diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 77c87d18f2..10345be962 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -18,7 +18,7 @@ int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *), void *xArg, int flags) { // not support read-committed version at the moment - ASSERT(flags == 0 || flags == (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)); + tAssert(flags == 0 || flags == (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)); pTxn->flags = flags; pTxn->txnId = txnid; diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 743a1f27b0..fb5f18dcb3 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -345,7 +345,7 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) { int iOvfl; int lidx; - ASSERT(idx >= 0 && idx < TDB_PAGE_TOTAL_CELLS(pPage)); + tAssert(idx >= 0 && idx < TDB_PAGE_TOTAL_CELLS(pPage)); iOvfl = 0; for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -358,7 +358,7 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) { } lidx = idx - iOvfl; - ASSERT(lidx >= 0 && lidx < pPage->pPageMethods->getCellNum(pPage)); + tAssert(lidx >= 0 && lidx < pPage->pPageMethods->getCellNum(pPage)); pCell = pPage->pData + pPage->pPageMethods->getCellOffset(pPage, lidx); return pCell; diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index fe97f9c986..b8275686fc 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -56,7 +56,7 @@ static inline int tdbPutVarInt(u8 *p, int v) { v >>= 7; } - ASSERT(n < 6); + tAssert(n < 6); return n; } @@ -79,7 +79,7 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { n++; } - ASSERT(n < 6); + tAssert(n < 6); *v = tv; return n; diff --git a/source/libs/tdb/test/tdbExOVFLTest.cpp b/source/libs/tdb/test/tdbExOVFLTest.cpp index f4f09b20b8..8900462c34 100644 --- a/source/libs/tdb/test/tdbExOVFLTest.cpp +++ b/source/libs/tdb/test/tdbExOVFLTest.cpp @@ -3,6 +3,7 @@ #define ALLOW_FORBID_FUNC #include "os.h" #include "tdb.h" +#include "tlog.h" #include #include @@ -103,7 +104,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in int mlen; int cret; - ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -224,7 +225,7 @@ TEST(TdbOVFLPagesTest, TbGetTest) { // char const *key = "key1"; char const *key = "key123456789"; ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - ASSERT(ret == 0); + tAssert(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, valLen); @@ -276,7 +277,7 @@ TEST(TdbOVFLPagesTest, TbDeleteTest) { int vLen; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - ASSERT(ret == 0); + tAssert(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, valLen); @@ -302,7 +303,7 @@ tdbBegin(pEnv, &txn); int vLen; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - ASSERT(ret == 0); + tAssert(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, strlen("value1")); @@ -321,7 +322,7 @@ tdbBegin(pEnv, &txn); int vLen = -1; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - ASSERT(ret == -1); + tAssert(ret == -1); GTEST_ASSERT_EQ(ret, -1); GTEST_ASSERT_EQ(vLen, -1); @@ -415,7 +416,7 @@ TEST(tdb_test, simple_insert1) { // sprintf(val, "value%d", i); ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - ASSERT(ret == 0); + tAssert(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, sizeof(val) / sizeof(val[0])); diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 54e80a0009..944d0adff6 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -3,6 +3,7 @@ #define ALLOW_FORBID_FUNC #include "os.h" #include "tdb.h" +#include "tlog.h" #include #include @@ -103,7 +104,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in int mlen; int cret; - ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -181,7 +182,7 @@ TEST(tdb_test, DISABLED_simple_insert1) { sprintf(val, "value%d", i); ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - ASSERT(ret == 0); + tAssert(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, strlen(val)); diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 943611ee27..6e048317c7 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -284,7 +284,7 @@ int32_t tfsMkdir(STfs *pTfs, const char *rname) { } int32_t tfsRmdir(STfs *pTfs, const char *rname) { - ASSERT(rname[0] != 0); + tAssert(rname[0] != 0); char aname[TMPNAME_LEN] = "\0"; diff --git a/source/libs/transport/src/tmsgcb.c b/source/libs/transport/src/tmsgcb.c index 95bc532994..428399235d 100644 --- a/source/libs/transport/src/tmsgcb.c +++ b/source/libs/transport/src/tmsgcb.c @@ -24,7 +24,7 @@ static SMsgCb defaultMsgCb; void tmsgSetDefault(const SMsgCb* msgcb) { defaultMsgCb = *msgcb; } int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg) { - ASSERT(msgcb != NULL); + tAssert(msgcb != NULL); int32_t code = (*msgcb->putToQueueFp)(msgcb->mgmt, qtype, pMsg); if (code != 0) { rpcFreeCont(pMsg->pCont); diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index 8e6628bb21..fa86905a51 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -49,7 +49,7 @@ static FORCE_INLINE int walBuildTmpMetaName(SWal* pWal, char* buf) { static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { int32_t sz = taosArrayGetSize(pWal->fileInfoSet); terrno = TSDB_CODE_SUCCESS; - ASSERT(fileIdx >= 0 && fileIdx < sz); + tAssert(fileIdx >= 0 && fileIdx < sz); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx); char fnameStr[WAL_FILE_LEN]; @@ -101,7 +101,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { offsetBackward = offset; } - ASSERT(offset <= end); + tAssert(offset <= end); readSize = end - offset; capacity = readSize + sizeof(magic); @@ -257,7 +257,7 @@ static void walRebuildFileInfoSet(SArray* metaLogList, SArray* actualLogList) { SWalFileInfo* pLogInfo = taosArrayGet(actualLogList, i); while (j < metaFileNum) { SWalFileInfo* pMetaInfo = taosArrayGet(metaLogList, j); - ASSERT(pMetaInfo != NULL); + tAssert(pMetaInfo != NULL); if (pMetaInfo->firstVer < pLogInfo->firstVer) { j++; } else if (pMetaInfo->firstVer == pLogInfo->firstVer) { @@ -385,7 +385,7 @@ int walCheckAndRepairMeta(SWal* pWal) { taosArrayDestroy(actualLog); int32_t sz = taosArrayGetSize(pWal->fileInfoSet); - ASSERT(sz == actualFileNum); + tAssert(sz == actualFileNum); // scan and determine the lastVer int32_t fileIdx = sz; @@ -403,7 +403,7 @@ int walCheckAndRepairMeta(SWal* pWal) { return -1; } - ASSERT(pFileInfo->firstVer >= 0); + tAssert(pFileInfo->firstVer >= 0); if (pFileInfo->lastVer >= pFileInfo->firstVer && fileSize == pFileInfo->fileSize) { totSize += pFileInfo->fileSize; @@ -417,7 +417,7 @@ int walCheckAndRepairMeta(SWal* pWal) { wError("failed to scan wal last ver since %s", terrstr()); return -1; } - ASSERT(pFileInfo->fileSize == 0); + tAssert(pFileInfo->fileSize == 0); // remove the empty wal log, and its idx wInfo("vgId:%d, wal remove empty file %s", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); @@ -478,7 +478,7 @@ int walReadLogHead(TdFilePtr pLogFile, int64_t offset, SWalCkHead* pCkHead) { int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { int32_t sz = taosArrayGetSize(pWal->fileInfoSet); - ASSERT(fileIdx >= 0 && fileIdx < sz); + tAssert(fileIdx >= 0 && fileIdx < sz); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx); char fnameStr[WAL_FILE_LEN]; walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr); @@ -492,7 +492,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { return -1; } - ASSERT(pFileInfo->fileSize > 0 && pFileInfo->firstVer >= 0 && pFileInfo->lastVer >= pFileInfo->firstVer); + tAssert(pFileInfo->fileSize > 0 && pFileInfo->firstVer >= 0 && pFileInfo->lastVer >= pFileInfo->firstVer); if (fileSize == (pFileInfo->lastVer - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)) { return 0; } @@ -556,7 +556,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { } offset += sizeof(SWalIdxEntry); - ASSERT(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)); + tAssert(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)); // ftruncate idx file if (offset < fileSize) { @@ -577,7 +577,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { } while (idxEntry.ver < pFileInfo->lastVer) { - ASSERT(idxEntry.ver == ckHead.head.version); + tAssert(idxEntry.ver == ckHead.head.version); idxEntry.ver += 1; idxEntry.offset += sizeof(SWalCkHead) + ckHead.head.bodyLen; @@ -650,7 +650,7 @@ int walRollFileInfo(SWal* pWal) { char* walMetaSerialize(SWal* pWal) { char buf[30]; - ASSERT(pWal->fileInfoSet); + tAssert(pWal->fileInfoSet); int sz = taosArrayGetSize(pWal->fileInfoSet); cJSON* pRoot = cJSON_CreateObject(); cJSON* pMeta = cJSON_CreateObject(); @@ -707,7 +707,7 @@ char* walMetaSerialize(SWal* pWal) { } int walMetaDeserialize(SWal* pWal, const char* bytes) { - ASSERT(taosArrayGetSize(pWal->fileInfoSet) == 0); + tAssert(taosArrayGetSize(pWal->fileInfoSet) == 0); cJSON *pRoot, *pMeta, *pFiles, *pInfoJson, *pField; pRoot = cJSON_Parse(bytes); if (!pRoot) goto _err; @@ -823,7 +823,7 @@ int walSaveMeta(SWal* pWal) { // flush to a tmpfile n = walBuildTmpMetaName(pWal, tmpFnameStr); - ASSERT(n < sizeof(tmpFnameStr) && "Buffer overflow of file name"); + tAssert(n < sizeof(tmpFnameStr) && "Buffer overflow of file name"); TdFilePtr pMetaFile = taosOpenFile(tmpFnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pMetaFile == NULL) { @@ -854,7 +854,7 @@ int walSaveMeta(SWal* pWal) { // rename it n = walBuildMetaName(pWal, metaVer + 1, fnameStr); - ASSERT(n < sizeof(fnameStr) && "Buffer overflow of file name"); + tAssert(n < sizeof(fnameStr) && "Buffer overflow of file name"); if (taosRenameFile(tmpFnameStr, fnameStr) < 0) { wError("failed to rename file due to %s. dest:%s", strerror(errno), fnameStr); @@ -877,7 +877,7 @@ _err: } int walLoadMeta(SWal* pWal) { - ASSERT(pWal->fileInfoSet->size == 0); + tAssert(pWal->fileInfoSet->size == 0); // find existing meta file int metaVer = walFindCurMetaVer(pWal); if (metaVer == -1) { diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 27c3c4e694..d518550b8e 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -97,7 +97,7 @@ int32_t walNextValidMsg(SWalReader *pReader) { return -1; } fetchVer++; - ASSERT(fetchVer == pReader->curVersion); + tAssert(fetchVer == pReader->curVersion); } } pReader->curStopped = 1; @@ -132,7 +132,7 @@ static int64_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int return -1; } - ASSERT(entry.ver == ver); + tAssert(entry.ver == ver); ret = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); if (ret < 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -328,8 +328,8 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { static int32_t walSkipFetchBodyNew(SWalReader *pRead) { int64_t code; - ASSERT(pRead->curVersion == pRead->pHead->head.version); - ASSERT(pRead->curInvalid == 0); + tAssert(pRead->curVersion == pRead->pHead->head.version); + tAssert(pRead->curInvalid == 0); code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); if (code < 0) { @@ -410,8 +410,8 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) { pRead->pWal->cfg.vgId, pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer, pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer); - ASSERT(pRead->curVersion == pHead->head.version); - ASSERT(pRead->curInvalid == 0); + tAssert(pRead->curVersion == pHead->head.version); + tAssert(pRead->curInvalid == 0); code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR); if (code < 0) { diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c index eae5d9f1a7..1c3ebe89fd 100644 --- a/source/libs/wal/src/walRef.c +++ b/source/libs/wal/src/walRef.c @@ -58,7 +58,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) { SWalFileInfo tmpInfo; tmpInfo.firstVer = ver; SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - ASSERT(pRet != NULL); + tAssert(pRet != NULL); pRef->refFile = pRet->firstVer; taosThreadMutexUnlock(&pWal->mutex); @@ -88,7 +88,7 @@ SWalRef *walRefCommittedVer(SWal *pWal) { SWalFileInfo tmpInfo; tmpInfo.firstVer = ver; SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - ASSERT(pRet != NULL); + tAssert(pRet != NULL); pRef->refFile = pRet->firstVer; taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c index 2cb6614b01..26256df3d3 100644 --- a/source/libs/wal/src/walSeek.c +++ b/source/libs/wal/src/walSeek.c @@ -40,7 +40,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } - ASSERT(entry.ver == ver); + tAssert(entry.ver == ver); code = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -53,7 +53,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { int walInitWriteFile(SWal* pWal) { TdFilePtr pIdxTFile, pLogTFile; SWalFileInfo* pRet = taosArrayGetLast(pWal->fileInfoSet); - ASSERT(pRet != NULL); + tAssert(pRet != NULL); int64_t fileFirstVer = pRet->firstVer; char fnameStr[WAL_FILE_LEN]; @@ -109,9 +109,9 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) { tmpInfo.firstVer = ver; // bsearch in fileSet int32_t idx = taosArraySearchIdx(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - ASSERT(idx != -1); + tAssert(idx != -1); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, idx); - /*ASSERT(pFileInfo != NULL);*/ + /*tAssert(pFileInfo != NULL);*/ int64_t fileFirstVer = pFileInfo->firstVer; walBuildIdxName(pWal, fileFirstVer, fnameStr); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 5d6f9168ec..39c4503cdd 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -87,8 +87,8 @@ int32_t walApplyVer(SWal *pWal, int64_t ver) { } int32_t walCommit(SWal *pWal, int64_t ver) { - ASSERT(pWal->vers.commitVer >= pWal->vers.snapshotVer); - ASSERT(pWal->vers.commitVer <= pWal->vers.lastVer); + tAssert(pWal->vers.commitVer >= pWal->vers.snapshotVer); + tAssert(pWal->vers.commitVer <= pWal->vers.lastVer); if (ver < pWal->vers.commitVer) { return 0; } @@ -156,7 +156,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { taosThreadMutexUnlock(&pWal->mutex); return -1; } - ASSERT(entry.ver == ver); + tAssert(entry.ver == ver); walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); @@ -176,7 +176,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } // validate offset SWalCkHead head; - ASSERT(taosValidFile(pLogFile)); + tAssert(taosValidFile(pLogFile)); int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead)); if (size != sizeof(SWalCkHead)) { tAssert(0); @@ -185,7 +185,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } code = walValidHeadCksum(&head); - ASSERT(code == 0); + tAssert(code == 0); if (code != 0) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; tAssert(0); @@ -216,7 +216,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } pWal->vers.lastVer = ver - 1; if (pWal->vers.lastVer < pWal->vers.firstVer) { - ASSERT(pWal->vers.lastVer == pWal->vers.firstVer - 1); + tAssert(pWal->vers.lastVer == pWal->vers.firstVer - 1); } ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->lastVer = ver - 1; ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize = entry.offset; @@ -441,7 +441,7 @@ int32_t walRollImpl(SWal *pWal) { pWal->pIdxFile = pIdxFile; pWal->pLogFile = pLogFile; pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1; - ASSERT(pWal->writeCur >= 0); + tAssert(pWal->writeCur >= 0); pWal->lastRollSeq = walGetSeq(); @@ -458,8 +458,8 @@ END: static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { SWalIdxEntry entry = {.ver = ver, .offset = offset}; SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal); - ASSERT(pFileInfo != NULL); - ASSERT(pFileInfo->firstVer >= 0); + tAssert(pFileInfo != NULL); + tAssert(pFileInfo->firstVer >= 0); int64_t idxOffset = (entry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry); wDebug("vgId:%d, write index, index:%" PRId64 ", offset:%" PRId64 ", at %" PRId64, pWal->cfg.vgId, ver, offset, idxOffset); @@ -476,7 +476,7 @@ static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { if (endOffset < 0) { wFatal("vgId:%d, failed to seek end of idxfile due to %s. ver:%" PRId64 "", pWal->cfg.vgId, strerror(errno), ver); } - ASSERT(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned"); + tAssert(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned"); return 0; } @@ -486,9 +486,9 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy int64_t offset = walGetCurFileOffset(pWal); SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal); - ASSERT(pFileInfo != NULL); + tAssert(pFileInfo != NULL); - ASSERT(pFileInfo->firstVer != -1); + tAssert(pFileInfo->firstVer != -1); pWal->writeHead.head.version = index; pWal->writeHead.head.bodyLen = bodyLen; pWal->writeHead.head.msgType = msgType; @@ -525,7 +525,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy // set status if (pWal->vers.firstVer == -1) { - ASSERT(index == 0); + tAssert(index == 0); pWal->vers.firstVer = 0; } pWal->vers.lastVer = index; @@ -541,7 +541,7 @@ END: wFatal("vgId:%d, failed to ftruncate logfile to offset:%" PRId64 " during recovery due to %s", pWal->cfg.vgId, offset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); - ASSERT(0 && "failed to recover from error"); + tAssert(0 && "failed to recover from error"); } int64_t idxOffset = (index - pFileInfo->firstVer) * sizeof(SWalIdxEntry); @@ -549,7 +549,7 @@ END: wFatal("vgId:%d, failed to ftruncate idxfile to offset:%" PRId64 "during recovery due to %s", pWal->cfg.vgId, idxOffset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); - ASSERT(0 && "failed to recover from error"); + tAssert(0 && "failed to recover from error"); } return -1; } @@ -576,7 +576,7 @@ int64_t walAppendLog(SWal *pWal, int64_t index, tmsg_t msgType, SWalSyncInfo syn } } - ASSERT(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0); + tAssert(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0); if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) { taosThreadMutexUnlock(&pWal->mutex); @@ -614,7 +614,7 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SWalSync } } - ASSERT(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0); + tAssert(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0); if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) { taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/libs/wal/test/walMetaTest.cpp b/source/libs/wal/test/walMetaTest.cpp index 891e7dcdae..89313a1f72 100644 --- a/source/libs/wal/test/walMetaTest.cpp +++ b/source/libs/wal/test/walMetaTest.cpp @@ -12,7 +12,7 @@ class WalCleanEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - ASSERT(code == 0); + tAssert(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -28,7 +28,7 @@ class WalCleanEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - ASSERT(pWal != NULL); + tAssert(pWal != NULL); } void TearDown() override { @@ -44,7 +44,7 @@ class WalCleanDeleteEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - ASSERT(code == 0); + tAssert(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -58,7 +58,7 @@ class WalCleanDeleteEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - ASSERT(pWal != NULL); + tAssert(pWal != NULL); } void TearDown() override { @@ -74,7 +74,7 @@ class WalKeepEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - ASSERT(code == 0); + tAssert(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -95,7 +95,7 @@ class WalKeepEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - ASSERT(pWal != NULL); + tAssert(pWal != NULL); } void TearDown() override { @@ -111,7 +111,7 @@ class WalRetentionEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - ASSERT(code == 0); + tAssert(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -132,7 +132,7 @@ class WalRetentionEnv : public ::testing::Test { cfg.vgId = 0; cfg.level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, &cfg); - ASSERT(pWal != NULL); + tAssert(pWal != NULL); } void TearDown() override { @@ -146,7 +146,7 @@ class WalRetentionEnv : public ::testing::Test { TEST_F(WalCleanEnv, createNew) { walRollFileInfo(pWal); - ASSERT(pWal->fileInfoSet != NULL); + tAssert(pWal->fileInfoSet != NULL); ASSERT_EQ(pWal->fileInfoSet->size, 1); SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); ASSERT_EQ(pInfo->firstVer, 0); @@ -157,36 +157,36 @@ TEST_F(WalCleanEnv, createNew) { TEST_F(WalCleanEnv, serialize) { int code = walRollFileInfo(pWal); - ASSERT(code == 0); - ASSERT(pWal->fileInfoSet != NULL); + tAssert(code == 0); + tAssert(pWal->fileInfoSet != NULL); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); char* ss = walMetaSerialize(pWal); printf("%s\n", ss); taosMemoryFree(ss); code = walSaveMeta(pWal); - ASSERT(code == 0); + tAssert(code == 0); } TEST_F(WalCleanEnv, removeOldMeta) { int code = walRollFileInfo(pWal); - ASSERT(code == 0); - ASSERT(pWal->fileInfoSet != NULL); + tAssert(code == 0); + tAssert(pWal->fileInfoSet != NULL); code = walSaveMeta(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walRollFileInfo(pWal); - ASSERT(code == 0); + tAssert(code == 0); code = walSaveMeta(pWal); - ASSERT(code == 0); + tAssert(code == 0); } TEST_F(WalKeepEnv, readOldMeta) { @@ -327,7 +327,7 @@ TEST_F(WalKeepEnv, readHandleRead) { walResetEnv(); int code; SWalReader* pRead = walOpenReader(pWal, NULL); - ASSERT(pRead != NULL); + tAssert(pRead != NULL); int i; for (i = 0; i < 100; i++) { @@ -388,7 +388,7 @@ TEST_F(WalRetentionEnv, repairMeta1) { ASSERT_EQ(pWal->vers.lastVer, 99); SWalReader* pRead = walOpenReader(pWal, NULL); - ASSERT(pRead != NULL); + tAssert(pRead != NULL); for (int i = 0; i < 1000; i++) { int ver = taosRand() % 100; diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 230ca5b968..7d9c2896ce 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) { void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) { #ifdef USE_TD_MEMORY - ASSERT(0); + tAssert(0); #else #if defined(LINUX) void* p = memalign(alignment, size); diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 4bd8294423..68137dee19 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -317,7 +317,7 @@ SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn) { if (fn == NULL) { memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size); } else { - ASSERT(pSrc->elemSize == sizeof(void*)); + tAssert(pSrc->elemSize == sizeof(void*)); for (int32_t i = 0; i < pSrc->size; ++i) { void* p = fn(taosArrayGetP(pSrc, i)); @@ -399,7 +399,7 @@ void taosArrayDestroyEx(SArray* pArray, FDelete fp) { } void taosArraySort(SArray* pArray, __compar_fn_t compar) { - ASSERT(pArray != NULL && compar != NULL); + tAssert(pArray != NULL && compar != NULL); taosSort(pArray->pData, pArray->size, pArray->elemSize, compar); } diff --git a/source/util/src/tbloomfilter.c b/source/util/src/tbloomfilter.c index 84a78f3477..40dac37283 100644 --- a/source/util/src/tbloomfilter.c +++ b/source/util/src/tbloomfilter.c @@ -70,7 +70,7 @@ SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate) { } int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len) { - ASSERT(!tBloomFilterIsFull(pBF)); + tAssert(!tBloomFilterIsFull(pBF)); uint64_t h1 = (uint64_t)pBF->hashFn1(keyBuf, len); uint64_t h2 = (uint64_t)pBF->hashFn2(keyBuf, len); bool hasChange = false; diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index 7d1686ef80..068ba77157 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -266,12 +266,12 @@ static void pushfrontNodeInEntryList(SCacheEntry *pEntry, SCacheNode *pNode) { pNode->pNext = pEntry->next; pEntry->next = pNode; pEntry->num += 1; - ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); + tAssert((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); } static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode *pNode) { if (prev == NULL) { - ASSERT(pe->next == pNode); + tAssert(pe->next == pNode); pe->next = pNode->pNext; } else { prev->pNext = pNode->pNext; @@ -279,7 +279,7 @@ static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode pNode->pNext = NULL; pe->num -= 1; - ASSERT((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0)); + tAssert((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0)); } static FORCE_INLINE SCacheEntry *doFindEntry(SCacheObj *pCacheObj, const void *key, size_t keyLen) { @@ -471,7 +471,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen SCacheNode *pNode = doSearchInEntryList(pe, key, keyLen, &prev); if (pNode != NULL) { int32_t ref = T_REF_INC(pNode); - ASSERT(ref > 0); + tAssert(ref > 0); } taosRUnLockLatch(&pe->latch); @@ -670,7 +670,7 @@ void doTraverseElems(SCacheObj *pCacheObj, bool (*fp)(void *param, SCacheNode *p } else { *pPre = next; pEntry->num -= 1; - ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); + tAssert((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); atomic_sub_fetch_ptr(&pCacheObj->numOfElems, 1); pNode = next; @@ -928,7 +928,7 @@ void taosStopCacheRefreshWorker(void) { size_t taosCacheGetNumOfObj(const SCacheObj *pCacheObj) { return pCacheObj->numOfElems + pCacheObj->numOfElemsInTrash; } SCacheIter *taosCacheCreateIter(const SCacheObj *pCacheObj) { - ASSERT(pCacheObj != NULL); + tAssert(pCacheObj != NULL); SCacheIter *pIter = taosMemoryCalloc(1, sizeof(SCacheIter)); pIter->pCacheObj = (SCacheObj *)pCacheObj; pIter->entryIndex = -1; @@ -978,11 +978,11 @@ bool taosCacheIterNext(SCacheIter *pIter) { SCacheNode *pNode = pEntry->next; for (int32_t i = 0; i < pEntry->num; ++i) { - ASSERT(pNode != NULL); + tAssert(pNode != NULL); pIter->pCurrent[i] = pNode; int32_t ref = T_REF_INC(pIter->pCurrent[i]); - ASSERT(ref >= 1); + tAssert(ref >= 1); pNode = pNode->pNext; } diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index f20b6af358..16f71f0b84 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1323,7 +1323,7 @@ static int32_t tCompTSSwitchToCopy(SCompressor *pCmprsor) { } } - ASSERT(n == pCmprsor->nBuf && nBuf == sizeof(int64_t) * pCmprsor->nVal + 1); + tAssert(n == pCmprsor->nBuf && nBuf == sizeof(int64_t) * pCmprsor->nVal + 1); uint8_t *pBuf = pCmprsor->pBuf; pCmprsor->pBuf = pCmprsor->aBuf[0]; @@ -1338,7 +1338,7 @@ static int32_t tCompTimestamp(SCompressor *pCmprsor, const void *pData, int32_t int32_t code = 0; int64_t ts = *(int64_t *)pData; - ASSERT(nData == 8); + tAssert(nData == 8); if (pCmprsor->pBuf[0] == 1) { if (pCmprsor->nVal == 0) { @@ -1502,7 +1502,7 @@ static int32_t tCompIntSwitchToCopy(SCompressor *pCmprsor) { pCmprsor->i_nEle--; } - ASSERT(n == pCmprsor->nBuf && nBuf == size); + tAssert(n == pCmprsor->nBuf && nBuf == size); uint8_t *pBuf = pCmprsor->pBuf; pCmprsor->pBuf = pCmprsor->aBuf[0]; @@ -1517,7 +1517,7 @@ _exit: static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - ASSERT(nData == DATA_TYPE_INFO[pCmprsor->type].bytes); + tAssert(nData == DATA_TYPE_INFO[pCmprsor->type].bytes); if (pCmprsor->pBuf[0] == 0) { int64_t val = DATA_TYPE_INFO[pCmprsor->type].getI64(pData); @@ -1738,7 +1738,7 @@ _exit: static int32_t tCompFloat(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - ASSERT(nData == sizeof(float)); + tAssert(nData == sizeof(float)); union { float f; @@ -1891,7 +1891,7 @@ _exit: static int32_t tCompDouble(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - ASSERT(nData == sizeof(double)); + tAssert(nData == sizeof(double)); union { double d; diff --git a/source/util/src/tencode.c b/source/util/src/tencode.c index 7f8a0edfdd..71f47bccd0 100644 --- a/source/util/src/tencode.c +++ b/source/util/src/tencode.c @@ -100,7 +100,7 @@ void tEndEncode(SEncoder* pCoder) { if (pCoder->data) { pNode = pCoder->eStack; - ASSERT(pNode); + tAssert(pNode); pCoder->eStack = pNode->pNext; len = pCoder->pos; @@ -142,7 +142,7 @@ void tEndDecode(SDecoder* pCoder) { SDecoderNode* pNode; pNode = pCoder->dStack; - ASSERT(pNode); + tAssert(pNode); pCoder->dStack = pNode->pNext; pCoder->data = pNode->data; diff --git a/source/util/src/thash.c b/source/util/src/thash.c index e9548613aa..427581d6f1 100644 --- a/source/util/src/thash.c +++ b/source/util/src/thash.c @@ -194,14 +194,14 @@ static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SH atomic_sub_fetch_16(&pNode->refCount, 1); if (prev != NULL) { prev->next = pNewNode; - ASSERT(prev->next != prev); + tAssert(prev->next != prev); } else { pe->next = pNewNode; } if (pNode->refCount <= 0) { pNewNode->next = pNode->next; - ASSERT(pNewNode->next != pNewNode); + tAssert(pNewNode->next != pNewNode); FREE_HASH_NODE(pHashObj->freeFp, pNode); } else { @@ -262,7 +262,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp pHashObj->freeFp = NULL; pHashObj->callbackFp = NULL; - ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); + tAssert((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHashEntry **)taosMemoryMalloc(pHashObj->capacity * sizeof(void *)); if (pHashObj->hashList == NULL) { @@ -533,7 +533,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) { pe->next = pNode->next; } else { prevNode->next = pNode->next; - ASSERT(prevNode->next != prevNode); + tAssert(prevNode->next != prevNode); } pe->num--; @@ -729,7 +729,7 @@ void pushfrontNodeInEntryList(SHashEntry *pEntry, SHashNode *pNode) { pNode->next = pEntry->next; pEntry->next = pNode; - ASSERT(pNode->next != pNode); + tAssert(pNode->next != pNode); pEntry->num += 1; } @@ -780,12 +780,12 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) { if (pOld->refCount <= 0) { if (prevNode) { prevNode->next = pOld->next; - ASSERT(prevNode->next != prevNode); + tAssert(prevNode->next != prevNode); } else { pe->next = pOld->next; SHashNode *x = pe->next; if (x != NULL) { - ASSERT(x->next != x); + tAssert(x->next != x); } } @@ -844,7 +844,7 @@ void *taosHashIterate(SHashObj *pHashObj, void *p) { /*uint16_t prevRef = atomic_load_16(&pNode->refCount);*/ uint16_t afterRef = atomic_add_fetch_16(&pNode->refCount, 1); #if 0 - ASSERT(prevRef < afterRef); + tAssert(prevRef < afterRef); // the reference count value is overflow, which will cause the delete node operation immediately. if (prevRef > afterRef) { diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 7beddd5d4f..251b508040 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -797,7 +797,7 @@ bool taosAssertLog(bool condition, const char *file, int32_t line, const char *f buffer[len] = 0; taosPrintLogImp(1, 255, buffer, len); - taosPrintLog(flags, level, dflag, "ASSERT at file %s:%d exit:%d", file, line, tsAssert); + taosPrintLog(flags, level, dflag, "tAssert at file %s:%d exit:%d", file, line, tsAssert); taosPrintTrace(flags, level, dflag); if (tsAssert) { @@ -807,7 +807,7 @@ bool taosAssertLog(bool condition, const char *file, int32_t line, const char *f #ifdef NDEBUG abort(); #else - ASSERT(0); + assert(0); #endif } diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 37874ae250..33761740b2 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -197,7 +197,7 @@ static char* doFlushPageToDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) { size = pg->length; } - ASSERT(size > 0 || (pg->offset == -1 && pg->length == -1)); + tAssert(size > 0 || (pg->offset == -1 && pg->length == -1)); char* pDataBuf = pg->pData; memset(pDataBuf, 0, getAllocPageSize(pBuf->pageSize)); @@ -500,7 +500,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) { size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; } SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { - ASSERT(pBuf != NULL); + tAssert(pBuf != NULL); return pBuf->pIdList; } @@ -578,7 +578,7 @@ SPageInfo* getLastPageInfo(SArray* pList) { } int32_t getPageId(const SPageInfo* pPgInfo) { - ASSERT(pPgInfo != NULL); + tAssert(pPgInfo != NULL); return pPgInfo->pageId; } diff --git a/source/util/src/tscalablebf.c b/source/util/src/tscalablebf.c index 797f3a924d..6c562d3b6d 100644 --- a/source/util/src/tscalablebf.c +++ b/source/util/src/tscalablebf.c @@ -51,7 +51,7 @@ int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) { } SBloomFilter *pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); - ASSERT(pNormalBf); + tAssert(pNormalBf); if (tBloomFilterIsFull(pNormalBf)) { pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO); diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index c72c5c70ae..14ffa052fe 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -268,8 +268,8 @@ SSkipListIterator *tSkipListCreateIter(SSkipList *pSkipList) { } SSkipListIterator *tSkipListCreateIterFromVal(SSkipList *pSkipList, const char *val, int32_t type, int32_t order) { - ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - ASSERT(pSkipList != NULL); + tAssert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); + tAssert(pSkipList != NULL); SSkipListIterator *iter = doCreateSkipListIterator(pSkipList, order); if (val == NULL) { @@ -362,7 +362,7 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { while (p != pSkipList->pTail) { char *key = SL_GET_NODE_KEY(pSkipList, p); if (prev != NULL) { - ASSERT(pSkipList->comparFn(prev, key) < 0); + tAssert(pSkipList->comparFn(prev, key) < 0); } switch (pSkipList->type) { @@ -516,7 +516,7 @@ static bool tSkipListGetPosToPut(SSkipList *pSkipList, SSkipListNode **backward, static void tSkipListRemoveNodeImpl(SSkipList *pSkipList, SSkipListNode *pNode) { int32_t level = pNode->level; uint8_t dupMode = SL_DUP_MODE(pSkipList); - ASSERT(dupMode != SL_DISCARD_DUP_KEY && dupMode != SL_UPDATE_DUP_KEY); + tAssert(dupMode != SL_DISCARD_DUP_KEY && dupMode != SL_UPDATE_DUP_KEY); for (int32_t j = level - 1; j >= 0; --j) { SSkipListNode *prev = SL_NODE_GET_BACKWARD_POINTER(pNode, j); @@ -585,7 +585,7 @@ static FORCE_INLINE int32_t getSkipListRandLevel(SSkipList *pSkipList) { } } - ASSERT(level <= pSkipList->maxLevel); + tAssert(level <= pSkipList->maxLevel); return level; } diff --git a/source/util/test/hashTest.cpp b/source/util/test/hashTest.cpp index 76fb9c7067..21705b0d62 100644 --- a/source/util/test/hashTest.cpp +++ b/source/util/test/hashTest.cpp @@ -250,7 +250,7 @@ void perfTest() { int64_t start1h = taosGetTimestampMs(); int64_t start1hCt = taosHashGetCompTimes(hash1h); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash1h, name + (i % 50) * 9, 9)); + tAssert(taosHashGet(hash1h, name + (i % 50) * 9, 9)); } int64_t end1h = taosGetTimestampMs(); int64_t end1hCt = taosHashGetCompTimes(hash1h); @@ -258,7 +258,7 @@ void perfTest() { int64_t start1s = taosGetTimestampMs(); int64_t start1sCt = taosHashGetCompTimes(hash1s); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash1s, name + (i % 500) * 9, 9)); + tAssert(taosHashGet(hash1s, name + (i % 500) * 9, 9)); } int64_t end1s = taosGetTimestampMs(); int64_t end1sCt = taosHashGetCompTimes(hash1s); @@ -266,7 +266,7 @@ void perfTest() { int64_t start10s = taosGetTimestampMs(); int64_t start10sCt = taosHashGetCompTimes(hash10s); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash10s, name + (i % 5000) * 9, 9)); + tAssert(taosHashGet(hash10s, name + (i % 5000) * 9, 9)); } int64_t end10s = taosGetTimestampMs(); int64_t end10sCt = taosHashGetCompTimes(hash10s); @@ -274,7 +274,7 @@ void perfTest() { int64_t start100s = taosGetTimestampMs(); int64_t start100sCt = taosHashGetCompTimes(hash100s); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash100s, name + (i % 50000) * 9, 9)); + tAssert(taosHashGet(hash100s, name + (i % 50000) * 9, 9)); } int64_t end100s = taosGetTimestampMs(); int64_t end100sCt = taosHashGetCompTimes(hash100s); @@ -282,7 +282,7 @@ void perfTest() { int64_t start1m = taosGetTimestampMs(); int64_t start1mCt = taosHashGetCompTimes(hash1m); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash1m, name + (i % 500000) * 9, 9)); + tAssert(taosHashGet(hash1m, name + (i % 500000) * 9, 9)); } int64_t end1m = taosGetTimestampMs(); int64_t end1mCt = taosHashGetCompTimes(hash1m); @@ -290,7 +290,7 @@ void perfTest() { int64_t start10m = taosGetTimestampMs(); int64_t start10mCt = taosHashGetCompTimes(hash10m); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash10m, name + (i % 5000000) * 9, 9)); + tAssert(taosHashGet(hash10m, name + (i % 5000000) * 9, 9)); } int64_t end10m = taosGetTimestampMs(); int64_t end10mCt = taosHashGetCompTimes(hash10m); @@ -298,7 +298,7 @@ void perfTest() { int64_t start100m = taosGetTimestampMs(); int64_t start100mCt = taosHashGetCompTimes(hash100m); for (int64_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(hash100m, name + (i % 50000000) * 9, 9)); + tAssert(taosHashGet(hash100m, name + (i % 50000000) * 9, 9)); } int64_t end100m = taosGetTimestampMs(); int64_t end100mCt = taosHashGetCompTimes(hash100m); @@ -323,14 +323,14 @@ void perfTest() { SArray* pArray = sArray[i]; for (int64_t m = 0; m < num; ++m) { char* p = (char*)taosArrayGet(pArray, m); - ASSERT(taosArrayPush(slArray, p)); + tAssert(taosArrayPush(slArray, p)); } } int64_t start100mS = taosGetTimestampMs(); int64_t start100mSCt = taosHashGetCompTimes(hash100m); int32_t num = taosArrayGetSize(slArray); for (int64_t i = 0; i < num; ++i) { - ASSERT(taosHashGet(hash100m, (char*)TARRAY_GET_ELEM(slArray, i), 9)); + tAssert(taosHashGet(hash100m, (char*)TARRAY_GET_ELEM(slArray, i), 9)); } int64_t end100mS = taosGetTimestampMs(); int64_t end100mSCt = taosHashGetCompTimes(hash100m); @@ -377,12 +377,12 @@ void perfTest() { int64_t startMhash = taosGetTimestampMs(); #if 0 for (int32_t i = 0; i < 10000000; ++i) { - ASSERT(taosHashGet(mhash[i%1000], name + i * 9, 9)); + tAssert(taosHashGet(mhash[i%1000], name + i * 9, 9)); } #else // for (int64_t i = 0; i < 10000000; ++i) { for (int64_t i = 0; i < 50000000; i += 5) { - ASSERT(taosHashGet(mhash[i / 50000], name + i * 9, 9)); + tAssert(taosHashGet(mhash[i / 50000], name + i * 9, 9)); } #endif int64_t endMhash = taosGetTimestampMs(); diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index b16a334552..3dabfd42fa 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -20,6 +20,7 @@ #include #include "taos.h" #include "types.h" +#include "tlog.h" int smlProcess_influx_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1016,14 +1017,14 @@ int smlProcess_18784_Test() { pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); printf("%s result:%s, rows:%d\n", __FUNCTION__, taos_errstr(pRes), taos_affected_rows(pRes)); int code = taos_errno(pRes); - ASSERT(!code); - ASSERT(taos_affected_rows(pRes) == 2); + tAssert(!code); + tAssert(taos_affected_rows(pRes) == 2); taos_free_result(pRes); pRes = taos_query(taos, "select * from disk"); - ASSERT(pRes); + tAssert(pRes); int fieldNum = taos_field_count(pRes); - ASSERT(fieldNum == 5); + tAssert(fieldNum == 5); printf("fieldNum:%d\n", fieldNum); TAOS_ROW row = NULL; int32_t rowIndex = 0; @@ -1033,10 +1034,10 @@ int smlProcess_18784_Test() { int64_t total = *(int64_t*)row[2]; int64_t freed = *(int64_t*)row[3]; if(rowIndex == 0){ - ASSERT(ts == 1661943960000); - ASSERT(used == 176059); - ASSERT(total == 1081101176832); - ASSERT(freed == 66932805); + tAssert(ts == 1661943960000); + tAssert(used == 176059); + tAssert(total == 1081101176832); + tAssert(freed == 66932805); // ASSERT_EQ(latitude, 24.5208); // ASSERT_EQ(longitude, 28.09377); // ASSERT_EQ(elevation, 428); @@ -1074,7 +1075,7 @@ int sml_19221_Test() { int32_t totalRows = 0; pRes = taos_schemaless_insert_raw(taos, tmp, strlen(sql[0]), &totalRows, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - ASSERT(totalRows == 3); + tAssert(totalRows == 3); printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); int code = taos_errno(pRes); taos_free_result(pRes); @@ -1131,7 +1132,7 @@ int sml_ttl_Test() { printf("%s result2:%s\n", __FUNCTION__, taos_errstr(pRes)); TAOS_ROW row = taos_fetch_row(pRes); int32_t ttl = *(int32_t*)row[0]; - ASSERT(ttl == 20); + tAssert(ttl == 20); int code = taos_errno(pRes); taos_free_result(pRes); @@ -1143,40 +1144,40 @@ int sml_ttl_Test() { int main(int argc, char *argv[]) { int ret = 0; ret = sml_ttl_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_ts2164_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_influx_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_telnet_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_json1_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_json2_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_json3_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_json4_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_TD15662_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_TD15742_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_16384_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_oom_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_16368_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_dup_time_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_16960_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_add_tag_col_Test(); - ASSERT(!ret); + tAssert(!ret); ret = smlProcess_18784_Test(); - ASSERT(!ret); + tAssert(!ret); ret = sml_19221_Test(); - ASSERT(!ret); + tAssert(!ret); return ret; } From 6ef608f7af4edc7d0d43e3c1292d8b97590a4e5a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 19:02:43 +0800 Subject: [PATCH 19/66] fix: complie error --- source/libs/sync/test/syncAppendEntriesReplyTest.cpp | 2 +- source/libs/sync/test/syncTest.cpp | 2 +- source/libs/sync/test/sync_test_lib/inc/syncIO.h | 2 ++ source/libs/sync/test/sync_test_lib/src/syncIO.c | 2 ++ .../libs/sync/test/sync_test_lib/src/syncMessageDebug.c | 4 ++-- source/os/src/osDir.c | 8 ++++---- source/os/src/osFile.c | 6 +++--- source/os/src/osMemory.c | 2 +- source/os/src/osSysinfo.c | 6 +++--- source/util/test/hashTest.cpp | 1 + 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp index 1eb803e846..e1a8a5c832 100644 --- a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp @@ -19,7 +19,7 @@ SyncAppendEntriesReply *createMsg() { pMsg->success = true; pMsg->matchIndex = 77; pMsg->term = 33; - pMsg->privateTerm = 44; + // pMsg->privateTerm = 44; pMsg->startTime = taosGetTimestampMs(); return pMsg; } diff --git a/source/libs/sync/test/syncTest.cpp b/source/libs/sync/test/syncTest.cpp index 9ae79e11fb..7b636085f2 100644 --- a/source/libs/sync/test/syncTest.cpp +++ b/source/libs/sync/test/syncTest.cpp @@ -1,5 +1,5 @@ #include "syncTest.h" -#include +// #include /* typedef enum { diff --git a/source/libs/sync/test/sync_test_lib/inc/syncIO.h b/source/libs/sync/test/sync_test_lib/inc/syncIO.h index 19f896182e..98b013b46d 100644 --- a/source/libs/sync/test/sync_test_lib/inc/syncIO.h +++ b/source/libs/sync/test/sync_test_lib/inc/syncIO.h @@ -81,6 +81,8 @@ int32_t syncIOQTimerStop(); int32_t syncIOPingTimerStart(); int32_t syncIOPingTimerStop(); +void syncEntryDestory(SSyncRaftEntry* pEntry); + #ifdef __cplusplus } #endif diff --git a/source/libs/sync/test/sync_test_lib/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c index 41b0533451..18bf26cc33 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -469,3 +469,5 @@ static void syncIOTickPing(void *param, void *tmrId) { taosTmrReset(syncIOTickPing, io->pingTimerMS, io, io->timerMgr, &io->pingTimer); } + +void syncEntryDestory(SSyncRaftEntry* pEntry) {} \ No newline at end of file diff --git a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c index fbc9b43d05..74ab09aa31 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c @@ -1583,8 +1583,8 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) { cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); cJSON_AddItemToObject(pRoot, "destId", pDestId); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); - cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); + // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); cJSON_AddStringToObject(pRoot, "term", u64buf); diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index 421901184b..d219873b5a 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -163,7 +163,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -179,7 +179,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } } @@ -225,7 +225,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -241,7 +241,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 68365be481..8c2170239f 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -313,7 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { assert(!(tdFileOptions & TD_FILE_EXCL)); fp = fopen(path, mode); if (fp == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } else { @@ -336,14 +336,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { fd = open(path, access, S_IRWXU | S_IRWXG | S_IRWXO); #endif if (fd == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } TdFilePtr pFile = (TdFilePtr)taosMemoryMalloc(sizeof(TdFile)); if (pFile == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; if (fd >= 0) close(fd); if (fp != NULL) fclose(fp); return NULL; diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 7d9c2896ce..2e68bd5ccd 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) { void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) { #ifdef USE_TD_MEMORY - tAssert(0); + assert(0); #else #if defined(LINUX) void* p = memalign(alignment, size); diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 7ec1da0530..e28abf131d 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -617,14 +617,14 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { return 0; } else { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } #elif defined(_TD_DARWIN_64) struct statvfs info; if (statvfs(dataDir, &info)) { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; @@ -635,7 +635,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { #else struct statvfs info; if (statvfs(dataDir, &info)) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; diff --git a/source/util/test/hashTest.cpp b/source/util/test/hashTest.cpp index 21705b0d62..c7b3750875 100644 --- a/source/util/test/hashTest.cpp +++ b/source/util/test/hashTest.cpp @@ -6,6 +6,7 @@ #include "taos.h" #include "taosdef.h" #include "thash.h" +#include "tlog.h" namespace { From c29401edf2cf65c784e5cf13427fcb3924c9c576 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 7 Dec 2022 19:46:26 +0800 Subject: [PATCH 20/66] refactor(sync): re send snapshot in timer-routine --- include/libs/sync/sync.h | 1 + source/libs/sync/inc/syncSnapshot.h | 1 + source/libs/sync/src/syncSnapshot.c | 50 ++++++++++++++++------------- source/libs/sync/src/syncTimeout.c | 15 +++++++++ source/libs/sync/src/syncUtil.c | 4 +-- 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 900bc88c41..4cf4800472 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -47,6 +47,7 @@ extern "C" { #define SYNC_HEARTBEAT_SLOW_MS 1500 #define SYNC_HEARTBEAT_REPLY_SLOW_MS 1500 +#define SYNC_SNAP_RESEND_MS 1000 * 60 #define SYNC_MAX_BATCH_SIZE 1 #define SYNC_INDEX_BEGIN 0 diff --git a/source/libs/sync/inc/syncSnapshot.h b/source/libs/sync/inc/syncSnapshot.h index 1f9675a3cd..ee83636192 100644 --- a/source/libs/sync/inc/syncSnapshot.h +++ b/source/libs/sync/inc/syncSnapshot.h @@ -44,6 +44,7 @@ typedef struct SSyncSnapshotSender { SyncTerm term; int64_t startTime; int64_t endTime; + int64_t lastSendTime; bool finish; // init when create diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index b8ecbe7515..42deb2c20a 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -103,6 +103,7 @@ int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { pSender->sendingMS = 0; pSender->term = pSender->pSyncNode->pRaftStore->currentTerm; pSender->startTime = taosGetTimestampMs(); + pSender->lastSendTime = pSender->startTime; pSender->finish = false; // build begin msg @@ -201,6 +202,8 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); + pSender->lastSendTime = taosGetTimestampMs(); + // event log if (pSender->seq == SYNC_SNAPSHOT_SEQ_END) { sSTrace(pSender, "snapshot sender finish"); @@ -213,33 +216,36 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // send snapshot data from cache int32_t snapshotReSend(SSyncSnapshotSender *pSender) { // send current block data + + // build msg + SRpcMsg rpcMsg = {0}; + (void)syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId); + + SyncSnapshotSend *pMsg = rpcMsg.pCont; + pMsg->srcId = pSender->pSyncNode->myRaftId; + pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; + pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; + pMsg->beginIndex = pSender->snapshotParam.start; + pMsg->lastIndex = pSender->snapshot.lastApplyIndex; + pMsg->lastTerm = pSender->snapshot.lastApplyTerm; + pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; + pMsg->lastConfig = pSender->lastConfig; + pMsg->seq = pSender->seq; + if (pSender->pCurrentBlock != NULL && pSender->blockLen > 0) { - // build msg - SRpcMsg rpcMsg = {0}; - (void)syncBuildSnapshotSend(&rpcMsg, pSender->blockLen, pSender->pSyncNode->vgId); - - SyncSnapshotSend *pMsg = rpcMsg.pCont; - pMsg->srcId = pSender->pSyncNode->myRaftId; - pMsg->destId = (pSender->pSyncNode->replicasId)[pSender->replicaIndex]; - pMsg->term = pSender->pSyncNode->pRaftStore->currentTerm; - pMsg->beginIndex = pSender->snapshotParam.start; - pMsg->lastIndex = pSender->snapshot.lastApplyIndex; - pMsg->lastTerm = pSender->snapshot.lastApplyTerm; - pMsg->lastConfigIndex = pSender->snapshot.lastConfigIndex; - pMsg->lastConfig = pSender->lastConfig; - pMsg->seq = pSender->seq; - // pMsg->privateTerm = pSender->privateTerm; memcpy(pMsg->data, pSender->pCurrentBlock, pSender->blockLen); - - // send msg - syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); - syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); - - // event log - sSTrace(pSender, "snapshot sender resend"); } + // send msg + syncNodeSendMsgById(&pMsg->destId, pSender->pSyncNode, &rpcMsg); + syncLogSendSyncSnapshotSend(pSender->pSyncNode, pMsg, ""); + + pSender->lastSendTime = taosGetTimestampMs(); + + // event log + sSTrace(pSender, "snapshot sender resend"); + return 0; } diff --git a/source/libs/sync/src/syncTimeout.c b/source/libs/sync/src/syncTimeout.c index 9c39fc1e8e..16e593d0e4 100644 --- a/source/libs/sync/src/syncTimeout.c +++ b/source/libs/sync/src/syncTimeout.c @@ -20,6 +20,7 @@ #include "syncRaftLog.h" #include "syncReplication.h" #include "syncRespMgr.h" +#include "syncSnapshot.h" #include "syncUtil.h" static void syncNodeCleanConfigIndex(SSyncNode* ths) { @@ -70,6 +71,20 @@ static int32_t syncNodeTimerRoutine(SSyncNode* ths) { } int64_t timeNow = taosGetTimestampMs(); + + for (int i = 0; i < ths->peersNum; ++i) { + SSyncSnapshotSender* pSender = syncNodeGetSnapshotSender(ths, &(ths->peersId[i])); + if (pSender != NULL) { + if (ths->isStart && ths->state == TAOS_SYNC_STATE_LEADER && pSender->start && + timeNow - pSender->lastSendTime > SYNC_SNAP_RESEND_MS) { + snapshotReSend(pSender); + } else { + sTrace("vgId:%d, do not resend: nstart%d, now:%" PRId64 ", lstsend:%" PRId64 ", diff:%" PRId64, ths->vgId, + ths->isStart, timeNow, pSender->lastSendTime, timeNow - pSender->lastSendTime); + } + } + } + if (atomic_load_64(&ths->snapshottingIndex) != SYNC_INDEX_INVALID) { // end timeout wal snapshot if (timeNow - ths->snapshottingTime > SYNC_DEL_WAL_MS && diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 7787438dfe..581e931974 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -568,7 +568,7 @@ void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* p syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, - "send sync-snapshot-send from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64 ", lterm:%" PRId64 + "send sync-snapshot-send to %s:%d {term:%" PRId64 ", begin:%" PRId64 ", end:%" PRId64 ", lterm:%" PRId64 ", stime:%" PRId64 ", seq:%d}, %s", host, port, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->seq, s); } @@ -595,7 +595,7 @@ void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMs syncUtilU642Addr(pMsg->destId.addr, host, sizeof(host), &port); sNTrace(pSyncNode, - "send sync-snapshot-rsp from %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 + "send sync-snapshot-rsp to %s:%d {term:%" PRId64 ", begin:%" PRId64 ", lst:%" PRId64 ", lterm:%" PRId64 ", stime:%" PRId64 ", ack:%d}, %s", host, port, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm, pMsg->startTime, pMsg->ack, s); } From 64e39cf2d46b93840133c413f081b36cae1136e0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 20:16:22 +0800 Subject: [PATCH 21/66] enh: alter db replica return quickly, operation executed asynchronously --- source/dnode/mnode/impl/src/mndDb.c | 10 ++++++++-- tests/script/tsim/db/alter_replica_13.sim | 19 +++++++++++++++++++ tests/script/tsim/db/alter_replica_31.sim | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index b8a78d0d74..d501cd02c6 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -802,7 +802,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } - + mInfo("====>1"); mInfo("db:%s, start to alter", alterReq.db); pDb = mndAcquireDb(pMnode, alterReq.db); @@ -829,7 +829,13 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { dbObj.cfgVersion++; dbObj.updateTime = taosGetTimestampMs(); code = mndAlterDb(pMnode, pReq, pDb, &dbObj); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + + if (dbObj.cfg.replications != pDb->cfg.replications) { + // return quickly, operation executed asynchronously + mInfo("db:%s, alter db replica from %d to %d", pDb->name, pDb->cfg.replications, dbObj.cfg.replications); + } else { + if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + } _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { diff --git a/tests/script/tsim/db/alter_replica_13.sim b/tests/script/tsim/db/alter_replica_13.sim index 4eafb86198..08006216fb 100644 --- a/tests/script/tsim/db/alter_replica_13.sim +++ b/tests/script/tsim/db/alter_replica_13.sim @@ -116,6 +116,25 @@ endi print ============= step4: alter database sql alter database db replica 3 +$wt = 0 +stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + +sql show db.vgroups +print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 $leaderIndex = 0 diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index 47e1fda79f..9c39a624a1 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -148,6 +148,26 @@ endi print ============= step3: alter database sql alter database db replica 1 +$wt = 0 +stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + +sql show db.vgroups +print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 + $hasleader = 0 $x = 0 From 71b1269dc9aa3e12941fc6d51f6001800bd9edb4 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 7 Dec 2022 20:21:30 +0800 Subject: [PATCH 22/66] fix: taosbenchmark vgid ntb (#18780) * fix: taosbenchmark vgid with tables less than vgroups * fix: update taos-tools 7583475 * fix: update taos-tools ac69142 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 5683a4358e..4abd9e86a6 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG cac24d3 + GIT_TAG ac69142 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 6d94afe48f1d12957497ee4c7d161359433a9611 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 21:51:17 +0800 Subject: [PATCH 23/66] Revert "refact: adjust some assert cases" --- include/common/tdatablock.h | 16 +- include/common/trow.h | 2 +- include/libs/qcom/query.h | 4 +- include/libs/stream/tstream.h | 6 +- include/os/os.h | 1 - include/os/osDef.h | 6 + include/os/osString.h | 2 +- include/os/osSystem.h | 20 -- include/util/tcoding.h | 8 +- include/util/tlog.h | 5 - source/client/src/clientEnv.c | 4 +- source/client/src/clientHb.c | 2 +- source/client/src/clientImpl.c | 22 +- source/client/src/clientMain.c | 14 +- source/client/src/clientMsgHandler.c | 2 +- source/client/src/clientRawBlockWrite.c | 12 +- source/client/src/clientSml.c | 16 +- source/client/src/clientStmt.c | 2 +- source/client/src/clientTmq.c | 14 +- source/common/src/tdatablock.c | 76 +++---- source/common/src/tdataformat.c | 80 +++---- source/common/src/tglobal.c | 7 +- source/common/src/tmsg.c | 26 +-- source/common/src/trow.c | 67 +++--- source/common/src/ttime.c | 16 +- source/common/test/dataformatTest.cpp | 6 +- source/dnode/mgmt/exe/dmMain.c | 7 +- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 5 +- source/dnode/mgmt/test/sut/src/client.cpp | 2 +- source/dnode/mgmt/test/sut/src/sut.cpp | 2 +- source/dnode/mnode/impl/src/mndConsumer.c | 37 ++- source/dnode/mnode/impl/src/mndDb.c | 16 +- source/dnode/mnode/impl/src/mndDef.c | 2 +- source/dnode/mnode/impl/src/mndMnode.c | 1 + source/dnode/mnode/impl/src/mndScheduler.c | 42 ++-- source/dnode/mnode/impl/src/mndShow.c | 1 + source/dnode/mnode/impl/src/mndSma.c | 14 +- source/dnode/mnode/impl/src/mndStb.c | 8 +- source/dnode/mnode/impl/src/mndStream.c | 20 +- source/dnode/mnode/impl/src/mndSubscribe.c | 50 ++--- source/dnode/mnode/impl/src/mndTopic.c | 6 +- source/dnode/mnode/impl/test/trans/trans1.cpp | 4 +- source/dnode/snode/src/snode.c | 12 +- source/dnode/vnode/src/meta/metaCache.c | 10 +- source/dnode/vnode/src/meta/metaEntry.c | 4 +- source/dnode/vnode/src/meta/metaOpen.c | 2 +- source/dnode/vnode/src/meta/metaQuery.c | 4 +- source/dnode/vnode/src/meta/metaSnapshot.c | 16 +- source/dnode/vnode/src/meta/metaTable.c | 30 +-- source/dnode/vnode/src/sma/smaCommit.c | 4 +- source/dnode/vnode/src/sma/smaEnv.c | 8 +- source/dnode/vnode/src/sma/smaFS.c | 4 +- source/dnode/vnode/src/sma/smaOpen.c | 12 +- source/dnode/vnode/src/sma/smaRollup.c | 28 +-- source/dnode/vnode/src/sma/smaSnapshot.c | 6 +- source/dnode/vnode/src/sma/smaTimeRange.c | 4 +- source/dnode/vnode/src/sma/smaUtil.c | 18 +- source/dnode/vnode/src/tq/tq.c | 96 ++++---- source/dnode/vnode/src/tq/tqExec.c | 20 +- source/dnode/vnode/src/tq/tqMeta.c | 48 ++-- source/dnode/vnode/src/tq/tqOffset.c | 18 +- source/dnode/vnode/src/tq/tqOffsetSnapshot.c | 16 +- source/dnode/vnode/src/tq/tqPush.c | 14 +- source/dnode/vnode/src/tq/tqRead.c | 40 ++-- source/dnode/vnode/src/tq/tqSink.c | 8 +- source/dnode/vnode/src/tq/tqSnapshot.c | 2 +- source/dnode/vnode/src/tq/tqStreamStateSnap.c | 4 +- source/dnode/vnode/src/tq/tqStreamTaskSnap.c | 4 +- source/dnode/vnode/src/tsdb/tsdbCache.c | 6 +- source/dnode/vnode/src/tsdb/tsdbCacheRead.c | 4 +- source/dnode/vnode/src/tsdb/tsdbCommit.c | 42 ++-- source/dnode/vnode/src/tsdb/tsdbDiskData.c | 12 +- source/dnode/vnode/src/tsdb/tsdbFS.c | 50 ++--- source/dnode/vnode/src/tsdb/tsdbFile.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 14 +- source/dnode/vnode/src/tsdb/tsdbMergeTree.c | 4 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 70 +++--- .../dnode/vnode/src/tsdb/tsdbReaderWriter.c | 54 ++--- source/dnode/vnode/src/tsdb/tsdbRetention.c | 2 +- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 32 +-- source/dnode/vnode/src/tsdb/tsdbUtil.c | 86 +++---- source/dnode/vnode/src/tsdb/tsdbWrite.c | 4 +- source/dnode/vnode/src/vnd/vnodeBufPool.c | 10 +- source/dnode/vnode/src/vnd/vnodeCfg.c | 2 +- source/dnode/vnode/src/vnd/vnodeModule.c | 2 +- source/dnode/vnode/src/vnd/vnodeQuery.c | 6 +- source/dnode/vnode/src/vnd/vnodeSnapshot.c | 6 +- source/dnode/vnode/src/vnd/vnodeSvr.c | 8 +- source/dnode/vnode/src/vnd/vnodeSync.c | 4 +- source/libs/catalog/src/ctgDbg.c | 2 +- source/libs/catalog/src/ctgRemote.c | 4 +- source/libs/command/src/command.c | 2 +- source/libs/command/src/explain.c | 2 +- source/libs/executor/inc/executil.h | 2 +- source/libs/executor/src/cachescanoperator.c | 4 +- source/libs/executor/src/dataDeleter.c | 8 +- source/libs/executor/src/dataDispatcher.c | 14 +- source/libs/executor/src/exchangeoperator.c | 4 +- source/libs/executor/src/executil.c | 30 +-- source/libs/executor/src/executor.c | 96 ++++---- source/libs/executor/src/executorimpl.c | 50 ++--- source/libs/executor/src/filloperator.c | 20 +- source/libs/executor/src/groupoperator.c | 26 +-- source/libs/executor/src/joinoperator.c | 16 +- source/libs/executor/src/projectoperator.c | 10 +- source/libs/executor/src/scanoperator.c | 76 +++---- source/libs/executor/src/sortoperator.c | 12 +- source/libs/executor/src/tfill.c | 6 +- source/libs/executor/src/timesliceoperator.c | 2 +- source/libs/executor/src/timewindowoperator.c | 64 +++--- source/libs/executor/src/tlinearhash.c | 21 +- source/libs/executor/src/tsimplehash.c | 6 +- source/libs/executor/src/tsort.c | 6 +- source/libs/function/src/builtins.c | 5 +- source/libs/function/src/builtinsimpl.c | 46 ++-- .../libs/function/src/detail/tavgfunction.c | 7 +- source/libs/function/src/detail/tminmax.c | 4 +- source/libs/function/src/tpercentile.c | 3 +- source/libs/function/src/udfd.c | 2 +- source/libs/index/src/indexComm.c | 4 +- source/libs/parser/src/parInsertUtil.c | 18 +- source/libs/qcom/src/queryUtil.c | 4 +- source/libs/qworker/src/qworker.c | 2 +- source/libs/scalar/inc/sclvector.h | 2 +- source/libs/scalar/src/scalar.c | 2 +- source/libs/scalar/src/sclfunc.c | 18 +- source/libs/scalar/src/sclvector.c | 32 +-- .../libs/scalar/test/scalar/scalarTests.cpp | 2 +- source/libs/stream/src/stream.c | 10 +- source/libs/stream/src/streamCheckpoint.c | 4 +- source/libs/stream/src/streamData.c | 14 +- source/libs/stream/src/streamDispatch.c | 32 +-- source/libs/stream/src/streamExec.c | 16 +- source/libs/stream/src/streamMeta.c | 14 +- source/libs/stream/src/streamRecover.c | 10 +- source/libs/stream/src/streamState.c | 2 +- source/libs/stream/src/streamUpdate.c | 6 +- source/libs/sync/src/syncAppendEntries.c | 12 +- source/libs/sync/src/syncAppendEntriesReply.c | 6 +- source/libs/sync/src/syncCommit.c | 10 +- source/libs/sync/src/syncElection.c | 10 +- source/libs/sync/src/syncIndexMgr.c | 12 +- source/libs/sync/src/syncMain.c | 78 +++---- source/libs/sync/src/syncPipeline.c | 116 +++++----- source/libs/sync/src/syncRaftCfg.c | 76 +++---- source/libs/sync/src/syncRaftEntry.c | 16 +- source/libs/sync/src/syncRaftLog.c | 18 +- source/libs/sync/src/syncRaftStore.c | 34 +-- source/libs/sync/src/syncReplication.c | 10 +- source/libs/sync/src/syncRequestVote.c | 4 +- source/libs/sync/src/syncRequestVoteReply.c | 4 +- source/libs/sync/src/syncSnapshot.c | 30 +-- source/libs/sync/src/syncUtil.c | 4 +- .../sync/test/syncAppendEntriesBatchTest.cpp | 2 +- .../sync/test/syncAppendEntriesReplyTest.cpp | 2 +- source/libs/sync/test/syncEncodeTest.cpp | 2 +- source/libs/sync/test/syncEntryCacheTest.cpp | 18 +- source/libs/sync/test/syncHashCacheTest.cpp | 44 ++-- .../libs/sync/test/syncRaftCfgIndexTest.cpp | 2 +- source/libs/sync/test/syncTest.cpp | 2 +- .../libs/sync/test/sync_test_lib/inc/syncIO.h | 2 - .../sync/test/sync_test_lib/src/syncBatch.c | 28 +-- .../libs/sync/test/sync_test_lib/src/syncIO.c | 42 ++-- .../test/sync_test_lib/src/syncMainDebug.c | 6 +- .../test/sync_test_lib/src/syncMessageDebug.c | 210 +++++++++--------- .../test/sync_test_lib/src/syncRaftCfgDebug.c | 4 +- .../sync_test_lib/src/syncRaftEntryDebug.c | 2 +- source/libs/tdb/src/db/tdbBtree.c | 148 ++++++------ source/libs/tdb/src/db/tdbDb.c | 4 +- source/libs/tdb/src/db/tdbPCache.c | 18 +- source/libs/tdb/src/db/tdbPage.c | 70 +++--- source/libs/tdb/src/db/tdbPager.c | 24 +- source/libs/tdb/src/db/tdbTable.c | 2 +- source/libs/tdb/src/db/tdbTxn.c | 2 +- source/libs/tdb/src/inc/tdbInt.h | 6 +- source/libs/tdb/src/inc/tdbUtil.h | 4 +- source/libs/tdb/test/tdbExOVFLTest.cpp | 13 +- source/libs/tdb/test/tdbTest.cpp | 5 +- source/libs/tfs/src/tfs.c | 2 +- source/libs/transport/src/tmsgcb.c | 2 +- source/libs/wal/src/walMeta.c | 30 +-- source/libs/wal/src/walRead.c | 34 +-- source/libs/wal/src/walRef.c | 4 +- source/libs/wal/src/walSeek.c | 8 +- source/libs/wal/src/walWrite.c | 52 ++--- source/libs/wal/test/walMetaTest.cpp | 48 ++-- source/os/src/osDir.c | 8 +- source/os/src/osFile.c | 6 +- source/os/src/osMemory.c | 2 +- source/os/src/osString.c | 6 +- source/os/src/osSysinfo.c | 6 +- source/util/src/talgo.c | 3 +- source/util/src/tarray.c | 4 +- source/util/src/tbloomfilter.c | 2 +- source/util/src/tcache.c | 16 +- source/util/src/tcompression.c | 22 +- source/util/src/tencode.c | 4 +- source/util/src/thash.c | 16 +- source/util/src/tlog.c | 35 --- source/util/src/tpagedbuf.c | 6 +- source/util/src/tscalablebf.c | 2 +- source/util/src/tsched.c | 16 +- source/util/src/tskiplist.c | 10 +- source/util/test/hashTest.cpp | 23 +- tests/script/tsim/db/alter_replica_13.sim | 19 -- tests/script/tsim/db/alter_replica_31.sim | 20 -- utils/test/c/sml_test.c | 59 +++-- 207 files changed, 1837 insertions(+), 1977 deletions(-) diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 3e2ae85853..e1d3b01611 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -112,10 +112,10 @@ static FORCE_INLINE bool colDataIsNull(const SColumnInfoData* pColumnInfoData, u if (pColAgg != NULL) { if (pColAgg->numOfNull == totalRows) { - tAssert(pColumnInfoData->nullbitmap == NULL); + ASSERT(pColumnInfoData->nullbitmap == NULL); return true; } else if (pColAgg->numOfNull == 0) { - tAssert(pColumnInfoData->nullbitmap == NULL); + ASSERT(pColumnInfoData->nullbitmap == NULL); return false; } } @@ -157,40 +157,40 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui } static FORCE_INLINE void colDataAppendInt8(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int8_t* v) { - tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || + ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int8_t*)p = *(int8_t*)v; } static FORCE_INLINE void colDataAppendInt16(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int16_t* v) { - tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT || + ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_SMALLINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_USMALLINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int16_t*)p = *(int16_t*)v; } static FORCE_INLINE void colDataAppendInt32(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int32_t* v) { - tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT); + ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_INT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UINT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int32_t*)p = *(int32_t*)v; } static FORCE_INLINE void colDataAppendInt64(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int64_t* v) { int32_t type = pColumnInfoData->info.type; - tAssert(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(type == TSDB_DATA_TYPE_BIGINT || type == TSDB_DATA_TYPE_UBIGINT || type == TSDB_DATA_TYPE_TIMESTAMP); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(int64_t*)p = *(int64_t*)v; } static FORCE_INLINE void colDataAppendFloat(SColumnInfoData* pColumnInfoData, uint32_t currentRow, float* v) { - tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT); + ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_FLOAT); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(float*)p = *(float*)v; } static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, uint32_t currentRow, double* v) { - tAssert(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE); + ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_DOUBLE); char* p = pColumnInfoData->pData + pColumnInfoData->info.bytes * currentRow; *(double*)p = *(double*)v; } diff --git a/include/common/trow.h b/include/common/trow.h index 87cd356624..6a71a8844e 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -214,7 +214,7 @@ static FORCE_INLINE SKvRowIdx *tdKvRowColIdxAt(STSRow *pRow, col_id_t idx) { } static FORCE_INLINE int16_t tdKvRowColIdAt(STSRow *pRow, col_id_t idx) { - tAssert(idx >= 0); + ASSERT(idx >= 0); if (idx == 0) { return PRIMARYKEY_TIMESTAMP_COL_ID; } diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index a1d9a3dc4c..91ec5f52e5 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -90,8 +90,8 @@ typedef struct STbVerInfo { } STbVerInfo; /* - * tAssert(sizeof(SCTableMeta) == 24) - * tAssert(tableType == TSDB_CHILD_TABLE) + * ASSERT(sizeof(SCTableMeta) == 24) + * ASSERT(tableType == TSDB_CHILD_TABLE) * The cached child table meta info. For each child table, 24 bytes are required to keep the essential table info. */ typedef struct SCTableMeta { diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 44f8008ff1..16cf960724 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -188,13 +188,13 @@ SStreamQueue* streamQueueOpen(); void streamQueueClose(SStreamQueue* queue); static FORCE_INLINE void streamQueueProcessSuccess(SStreamQueue* queue) { - tAssert(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); queue->qItem = NULL; atomic_store_8(&queue->status, STREAM_QUEUE__SUCESS); } static FORCE_INLINE void streamQueueProcessFail(SStreamQueue* queue) { - tAssert(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); + ASSERT(atomic_load_8(&queue->status) == STREAM_QUEUE__PROCESSING); atomic_store_8(&queue->status, STREAM_QUEUE__FAILED); } @@ -206,7 +206,7 @@ static FORCE_INLINE void* streamQueueCurItem(SStreamQueue* queue) { static FORCE_INLINE void* streamQueueNextItem(SStreamQueue* queue) { int8_t dequeueFlag = atomic_exchange_8(&queue->status, STREAM_QUEUE__PROCESSING); if (dequeueFlag == STREAM_QUEUE__FAILED) { - tAssert(queue->qItem != NULL); + ASSERT(queue->qItem != NULL); return streamQueueCurItem(queue); } else { queue->qItem = NULL; diff --git a/include/os/os.h b/include/os/os.h index b27fa84406..0688eeb9ad 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -27,7 +27,6 @@ extern "C" { #if !defined(WINDOWS) #include -#include #include #include #include diff --git a/include/os/osDef.h b/include/os/osDef.h index c18728c9a7..0bf9c6184e 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -120,6 +120,12 @@ void syslog(int unused, const char *format, ...); #define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b))) #define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2)) +#ifndef NDEBUG +#define ASSERT(x) assert(x) +#else +#define ASSERT(x) +#endif + #ifndef UNUSED #define UNUSED(x) ((void)(x)) #endif diff --git a/include/os/osString.h b/include/os/osString.h index 095af6d1c9..4c3fbe46c3 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -62,7 +62,7 @@ typedef int32_t TdUcs4; int32_t taosUcs4len(TdUcs4 *ucs4); int64_t taosStr2int64(const char *str); -int32_t taosConvInit(); +void taosConvInit(void); void taosConvDestroy(); int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs); bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len); diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 31ec513fca..eca984c41a 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -46,26 +46,6 @@ void taosSetTerminalMode(); int32_t taosGetOldTerminalMode(); void taosResetTerminalMode(); -#if !defined(WINDOWS) -#define taosPrintTrace(flags, level, dflag) \ - { \ - void* array[100]; \ - int32_t size = backtrace(array, 100); \ - char** strings = backtrace_symbols(array, size); \ - if (strings != NULL) { \ - taosPrintLog(flags, level, dflag, "obtained %d stack frames", size); \ - for (int32_t i = 0; i < size; i++) { \ - taosPrintLog(flags, level, dflag, "frame:%d, %s", i, strings[i]); \ - } \ - } \ - \ - taosMemoryFree(strings); \ - } -#else -#define taosPrintTrace(flags, level, dflag) \ - {} -#endif - #ifdef __cplusplus } #endif diff --git a/include/util/tcoding.h b/include/util/tcoding.h index d1114ce15a..38eb0d8fc6 100644 --- a/include/util/tcoding.h +++ b/include/util/tcoding.h @@ -18,8 +18,6 @@ #include "os.h" -#include "tlog.h" - #ifdef __cplusplus extern "C" { #endif @@ -214,7 +212,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU16(void **buf, uint16_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; - tAssert(i < 3); + ASSERT(i < 3); } if (buf != NULL) { @@ -262,7 +260,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU32(void **buf, uint32_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); value >>= 7; i++; - tAssert(i < 5); + ASSERT(i < 5); } if (buf != NULL) { @@ -310,7 +308,7 @@ static FORCE_INLINE int32_t taosEncodeVariantU64(void **buf, uint64_t value) { if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; - tAssert(i < 10); + ASSERT(i < 10); } if (buf != NULL) { diff --git a/include/util/tlog.h b/include/util/tlog.h index 1785fd2c5c..68b004cda7 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -38,7 +38,6 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content); extern bool tsLogEmbedded; extern bool tsAsyncLog; -extern bool tsAssert; extern int32_t tsNumOfLogLines; extern int32_t tsLogKeepDays; extern LogFp tsLogFp; @@ -83,10 +82,6 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #endif ; -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); -#define tAssertS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) -#define tAssert(condition) tAssertS(condition, "assert info not provided") - // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index d61693ddb3..7564d91330 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -407,9 +407,7 @@ void taos_init_imp(void) { initQueryModuleMsgHandle(); - if (taosConvInit() != 0) { - tAssertS(0, "failed to init conv"); - } + taosConvInit(); rpcInit(); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index d0b5703224..47ed2cf035 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -376,7 +376,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { desc.subPlanNum = 0; } desc.subPlanNum = taosArrayGetSize(desc.subDesc); - tAssert(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); + ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); } else { desc.subDesc = NULL; } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index cca3120011..e6584f4a00 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -446,7 +446,7 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra } void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols) { - tAssert(pSchema != NULL && numOfCols > 0); + ASSERT(pSchema != NULL && numOfCols > 0); pResInfo->numOfCols = numOfCols; if (pResInfo->fields != NULL) { @@ -457,7 +457,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t } pResInfo->fields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); pResInfo->userFields = taosMemoryCalloc(numOfCols, sizeof(TAOS_FIELD)); - tAssert(numOfCols == pResInfo->numOfCols); + ASSERT(numOfCols == pResInfo->numOfCols); for (int32_t i = 0; i < pResInfo->numOfCols; ++i) { pResInfo->fields[i].bytes = pSchema[i].bytes; @@ -1617,8 +1617,8 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int char* pStart = pCol->offset[j] + pCol->pData; int32_t len = taosUcs4ToMbs((TdUcs4*)varDataVal(pStart), varDataLen(pStart), varDataVal(p)); - tAssert(len <= bytes); - tAssert((p + len) < (pResultInfo->convertBuf[i] + colLength[i])); + ASSERT(len <= bytes); + ASSERT((p + len) < (pResultInfo->convertBuf[i] + colLength[i])); varDataSetLen(p, len); pCol->offset[j] = (p - pResultInfo->convertBuf[i]); @@ -1636,7 +1636,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols) { int32_t cols = *(int32_t*)(p + sizeof(int32_t) * 3); - tAssert(numOfCols == cols); + ASSERT(numOfCols == cols); return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) * 3 + sizeof(uint64_t) + numOfCols * (sizeof(int8_t) + sizeof(int32_t)); @@ -1679,7 +1679,7 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i } else if (jsonInnerType == TSDB_DATA_TYPE_BOOL) { len += (VARSTR_HEADER_SIZE + 5); } else { - tAssert(0); + ASSERT(0); } } } else if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { @@ -1739,7 +1739,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int for (int32_t i = 0; i < numOfCols; ++i) { int32_t colLen = htonl(colLength[i]); int32_t colLen1 = htonl(colLength1[i]); - tAssert(colLen < dataLen); + ASSERT(colLen < dataLen); if (pResultInfo->fields[i].type == TSDB_DATA_TYPE_JSON) { int32_t* offset = (int32_t*)pStart; @@ -1785,7 +1785,7 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int sprintf(varDataVal(dst), "%s", (*((char*)jsonInnerData) == 1) ? "true" : "false"); varDataSetLen(dst, strlen(varDataVal(dst))); } else { - tAssert(0); + ASSERT(0); } offset1[j] = len; @@ -1852,7 +1852,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 int32_t cols = *(int32_t*)p; p += sizeof(int32_t); - tAssert(rows == numOfRows && cols == numOfCols); + ASSERT(rows == numOfRows && cols == numOfCols); int32_t hasColumnSeg = *(int32_t*)p; p += sizeof(int32_t); @@ -1868,7 +1868,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 int32_t bytes = *(int32_t*)p; p += sizeof(int32_t); - /*tAssert(type == pFields[i].type && bytes == pFields[i].bytes);*/ + /*ASSERT(type == pFields[i].type && bytes == pFields[i].bytes);*/ } int32_t* colLength = (int32_t*)p; @@ -1879,7 +1879,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 colLength[i] = htonl(colLength[i]); if (colLength[i] >= dataLen) { tscError("invalid colLength %d, dataLen %d", colLength[i], dataLen); - tAssert(0); + ASSERT(0); } if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 134e410f2b..f2dec7217f 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -575,7 +575,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { (*numOfRows) = pResultInfo->numOfRows; return 0; } else { - tAssert(0); + ASSERT(0); return -1; } } @@ -982,8 +982,8 @@ static void fetchCallback(void *pResult, void *param, int32_t code) { } void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { - tAssert(res != NULL && fp != NULL); - tAssert(TD_RES_QUERY(res)); + ASSERT(res != NULL && fp != NULL); + ASSERT(TD_RES_QUERY(res)); SRequestObj *pRequest = res; pRequest->body.fetchFp = fp; @@ -1026,8 +1026,8 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { } void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { - tAssert(res != NULL && fp != NULL); - tAssert(TD_RES_QUERY(res)); + ASSERT(res != NULL && fp != NULL); + ASSERT(TD_RES_QUERY(res)); SRequestObj *pRequest = res; SReqResultInfo *pResultInfo = &pRequest->body.resInfo; @@ -1040,8 +1040,8 @@ void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { } const void *taos_get_raw_block(TAOS_RES *res) { - tAssert(res != NULL); - tAssert(TD_RES_QUERY(res)); + ASSERT(res != NULL); + ASSERT(TD_RES_QUERY(res)); SRequestObj *pRequest = res; return pRequest->body.resInfo.pData; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 564ec3a7c1..85027ff371 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -454,7 +454,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { (*pRsp)->numOfCols = htonl(SHOW_VARIABLES_RESULT_COLS); int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS); - tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); + ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); blockDataDestroy(pBlock); return TSDB_CODE_SUCCESS; diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index a08c1a59b2..150194aa27 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -373,7 +373,7 @@ _exit: } static char* processAutoCreateTable(STaosxRsp* rsp) { - tAssert(rsp->createTableNum != 0); + ASSERT(rsp->createTableNum != 0); SDecoder* decoder = taosMemoryCalloc(rsp->createTableNum, sizeof(SDecoder)); SVCreateTbReq* pCreateReq = taosMemoryCalloc(rsp->createTableNum, sizeof(SVCreateTbReq)); @@ -389,7 +389,7 @@ static char* processAutoCreateTable(STaosxRsp* rsp) { goto _exit; } - tAssert(pCreateReq[iReq].type == TSDB_CHILD_TABLE); + ASSERT(pCreateReq[iReq].type == TSDB_CHILD_TABLE); } string = buildCreateCTableJson(pCreateReq, rsp->createTableNum); @@ -494,7 +494,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { char* buf = NULL; if (vAlterTbReq.tagType == TSDB_DATA_TYPE_JSON) { - tAssert(tTagIsJson(vAlterTbReq.pTagVal) == true); + ASSERT(tTagIsJson(vAlterTbReq.pTagVal) == true); buf = parseTagDatatoJson(vAlterTbReq.pTagVal); } else { buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 1, 1); @@ -1750,7 +1750,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { } // pSW->pSchema should be same as pTableMeta->schema - // tAssert(pSW->nCols == pTableMeta->tableInfo.numOfColumns); + // ASSERT(pSW->nCols == pTableMeta->tableInfo.numOfColumns); uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid); uint64_t uid = pTableMeta->uid; int16_t sver = pTableMeta->sversion; @@ -1975,7 +1975,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) goto end; } - tAssert(pCreateReq.type == TSDB_CHILD_TABLE); + ASSERT(pCreateReq.type == TSDB_CHILD_TABLE); if (strcmp(tbName, pCreateReq.name) == 0) { schemaLen = *lenTmp; schemaData = *dataTmp; @@ -2053,7 +2053,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) } // pSW->pSchema should be same as pTableMeta->schema - // tAssert(pSW->nCols == pTableMeta->tableInfo.numOfColumns); + // ASSERT(pSW->nCols == pTableMeta->tableInfo.numOfColumns); uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid); uint64_t uid = pTableMeta->uid; int16_t sver = pTableMeta->sversion; diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 09b8110b9e..a4e943da32 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -785,7 +785,7 @@ static int64_t smlGetTimeValue(const char *value, int32_t len, int8_t type) { case TSDB_TIME_PRECISION_NANO: break; default: - tAssert(0); + ASSERT(0); } if (ts >= (double)INT64_MAX || ts < 0) { return -1; @@ -873,7 +873,7 @@ static int32_t smlParseTS(SSmlHandle *info, const char *data, int32_t len, SArra } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { ts = smlParseOpenTsdbTime(info, data, len); } else { - tAssert(0); + ASSERT(0); } uDebug("SML:0x%" PRIx64 " smlParseTS:%" PRId64, info->id, ts); @@ -1287,7 +1287,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols } } else { size_t tmp = taosArrayGetSize(metaArray); - tAssert(tmp <= INT16_MAX); + ASSERT(tmp <= INT16_MAX); int16_t size = tmp; taosArrayPush(metaArray, &kv); taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES); @@ -1364,8 +1364,8 @@ static int32_t smlKvTimeArrayCompare(const void *key1, const void *key2) { SArray *s2 = *(SArray **)key2; SSmlKv *kv1 = (SSmlKv *)taosArrayGetP(s1, 0); SSmlKv *kv2 = (SSmlKv *)taosArrayGetP(s2, 0); - tAssert(kv1->type == TSDB_DATA_TYPE_TIMESTAMP); - tAssert(kv2->type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(kv1->type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(kv2->type == TSDB_DATA_TYPE_TIMESTAMP); if (kv1->i < kv2->i) { return -1; } else if (kv1->i > kv2->i) { @@ -2206,7 +2206,7 @@ static int32_t smlParseTelnetLine(SSmlHandle *info, void *data, const int len) { } else if (info->protocol == TSDB_SML_JSON_PROTOCOL) { ret = smlParseJSONString(info, (cJSON *)data, tinfo, cols); } else { - tAssert(0); + ASSERT(0); } if (ret != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlParseTelnetLine failed", info->id); @@ -2331,7 +2331,7 @@ static int32_t smlInsertData(SSmlHandle *info) { SSmlSTableMeta **pMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); - tAssert(NULL != pMeta && NULL != *pMeta); + ASSERT(NULL != pMeta && NULL != *pMeta); // use tablemeta of stable to save vgid and uid of child table (*pMeta)->tableMeta->vgId = vg.vgId; @@ -2421,7 +2421,7 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { code = smlParseTelnetLine(info, tmp, len); } else { - tAssert(0); + ASSERT(0); } if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, tmp); diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 24d5255c34..82ea9e0d8f 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -389,7 +389,7 @@ int32_t stmtGetFromCache(STscStmt* pStmt) { if (NULL == pStmt->sql.pTableCache || taosHashGetSize(pStmt->sql.pTableCache) <= 0) { if (pStmt->bInfo.inExecCache) { - tAssert(taosHashGetSize(pStmt->exec.pBlockHash) == 1); + ASSERT(taosHashGetSize(pStmt->exec.pBlockHash) == 1); pStmt->bInfo.needParse = false; tscDebug("reuse stmt block for tb %s in execBlock", pStmt->bInfo.tbFName); return TSDB_CODE_SUCCESS; diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 0e92397c1c..ade0c95227 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -418,7 +418,7 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) { static void tmqCommitRspCountDown(SMqCommitCbParamSet* pParamSet) { int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1); - tAssert(waitingRspNum >= 0); + ASSERT(waitingRspNum >= 0); if (waitingRspNum == 0) { tmqCommitDone(pParamSet); } @@ -529,7 +529,7 @@ static int32_t tmqSendCommitReq(tmq_t* tmq, SMqClientVg* pVg, SMqClientTopic* pT int32_t tmqCommitMsgImpl(tmq_t* tmq, const TAOS_RES* msg, int8_t async, tmq_commit_cb* userCb, void* userParam) { char* topic; int32_t vgId; - tAssert(msg != NULL); + ASSERT(msg != NULL); if (TD_RES_TMQ(msg)) { SMqRspObj* pRspObj = (SMqRspObj*)msg; topic = pRspObj->topic; @@ -806,7 +806,7 @@ int32_t tmqHandleAllDelayedTask(tmq_t* tmq) { taosTmrReset(tmqAssignDelayedCommitTask, tmq->autoCommitInterval, pRefId, tmqMgmt.timer, &tmq->commitTimer); } else if (*pTaskType == TMQ_DELAYED_TASK__REPORT) { } else { - tAssert(0); + ASSERT(0); } taosFreeQitem(pTaskType); } @@ -916,9 +916,9 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { const char* user = conf->user == NULL ? TSDB_DEFAULT_USER : conf->user; const char* pass = conf->pass == NULL ? TSDB_DEFAULT_PASS : conf->pass; - tAssert(user); - tAssert(pass); - tAssert(conf->groupId[0]); + ASSERT(user); + ASSERT(pass); + ASSERT(conf->groupId[0]); pTmq->clientTopics = taosArrayInit(0, sizeof(SMqClientTopic)); pTmq->mqueue = taosOpenQueue(); @@ -1209,7 +1209,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { tDecoderClear(&decoder); memcpy(&pRspWrapper->taosxRsp, pMsg->pData, sizeof(SMqRspHead)); } else { - tAssert(0); + ASSERT(0); } taosMemoryFree(pMsg->pData); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 6d2bf53391..dfd0b68039 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -22,7 +22,7 @@ #define MALLOC_ALIGN_BYTES 256 int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRows) { - tAssert(pColumnInfoData != NULL); + ASSERT(pColumnInfoData != NULL); if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { return pColumnInfoData->varmeta.length; } else { @@ -59,13 +59,13 @@ int32_t getJsonValueLen(const char* data) { } else if (tTagIsJson(data)) { // json string dataLen = ((STag*)(data))->len; } else { - tAssert(0); + ASSERT(0); } return dataLen; } int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, bool isNull) { - tAssert(pColumnInfoData != NULL); + ASSERT(pColumnInfoData != NULL); if (isNull) { // There is a placehold for each NULL value of binary or nchar type. @@ -144,7 +144,7 @@ int32_t colDataReserve(SColumnInfoData* pColumnInfoData, size_t newSize) { static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t currentRow, const char* pData, int32_t itemLen, int32_t numOfRows) { - tAssert(pColumnInfoData->info.bytes >= itemLen); + ASSERT(pColumnInfoData->info.bytes >= itemLen); size_t start = 1; // the first item @@ -177,7 +177,7 @@ static void doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t curren int32_t colDataAppendNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData, uint32_t numOfRows) { - tAssert(pData != NULL && pColumnInfoData != NULL); + ASSERT(pData != NULL && pColumnInfoData != NULL); int32_t len = pColumnInfoData->info.bytes; if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { @@ -236,7 +236,7 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity, const SColumnInfoData* pSource, int32_t numOfRow2) { - tAssert(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); + ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); if (numOfRow2 == 0) { return numOfRow1; } @@ -316,13 +316,13 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows, const SDataBlockInfo* pBlockInfo) { - tAssert(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); + ASSERT(pColumnInfoData != NULL && pSource != NULL && pColumnInfoData->info.type == pSource->info.type); if (numOfRows <= 0) { return numOfRows; } if (pBlockInfo != NULL) { - tAssert(pBlockInfo->capacity >= numOfRows); + ASSERT(pBlockInfo->capacity >= numOfRows); } if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { @@ -418,7 +418,7 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) { // Actual data rows pluses the corresponding meta data must fit in one memory buffer of the given page size. int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex, int32_t pageSize) { - tAssert(pBlock != NULL && stopIndex != NULL); + ASSERT(pBlock != NULL && stopIndex != NULL); size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); int32_t numOfRows = pBlock->info.rows; @@ -433,7 +433,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd if (!hasVarCol) { size_t rowSize = blockDataGetRowSize(pBlock); int32_t capacity = payloadSize / (rowSize + numOfCols * bitmapChar / 8.0); - tAssert(capacity > 0); + ASSERT(capacity > 0); *stopIndex = startIndex + capacity - 1; if (*stopIndex >= numOfRows) { @@ -465,7 +465,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd if (size > pageSize) { // pageSize must be able to hold one row *stopIndex = j - 1; - tAssert(*stopIndex >= startIndex); + ASSERT(*stopIndex >= startIndex); return TSDB_CODE_SUCCESS; } @@ -536,7 +536,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3 * @return */ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) { - tAssert(pBlock != NULL); + ASSERT(pBlock != NULL); // write the number of rows *(uint32_t*)buf = pBlock->info.rows; @@ -608,7 +608,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) { } pCol->varmeta.length = colLength; - tAssert(pCol->varmeta.length <= pCol->varmeta.allocLen); + ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen); } memcpy(pCol->pData, pStart, colLength); @@ -655,7 +655,7 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) } pCol->varmeta.length = colLength; - tAssert(pCol->varmeta.length <= pCol->varmeta.allocLen); + ASSERT(pCol->varmeta.length <= pCol->varmeta.allocLen); } if (!colDataIsNNull_s(pCol, 0, pBlock->info.rows)) { @@ -669,7 +669,7 @@ int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) } size_t blockDataGetRowSize(SSDataBlock* pBlock) { - tAssert(pBlock != NULL); + ASSERT(pBlock != NULL); if (pBlock->info.rowSize == 0) { size_t rowSize = 0; @@ -698,7 +698,7 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols) { } double blockDataGetSerialRowSize(const SSDataBlock* pBlock) { - tAssert(pBlock != NULL); + ASSERT(pBlock != NULL); double rowSize = 0; size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); @@ -901,7 +901,7 @@ static int32_t* createTupleIndex(size_t rows) { static void destroyTupleIndex(int32_t* index) { taosMemoryFreeClear(index); } int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { - tAssert(pDataBlock != NULL && pOrderInfo != NULL); + ASSERT(pDataBlock != NULL && pOrderInfo != NULL); if (pDataBlock->info.rows <= 1) { return TSDB_CODE_SUCCESS; } @@ -1145,7 +1145,7 @@ void blockDataCleanup(SSDataBlock* pDataBlock) { void blockDataEmpty(SSDataBlock* pDataBlock) { SDataBlockInfo* pInfo = &pDataBlock->info; - tAssert(pInfo->rows <= pDataBlock->info.capacity); + ASSERT(pInfo->rows <= pDataBlock->info.capacity); if (pInfo->capacity == 0) { return; } @@ -1163,13 +1163,13 @@ void blockDataEmpty(SSDataBlock* pDataBlock) { // todo temporarily disable it static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows, bool clearPayload) { - tAssert(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/); + ASSERT(numOfRows > 0 /*&& pBlockInfo->capacity >= pBlockInfo->rows*/); if (numOfRows <= pBlockInfo->capacity) { return TSDB_CODE_SUCCESS; } // todo temp disable it - // tAssert(pColumn->info.bytes != 0); + // ASSERT(pColumn->info.bytes != 0); int32_t existedRows = pBlockInfo->rows; @@ -1191,7 +1191,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* int32_t oldLen = BitmapLen(existedRows); pColumn->nullbitmap = tmp; memset(&pColumn->nullbitmap[oldLen], 0, BitmapLen(numOfRows) - oldLen); - tAssert(pColumn->info.bytes); + ASSERT(pColumn->info.bytes); // make sure the allocated memory is MALLOC_ALIGN_BYTES aligned tmp = taosMemoryMallocAlign(MALLOC_ALIGN_BYTES, numOfRows * pColumn->info.bytes); @@ -1209,7 +1209,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* // todo remove it soon #if defined LINUX - tAssert((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0); + ASSERT((((uint64_t)pColumn->pData) & (MALLOC_ALIGN_BYTES - 1)) == 0x0); #endif if (clearPayload) { @@ -1303,7 +1303,7 @@ void* blockDataDestroy(SSDataBlock* pBlock) { } int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { - tAssert(src != NULL); + ASSERT(src != NULL); dst->info = src->info; dst->info.rows = 0; @@ -1339,7 +1339,7 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { } int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) { - tAssert(src != NULL && dst != NULL); + ASSERT(src != NULL && dst != NULL); blockDataCleanup(dst); int32_t code = blockDataEnsureCapacity(dst, src->info.rows); @@ -1496,7 +1496,7 @@ SSDataBlock* createDataBlock() { } int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoData) { - tAssert(pBlock != NULL && pColInfoData != NULL); + ASSERT(pBlock != NULL && pColInfoData != NULL); if (pBlock->pDataBlock == NULL) { pBlock->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData)); if (pBlock->pDataBlock == NULL) { @@ -1512,7 +1512,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat } // todo disable it temporarily - // tAssert(pColInfoData->info.type != 0); + // ASSERT(pColInfoData->info.type != 0); if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { pBlock->info.hasVarCol = true; } @@ -1531,7 +1531,7 @@ SColumnInfoData createColumnInfoData(int16_t type, int32_t bytes, int16_t colId) } SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) { - tAssert(pBlock != NULL); + ASSERT(pBlock != NULL); if (index >= taosArrayGetSize(pBlock->pDataBlock)) { return NULL; } @@ -1545,7 +1545,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { int32_t payloadSize = pageSize - blockDataGetSerialMetaSize(numOfCols); int32_t rowSize = pBlock->info.rowSize; int32_t nRows = payloadSize / rowSize; - tAssert(nRows >= 1); + ASSERT(nRows >= 1); // the true value must be less than the value of nRows int32_t additional = 0; @@ -1559,7 +1559,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { } int32_t newRows = (payloadSize - additional) / rowSize; - tAssert(newRows <= nRows && newRows >= 1); + ASSERT(newRows <= nRows && newRows >= 1); return newRows; } @@ -2137,7 +2137,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_MEDIUMBLOB: uError("the column type %" PRIi16 " is defined but not implemented yet", pColInfoData->info.type); - tAssert(0); + ASSERT(0); break; default: if (pColInfoData->info.type < TSDB_DATA_TYPE_MAX && pColInfoData->info.type > TSDB_DATA_TYPE_NULL) { @@ -2171,7 +2171,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB } } else { uError("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type); - tAssert(0); + ASSERT(0); } break; } @@ -2217,7 +2217,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB } char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) { - tAssert(stbFullName[0] != 0); + ASSERT(stbFullName[0] != 0); SArray* tags = taosArrayInit(0, sizeof(void*)); if (tags == NULL) { return NULL; @@ -2255,7 +2255,7 @@ char* buildCtbNameByGroupId(const char* stbFullName, uint64_t groupId) { taosMemoryFree(pTag); taosArrayDestroy(tags); - tAssert(rname.ctbShortName && rname.ctbShortName[0]); + ASSERT(rname.ctbShortName && rname.ctbShortName[0]); return rname.ctbShortName; } @@ -2273,7 +2273,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { int32_t* rows = (int32_t*)data; *rows = pBlock->info.rows; data += sizeof(int32_t); - tAssert(*rows > 0); + ASSERT(*rows > 0); int32_t* cols = (int32_t*)data; *cols = numOfCols; @@ -2333,7 +2333,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) { *actualLen = dataLen; *groupId = pBlock->info.id.groupId; - tAssert(dataLen > 0); + ASSERT(dataLen > 0); uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols); @@ -2345,7 +2345,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { int32_t version = *(int32_t*)pStart; pStart += sizeof(int32_t); - tAssert(version == 1); + ASSERT(version == 1); // total length sizeof(int32_t) int32_t dataLen = *(int32_t*)pStart; @@ -2393,7 +2393,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { for (int32_t i = 0; i < numOfCols; ++i) { colLen[i] = htonl(colLen[i]); - tAssert(colLen[i] >= 0); + ASSERT(colLen[i] >= 0); SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { @@ -2428,6 +2428,6 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) { } pBlock->info.rows = numOfRows; - tAssert(pStart - pData == dataLen); + ASSERT(pStart - pData == dataLen); return pStart; } diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 8699d35a9d..fc49c03379 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -89,7 +89,7 @@ typedef struct { SET_BIT2(PB, IDX, VAL); \ break; \ default: \ - tAssert(0); \ + ASSERT(0); \ break; \ } \ } \ @@ -98,9 +98,9 @@ typedef struct { int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { int32_t code = 0; - tAssert(taosArrayGetSize(aColVal) > 0); - tAssert(((SColVal *)aColVal->pData)[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID); - tAssert(((SColVal *)aColVal->pData)[0].type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(taosArrayGetSize(aColVal) > 0); + ASSERT(((SColVal *)aColVal->pData)[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID); + ASSERT(((SColVal *)aColVal->pData)[0].type == TSDB_DATA_TYPE_TIMESTAMP); // scan --------------- uint8_t flag = 0; @@ -135,7 +135,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { nkv += tPutI16v(NULL, -pTColumn->colId); nIdx++; } else { - tAssert(0); + ASSERT(0); } pTColumn = (++iTColumn < pTSchema->numOfCols) ? pTSchema->columns + iTColumn : NULL; @@ -174,7 +174,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { ntp = sizeof(SRow) + BIT2_SIZE(pTSchema->numOfCols - 1) + ntp; break; default: - tAssert(0); + ASSERT(0); break; } if (maxIdx <= UINT8_MAX) { @@ -302,7 +302,7 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { pv = pf + pTSchema->flen; break; default: - tAssert(0); + ASSERT(0); break; } @@ -353,8 +353,8 @@ _exit: } void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { - tAssert(iCol < pTSchema->numOfCols); - tAssert(pRow->sver == pTSchema->version); + ASSERT(iCol < pTSchema->numOfCols); + ASSERT(pRow->sver == pTSchema->version); STColumn *pTColumn = pTSchema->columns + iCol; @@ -512,7 +512,7 @@ struct SRowIter { }; int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { - tAssert(pRow->sver == pTSchema->version); + ASSERT(pRow->sver == pTSchema->version); int32_t code = 0; @@ -559,7 +559,7 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { pIter->pv = pIter->pf + pTSchema->flen; break; default: - tAssert(0); + ASSERT(0); break; } } @@ -649,7 +649,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { pIter->cv = COL_VAL_NONE(pTColumn->colId, pTColumn->type); goto _exit; } else { - tAssert(0); + ASSERT(0); } } else { pIter->cv = COL_VAL_NONE(pTColumn->colId, pTColumn->type); @@ -673,7 +673,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { bv = GET_BIT2(pIter->pb, pIter->iTColumn - 1); break; default: - tAssert(0); + ASSERT(0); break; } @@ -773,7 +773,7 @@ static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const c printf("%s:%d type:%d vlen:%d, val:%" PRIi8 "\n", tag, ln, (int32_t)type, vlen, *(int8_t *)val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -897,7 +897,7 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { isLarge = 1; } - tAssert(szTag <= INT16_MAX); + ASSERT(szTag <= INT16_MAX); // build tag (*ppTag) = (STag *)taosMemoryCalloc(szTag, 1); @@ -1142,7 +1142,7 @@ int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, c pBuilder->nCols++; - tAssert(pCol->offset < pBuilder->flen); + ASSERT(pCol->offset < pBuilder->flen); return 0; } @@ -1179,8 +1179,8 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version) { pTSchema->version = version; // timestamp column - tAssert(aSchema[0].type == TSDB_DATA_TYPE_TIMESTAMP); - tAssert(aSchema[0].colId == PRIMARYKEY_TIMESTAMP_COL_ID); + ASSERT(aSchema[0].type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(aSchema[0].colId == PRIMARYKEY_TIMESTAMP_COL_ID); pTSchema->columns[0].colId = aSchema[0].colId; pTSchema->columns[0].type = aSchema[0].type; pTSchema->columns[0].flags = aSchema[0].flags; @@ -1245,7 +1245,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, SColVal *pColVa pColData->nData += pColVal->value.nData; } } else { - tAssert(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal); + ASSERT(pColData->nData == tDataTypes[pColData->type].bytes * pColData->nVal); code = tRealloc(&pColData->pData, pColData->nData + tDataTypes[pColData->type].bytes); if (code) goto _exit; memcpy(pColData->pData + pColData->nData, &pColVal->value.val, tDataTypes[pColData->type].bytes); @@ -1562,7 +1562,7 @@ static int32_t (*tColDataAppendValueImpl[8][3])(SColData *pColData, SColVal *pCo {tColDataAppendValue70, tColDataAppendValue71, tColDataAppendValue72}, // HAS_VALUE|HAS_NULL|HAS_NONE }; int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) { - tAssert(pColData->cid == pColVal->cid && pColData->type == pColVal->type); + ASSERT(pColData->cid == pColVal->cid && pColData->type == pColVal->type); return tColDataAppendValueImpl[pColData->flag][pColVal->flag](pColData, pColVal); } @@ -1581,7 +1581,7 @@ static FORCE_INLINE void tColDataGetValue3(SColData *pColData, int32_t iVal, SCo *pColVal = COL_VAL_NULL(pColData->cid, pColData->type); break; default: - tAssert(0); + ASSERT(0); } } static FORCE_INLINE void tColDataGetValue4(SColData *pColData, int32_t iVal, SColVal *pColVal) { // HAS_VALUE @@ -1608,7 +1608,7 @@ static FORCE_INLINE void tColDataGetValue5(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - tAssert(0); + ASSERT(0); } } static FORCE_INLINE void tColDataGetValue6(SColData *pColData, int32_t iVal, @@ -1621,7 +1621,7 @@ static FORCE_INLINE void tColDataGetValue6(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - tAssert(0); + ASSERT(0); } } static FORCE_INLINE void tColDataGetValue7(SColData *pColData, int32_t iVal, @@ -1637,7 +1637,7 @@ static FORCE_INLINE void tColDataGetValue7(SColData *pColData, int32_t iVal, tColDataGetValue4(pColData, iVal, pColVal); break; default: - tAssert(0); + ASSERT(0); } } static void (*tColDataGetValueImpl[])(SColData *pColData, int32_t iVal, SColVal *pColVal) = { @@ -1651,7 +1651,7 @@ static void (*tColDataGetValueImpl[])(SColData *pColData, int32_t iVal, SColVal tColDataGetValue7 // HAS_VALUE | HAS_NULL | HAS_NONE }; void tColDataGetValue(SColData *pColData, int32_t iVal, SColVal *pColVal) { - tAssert(iVal >= 0 && iVal < pColData->nVal && pColData->flag); + ASSERT(iVal >= 0 && iVal < pColData->nVal && pColData->flag); tColDataGetValueImpl[pColData->flag](pColData, iVal, pColVal); } @@ -1681,7 +1681,7 @@ uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal) { v = GET_BIT2(pColData->pBitMap, iVal); break; default: - tAssert(0); + ASSERT(0); break; } return v; @@ -1691,9 +1691,9 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest) { int32_t code = 0; int32_t size; - tAssert(pColDataSrc->nVal > 0); - tAssert(pColDataDest->cid == pColDataSrc->cid); - tAssert(pColDataDest->type == pColDataSrc->type); + ASSERT(pColDataSrc->nVal > 0); + ASSERT(pColDataDest->cid == pColDataSrc->cid); + ASSERT(pColDataDest->type == pColDataSrc->type); pColDataDest->smaOn = pColDataSrc->smaOn; pColDataDest->nVal = pColDataSrc->nVal; @@ -1759,7 +1759,7 @@ static FORCE_INLINE void tColDataCalcSMABool(SColData *pColData, int64_t *sum, i CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1791,7 +1791,7 @@ static FORCE_INLINE void tColDataCalcSMATinyInt(SColData *pColData, int64_t *sum CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1823,7 +1823,7 @@ static FORCE_INLINE void tColDataCalcSMATinySmallInt(SColData *pColData, int64_t CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1855,7 +1855,7 @@ static FORCE_INLINE void tColDataCalcSMAInt(SColData *pColData, int64_t *sum, in CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1887,7 +1887,7 @@ static FORCE_INLINE void tColDataCalcSMABigInt(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*sum, *max, *min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1919,7 +1919,7 @@ static FORCE_INLINE void tColDataCalcSMAFloat(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1951,7 +1951,7 @@ static FORCE_INLINE void tColDataCalcSMADouble(SColData *pColData, int64_t *sum, CALC_SUM_MAX_MIN(*(double *)sum, *(double *)max, *(double *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -1983,7 +1983,7 @@ static FORCE_INLINE void tColDataCalcSMAUTinyInt(SColData *pColData, int64_t *su CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -2015,7 +2015,7 @@ static FORCE_INLINE void tColDataCalcSMATinyUSmallInt(SColData *pColData, int64_ CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -2047,7 +2047,7 @@ static FORCE_INLINE void tColDataCalcSMAUInt(SColData *pColData, int64_t *sum, i CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } @@ -2079,7 +2079,7 @@ static FORCE_INLINE void tColDataCalcSMAUBigInt(SColData *pColData, int64_t *sum CALC_SUM_MAX_MIN(*(uint64_t *)sum, *(uint64_t *)max, *(uint64_t *)min, val); break; default: - tAssert(0); + ASSERT(0); break; } } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1c2407ad45..d1a3f38143 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -334,7 +334,6 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddLocale(pCfg, "locale", tsLocale) != 0) return -1; if (cfgAddCharset(pCfg, "charset", tsCharset) != 0) return -1; if (cfgAddBool(pCfg, "enableCoreFile", 1, 1) != 0) return -1; - if (cfgAddBool(pCfg, "assert", 1, 1) != 0) return -1; if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1) != 0) return -1; if (cfgAddBool(pCfg, "SSE42", tsSSE42Enable, 0) != 0) return -1; @@ -694,8 +693,6 @@ static void taosSetSystemCfg(SConfig *pCfg) { bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; taosSetCoreDump(enableCore); - tsAssert = cfgGetItem(pCfg, "assert")->bval; - // todo tsVersion = 30000000; } @@ -791,9 +788,7 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { case 'a': { if (strcasecmp("asyncLog", name) == 0) { tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval; - } else if (strcasecmp("assert", name) == 0) { - tsAssert = cfgGetItem(pCfg, "assert")->bval; - } + } break; } case 'c': { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3dd8be66a5..00929a1836 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -28,8 +28,6 @@ #undef TD_MSG_SEG_CODE_ #include "tmsgdef.h" -#include "tlog.h" - int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { if (pMsg == NULL) { terrno = TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP; @@ -38,7 +36,7 @@ int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { pIter->totalLen = htonl(pMsg->length); pIter->numOfBlocks = htonl(pMsg->numOfBlocks); - tAssert(pIter->totalLen > 0); + ASSERT(pIter->totalLen > 0); pIter->len = 0; pIter->pMsg = pMsg; if (pIter->totalLen <= sizeof(SSubmitReq)) { @@ -50,17 +48,17 @@ int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { } int32_t tGetSubmitMsgNext(SSubmitMsgIter *pIter, SSubmitBlk **pPBlock) { - tAssert(pIter->len >= 0); + ASSERT(pIter->len >= 0); if (pIter->len == 0) { pIter->len += sizeof(SSubmitReq); } else { if (pIter->len >= pIter->totalLen) { - tAssert(0); + ASSERT(0); } pIter->len += (sizeof(SSubmitBlk) + pIter->dataLen + pIter->schemaLen); - tAssert(pIter->len > 0); + ASSERT(pIter->len > 0); } if (pIter->len > pIter->totalLen) { @@ -308,7 +306,7 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq) } } - tAssert(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); + ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); taosArrayPush(pReq->query->queryDesc, &desc); } @@ -5679,7 +5677,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) { } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tEncodeSSchemaWrapper(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { - tAssert(0); + ASSERT(0); } tEndEncode(pCoder); @@ -5721,7 +5719,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { } else if (pReq->type == TSDB_NORMAL_TABLE) { if (tDecodeSSchemaWrapperEx(pCoder, &pReq->ntb.schemaRow) < 0) return -1; } else { - tAssert(0); + ASSERT(0); } tEndDecode(pCoder); @@ -6349,7 +6347,7 @@ int32_t tEncodeSTqOffsetVal(SEncoder *pEncoder, const STqOffsetVal *pOffsetVal) } else if (pOffsetVal->type < 0) { // do nothing } else { - tAssert(0); + ASSERT(0); } return 0; } @@ -6364,7 +6362,7 @@ int32_t tDecodeSTqOffsetVal(SDecoder *pDecoder, STqOffsetVal *pOffsetVal) { } else if (pOffsetVal->type < 0) { // do nothing } else { - tAssert(0); + ASSERT(0); } return 0; } @@ -6381,7 +6379,7 @@ int32_t tFormatOffset(char *buf, int32_t maxLen, const STqOffsetVal *pVal) { } else if (pVal->type == TMQ_OFFSET__SNAPSHOT_DATA || pVal->type == TMQ_OFFSET__SNAPSHOT_META) { snprintf(buf, maxLen, "offset(ss data) uid:%" PRId64 ", ts:%" PRId64, pVal->uid, pVal->ts); } else { - tAssert(0); + ASSERT(0); } return 0; } @@ -6395,8 +6393,8 @@ bool tOffsetEqual(const STqOffsetVal *pLeft, const STqOffsetVal *pRight) { } else if (pLeft->type == TMQ_OFFSET__SNAPSHOT_META) { return pLeft->uid == pRight->uid; } else { - tAssert(0); - /*tAssert(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/ + ASSERT(0); + /*ASSERT(pLeft->type == TMQ_OFFSET__RESET_NONE || pLeft->type == TMQ_OFFSET__RESET_EARLIEAST ||*/ /*pLeft->type == TMQ_OFFSET__RESET_LATEST);*/ /*return true;*/ } diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 769ff4bb42..52ebd7f879 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "trow.h" -#include "tlog.h" const uint8_t tdVTypeByte[2][3] = {{ // 2 bits @@ -61,7 +60,7 @@ void tdSRowPrint(STSRow *row, STSchema *pSchema, const char *tag) { if (!tdSTSRowIterNext(&iter, &sVal)) { break; } - tAssert(sVal.valType == 0 || sVal.valType == 1 || sVal.valType == 2); + ASSERT(sVal.valType == 0 || sVal.valType == 1 || sVal.valType == 2); tdSCellValPrint(&sVal, cols[iter.colIdx - 1].type); } printf("\n"); @@ -76,7 +75,7 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) { return; } if (!pVal->val) { - tAssert(0); + ASSERT(0); printf("BadVal "); return; } @@ -249,7 +248,7 @@ bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) { } else if (TD_IS_KV_ROW(pIter->pRow)) { tdSTSRowIterGetKvVal(pIter, pCol->colId, &pIter->kvIdx, pVal); } else { - tAssert(0); + ASSERT(0); } ++pIter->colIdx; @@ -331,7 +330,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { void *varBuf = NULL; bool isAlloc = false; - tAssert(nColVal > 1); + ASSERT(nColVal > 1); for (int32_t iColumn = 0; iColumn < pTSchema->numOfCols; ++iColumn) { pTColumn = &pTSchema->columns[iColumn]; @@ -342,9 +341,9 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { } if (iColumn == 0) { - tAssert(pColVal->cid == pTColumn->colId); - tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); - tAssert(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); + ASSERT(pColVal->cid == pTColumn->colId); + ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID); } else { if (IS_VAR_DATA_TYPE(pTColumn->type)) { if (pColVal && COL_VAL_IS_VALUE(pColVal)) { @@ -490,7 +489,7 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) { if (!pBitmap || colIdx < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -512,7 +511,7 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa *pValType = ((*pDestByte) & 0x03); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -521,7 +520,7 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pValType) { if (!pBitmap || colIdx < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -555,7 +554,7 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal *pValType = ((*pDestByte) & 0x01); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -564,7 +563,7 @@ int32_t tdGetBitmapValTypeI(const void *pBitmap, int16_t colIdx, TDRowValT *pVal int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { if (!pBitmap || colIdx < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -607,7 +606,7 @@ int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { // *pDestByte |= (valType); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -616,7 +615,7 @@ int32_t tdSetBitmapValTypeI(void *pBitmap, int16_t colIdx, TDRowValT valType) { int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int32_t offset, int16_t colIdx) { #ifdef TD_SUPPORT_BITMAP - tAssert(colIdx < tdRowGetNCols(pRow) - 1); + ASSERT(colIdx < tdRowGetNCols(pRow) - 1); if (tdGetBitmapValType(pBitmap, colIdx, &output->valType, 0) != TSDB_CODE_SUCCESS) { output->valType = TD_VTYPE_NONE; return terrno; @@ -630,7 +629,7 @@ int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, void *pBitmap, int32_ output->val = POINTER_SHIFT(pRow, offset); } #else - tAssert(0); + ASSERT(0); if (offset < 0) { terrno = TSDB_CODE_INVALID_PARA; output->valType = TD_VTYPE_NONE; @@ -680,7 +679,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp return terrno; } #else - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; #endif @@ -707,7 +706,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp if (!pBuilder->hasNone) pBuilder->hasNone = true; return TSDB_CODE_SUCCESS; default: - tAssert(0); + ASSERT(0); break; } @@ -722,7 +721,7 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const void *val, bool isCopyVarData, int8_t colType, int16_t colIdx, int32_t offset, col_id_t colId) { if ((offset < (int32_t)sizeof(SKvRowIdx)) || (colIdx < 1)) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -810,7 +809,7 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou pBuilder->nCols = nCols; pBuilder->nBoundCols = nBoundCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -832,7 +831,7 @@ int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBou int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { pBuilder->pBuf = (STSRow *)pBuf; if (!pBuilder->pBuf) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -843,7 +842,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { TD_ROW_SET_INFO(pBuilder->pBuf, 0); TD_ROW_SET_TYPE(pBuilder->pBuf, pBuilder->rowType); - tAssert(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); + ASSERT(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); uint32_t len = 0; switch (pBuilder->rowType) { @@ -869,7 +868,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { TD_ROW_SET_NCOLS(pBuilder->pBuf, pBuilder->nBoundCols); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -880,12 +879,12 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) { pBuilder->pBuf = (STSRow *)pBuf; if (!pBuilder->pBuf) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } - tAssert(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); + ASSERT(pBuilder->nBitmaps > 0 && pBuilder->flen > 0); uint32_t len = 0; switch (pBuilder->rowType) { @@ -900,7 +899,7 @@ int32_t tdSRowGetBuf(SRowBuilder *pBuilder, void *pBuf) { #endif break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -920,7 +919,7 @@ int32_t tdSRowSetTpInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t flen) { pBuilder->flen = flen; pBuilder->nCols = nCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -939,7 +938,7 @@ int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, pBuilder->nCols = nCols; pBuilder->nBoundCols = nBoundCols; if (pBuilder->flen <= 0 || pBuilder->nCols <= 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -968,7 +967,7 @@ int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValT tdGetBitmapValTypeI(pBitmap, colIdx, pValType); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return TSDB_CODE_FAILED; } @@ -987,7 +986,7 @@ bool tdIsBitmapValTypeNorm(const void *pBitmap, int16_t idx, int8_t bitmapMode) int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) { if (!pBitmap || colIdx < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -1014,7 +1013,7 @@ int32_t tdSetBitmapValTypeII(void *pBitmap, int16_t colIdx, TDRowValT valType) { // *pDestByte |= (valType); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -1031,7 +1030,7 @@ int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TDRowValT valType, int tdSetBitmapValTypeI(pBitmap, colIdx, valType); break; default: - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_PARA; return TSDB_CODE_FAILED; } @@ -1070,14 +1069,14 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV SCellVal cv = {0}; SValue value = {0}; - tAssert((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0)); + ASSERT((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0)); if (TD_IS_TP_ROW(pRow)) { tdSTpRowGetVal(pRow, pTColumn->colId, pTColumn->type, pTSchema->flen, pTColumn->offset, iCol - 1, &cv); } else if (TD_IS_KV_ROW(pRow)) { tdSKvRowGetVal(pRow, pTColumn->colId, iCol - 1, &cv); } else { - tAssert(0); + ASSERT(0); } if (tdValTypeIsNone(cv.valType)) { diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 39261771d4..a106a09a69 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -23,8 +23,6 @@ #define _DEFAULT_SOURCE #include "ttime.h" -#include "tlog.h" - /* * mktime64 - Converts date to seconds. * Converts Gregorian date to seconds since 1970-01-01 00:00:00. @@ -433,9 +431,9 @@ char getPrecisionUnit(int32_t precision) { } int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPrecision) { - tAssert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || + ASSERT(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || fromPrecision == TSDB_TIME_PRECISION_NANO); - tAssert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || + ASSERT(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO || toPrecision == TSDB_TIME_PRECISION_NANO); switch (fromPrecision) { @@ -454,7 +452,7 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } return utime * 1000000; default: - tAssert(0); + ASSERT(0); return utime; } } // end from milli @@ -470,7 +468,7 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre } return utime * 1000; default: - tAssert(0); + ASSERT(0); return utime; } } // end from micro @@ -483,12 +481,12 @@ int64_t convertTimePrecision(int64_t utime, int32_t fromPrecision, int32_t toPre case TSDB_TIME_PRECISION_NANO: return utime; default: - tAssert(0); + ASSERT(0); return utime; } } // end from nano default: { - tAssert(0); + ASSERT(0); return utime; // only to pass windows compilation } } // end switch fromPrecision @@ -830,7 +828,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio } } - tAssert(pInterval->offset >= 0); + ASSERT(pInterval->offset >= 0); if (pInterval->offset > 0) { start = taosTimeAdd(start, pInterval->offset, pInterval->offsetUnit, precision); diff --git a/source/common/test/dataformatTest.cpp b/source/common/test/dataformatTest.cpp index 0dbc314b7c..b05ae602f8 100644 --- a/source/common/test/dataformatTest.cpp +++ b/source/common/test/dataformatTest.cpp @@ -111,7 +111,7 @@ STSchema *genSTSchema(int16_t nCols) { } break; default: - tAssert(0); + ASSERT(0); break; } } @@ -197,7 +197,7 @@ static int32_t genTestData(const char **data, int16_t nCols, SArray **pArray) { sscanf(data[i], "%" PRIu64, &colVal.value.u64); } break; default: - tAssert(0); + ASSERT(0); } taosArrayPush(*pArray, &colVal); } @@ -297,7 +297,7 @@ void debugPrintTSRow(STSRow2 *row, STSchema *pTSchema, const char *tags, int32_t } static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) { - tAssert(rawVal); + ASSERT(rawVal); if (COL_VAL_IS_NONE(cv)) { EXPECT_STRCASEEQ(rawVal, NONE_CSTR); diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 6963803df0..188677656a 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -201,12 +201,7 @@ int mainWindows(int argc, char **argv) { return -1; } - if (taosConvInit() != 0) { - dError("failed to init conv"); - taosCloseLog(); - taosCleanupArgs(); - return -1; - } + taosConvInit(); if (global.dumpConfig) { dmDumpCfg(); diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 009bdf8a34..2d2a121795 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -139,7 +139,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { SSnode *pSnode = pMgmt->pSnode; if (pSnode == NULL) { - dError("msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(), TMSG_INFO(pMsg->msgType), qtype); taosFreeQitem(pMsg); rpcFreeCont(pRpc->pCont); @@ -161,8 +161,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { smPutNodeMsgToWriteQueue(pMgmt, pMsg); break; default: - tAssertS(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), - TMSG_INFO(pMsg->msgType), qtype); + ASSERT(0); } return 0; } diff --git a/source/dnode/mgmt/test/sut/src/client.cpp b/source/dnode/mgmt/test/sut/src/client.cpp index 076ecdd168..a27a511651 100644 --- a/source/dnode/mgmt/test/sut/src/client.cpp +++ b/source/dnode/mgmt/test/sut/src/client.cpp @@ -55,7 +55,7 @@ void TestClient::DoInit() { // rpcInit.spi = 1; clientRpc = rpcOpen(&rpcInit); - tAssert(clientRpc); + ASSERT(clientRpc); tsem_init(&this->sem, 0, 0); } diff --git a/source/dnode/mgmt/test/sut/src/sut.cpp b/source/dnode/mgmt/test/sut/src/sut.cpp index f644e5e67b..b54590ce82 100644 --- a/source/dnode/mgmt/test/sut/src/sut.cpp +++ b/source/dnode/mgmt/test/sut/src/sut.cpp @@ -105,7 +105,7 @@ int32_t Testbase::SendShowReq(int8_t showType, const char* tb, const char* db) { tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq); SRpcMsg* pRsp = SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); - tAssert(pRsp->pCont != nullptr); + ASSERT(pRsp->pCont != nullptr); if (pRsp->contLen == 0) return -1; if (pRsp->code != 0) return -1; diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 6c467d26c7..76bff9a70f 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -133,9 +133,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; SMqConsumerRecoverMsg *pRecoverMsg = pMsg->pCont; SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pRecoverMsg->consumerId); - - tAssertS(pConsumer != NULL, "receive consumer recover msg, consumer id %" PRId64 ", status %s", - pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); + ASSERT(pConsumer); mInfo("receive consumer recover msg, consumer id %" PRId64 ", status %s", pRecoverMsg->consumerId, mndConsumerStatusName(pConsumer->status)); @@ -383,8 +381,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { return -1; } - tAssertS(strcmp(req.cgroup, pConsumer->cgroup) == 0, "cgroup:%s not match consumer:%s", req.cgroup, - pConsumer->cgroup); + ASSERT(strcmp(req.cgroup, pConsumer->cgroup) == 0); atomic_store_32(&pConsumer->hbStatus, 0); @@ -433,7 +430,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); // txn guarantees pSub is created - tAssert(pSub != NULL); + ASSERT(pSub); taosRLockLatch(&pSub->lock); SMqSubTopicEp topicEp = {0}; @@ -441,7 +438,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { // 2.1 fetch topic schema SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic); - tAssertS(pTopic != NULL, "failed to acquire topic:%s", topic); + ASSERT(pTopic); taosRLockLatch(&pTopic->lock); tstrncpy(topicEp.db, pTopic->db, TSDB_DB_FNAME_LEN); topicEp.schema.nCols = pTopic->schema.nCols; @@ -777,8 +774,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, taosWLockLatch(&pOldConsumer->lock); if (pNewConsumer->updateType == CONSUMER_UPDATE__MODIFY) { - tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); - tAssert(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); if (taosArrayGetSize(pNewConsumer->rebNewTopics) == 0 && taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0) { pOldConsumer->status = MQ_CONSUMER_STATUS__READY; @@ -800,8 +797,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->status = MQ_CONSUMER_STATUS__MODIFY; } } else if (pNewConsumer->updateType == CONSUMER_UPDATE__LOST) { - tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); - tAssert(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0); int32_t sz = taosArrayGetSize(pOldConsumer->currentTopics); /*pOldConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));*/ @@ -814,8 +811,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->status = MQ_CONSUMER_STATUS__LOST; } else if (pNewConsumer->updateType == CONSUMER_UPDATE__RECOVER) { - tAssert(taosArrayGetSize(pOldConsumer->currentTopics) == 0); - tAssert(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->currentTopics) == 0); + ASSERT(taosArrayGetSize(pOldConsumer->rebNewTopics) == 0); int32_t sz = taosArrayGetSize(pOldConsumer->assignedTopics); for (int32_t i = 0; i < sz; i++) { @@ -832,15 +829,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, pOldConsumer->rebalanceTime = pNewConsumer->upTime; } else if (pNewConsumer->updateType == CONSUMER_UPDATE__ADD) { - tAssert(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1); - tAssert(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0); + ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 1); + ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 0); char *addedTopic = strdup(taosArrayGetP(pNewConsumer->rebNewTopics, 0)); // not exist in current topic #if 1 for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->currentTopics); i++) { char *topic = taosArrayGetP(pOldConsumer->currentTopics, i); - tAssert(strcmp(topic, addedTopic) != 0); + ASSERT(strcmp(topic, addedTopic) != 0); } #endif @@ -881,15 +878,15 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, atomic_add_fetch_32(&pOldConsumer->epoch, 1); } else if (pNewConsumer->updateType == CONSUMER_UPDATE__REMOVE) { - tAssert(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0); - tAssert(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1); + ASSERT(taosArrayGetSize(pNewConsumer->rebNewTopics) == 0); + ASSERT(taosArrayGetSize(pNewConsumer->rebRemovedTopics) == 1); char *removedTopic = taosArrayGetP(pNewConsumer->rebRemovedTopics, 0); // not exist in new topic #if 1 for (int32_t i = 0; i < taosArrayGetSize(pOldConsumer->rebNewTopics); i++) { char *topic = taosArrayGetP(pOldConsumer->rebNewTopics, i); - tAssert(strcmp(topic, removedTopic) != 0); + ASSERT(strcmp(topic, removedTopic) != 0); } #endif @@ -915,7 +912,7 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, } } // must find the topic - tAssert(i < sz); + ASSERT(i < sz); // set status if (taosArrayGetSize(pOldConsumer->rebNewTopics) == 0 && taosArrayGetSize(pOldConsumer->rebRemovedTopics) == 0) { diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index d501cd02c6..5fa86dffe2 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -112,11 +112,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) { SDB_SET_INT8(pRaw, dataPos, pDb->cfg.hashMethod, _OVER) SDB_SET_INT32(pRaw, dataPos, pDb->cfg.numOfRetensions, _OVER) for (int32_t i = 0; i < pDb->cfg.numOfRetensions; ++i) { - if (tAssertS(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); - } + ASSERT(taosArrayGetSize(pDb->cfg.pRetensions) == pDb->cfg.numOfRetensions); SRetention *pRetension = taosArrayGet(pDb->cfg.pRetensions, i); SDB_SET_INT64(pRaw, dataPos, pRetension->freq, _OVER) SDB_SET_INT64(pRaw, dataPos, pRetension->keep, _OVER) @@ -802,7 +798,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } - mInfo("====>1"); + mInfo("db:%s, start to alter", alterReq.db); pDb = mndAcquireDb(pMnode, alterReq.db); @@ -829,13 +825,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { dbObj.cfgVersion++; dbObj.updateTime = taosGetTimestampMs(); code = mndAlterDb(pMnode, pReq, pDb, &dbObj); - - if (dbObj.cfg.replications != pDb->cfg.replications) { - // return quickly, operation executed asynchronously - mInfo("db:%s, alter db replica from %d to %d", pDb->name, pDb->cfg.replications, dbObj.cfg.replications); - } else { - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - } + if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 74ed4f9db0..b5c2fb05b3 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -489,7 +489,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) { tlen += tEncodeSMqConsumerEp(buf, pConsumerEp); cnt++; } - tAssert(cnt == sz); + ASSERT(cnt == sz); tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp); tlen += taosEncodeString(buf, pSub->dbName); return tlen; diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 674bd9f74a..9c847c1138 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -755,6 +755,7 @@ static void mndReloadSyncConfig(SMnode *pMnode) { mInfo("vgId:1, mnode sync not reconfig since readyMnodes:%d updatingMnodes:%d", readyMnodes, updatingMnodes); return; } + // ASSERT(0); if (cfg.myIndex == -1) { #if 1 diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index c5e9f2af36..af1a29def0 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -115,13 +115,13 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream if (pStream->fixedSinkVgId == 0) { SDbObj* pDb = mndAcquireDb(pMnode, pStream->targetDb); - tAssert(pDb != NULL); + ASSERT(pDb); if (pDb->cfg.numOfVgroups > 1) { isShuffle = true; pTask->outputType = TASK_OUTPUT__SHUFFLE_DISPATCH; pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) { - tAssert(0); + ASSERT(0); return -1; } } @@ -140,9 +140,9 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream for (int32_t j = 0; j < sinkLvSize; j++) { SStreamTask* pLastLevelTask = taosArrayGetP(sinkLv, j); if (pLastLevelTask->nodeId == pVgInfo->vgId) { - tAssert(pVgInfo->vgId > 0); + ASSERT(pVgInfo->vgId > 0); pVgInfo->taskId = pLastLevelTask->taskId; - tAssert(pVgInfo->taskId != 0); + ASSERT(pVgInfo->taskId != 0); break; } } @@ -152,7 +152,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStream pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; SArray* pArray = taosArrayGetP(pStream->tasks, 0); // one sink only - tAssert(taosArrayGetSize(pArray) == 1); + ASSERT(taosArrayGetSize(pArray) == 1); SStreamTask* lastLevelTask = taosArrayGetP(pArray, 0); pTask->fixedEpDispatcher.taskId = lastLevelTask->taskId; pTask->fixedEpDispatcher.nodeId = lastLevelTask->nodeId; @@ -170,7 +170,7 @@ int32_t mndAssignTaskToVg(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, co plan->execNode.epSet = pTask->epSet; if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_QRY_INVALID_INPUT; return -1; } @@ -195,7 +195,7 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan, plan->execNode.epSet = pTask->epSet; if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_QRY_INVALID_INPUT; return -1; } @@ -222,7 +222,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { void* pIter = NULL; SArray* tasks = taosArrayGetP(pStream->tasks, 0); - tAssert(taosArrayGetSize(pStream->tasks) == 1); + ASSERT(taosArrayGetSize(pStream->tasks) == 1); while (1) { SVgObj* pVgroup = NULL; @@ -257,7 +257,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { pTask->tbSink.stbUid = pStream->targetStbUid; memcpy(pTask->tbSink.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN); pTask->tbSink.pSchemaWrapper = tCloneSSchemaWrapper(&pStream->outputSchema); - tAssert(pTask->tbSink.pSchemaWrapper); + ASSERT(pTask->tbSink.pSchemaWrapper); } sdbRelease(pSdb, pVgroup); } @@ -265,7 +265,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, SStreamObj* pStream) { } int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) { - tAssert(pStream->fixedSinkVgId != 0); + ASSERT(pStream->fixedSinkVgId != 0); SArray* tasks = taosArrayGetP(pStream->tasks, 0); SStreamTask* pTask = tNewSStreamTask(pStream->uid); if (pTask == NULL) { @@ -275,7 +275,7 @@ int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, SStreamObj* pStream) { pTask->fillHistory = pStream->fillHistory; mndAddTaskToTaskSet(tasks, pTask); - tAssert(pStream->fixedSinkVg.vgId == pStream->fixedSinkVgId); + ASSERT(pStream->fixedSinkVg.vgId == pStream->fixedSinkVgId); pTask->nodeId = pStream->fixedSinkVgId; #if 0 @@ -311,13 +311,13 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { return -1; } int32_t planTotLevel = LIST_LENGTH(pPlan->pSubplans); - tAssert(planTotLevel <= 2); + ASSERT(planTotLevel <= 2); pStream->tasks = taosArrayInit(planTotLevel, sizeof(void*)); bool hasExtraSink = false; bool externalTargetDB = strcmp(pStream->sourceDb, pStream->targetDb) != 0; SDbObj* pDbObj = mndAcquireDb(pMnode, pStream->targetDb); - tAssert(pDbObj != NULL); + ASSERT(pDbObj != NULL); bool multiTarget = pDbObj->cfg.numOfVgroups > 1; sdbRelease(pSdb, pDbObj); @@ -351,7 +351,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - tAssert(plan->subplanType == SUBPLAN_TYPE_MERGE); + ASSERT(plan->subplanType == SUBPLAN_TYPE_MERGE); pInnerTask = tNewSStreamTask(pStream->uid); if (pInnerTask == NULL) { @@ -409,7 +409,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 1); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - tAssert(plan->subplanType == SUBPLAN_TYPE_SCAN); + ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; while (1) { @@ -471,9 +471,9 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { taosArrayPush(pStream->tasks, &taskOneLevel); SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); - tAssert(LIST_LENGTH(inner->pNodeList) == 1); + ASSERT(LIST_LENGTH(inner->pNodeList) == 1); SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - tAssert(plan->subplanType == SUBPLAN_TYPE_SCAN); + ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; while (1) { @@ -550,8 +550,8 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); } - tAssert(pSub->unassignedVgs); - tAssert(taosHashGetSize(pSub->consumerHash) == 0); + ASSERT(pSub->unassignedVgs); + ASSERT(taosHashGetSize(pSub->consumerHash) == 0); void* pIter = NULL; while (1) { @@ -590,9 +590,9 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib sdbRelease(pSdb, pVgroup); } - tAssert(pSub->unassignedVgs->size > 0); + ASSERT(pSub->unassignedVgs->size > 0); - tAssert(taosHashGetSize(pSub->consumerHash) == 0); + ASSERT(taosHashGetSize(pSub->consumerHash) == 0); qDestroyQueryPlan(pPlan); diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index cb11ffc196..6a7e2aaa51 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -111,6 +111,7 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { } else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) { type = TSDB_MGMT_TABLE_PRIVILEGES; } else { + // ASSERT(0); } return type; diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 182d766a2e..e6a6e6ae5b 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -488,7 +488,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea memcpy(smaObj.db, pDb->name, TSDB_DB_FNAME_LEN); smaObj.createdTime = taosGetTimestampMs(); smaObj.uid = mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); - tAssert(smaObj.uid != 0); + ASSERT(smaObj.uid != 0); char resultTbName[TSDB_TABLE_FNAME_LEN + 16] = {0}; snprintf(resultTbName, TSDB_TABLE_FNAME_LEN + 16, "%s_td_tsma_rst_tb", pCreate->name); memcpy(smaObj.dstTbName, resultTbName, TSDB_TABLE_FNAME_LEN); @@ -558,13 +558,13 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea SNode *pAst = NULL; if (nodesStringToNode(streamObj.ast, &pAst) < 0) { - tAssert(0); + ASSERT(0); return -1; } // extract output schema from ast if (qExtractResultSchema(pAst, (int32_t *)&streamObj.outputSchema.nCols, &streamObj.outputSchema.pSchema) != 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -579,13 +579,13 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea }; if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) { - tAssert(0); + ASSERT(0); return -1; } // save physcial plan if (nodesNodeToString((SNode *)pPlan, false, &streamObj.physicalPlan, NULL) != 0) { - tAssert(0); + ASSERT(0); return -1; } if (pAst != NULL) nodesDestroyNode(pAst); @@ -822,14 +822,14 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { mError("stream:%s, failed to drop task since %s", pStream->name, terrstr()); sdbRelease(pMnode->pSdb, pStream); - tAssert(0); + ASSERT(0); goto _OVER; } // drop stream if (mndPersistDropStreamLog(pMnode, pTrans, pStream) < 0) { sdbRelease(pMnode->pSdb, pStream); - tAssert(0); + ASSERT(0); goto _OVER; } } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 28955bd45e..c611cfb6e1 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1176,7 +1176,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pTopic->ast, &pAst) != 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1221,7 +1221,7 @@ static int32_t mndCheckAlterColForStream(SMnode *pMnode, const char *stbFullName SNode *pAst = NULL; if (nodesStringToNode(pStream->ast, &pAst) != 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -2091,7 +2091,7 @@ static int32_t mndCheckDropStbForTopic(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pTopic->ast, &pAst) != 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -2138,7 +2138,7 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName, SNode *pAst = NULL; if (nodesStringToNode(pStream->ast, &pAst) != 0) { - tAssert(0); + ASSERT(0); return -1; } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 56c0c20346..7ee688d220 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -325,13 +325,13 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, // deserialize ast if (nodesStringToNode(pObj->ast, &pAst) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ goto FAIL; } // extract output schema from ast if (qExtractResultSchema(pAst, (int32_t *)&pObj->outputSchema.nCols, &pObj->outputSchema.pSchema) != 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ goto FAIL; } @@ -346,13 +346,13 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, // using ast and param to build physical plan if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ goto FAIL; } // save physcial plan if (nodesNodeToString((SNode *)pPlan, false, &pObj->physicalPlan, NULL) != 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ goto FAIL; } @@ -360,7 +360,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, if (pCreate->numOfTags) { pObj->tagSchema.pSchema = taosMemoryCalloc(pCreate->numOfTags, sizeof(SSchema)); } - tAssert(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags)); + ASSERT(pCreate->numOfTags == taosArrayGetSize(pCreate->pTags)); for (int32_t i = 0; i < pCreate->numOfTags; i++) { SField *pField = taosArrayGet(pCreate->pTags, i); pObj->tagSchema.pSchema[i].colId = pObj->outputSchema.nCols + i + 1; @@ -378,7 +378,7 @@ FAIL: int32_t mndPersistTaskDeployReq(STrans *pTrans, const SStreamTask *pTask) { if (pTask->taskLevel == TASK_LEVEL__AGG) { - tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); + ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); } SEncoder encoder; tEncoderInit(&encoder, NULL, 0); @@ -544,7 +544,7 @@ _OVER: } static int32_t mndPersistTaskDropReq(STrans *pTrans, SStreamTask *pTask) { - tAssert(pTask->nodeId != 0); + ASSERT(pTask->nodeId != 0); // vnode /*if (pTask->nodeId > 0) {*/ @@ -790,10 +790,10 @@ static int32_t mndProcessStreamDoCheckpoint(SRpcMsg *pReq) { int32_t sz = taosArrayGetSize(pLevel); for (int32_t j = 0; j < sz; j++) { SStreamTask *pTask = taosArrayGetP(pLevel, j); - tAssert(pTask->nodeId > 0); + ASSERT(pTask->nodeId > 0); SVgObj *pVgObj = mndAcquireVgroup(pMnode, pTask->nodeId); if (pVgObj == NULL) { - tAssert(0); + ASSERT(0); taosRUnLockLatch(&pStream->lock); mndReleaseStream(pMnode, pStream); mndTransDrop(pTrans); @@ -853,7 +853,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { SMDropStreamReq dropReq = {0}; if (tDeserializeSMDropStreamReq(pReq->pCont, pReq->contLen, &dropReq) < 0) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_INVALID_MSG; return -1; } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index a55c0c1996..55e073a8a4 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -96,8 +96,8 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic, pSub->subType = pTopic->subType; pSub->withMeta = pTopic->withMeta; - tAssert(pSub->unassignedVgs->size == 0); - tAssert(taosHashGetSize(pSub->consumerHash) == 0); + ASSERT(pSub->unassignedVgs->size == 0); + ASSERT(taosHashGetSize(pSub->consumerHash) == 0); if (mndSchedInitSubEp(pMnode, pTopic, pSub) < 0) { tDeleteSubscribeObj(pSub); @@ -105,8 +105,8 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic, return NULL; } - tAssert(pSub->unassignedVgs->size > 0); - tAssert(taosHashGetSize(pSub->consumerHash) == 0); + ASSERT(pSub->unassignedVgs->size > 0); + ASSERT(taosHashGetSize(pSub->consumerHash) == 0); return pSub; } @@ -144,7 +144,7 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const SMqSubscri static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SMqSubscribeObj *pSub, const SMqRebOutputVg *pRebVg) { - tAssert(pRebVg->oldConsumerId != pRebVg->newConsumerId); + ASSERT(pRebVg->oldConsumerId != pRebVg->newConsumerId); void *buf; int32_t tlen; @@ -155,7 +155,7 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SM int32_t vgId = pRebVg->pVgEp->vgId; SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId); if (pVgObj == NULL) { - tAssert(0); + ASSERT(0); taosMemoryFree(buf); return -1; } @@ -218,11 +218,11 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR int32_t actualRemoved = 0; for (int32_t i = 0; i < removedNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->removedConsumers, i); - tAssert(consumerId > 0); + ASSERT(consumerId > 0); SMqConsumerEp *pConsumerEp = taosHashGet(pOutput->pSub->consumerHash, &consumerId, sizeof(int64_t)); - tAssert(pConsumerEp); + ASSERT(pConsumerEp); if (pConsumerEp) { - tAssert(consumerId == pConsumerEp->consumerId); + ASSERT(consumerId == pConsumerEp->consumerId); actualRemoved++; int32_t consumerVgNum = taosArrayGetSize(pConsumerEp->vgs); for (int32_t j = 0; j < consumerVgNum; j++) { @@ -241,7 +241,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR taosArrayPush(pOutput->removedConsumers, &consumerId); } } - tAssert(removedNum == actualRemoved); + ASSERT(removedNum == actualRemoved); // if previously no consumer, there are vgs not assigned { @@ -278,7 +278,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; - tAssert(pConsumerEp->consumerId > 0); + ASSERT(pConsumerEp->consumerId > 0); int32_t consumerVgNum = taosArrayGetSize(pConsumerEp->vgs); // all old consumers still existing are touched // TODO optimize: touch only consumer whose vgs changed @@ -325,7 +325,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR int32_t consumerNum = taosArrayGetSize(pInput->pRebInfo->newConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pInput->pRebInfo->newConsumers, i); - tAssert(consumerId > 0); + ASSERT(consumerId > 0); SMqConsumerEp newConsumerEp; newConsumerEp.consumerId = consumerId; newConsumerEp.vgs = taosArrayInit(0, sizeof(void *)); @@ -344,13 +344,13 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); if (pIter == NULL) break; SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; - tAssert(pConsumerEp->consumerId > 0); + ASSERT(pConsumerEp->consumerId > 0); // push until equal minVg while (taosArrayGetSize(pConsumerEp->vgs) < minVgCnt) { // iter hash and find one vg pRemovedIter = taosHashIterate(pHash, pRemovedIter); - tAssert(pRemovedIter); + ASSERT(pRemovedIter); pRebVg = (SMqRebOutputVg *)pRemovedIter; // push taosArrayPush(pConsumerEp->vgs, &pRebVg->pVgEp); @@ -361,7 +361,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } } - tAssert(pIter == NULL); + ASSERT(pIter == NULL); // 7. handle unassigned vg if (taosHashGetSize(pOutput->pSub->consumerHash) != 0) { // if has consumer, assign all left vg @@ -377,9 +377,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } while (1) { pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); - tAssert(pIter); + ASSERT(pIter); pConsumerEp = (SMqConsumerEp *)pIter; - tAssert(pConsumerEp->consumerId > 0); + ASSERT(pConsumerEp->consumerId > 0); if (taosArrayGetSize(pConsumerEp->vgs) == minVgCnt) { break; } @@ -404,7 +404,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR pIter = taosHashIterate(pHash, pIter); if (pIter == NULL) break; pRebOutput = (SMqRebOutputVg *)pIter; - tAssert(pRebOutput->newConsumerId == -1); + ASSERT(pRebOutput->newConsumerId == -1); taosArrayPush(pOutput->pSub->unassignedVgs, &pRebOutput->pVgEp); taosArrayPush(pOutput->rebVgs, pRebOutput); mInfo("mq rebalance: unassign vgId:%d (second scan)", pRebOutput->pVgEp->vgId); @@ -482,7 +482,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu consumerNum = taosArrayGetSize(pOutput->newConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pOutput->newConsumers, i); - tAssert(consumerId > 0); + ASSERT(consumerId > 0); SMqConsumerObj *pConsumerOld = mndAcquireConsumer(pMnode, consumerId); SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumerOld->consumerId, pConsumerOld->cgroup); pConsumerNew->updateType = CONSUMER_UPDATE__ADD; @@ -492,7 +492,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu taosArrayPush(pConsumerNew->rebNewTopics, &topic); mndReleaseConsumer(pMnode, pConsumerOld); if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) { - tAssert(0); + ASSERT(0); tDeleteSMqConsumerObj(pConsumerNew); taosMemoryFree(pConsumerNew); goto REB_FAIL; @@ -505,7 +505,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu consumerNum = taosArrayGetSize(pOutput->removedConsumers); for (int32_t i = 0; i < consumerNum; i++) { int64_t consumerId = *(int64_t *)taosArrayGet(pOutput->removedConsumers, i); - tAssert(consumerId > 0); + ASSERT(consumerId > 0); SMqConsumerObj *pConsumerOld = mndAcquireConsumer(pMnode, consumerId); SMqConsumerObj *pConsumerNew = tNewSMqConsumerObj(pConsumerOld->consumerId, pConsumerOld->cgroup); pConsumerNew->updateType = CONSUMER_UPDATE__REMOVE; @@ -515,7 +515,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu taosArrayPush(pConsumerNew->rebRemovedTopics, &topic); mndReleaseConsumer(pMnode, pConsumerOld); if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) { - tAssert(0); + ASSERT(0); tDeleteSMqConsumerObj(pConsumerNew); taosMemoryFree(pConsumerNew); goto REB_FAIL; @@ -572,7 +572,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { char cgroup[TSDB_CGROUP_LEN]; mndSplitSubscribeKey(pRebInfo->key, topic, cgroup, true); SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic); - /*tAssert(pTopic);*/ + /*ASSERT(pTopic);*/ if (pTopic == NULL) { mError("mq rebalance %s failed since topic %s not exist, abort", pRebInfo->key, topic); continue; @@ -581,7 +581,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { rebOutput.pSub = mndCreateSub(pMnode, pTopic, pRebInfo->key); memcpy(rebOutput.pSub->dbName, pTopic->db, TSDB_DB_FNAME_LEN); - tAssert(taosHashGetSize(rebOutput.pSub->consumerHash) == 0); + ASSERT(taosHashGetSize(rebOutput.pSub->consumerHash) == 0); taosRUnLockLatch(&pTopic->lock); mndReleaseTopic(pMnode, pTopic); @@ -601,7 +601,7 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { // if add more consumer to balanced subscribe, // possibly no vg is changed - /*tAssert(taosArrayGetSize(rebOutput.rebVgs) != 0);*/ + /*ASSERT(taosArrayGetSize(rebOutput.rebVgs) != 0);*/ if (mndPersistRebResult(pMnode, pMsg, &rebOutput) < 0) { mError("mq rebalance persist rebalance output error, possibly vnode splitted or dropped"); diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index e582eac2a7..e271eedd17 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -384,7 +384,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * topicObj.subType = pCreate->subType; topicObj.withMeta = pCreate->withMeta; if (topicObj.withMeta) { - tAssert(topicObj.subType != TOPIC_SUB_TYPE__COLUMN); + ASSERT(topicObj.subType != TOPIC_SUB_TYPE__COLUMN); } if (pCreate->subType == TOPIC_SUB_TYPE__COLUMN) { @@ -499,7 +499,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * if (code < 0) { sdbRelease(pSdb, pVgroup); mndTransDrop(pTrans); - tAssert(0); + ASSERT(0); return -1; } void *buf = taosMemoryCalloc(1, sizeof(SMsgHead) + len); @@ -717,7 +717,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) { // TODO check if rebalancing if (mndDropSubByTopic(pMnode, pTrans, dropReq.name) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ mError("topic:%s, failed to drop since %s", pTopic->name, terrstr()); mndTransDrop(pTrans); mndReleaseTopic(pMnode, pTopic); diff --git a/source/dnode/mnode/impl/test/trans/trans1.cpp b/source/dnode/mnode/impl/test/trans/trans1.cpp index f783788a0f..92a442aa5e 100644 --- a/source/dnode/mnode/impl/test/trans/trans1.cpp +++ b/source/dnode/mnode/impl/test/trans/trans1.cpp @@ -32,7 +32,7 @@ class MndTestTrans1 : public ::testing::Test { void* buffer = taosMemoryMalloc(size); int32_t readLen = taosReadFile(pFile, buffer, size); if (readLen < 0 || readLen == size) { - tAssert(1); + ASSERT(1); } taosCloseFile(&pFile); @@ -41,7 +41,7 @@ class MndTestTrans1 : public ::testing::Test { pFile = taosOpenFile(file, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); int32_t writeLen = taosWriteFile(pFile, buffer, readLen); if (writeLen < 0 || writeLen == readLen) { - tAssert(1); + ASSERT(1); } taosMemoryFree(buffer); taosFsyncFile(pFile); diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 072727507d..b133226ed3 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -61,8 +61,8 @@ FAIL: } int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) { - tAssert(pTask->taskLevel == TASK_LEVEL__AGG); - tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); + ASSERT(pTask->taskLevel == TASK_LEVEL__AGG); + ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); pTask->refCnt = 1; pTask->schedStatus = TASK_SCHED_STATUS__INACTIVE; @@ -91,7 +91,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); - tAssert(pTask->exec.executor); + ASSERT(pTask->exec.executor); return 0; } @@ -149,7 +149,7 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) { } tDecoderClear(&decoder); - tAssert(pTask->taskLevel == TASK_LEVEL__AGG); + ASSERT(pTask->taskLevel == TASK_LEVEL__AGG); // 2.save task code = streamMetaAddTask(pSnode->pMeta, -1, pTask); @@ -263,7 +263,7 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) { case TDMT_STREAM_TASK_DROP: return sndProcessTaskDropReq(pSnode, pReq, len); default: - tAssert(0); + ASSERT(0); } return 0; } @@ -317,7 +317,7 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) { case TDMT_STREAM_RECOVER_FINISH_RSP: return sndProcessTaskRecoverFinishRsp(pSnode, pMsg); default: - tAssert(0); + ASSERT(0); } return 0; } diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 21f63e6e98..0ed68dce95 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -205,7 +205,7 @@ _exit: int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { int32_t code = 0; - // tAssert(metaIsWLocked(pMeta)); + // ASSERT(metaIsWLocked(pMeta)); // search SMetaCache* pCache = pMeta->pCache; @@ -216,7 +216,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { } if (*ppEntry) { // update - tAssert(pInfo->suid == (*ppEntry)->info.suid); + ASSERT(pInfo->suid == (*ppEntry)->info.suid); if (pInfo->version > (*ppEntry)->info.version) { (*ppEntry)->info.version = pInfo->version; (*ppEntry)->info.skmVer = pInfo->skmVer; @@ -335,7 +335,7 @@ _exit: int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) { int32_t code = 0; - // tAssert(metaIsWLocked(pMeta)); + // ASSERT(metaIsWLocked(pMeta)); // search SMetaCache* pCache = pMeta->pCache; @@ -435,7 +435,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK return TSDB_CODE_SUCCESS; } else { // do some book mark work after acquiring the filter result from cache STagFilterResEntry** pEntry = taosHashGet(pMeta->pCache->sTagFilterResCache.pTableEntry, &suid, sizeof(uint64_t)); - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); *acquireRes = 1; const char* p = taosLRUCacheValue(pMeta->pCache->sTagFilterResCache.pUidResCache, pHandle); @@ -522,7 +522,7 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int pBuf[0] = suid; memcpy(&pBuf[1], pKey, keyLen); - tAssert(sizeof(uint64_t) + keyLen == 24); + ASSERT(sizeof(uint64_t) + keyLen == 24); // add to cache. taosLRUCacheInsert(pCache, pBuf, sizeof(uint64_t) + keyLen, pPayload, payloadLen, freePayload, NULL, TAOS_LRU_PRIORITY_LOW); diff --git a/source/dnode/vnode/src/meta/metaEntry.c b/source/dnode/vnode/src/meta/metaEntry.c index 0a6e91f511..72f7365a1e 100644 --- a/source/dnode/vnode/src/meta/metaEntry.c +++ b/source/dnode/vnode/src/meta/metaEntry.c @@ -51,7 +51,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) { } else if (pME->type == TSDB_TSMA_TABLE) { if (tEncodeTSma(pCoder, pME->smaEntry.tsma) < 0) return -1; } else { - tAssert(0); + ASSERT(0); } tEndEncode(pCoder); @@ -99,7 +99,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { } if (tDecodeTSma(pCoder, pME->smaEntry.tsma, true) < 0) return -1; } else { - tAssert(0); + ASSERT(0); } tEndDecode(pCoder); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index f03998987a..1b5f742559 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -358,7 +358,7 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL return -1; } - tAssert(pTagIdxKey1->type == pTagIdxKey2->type); + ASSERT(pTagIdxKey1->type == pTagIdxKey2->type); // check NULL, NULL is always the smallest if (pTagIdxKey1->isNull && !pTagIdxKey2->isNull) { diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 7b851bb9f8..cfdb4ab8d1 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -662,7 +662,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv goto _exit; } - tAssert(c); + ASSERT(c); if (c < 0) { tdbTbcMoveToPrev(pSkmDbC); @@ -686,7 +686,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv } } - tAssert(sver > 0); + ASSERT(sver > 0); skmDbKey.uid = suid ? suid : uid; skmDbKey.sver = sver; diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c index f487651b0e..6a4dcf6ead 100644 --- a/source/dnode/vnode/src/meta/metaSnapshot.c +++ b/source/dnode/vnode/src/meta/metaSnapshot.c @@ -100,7 +100,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) { break; } - tAssert(pData && nData); + ASSERT(pData && nData); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData); if (*ppData == NULL) { @@ -161,7 +161,7 @@ int32_t metaSnapWriterClose(SMetaSnapWriter** ppWriter, int8_t rollback) { SMetaSnapWriter* pWriter = *ppWriter; if (rollback) { - tAssert(0); + ASSERT(0); } else { code = metaCommit(pWriter->pMeta, pWriter->pMeta->txn); if (code) goto _err; @@ -352,7 +352,7 @@ int32_t buildSnapContext(SMeta* pMeta, int64_t snapVersion, int64_t suid, int8_t for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) { int64_t* uid = taosArrayGet(ctx->idList, i); SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t)); - tAssert(idData); + ASSERT(idData); idData->index = i; metaDebug("tmqsnap init idVersion uid:%" PRIi64 " version:%" PRIi64 " index:%d", *uid, idData->version, idData->index); @@ -469,7 +469,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - tAssert(idInfo); + ASSERT(idInfo); *uid = *uidTmp; ret = MoveToPosition(ctx, idInfo->version, *uidTmp); @@ -503,7 +503,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in (ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)) { STableInfoForChildTable* data = (STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t)); - tAssert(data); + ASSERT(data); SVCreateTbReq req = {0}; req.type = TSDB_CHILD_TABLE; @@ -524,7 +524,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in } else { SArray* pTagVals = NULL; if (tTagToValArray((const STag*)p, &pTagVals) != 0) { - tAssert(0); + ASSERT(0); } int16_t nCols = taosArrayGetSize(pTagVals); for (int j = 0; j < nCols; ++j) { @@ -568,7 +568,7 @@ int32_t getMetafromSnapShot(SSnapContext* ctx, void** pBuf, int32_t* contLen, in ret = buildNormalChildTableInfo(&req, pBuf, contLen); *type = TDMT_VND_CREATE_TABLE; } else { - tAssert(0); + ASSERT(0); } tDecoderClear(&dc); @@ -589,7 +589,7 @@ SMetaTableInfo getUidfromSnapShot(SSnapContext* ctx) { int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); ctx->index++; SIdInfo* idInfo = (SIdInfo*)taosHashGet(ctx->idVersion, uidTmp, sizeof(tb_uid_t)); - tAssert(idInfo); + ASSERT(idInfo); int32_t ret = MoveToPosition(ctx, idInfo->version, *uidTmp); if (ret != 0) { diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 904be38794..0b00f036de 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -46,7 +46,7 @@ static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) { pInfo->suid = 0; pInfo->skmVer = pEntry->ntbEntry.schemaRow.version; } else { - tAssert(0); + ASSERT(0); } } @@ -342,10 +342,10 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c); - tAssert(ret == 0 && c == 0); + ASSERT(ret == 0 && c == 0); ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); - tAssert(ret == 0); + ASSERT(ret == 0); oStbEntry.pBuf = taosMemoryMalloc(nData); memcpy(oStbEntry.pBuf, pData, nData); @@ -558,7 +558,7 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) { ctime = pME->ntbEntry.ctime; ttlDays = pME->ntbEntry.ttlDays; } else { - tAssert(0); + ASSERT(0); } if (ttlDays <= 0) return; @@ -770,7 +770,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -780,7 +780,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -789,7 +789,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - tAssert(ret == 0); + ASSERT(ret == 0); if (entry.type != TSDB_NORMAL_TABLE) { terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION; @@ -809,7 +809,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl if (iCol >= pSchema->nCols) break; pColumn = &pSchema->pSchema[iCol]; - tAssert(pAlterTbReq->colName); + ASSERT(pAlterTbReq->colName); if (strcmp(pColumn->name, pAlterTbReq->colName) == 0) break; iCol++; } @@ -961,7 +961,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -974,7 +974,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA /* get ctbEntry */ tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); ctbEntry.pBuf = taosMemoryMalloc(nData); @@ -1072,7 +1072,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA metaUpdateTagIdx(pMeta, &ctbEntry); } - tAssert(ctbEntry.ctbEntry.pTags); + ASSERT(ctbEntry.ctbEntry.pTags); SCtbIdxKey ctbIdxKey = {.suid = ctbEntry.ctbEntry.suid, .uid = uid}; tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags, ((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn); @@ -1127,7 +1127,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); oversion = ((SUidIdxVal *)pData)[0].version; @@ -1137,7 +1137,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); - tAssert(c == 0); + ASSERT(c == 0); tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); // get table entry @@ -1146,7 +1146,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p memcpy(entry.pBuf, pData, nData); tDecoderInit(&dc, entry.pBuf, nData); ret = metaDecodeEntry(&dc, &entry); - tAssert(ret == 0); + ASSERT(ret == 0); entry.version = version; metaWLock(pMeta); @@ -1401,7 +1401,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) { } else if (pME->type == TSDB_NORMAL_TABLE) { pSW = &pME->ntbEntry.schemaRow; } else { - tAssert(0); + ASSERT(0); } skmDbKey.uid = pME->uid; diff --git a/source/dnode/vnode/src/sma/smaCommit.c b/source/dnode/vnode/src/sma/smaCommit.c index 6940a2acc3..9748963722 100644 --- a/source/dnode/vnode/src/sma/smaCommit.c +++ b/source/dnode/vnode/src/sma/smaCommit.c @@ -317,7 +317,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { } } pRSmaStat->commitAppliedVer = pSma->pVnode->state.applied; - tAssert(pRSmaStat->commitAppliedVer > 0); + ASSERT(pRSmaStat->commitAppliedVer > 0); // step 2: wait for all triggered fetch tasks to finish nLoops = 0; @@ -361,7 +361,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) { // lock taosWLockLatch(SMA_ENV_LOCK(pEnv)); - tAssert(RSMA_INFO_HASH(pRSmaStat)); + ASSERT(RSMA_INFO_HASH(pRSmaStat)); void *pIter = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL); diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index 5192e3cb34..a272f5fc97 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -193,7 +193,7 @@ static void tRSmaInfoHashFreeNode(void *data) { } static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pSma) { - tAssert(pSmaStat != NULL); + ASSERT(pSmaStat != NULL); if (*pSmaStat) { // no lock return TSDB_CODE_SUCCESS; @@ -250,7 +250,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS } else if (smaType == TSDB_SMA_TYPE_TIME_RANGE) { // TODO } else { - tAssert(0); + ASSERT(0); } } return TSDB_CODE_SUCCESS; @@ -342,7 +342,7 @@ static int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) { smaDebug("vgId:%d, remove refId:%" PRIi64 " from rsmaRef:%" PRIi32 " succeed", vid, refId, smaMgmt.rsetId); } } else { - tAssert(0); + ASSERT(0); } } return 0; @@ -360,7 +360,7 @@ int32_t tdLockSma(SSma *pSma) { } int32_t tdUnLockSma(SSma *pSma) { - tAssert(SMA_LOCKED(pSma)); + ASSERT(SMA_LOCKED(pSma)); pSma->locked = false; int code = taosThreadMutexUnlock(&pSma->mutex); if (code != 0) { diff --git a/source/dnode/vnode/src/sma/smaFS.c b/source/dnode/vnode/src/sma/smaFS.c index f4843eb498..8db36be741 100644 --- a/source/dnode/vnode/src/sma/smaFS.c +++ b/source/dnode/vnode/src/sma/smaFS.c @@ -90,7 +90,7 @@ int32_t tdRSmaFSRef(SSma *pSma, SRSmaStat *pStat, int64_t version) { taosRLockLatch(RSMA_FS_LOCK(pStat)); if ((pTaskF = taosArraySearch(aQTaskInf, &version, tdQTaskInfCmprFn1, TD_EQ))) { oldVal = atomic_fetch_add_32(&pTaskF->nRef, 1); - tAssert(oldVal > 0); + ASSERT(oldVal > 0); } taosRUnLockLatch(RSMA_FS_LOCK(pStat)); return oldVal; @@ -117,7 +117,7 @@ void tdRSmaFSUnRef(SSma *pSma, SRSmaStat *pStat, int64_t version) { taosWLockLatch(RSMA_FS_LOCK(pStat)); if ((idx = taosArraySearchIdx(aQTaskInf, &version, tdQTaskInfCmprFn1, TD_EQ)) >= 0) { - tAssert(idx < taosArrayGetSize(aQTaskInf)); + ASSERT(idx < taosArrayGetSize(aQTaskInf)); pTaskF = taosArrayGet(aQTaskInf, idx); if (atomic_sub_fetch_32(&pTaskF->nRef, 1) <= 0) { tdRSmaQTaskInfoGetFullName(TD_VID(pVnode), pTaskF->version, tfsGetPrimaryPath(pVnode->pTfs), qTaskFullName); diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 06a48148ad..2a769b68fe 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -72,7 +72,7 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p goto end; } - tAssert(level >= TSDB_RETENTION_L1 && level <= TSDB_RETENTION_L2); + ASSERT(level >= TSDB_RETENTION_L1 && level <= TSDB_RETENTION_L2); freqDuration = convertTimeFromPrecisionToUnit((r + level)->freq, precision, TIME_UNIT_MINUTE); keepDuration = convertTimeFromPrecisionToUnit((r + level)->keep, precision, TIME_UNIT_MINUTE); @@ -100,7 +100,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty pKeepCfg->precision = pCfg->precision; switch (type) { case TSDB_TYPE_TSMA: - tAssert(0); + ASSERT(0); break; case TSDB_TYPE_RSMA_L0: SMA_SET_KEEP_CFG(pVnode, 0); @@ -112,7 +112,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty SMA_SET_KEEP_CFG(pVnode, 2); break; default: - tAssert(0); + ASSERT(0); break; } return 0; @@ -121,7 +121,7 @@ int smaSetKeepCfg(SVnode *pVnode, STsdbKeepCfg *pKeepCfg, STsdbCfg *pCfg, int ty int32_t smaOpen(SVnode *pVnode, int8_t rollback) { STsdbCfg *pCfg = &pVnode->config.tsdbCfg; - tAssert(!pVnode->pSma); + ASSERT(!pVnode->pSma); SSma *pSma = taosMemoryCalloc(1, sizeof(SSma)); if (!pSma) { @@ -145,7 +145,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback) { } else if (i == TSDB_RETENTION_L2) { SMA_OPEN_RSMA_IMPL(pVnode, 2); } else { - tAssert(0); + ASSERT(0); } } @@ -182,7 +182,7 @@ int32_t smaClose(SSma *pSma) { * @return int32_t */ int32_t tdRSmaRestore(SSma *pSma, int8_t type, int64_t committedVer) { - tAssert(VND_IS_RSMA(pSma->pVnode)); + ASSERT(VND_IS_RSMA(pSma->pVnode)); return tdRSmaProcessRestoreImpl(pSma, type, committedVer); } diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 1918c85e91..6bd2ae3435 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -161,7 +161,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo, bool isDeepFree) { } static FORCE_INLINE int32_t tdUidStoreInit(STbUidStore **pStore) { - tAssert(*pStore == NULL); + ASSERT(*pStore == NULL); *pStore = taosMemoryCalloc(1, sizeof(STbUidStore)); if (*pStore == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -264,7 +264,7 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui return TSDB_CODE_SUCCESS; } - tAssert(ppStore != NULL); + ASSERT(ppStore != NULL); if (!(*ppStore)) { if (tdUidStoreInit(ppStore) < 0) { @@ -332,7 +332,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat } pItem->level = idx == 0 ? TSDB_RETENTION_L1 : TSDB_RETENTION_L2; - tAssert(pItem->level > 0); + ASSERT(pItem->level > 0); SRSmaRef rsmaRef = {.refId = pStat->refId, .suid = pRSmaInfo->suid}; taosHashPut(smaMgmt.refHash, &pItem, POINTER_BYTES, &rsmaRef, sizeof(rsmaRef)); @@ -882,7 +882,7 @@ static int32_t tdCloneQTaskInfo(SSma *pSma, qTaskInfo_t dstTaskInfo, qTaskInfo_t .vnode = pVnode, .initTqReader = 1, }; - tAssert(!dstTaskInfo); + ASSERT(!dstTaskInfo); dstTaskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], &handle); if (!dstTaskInfo) { terrno = TSDB_CODE_RSMA_QTASKINFO_CREATE; @@ -928,8 +928,8 @@ static int32_t tdRSmaInfoClone(SSma *pSma, SRSmaInfo *pInfo) { terrstr()); goto _err; } - tAssert(mr.me.type == TSDB_SUPER_TABLE); - tAssert(mr.me.uid == pInfo->suid); + ASSERT(mr.me.type == TSDB_SUPER_TABLE); + ASSERT(mr.me.uid == pInfo->suid); if (TABLE_IS_ROLLUP(mr.me.flags)) { param = &mr.me.stbEntry.rsmaParam; for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { @@ -992,7 +992,7 @@ static SRSmaInfo *tdAcquireRSmaInfoBySuid(SSma *pSma, int64_t suid) { } tdRefRSmaInfo(pSma, pRSmaInfo); taosRUnLockLatch(SMA_ENV_LOCK(pEnv)); - tAssert(pRSmaInfo->suid == suid); + ASSERT(pRSmaInfo->suid == suid); return pRSmaInfo; } taosRUnLockLatch(SMA_ENV_LOCK(pEnv)); @@ -1038,7 +1038,7 @@ static int32_t tdExecuteRSmaAsync(SSma *pSma, const void *pMsg, int32_t inputTyp } } } else { - tAssert(0); + ASSERT(0); } tdReleaseRSmaInfo(pSma, pRSmaInfo); @@ -1133,8 +1133,8 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) { goto _err; } tDecoderClear(&mr.coder); - tAssert(mr.me.type == TSDB_SUPER_TABLE); - tAssert(mr.me.uid == suid); + ASSERT(mr.me.type == TSDB_SUPER_TABLE); + ASSERT(mr.me.uid == suid); if (TABLE_IS_ROLLUP(mr.me.flags)) { ++nRsmaTables; SRSmaParam *param = &mr.me.stbEntry.rsmaParam; @@ -1345,8 +1345,8 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { #if 0 SRSmaInfo *qInfo = tdAcquireRSmaInfoBySuid(pSma, pRSmaInfo->suid); SRSmaInfoItem *qItem = RSMA_INFO_ITEM(qInfo, pItem->level - 1); - tAssert(qItem->level == pItem->level); - tAssert(qItem->fetchLevel == pItem->fetchLevel); + ASSERT(qItem->level == pItem->level); + ASSERT(qItem->fetchLevel == pItem->fetchLevel); #endif if (atomic_load_8(&pRSmaInfo->assigned) == 0) { tsem_post(&(pStat->notEmpty)); @@ -1536,7 +1536,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { if (oldStat == 0 || ((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) { int32_t oldVal = atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1); - tAssert(oldVal >= 0); + ASSERT(oldVal >= 0); tdRSmaFetchAllResult(pSma, pInfo); if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) { atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0); @@ -1567,7 +1567,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { } } } else { - tAssert(0); + ASSERT(0); } if (atomic_load_64(&pRSmaStat->nBufItems) <= 0) { diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c index 8d97a4a664..34f884f9f9 100644 --- a/source/dnode/vnode/src/sma/smaSnapshot.c +++ b/source/dnode/vnode/src/sma/smaSnapshot.c @@ -184,7 +184,7 @@ static int32_t rsmaSnapReadQTaskInfo(SRSmaSnapReader* pReader, uint8_t** ppBuf) goto _err; } - tAssert(!(*ppBuf)); + ASSERT(!(*ppBuf)); // alloc *ppBuf = taosMemoryCalloc(1, sizeof(SSnapDataHdr) + size); if (!(*ppBuf)) { @@ -430,7 +430,7 @@ int32_t rsmaSnapWrite(SRSmaSnapWriter* pWriter, uint8_t* pData, uint32_t nData) } else if (pHdr->type == SNAP_DATA_QTASK) { code = rsmaSnapWriteQTaskInfo(pWriter, pData, nData); } else { - tAssert(0); + ASSERT(0); } if (code < 0) goto _err; @@ -451,7 +451,7 @@ static int32_t rsmaSnapWriteQTaskInfo(SRSmaSnapWriter* pWriter, uint8_t* pData, if (qWriter && qWriter->pWriteH) { SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; int64_t size = pHdr->size; - tAssert(size == (nData - sizeof(SSnapDataHdr))); + ASSERT(size == (nData - sizeof(SSnapDataHdr))); int64_t contLen = taosWriteFile(qWriter->pWriteH, pHdr->data, size); if (contLen != size) { code = TAOS_SYSTEM_ERROR(errno); diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index b480f9344b..a2c9484693 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -136,7 +136,7 @@ static int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t version, const char * " dstTb:%s dstVg:%d", SMA_VID(pSma), pCfg->indexName, pCfg->indexUid, pCfg->tableUid, pCfg->dstTbUid, pReq.name, pCfg->dstVgId); } else { - tAssert(0); + ASSERT(0); } return 0; @@ -218,7 +218,7 @@ static int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char } #if 0 - tAssert(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); + ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); #endif SRpcMsg submitReqMsg = { diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c index 7316b7ef97..4d09d690d6 100644 --- a/source/dnode/vnode/src/sma/smaUtil.c +++ b/source/dnode/vnode/src/sma/smaUtil.c @@ -46,7 +46,7 @@ static void *tdDecodeTFInfo(void *buf, STFInfo *pInfo) { } int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nwrite = taosWriteFile(pTFile->pFile, buf, nbyte); if (nwrite < nbyte) { @@ -58,7 +58,7 @@ int64_t tdWriteTFile(STFile *pTFile, void *buf, int64_t nbyte) { } int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t loffset = taosLSeekFile(TD_TFILE_PFILE(pTFile), offset, whence); if (loffset < 0) { @@ -70,12 +70,12 @@ int64_t tdSeekTFile(STFile *pTFile, int64_t offset, int whence) { } int64_t tdGetTFileSize(STFile *pTFile, int64_t *size) { - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); return taosFStatFile(pTFile->pFile, size, NULL); } int64_t tdReadTFile(STFile *pTFile, void *buf, int64_t nbyte) { - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t nread = taosReadFile(pTFile->pFile, buf, nbyte); if (nread < 0) { @@ -108,7 +108,7 @@ int32_t tdLoadTFileHeader(STFile *pTFile, STFInfo *pInfo) { char buf[TD_FILE_HEAD_SIZE] = "\0"; uint32_t _version; - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); if (tdSeekTFile(pTFile, 0, SEEK_SET) < 0) { return -1; @@ -133,7 +133,7 @@ void tdUpdateTFileMagic(STFile *pTFile, void *pCksm) { } int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) { - tAssert(TD_TFILE_OPENED(pTFile)); + ASSERT(TD_TFILE_OPENED(pTFile)); int64_t toffset; @@ -146,7 +146,7 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) toffset, nbyte, toffset + nbyte); #endif - tAssert(pTFile->info.fsize == toffset); + ASSERT(pTFile->info.fsize == toffset); if (offset) { *offset = toffset; @@ -162,7 +162,7 @@ int64_t tdAppendTFile(STFile *pTFile, void *buf, int64_t nbyte, int64_t *offset) } int32_t tdOpenTFile(STFile *pTFile, int flags) { - tAssert(!TD_TFILE_OPENED(pTFile)); + ASSERT(!TD_TFILE_OPENED(pTFile)); pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), flags); if (pTFile->pFile == NULL) { @@ -245,7 +245,7 @@ int32_t tdInitTFile(STFile *pTFile, const char *dname, const char *fname) { } int32_t tdCreateTFile(STFile *pTFile, bool updateHeader, int8_t fType) { - tAssert(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); + ASSERT(pTFile->info.fsize == 0 && pTFile->info.magic == TD_FILE_INIT_MAGIC); pTFile->pFile = taosOpenFile(TD_TFILE_FULL_NAME(pTFile), TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pTFile->pFile == NULL) { if (errno == ENOENT) { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index c0a9a1ab92..191fc1b49c 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -92,21 +92,21 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo); if (tqMetaOpen(pTq) < 0) { - tAssert(0); + ASSERT(0); } pTq->pOffsetStore = tqOffsetOpen(pTq); if (pTq->pOffsetStore == NULL) { - tAssert(0); + ASSERT(0); } pTq->pStreamMeta = streamMetaOpen(path, pTq, (FTaskExpand*)tqExpandTask, pTq->pVnode->config.vgId); if (pTq->pStreamMeta == NULL) { - tAssert(0); + ASSERT(0); } if (streamLoadTasks(pTq->pStreamMeta) < 0) { - tAssert(0); + ASSERT(0); } return pTq; @@ -166,17 +166,17 @@ int32_t tqSendMetaPollRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) { SMqDataRsp* pRsp = &pPushEntry->dataRsp; - tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); - tAssert(!pRsp->withSchema); - tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); + ASSERT(!pRsp->withSchema); + ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { /*if (pRsp->blockNum > 0) {*/ - /*tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version);*/ + /*ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version);*/ /*} else {*/ - tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); + ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); /*}*/ } @@ -223,17 +223,17 @@ int32_t tqPushDataRsp(STQ* pTq, STqPushEntry* pPushEntry) { } int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp) { - tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); - tAssert(!pRsp->withSchema); - tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); + ASSERT(!pRsp->withSchema); + ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { if (pRsp->blockNum > 0) { - tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); + ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); } else { - tAssert(pRsp->rspOffset.version >= pRsp->reqOffset.version); + ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version); } } @@ -279,20 +279,20 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con } int32_t tqSendTaosxRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, const STaosxRsp* pRsp) { - tAssert(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); - tAssert(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockData) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockDataLen) == pRsp->blockNum); if (pRsp->withSchema) { - tAssert(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum); + ASSERT(taosArrayGetSize(pRsp->blockSchema) == pRsp->blockNum); } else { - tAssert(taosArrayGetSize(pRsp->blockSchema) == 0); + ASSERT(taosArrayGetSize(pRsp->blockSchema) == 0); } if (pRsp->reqOffset.type == TMQ_OFFSET__LOG) { if (pRsp->blockNum > 0) { - tAssert(pRsp->rspOffset.version > pRsp->reqOffset.version); + ASSERT(pRsp->rspOffset.version > pRsp->reqOffset.version); } else { - tAssert(pRsp->rspOffset.version >= pRsp->reqOffset.version); + ASSERT(pRsp->rspOffset.version >= pRsp->reqOffset.version); } } @@ -348,7 +348,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m SDecoder decoder; tDecoderInit(&decoder, msg, msgLen); if (tDecodeSTqOffset(&decoder, &offset) < 0) { - tAssert(0); + ASSERT(0); return -1; } tDecoderClear(&decoder); @@ -363,7 +363,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m offset.val.version += 1; } } else { - tAssert(0); + ASSERT(0); } STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, offset.subKey); if (pOffset != NULL && tqOffsetLessOrEqual(&offset, pOffset)) { @@ -371,7 +371,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, int64_t version, char* msg, int32_t m } if (tqOffsetWrite(pTq->pOffsetStore, &offset) < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -434,7 +434,7 @@ static int32_t tqInitDataRsp(SMqDataRsp* pRsp, const SMqPollReq* pReq, int8_t su } #endif - tAssert(subType == TOPIC_SUB_TYPE__COLUMN); + ASSERT(subType == TOPIC_SUB_TYPE__COLUMN); pRsp->withSchema = false; return 0; @@ -473,7 +473,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { // 1.find handle STqHandle* pHandle = taosHashGet(pTq->pHandle, req.subKey, strlen(req.subKey)); - /*tAssert(pHandle);*/ + /*ASSERT(pHandle);*/ if (pHandle == NULL) { tqError("tmq poll: no consumer handle for consumer:%" PRId64 ", in vgId:%d, subkey %s", consumerId, TD_VID(pTq->pVnode), req.subKey); @@ -599,7 +599,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } // for taosx - tAssert(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN); + ASSERT(pHandle->execHandle.subType != TOPIC_SUB_TYPE__COLUMN); SMqMetaRsp metaRsp = {0}; @@ -690,8 +690,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { } } else { - tAssert(pHandle->fetchMeta); - tAssert(IS_META_MSG(pHead->msgType)); + ASSERT(pHandle->fetchMeta); + ASSERT(IS_META_MSG(pHead->msgType)); tqDebug("fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType); tqOffsetResetToLog(&metaRsp.rspOffset, fetchVer); metaRsp.resMsgType = pHead->msgType; @@ -736,7 +736,7 @@ int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgL } if (tqMetaDeleteHandle(pTq, pReq->subKey) < 0) { - tAssert(0); + ASSERT(0); } return 0; } @@ -802,7 +802,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL // TODO version should be assigned and refed during preprocess SWalRef* pRef = walRefCommittedVer(pTq->pVnode->pWal); if (pRef == NULL) { - tAssert(0); + ASSERT(0); return -1; } int64_t ver = pRef->refVer; @@ -823,12 +823,12 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL pHandle->execHandle.task = qCreateQueueExecTaskInfo(pHandle->execHandle.execCol.qmsg, &handle, &pHandle->execHandle.numOfCols, NULL); - tAssert(pHandle->execHandle.task); + ASSERT(pHandle->execHandle.task); void* scanner = NULL; qExtractStreamScanner(pHandle->execHandle.task, &scanner); - tAssert(scanner); + ASSERT(scanner); pHandle->execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner); - tAssert(pHandle->execHandle.pExecReader); + ASSERT(pHandle->execHandle.pExecReader); } else if (pHandle->execHandle.subType == TOPIC_SUB_TYPE__DB) { pHandle->pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); pHandle->execHandle.pExecReader = tqOpenReader(pTq->pVnode); @@ -862,10 +862,10 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL tqDebug("try to persist handle %s consumer %" PRId64, req.subKey, pHandle->consumerId); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { // TODO - tAssert(0); + ASSERT(0); } } else { - /*tAssert(pExec->consumerId == req.oldConsumerId);*/ + /*ASSERT(pExec->consumerId == req.oldConsumerId);*/ // TODO handle qmsg and exec modification atomic_store_32(&pHandle->epoch, -1); atomic_store_64(&pHandle->consumerId, req.newConsumerId); @@ -873,7 +873,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL taosMemoryFree(req.qmsg); if (tqMetaSaveHandle(pTq, req.subKey, pHandle) < 0) { // TODO - tAssert(0); + ASSERT(0); } // close handle } @@ -883,7 +883,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t version, char* msg, int32_t msgL int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { if (pTask->taskLevel == TASK_LEVEL__AGG) { - tAssert(taosArrayGetSize(pTask->childEpInfo) != 0); + ASSERT(taosArrayGetSize(pTask->childEpInfo) != 0); } pTask->refCnt = 1; @@ -921,7 +921,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &handle); - tAssert(pTask->exec.executor); + ASSERT(pTask->exec.executor); } else if (pTask->taskLevel == TASK_LEVEL__AGG) { pTask->pState = streamStateOpen(pTq->pStreamMeta->path, pTask, false, -1, -1); @@ -934,7 +934,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { .pStateBackend = pTask->pState, }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); - tAssert(pTask->exec.executor); + ASSERT(pTask->exec.executor); } // sink @@ -946,12 +946,12 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) { pTask->tbSink.vnode = pTq->pVnode; pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline; - tAssert(pTask->tbSink.pSchemaWrapper); - tAssert(pTask->tbSink.pSchemaWrapper->pSchema); + ASSERT(pTask->tbSink.pSchemaWrapper); + ASSERT(pTask->tbSink.pSchemaWrapper->pSchema); pTask->tbSink.pTSchema = tdGetSTSChemaFromSSChema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, 1); - tAssert(pTask->tbSink.pTSchema); + ASSERT(pTask->tbSink.pTSchema); } streamSetupTrigger(pTask); @@ -997,7 +997,7 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { int32_t len; tEncodeSize(tEncodeSStreamTaskCheckRsp, &rsp, len, code); if (code < 0) { - tAssert(0); + ASSERT(0); } void* buf = rpcMallocCont(sizeof(SMsgHead) + len); ((SMsgHead*)buf)->vgId = htonl(req.upstreamNodeId); @@ -1090,12 +1090,12 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) { if (pTask == NULL) { return -1; } - tAssert(pReq->taskId == pTask->taskId); + ASSERT(pReq->taskId == pTask->taskId); // check param int64_t fillVer1 = pTask->startVer; if (fillVer1 <= 0) { - tAssert(0); + ASSERT(0); streamMetaReleaseTask(pTq->pStreamMeta, pTask); return -1; } @@ -1290,7 +1290,7 @@ int32_t tqProcessDelReq(STQ* pTq, void* pReq, int32_t len, int64_t ver) { } int32_t ref = atomic_sub_fetch_32(pRef, 1); - tAssert(ref >= 0); + ASSERT(ref >= 0); if (ref == 0) { blockDataDestroy(pDelBlock); taosMemoryFree(pRef); diff --git a/source/dnode/vnode/src/tq/tqExec.c b/source/dnode/vnode/src/tq/tqExec.c index 16d9f8f981..093186ebbb 100644 --- a/source/dnode/vnode/src/tq/tqExec.c +++ b/source/dnode/vnode/src/tq/tqExec.c @@ -29,7 +29,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); - tAssert(actualLen <= dataStrLen); + ASSERT(actualLen <= dataStrLen); taosArrayPush(pRsp->blockDataLen, &actualLen); taosArrayPush(pRsp->blockData, &buf); return 0; @@ -62,7 +62,7 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, SMqDataRsp* pRsp, i int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* pOffset) { const STqExecHandle* pExec = &pHandle->execHandle; - tAssert(pExec->subType == TOPIC_SUB_TYPE__COLUMN); + ASSERT(pExec->subType == TOPIC_SUB_TYPE__COLUMN); qTaskInfo_t task = pExec->task; @@ -87,7 +87,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs uint64_t ts = 0; tqDebug("vgId:%d, tmq task start to execute", pTq->pVnode->config.vgId); if (qExecTask(task, &pDataBlock, &ts) < 0) { - tAssert(0); + ASSERT(0); } tqDebug("vgId:%d, tmq task executed, get %p", pTq->pVnode->config.vgId, pDataBlock); @@ -105,10 +105,10 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs } if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) { - tAssert(0); + ASSERT(0); return -1; } - tAssert(pRsp->rspOffset.type != 0); + ASSERT(pRsp->rspOffset.type != 0); if (pRsp->withTbName) { if (pRsp->rspOffset.type == TMQ_OFFSET__LOG) { @@ -118,7 +118,7 @@ int32_t tqScanData(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, STqOffs pRsp->withTbName = false; } } - tAssert(pRsp->withSchema == false); + ASSERT(pRsp->withSchema == false); return 0; } @@ -148,7 +148,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta uint64_t ts = 0; tqDebug("tmqsnap task start to execute"); if (qExecTask(task, &pDataBlock, &ts) < 0) { - tAssert(0); + ASSERT(0); } tqDebug("tmqsnap task execute end, get %p", pDataBlock); @@ -216,16 +216,16 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta } if (qStreamExtractOffset(task, &pRsp->rspOffset) < 0) { - tAssert(0); + ASSERT(0); } - tAssert(pRsp->rspOffset.type != 0); + ASSERT(pRsp->rspOffset.type != 0); return 0; } int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SSubmitReq* pReq, STaosxRsp* pRsp) { STqExecHandle* pExec = &pHandle->execHandle; - tAssert(pExec->subType != TOPIC_SUB_TYPE__COLUMN); + ASSERT(pExec->subType != TOPIC_SUB_TYPE__COLUMN); SArray* pBlocks = taosArrayInit(0, sizeof(SSDataBlock)); SArray* pSchemas = taosArrayInit(0, sizeof(void*)); diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 3614418d5f..f476f58b56 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -71,17 +71,17 @@ int32_t tDecodeSTqHandle(SDecoder* pDecoder, STqHandle* pHandle) { int32_t tqMetaOpen(STQ* pTq) { if (tdbOpen(pTq->path, 16 * 1024, 1, &pTq->pMetaDB, 0) < 0) { - tAssert(0); + ASSERT(0); return -1; } if (tdbTbOpen("tq.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pExecStore, 0) < 0) { - tAssert(0); + ASSERT(0); return -1; } if (tdbTbOpen("tq.check.db", -1, -1, NULL, pTq->pMetaDB, &pTq->pCheckStore, 0) < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -135,19 +135,19 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) { if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - tAssert(0); + ASSERT(0); } if (tdbTbDelete(pTq->pCheckStore, key, (int)strlen(key), txn) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } return 0; @@ -156,7 +156,7 @@ int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key) { int32_t tqMetaRestoreCheckInfo(STQ* pTq) { TBC* pCur = NULL; if (tdbTbcOpen(pTq->pCheckStore, &pCur, NULL) < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -197,40 +197,40 @@ int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) { int32_t code; int32_t vlen; tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code); - tAssert(code == 0); + ASSERT(code == 0); tqDebug("tq save %s(%d) consumer %" PRId64 " vgId:%d", pHandle->subKey, (int32_t)strlen(pHandle->subKey), pHandle->consumerId, TD_VID(pTq->pVnode)); void* buf = taosMemoryCalloc(1, vlen); if (buf == NULL) { - tAssert(0); + ASSERT(0); } SEncoder encoder; tEncoderInit(&encoder, buf, vlen); if (tEncodeSTqHandle(&encoder, pHandle) < 0) { - tAssert(0); + ASSERT(0); } TXN* txn; if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - tAssert(0); + ASSERT(0); } if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) { - tAssert(0); + ASSERT(0); } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } tEncoderClear(&encoder); @@ -243,19 +243,19 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) { if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < 0) { - tAssert(0); + ASSERT(0); } if (tdbTbDelete(pTq->pExecStore, key, (int)strlen(key), txn) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ } if (tdbCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - tAssert(0); + ASSERT(0); } return 0; @@ -264,7 +264,7 @@ int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) { int32_t tqMetaRestoreHandle(STQ* pTq) { TBC* pCur = NULL; if (tdbTbcOpen(pTq->pExecStore, &pCur, NULL) < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -284,7 +284,7 @@ int32_t tqMetaRestoreHandle(STQ* pTq) { handle.pRef = walOpenRef(pTq->pVnode->pWal); if (handle.pRef == NULL) { - tAssert(0); + ASSERT(0); return -1; } walRefVer(handle.pRef, handle.snapshotVer); @@ -300,12 +300,12 @@ int32_t tqMetaRestoreHandle(STQ* pTq) { if (handle.execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { handle.execHandle.task = qCreateQueueExecTaskInfo(handle.execHandle.execCol.qmsg, &reader, &handle.execHandle.numOfCols, NULL); - tAssert(handle.execHandle.task); + ASSERT(handle.execHandle.task); void* scanner = NULL; qExtractStreamScanner(handle.execHandle.task, &scanner); - tAssert(scanner); + ASSERT(scanner); handle.execHandle.pExecReader = qExtractReaderFromStreamScanner(scanner); - tAssert(handle.execHandle.pExecReader); + ASSERT(handle.execHandle.pExecReader); } else if (handle.execHandle.subType == TOPIC_SUB_TYPE__DB) { handle.pWalReader = walOpenReader(pTq->pVnode->pWal, NULL); handle.execHandle.pExecReader = tqOpenReader(pTq->pVnode); diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c index 0dd0a73ca4..dd56c165fd 100644 --- a/source/dnode/vnode/src/tq/tqOffset.c +++ b/source/dnode/vnode/src/tq/tqOffset.c @@ -40,25 +40,25 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) { if (code == 0) { break; } else { - tAssert(0); + ASSERT(0); // TODO handle error } } int32_t size = htonl(head.size); void* memBuf = taosMemoryCalloc(1, size); if ((code = taosReadFile(pFile, memBuf, size)) != size) { - tAssert(0); + ASSERT(0); // TODO handle error } STqOffset offset; SDecoder decoder; tDecoderInit(&decoder, memBuf, size); if (tDecodeSTqOffset(&decoder, &offset) < 0) { - tAssert(0); + ASSERT(0); } tDecoderClear(&decoder); if (taosHashPut(pStore->pHash, offset.subKey, strlen(offset.subKey), &offset, sizeof(STqOffset)) < 0) { - tAssert(0); + ASSERT(0); // TODO } taosMemoryFree(memBuf); @@ -85,7 +85,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) { } char* fname = tqOffsetBuildFName(pStore->pTq->path, 0); if (tqOffsetRestoreFromFile(pStore, fname) < 0) { - tAssert(0); + ASSERT(0); } taosMemoryFree(fname); return pStore; @@ -124,7 +124,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { const char* sysErrStr = strerror(errno); tqError("vgId:%d, cannot open file %s when commit offset since %s", pStore->pTq->pVnode->config.vgId, fname, sysErrStr); - tAssert(0); + ASSERT(0); return -1; } taosMemoryFree(fname); @@ -136,9 +136,9 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { int32_t bodyLen; int32_t code; tEncodeSize(tEncodeSTqOffset, pOffset, bodyLen, code); - tAssert(code == 0); + ASSERT(code == 0); if (code < 0) { - tAssert(0); + ASSERT(0); taosHashCancelIterate(pStore->pHash, pIter); return -1; } @@ -154,7 +154,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { // write file int64_t writeLen; if ((writeLen = taosWriteFile(pFile, buf, totLen)) != totLen) { - tAssert(0); + ASSERT(0); tqError("write offset incomplete, len %d, write len %" PRId64, bodyLen, writeLen); taosHashCancelIterate(pStore->pHash, pIter); taosMemoryFree(buf); diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c index 6ef3fa0fd6..b63ff8af1d 100644 --- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c +++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c @@ -61,7 +61,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) { int64_t sz = 0; if (taosStatFile(fname, &sz, NULL) < 0) { - tAssert(0); + ASSERT(0); } taosMemoryFree(fname); @@ -73,7 +73,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) { void* abuf = POINTER_SHIFT(buf, sizeof(SSnapDataHdr)); int64_t contLen = taosReadFile(pFile, abuf, sz); if (contLen != sz) { - tAssert(0); + ASSERT(0); return -1; } buf->size = sz; @@ -122,14 +122,14 @@ int32_t tqOffsetWriterClose(STqOffsetWriter** ppWriter, int8_t rollback) { if (rollback) { if (taosRemoveFile(pWriter->fname) < 0) { - tAssert(0); + ASSERT(0); } } else { if (taosRenameFile(pWriter->fname, fname) < 0) { - tAssert(0); + ASSERT(0); } if (tqOffsetRestoreFromFile(pTq->pOffsetStore, fname) < 0) { - tAssert(0); + ASSERT(0); } } taosMemoryFree(fname); @@ -146,14 +146,14 @@ int32_t tqOffsetSnapWrite(STqOffsetWriter* pWriter, uint8_t* pData, uint32_t nDa TdFilePtr pFile = taosOpenFile(pWriter->fname, TD_FILE_CREATE | TD_FILE_WRITE); SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; int64_t size = pHdr->size; - tAssert(size == nData - sizeof(SSnapDataHdr)); + ASSERT(size == nData - sizeof(SSnapDataHdr)); if (pFile) { int64_t contLen = taosWriteFile(pFile, pHdr->data, size); if (contLen != size) { - tAssert(0); + ASSERT(0); } } else { - tAssert(0); + ASSERT(0); return -1; } return 0; diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index 21feb4b99e..f89bc20362 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -25,9 +25,9 @@ void tqTmrRspFunc(void* param, void* tmrId) { static int32_t tqLoopExecFromQueue(STQ* pTq, STqHandle* pHandle, SStreamDataSubmit** ppSubmit, SMqDataRsp* pRsp) { SStreamDataSubmit* pSubmit = *ppSubmit; while (pSubmit != NULL) { - tAssert(pSubmit->ver == pHandle->pushHandle.processedVer + 1); + ASSERT(pSubmit->ver == pHandle->pushHandle.processedVer + 1); if (tqLogScanExec(pTq, &pHandle->execHandle, pSubmit->data, pRsp, 0) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ } // update processed atomic_store_64(&pHandle->pushHandle.processedVer, pSubmit->ver); @@ -161,7 +161,7 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_ tqLogScanExec(pTq, &pHandle->execHandle, pReq, &rsp, workerId); } else { // TODO - tAssert(0); + ASSERT(0); } if (rsp.blockNum == 0) { @@ -169,8 +169,8 @@ int32_t tqPushMsgNew(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_ continue; } - tAssert(taosArrayGetSize(rsp.blockData) == rsp.blockNum); - tAssert(taosArrayGetSize(rsp.blockDataLen) == rsp.blockNum); + ASSERT(taosArrayGetSize(rsp.blockData) == rsp.blockNum); + ASSERT(taosArrayGetSize(rsp.blockDataLen) == rsp.blockNum); rsp.rspOffset = fetchOffset; @@ -263,7 +263,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) SSDataBlock* pDataBlock = NULL; uint64_t ts = 0; if (qExecTask(task, &pDataBlock, &ts) < 0) { - tAssert(0); + ASSERT(0); } if (pDataBlock == NULL) { @@ -296,7 +296,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) void* key = taosArrayGetP(cachedKeys, i); size_t kLen = *(size_t*)taosArrayGet(cachedKeyLens, i); if (taosHashRemove(pTq->pPushMgr, key, kLen) != 0) { - tAssert(0); + ASSERT(0); } } taosArrayDestroyP(cachedKeys, (FDelete)taosMemoryFree); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 97512a0e4d..c3a4cefc66 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -177,7 +177,7 @@ bool isValValidForTable(STqHandle* pHandle, SWalCont* pHead) { } realTbSuid = req.suid; } else { - tAssert(0); + ASSERT(0); } end: @@ -206,7 +206,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { - tAssert(0); + ASSERT(0); *fetchOffset = offset; code = -1; goto END; @@ -220,7 +220,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea if (IS_META_MSG(pHead->msgType)) { code = walFetchBody(pHandle->pWalReader, ppCkHead); if (code < 0) { - tAssert(0); + ASSERT(0); *fetchOffset = offset; code = -1; goto END; @@ -238,7 +238,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea } code = walSkipFetchBody(pHandle->pWalReader, *ppCkHead); if (code < 0) { - tAssert(0); + ASSERT(0); *fetchOffset = offset; code = -1; goto END; @@ -297,11 +297,11 @@ void tqCloseReader(STqReader* pReader) { int32_t tqSeekVer(STqReader* pReader, int64_t ver) { if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - tAssert(pReader->pWalReader->curInvalid); - tAssert(pReader->pWalReader->curVersion == ver); + ASSERT(pReader->pWalReader->curInvalid); + ASSERT(pReader->pWalReader->curVersion == ver); return -1; } - tAssert(pReader->pWalReader->curVersion == ver); + ASSERT(pReader->pWalReader->curVersion == ver); return 0; } @@ -317,7 +317,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { ret->offset.version = pReader->ver; ret->fetchType = FETCH_TYPE__NONE; tqDebug("return offset %" PRId64 ", no more valid", ret->offset.version); - tAssert(ret->offset.version >= 0); + ASSERT(ret->offset.version >= 0); return -1; } void* body = pReader->pWalReader->pHead->head.body; @@ -340,7 +340,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { memset(&ret->data, 0, sizeof(SSDataBlock)); int32_t code = tqRetrieveDataBlock(&ret->data, pReader); if (code != 0 || ret->data.info.rows == 0) { - tAssert(0); + ASSERT(0); continue; } ret->fetchType = FETCH_TYPE__DATA; @@ -351,7 +351,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) { if (fromProcessedMsg) { ret->offset.type = TMQ_OFFSET__LOG; ret->offset.version = pReader->ver; - tAssert(pReader->ver >= 0); + ASSERT(pReader->ver >= 0); ret->fetchType = FETCH_TYPE__SEP; tqDebug("return offset %" PRId64 ", processed finish", ret->offset.version); return 0; @@ -434,7 +434,7 @@ bool tqNextDataBlockFilterOut(STqReader* pHandle, SHashObj* filterOutUids) { } if (pHandle->pBlock == NULL) return false; - tAssert(pHandle->tbIdHash == NULL); + ASSERT(pHandle->tbIdHash == NULL); void* ret = taosHashGet(filterOutUids, &pHandle->msgIter.uid, sizeof(int64_t)); if (ret == NULL) { return true; @@ -453,7 +453,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { if (pReader->pSchema == NULL) { tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table", pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer); - /*tAssert(0);*/ + /*ASSERT(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -464,7 +464,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) { if (pReader->pSchemaWrapper == NULL) { tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->msgIter.uid, pReader->cachedSchemaVer); - /*tAssert(0);*/ + /*ASSERT(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -566,7 +566,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas if (pReader->pSchema == NULL) { tqWarn("cannot found tsschema for table: uid:%" PRId64 " (suid:%" PRId64 "), version %d, possibly dropped table", pReader->msgIter.uid, pReader->msgIter.suid, pReader->cachedSchemaVer); - /*tAssert(0);*/ + /*ASSERT(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -577,7 +577,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas if (pReader->pSchemaWrapper == NULL) { tqWarn("cannot found schema wrapper for table: suid:%" PRId64 ", version %d, possibly dropped table", pReader->msgIter.uid, pReader->cachedSchemaVer); - /*tAssert(0);*/ + /*ASSERT(0);*/ pReader->cachedSchemaSuid = 0; terrno = TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND; return -1; @@ -670,7 +670,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas break; } - tAssert(sVal.valType != TD_VTYPE_NONE); + ASSERT(sVal.valType != TD_VTYPE_NONE); if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) { goto FAIL; @@ -731,7 +731,7 @@ int tqReaderAddTbUidList(STqReader* pReader, const SArray* tbUidList) { } int tqReaderRemoveTbUidList(STqReader* pReader, const SArray* tbUidList) { - tAssert(pReader->tbIdHash != NULL); + ASSERT(pReader->tbIdHash != NULL); for (int32_t i = 0; i < taosArrayGetSize(tbUidList); i++) { int64_t* pKey = (int64_t*)taosArrayGet(tbUidList, i); @@ -749,7 +749,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { STqHandle* pExec = (STqHandle*)pIter; if (pExec->execHandle.subType == TOPIC_SUB_TYPE__COLUMN) { int32_t code = qUpdateQualifiedTableId(pExec->execHandle.task, tbUidList, isAdd); - tAssert(code == 0); + ASSERT(code == 0); } else if (pExec->execHandle.subType == TOPIC_SUB_TYPE__DB) { if (!isAdd) { int32_t sz = taosArrayGetSize(tbUidList); @@ -790,7 +790,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { // TODO handle delete table from stb } } else { - tAssert(0); + ASSERT(0); } } while (1) { @@ -799,7 +799,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) { SStreamTask* pTask = *(SStreamTask**)pIter; if (pTask->taskLevel == TASK_LEVEL__SOURCE) { int32_t code = qUpdateQualifiedTableId(pTask->exec.executor, tbUidList, isAdd); - tAssert(code == 0); + ASSERT(code == 0); } } return 0; diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index b89c8d6e3a..5907be576a 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -19,7 +19,7 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBlock* pDataBlock, SBatchDeleteReq* deleteReq) { - tAssert(pDataBlock->info.type == STREAM_DELETE_RESULT); + ASSERT(pDataBlock->info.type == STREAM_DELETE_RESULT); int32_t totRow = pDataBlock->info.rows; SColumnInfoData* pStartTsCol = taosArrayGet(pDataBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTsCol = taosArrayGet(pDataBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -335,7 +335,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code); if (code < 0) { // - tAssert(0); + ASSERT(0); } SEncoder encoder; void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead)); @@ -559,7 +559,7 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data tqDebug("vgId:%d, task %d write into table, block num: %d", TD_VID(pVnode), pTask->taskId, (int32_t)pRes->size); - tAssert(pTask->tbSink.pTSchema); + ASSERT(pTask->tbSink.pTSchema); deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq)); SSubmitReq* submitReq = tqBlockToSubmit(pVnode, pRes, pTask->tbSink.pTSchema, pTask->tbSink.pSchemaWrapper, true, pTask->tbSink.stbUid, pTask->tbSink.stbFullName, &deleteReq); @@ -572,7 +572,7 @@ void tqSinkToTableMerge(SStreamTask* pTask, void* vnode, int64_t ver, void* data tEncodeSize(tEncodeSBatchDeleteReq, &deleteReq, len, code); if (code < 0) { // - tAssert(0); + ASSERT(0); } SEncoder encoder; void* serializedDeleteReq = rpcMallocCont(len + sizeof(SMsgHead)); diff --git a/source/dnode/vnode/src/tq/tqSnapshot.c b/source/dnode/vnode/src/tq/tqSnapshot.c index 95f4ae3446..d811d943ed 100644 --- a/source/dnode/vnode/src/tq/tqSnapshot.c +++ b/source/dnode/vnode/src/tq/tqSnapshot.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - tAssert(pVal && vLen); + ASSERT(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c index 6309f7ebc5..b1f00bdf74 100644 --- a/source/dnode/vnode/src/tq/tqStreamStateSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - tAssert(pVal && vLen); + ASSERT(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { @@ -168,7 +168,7 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) { if (rollback) { tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn); - tAssert(0); + ASSERT(0); } else { code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn); if (code) goto _err; diff --git a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c index bddc11f61f..305378bc93 100644 --- a/source/dnode/vnode/src/tq/tqStreamTaskSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamTaskSnap.c @@ -100,7 +100,7 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { } } - tAssert(pVal && vLen); + ASSERT(pVal && vLen); *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); if (*ppData == NULL) { @@ -168,7 +168,7 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) { if (rollback) { tdbAbort(pWriter->pTq->pMetaStore, pWriter->txn); - tAssert(0); + ASSERT(0); } else { code = tdbCommit(pWriter->pTq->pMetaStore, pWriter->txn); if (code) goto _err; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 7cc7d8a6eb..7309ea3407 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -525,7 +525,7 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) { return code; default: - tAssert(0); + ASSERT(0); break; } @@ -723,7 +723,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) { return code; default: - tAssert(0); + ASSERT(0); break; } @@ -822,7 +822,7 @@ static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow) { return code; } default: - tAssert(0); + ASSERT(0); break; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index b435a0a266..b87e5d5503 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -22,7 +22,7 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pReader, const int32_t* slotIds, void** pRes) { - tAssert(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock)); + ASSERT(pReader->numOfCols <= taosArrayGetSize(pBlock->pDataBlock)); int32_t numOfRows = pBlock->info.rows; if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) { @@ -66,7 +66,7 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea pBlock->info.rows += allNullRow ? 0 : 1; } else { - tAssert(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); + ASSERT(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 8cc6666e4d..8ec59ea959 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -153,7 +153,7 @@ _exit: int32_t tsdbPrepareCommit(STsdb *pTsdb) { taosThreadRwlockWrlock(&pTsdb->rwLock); - tAssert(pTsdb->imem == NULL); + ASSERT(pTsdb->imem == NULL); pTsdb->imem = pTsdb->mem; pTsdb->mem = NULL; taosThreadRwlockUnlock(&pTsdb->rwLock); @@ -388,7 +388,7 @@ static int32_t tsdbCommitterNextTableData(SCommitter *pCommitter) { int32_t code = 0; int32_t lino = 0; - tAssert(pCommitter->dReader.pBlockIdx); + ASSERT(pCommitter->dReader.pBlockIdx); pCommitter->dReader.iBlockIdx++; if (pCommitter->dReader.iBlockIdx < taosArrayGetSize(pCommitter->dReader.aBlockIdx)) { @@ -398,7 +398,7 @@ static int32_t tsdbCommitterNextTableData(SCommitter *pCommitter) { code = tsdbReadDataBlk(pCommitter->dReader.pReader, pCommitter->dReader.pBlockIdx, &pCommitter->dReader.mBlock); TSDB_CHECK_CODE(code, lino, _exit); - tAssert(pCommitter->dReader.mBlock.nItem > 0); + ASSERT(pCommitter->dReader.mBlock.nItem > 0); } else { pCommitter->dReader.pBlockIdx = NULL; } @@ -442,7 +442,7 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) { pIter->r.row = *pRow; break; } - tAssert(pIter->iTbDataP < taosArrayGetSize(pCommitter->aTbDataP)); + ASSERT(pIter->iTbDataP < taosArrayGetSize(pCommitter->aTbDataP)); tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter); // disk @@ -508,7 +508,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { tsdbFidKeyRange(pCommitter->commitFid, pCommitter->minutes, pCommitter->precision, &pCommitter->minKey, &pCommitter->maxKey); #if 0 - tAssert(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey); + ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey); #endif pCommitter->nextKey = TSKEY_MAX; @@ -544,7 +544,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { SSttFile fStt = {.commitID = pCommitter->commitID}; SDFileSet wSet = {.fid = pCommitter->commitFid, .pHeadF = &fHead, .pDataF = &fData, .pSmaF = &fSma}; if (pRSet) { - tAssert(pRSet->nSttF <= pCommitter->sttTrigger); + ASSERT(pRSet->nSttF <= pCommitter->sttTrigger); fData = *pRSet->pDataF; fSma = *pRSet->pSmaF; wSet.diskId = pRSet->diskId; @@ -826,7 +826,7 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter, SCommitInfo int32_t lino = 0; memset(pCommitter, 0, sizeof(*pCommitter)); - tAssert(pTsdb->imem && "last tsdb commit incomplete"); + ASSERT(pTsdb->imem && "last tsdb commit incomplete"); pCommitter->pTsdb = pTsdb; pCommitter->commitID = pInfo->info.state.commitID; @@ -992,7 +992,7 @@ static int32_t tsdbCommitDel(SCommitter *pCommitter) { STbData *pTbData; SDelIdx *pDelIdx; - tAssert(nTbData > 0); + ASSERT(nTbData > 0); pTbData = (STbData *)taosArrayGetP(pCommitter->aTbDataP, iTbData); pDelIdx = (iDelIdx < nDelIdx) ? (SDelIdx *)taosArrayGet(pCommitter->aDelIdx, iDelIdx) : NULL; @@ -1142,7 +1142,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) { } } } else { - tAssert(0); + ASSERT(0); } // compare with min in RB Tree @@ -1153,7 +1153,7 @@ static int32_t tsdbNextCommitRow(SCommitter *pCommitter) { tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pCommitter->pIter); pCommitter->pIter = NULL; } else { - tAssert(c); + ASSERT(c); } } } @@ -1183,7 +1183,7 @@ static int32_t tsdbCommitAheadBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) tBlockDataClear(pBlockData); while (pRowInfo) { - tAssert(pRowInfo->row.type == 0); + ASSERT(pRowInfo->row.type == 0); code = tsdbCommitterUpdateRowSchema(pCommitter, id.suid, id.uid, TSDBROW_SVERSION(&pRowInfo->row)); TSDB_CHECK_CODE(code, lino, _exit); @@ -1251,7 +1251,7 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) pRow = NULL; } } else if (c > 0) { - tAssert(pRowInfo->row.type == 0); + ASSERT(pRowInfo->row.type == 0); code = tsdbCommitterUpdateRowSchema(pCommitter, id.suid, id.uid, TSDBROW_SVERSION(&pRowInfo->row)); TSDB_CHECK_CODE(code, lino, _exit); @@ -1271,7 +1271,7 @@ static int32_t tsdbCommitMergeBlock(SCommitter *pCommitter, SDataBlk *pDataBlk) } } } else { - tAssert(0 && "dup rows not allowed"); + ASSERT(0 && "dup rows not allowed"); } if (pBDataW->nRow >= pCommitter->maxRow) { @@ -1314,14 +1314,14 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, TABLEID id) { SBlockIdx *pBlockIdx = pCommitter->dReader.pBlockIdx; - tAssert(pBlockIdx == NULL || tTABLEIDCmprFn(pBlockIdx, &id) >= 0); + ASSERT(pBlockIdx == NULL || tTABLEIDCmprFn(pBlockIdx, &id) >= 0); if (pBlockIdx && pBlockIdx->suid == id.suid && pBlockIdx->uid == id.uid) { int32_t iBlock = 0; SDataBlk block; SDataBlk *pDataBlk = █ SRowInfo *pRowInfo = tsdbGetCommitRow(pCommitter); - tAssert(pRowInfo->suid == id.suid && pRowInfo->uid == id.uid); + ASSERT(pRowInfo->suid == id.suid && pRowInfo->uid == id.uid); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pDataBlk, tGetDataBlk); while (pDataBlk && pRowInfo) { @@ -1399,8 +1399,8 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id) } if (!pBuilder->suid && !pBuilder->uid) { - tAssert(pCommitter->skmTable.suid == id.suid); - tAssert(pCommitter->skmTable.uid == id.uid); + ASSERT(pCommitter->skmTable.suid == id.suid); + ASSERT(pCommitter->skmTable.uid == id.uid); code = tDiskDataBuilderInit(pBuilder, pCommitter->skmTable.pTSchema, &id, pCommitter->cmprAlg, 0); TSDB_CHECK_CODE(code, lino, _exit); } @@ -1416,8 +1416,8 @@ static int32_t tsdbInitSttBlockBuilderIfNeed(SCommitter *pCommitter, TABLEID id) } if (!pBData->suid && !pBData->uid) { - tAssert(pCommitter->skmTable.suid == id.suid); - tAssert(pCommitter->skmTable.uid == id.uid); + ASSERT(pCommitter->skmTable.suid == id.suid); + ASSERT(pCommitter->skmTable.uid == id.uid); TABLEID tid = {.suid = id.suid, .uid = id.suid ? 0 : id.uid}; code = tBlockDataInit(pBData, &tid, pCommitter->skmTable.pTSchema, NULL, 0); TSDB_CHECK_CODE(code, lino, _exit); @@ -1532,7 +1532,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, TABLEID id) { } } else { SBlockData *pBData = &pCommitter->dWriter.bData; - tAssert(pBData->nRow == 0); + ASSERT(pBData->nRow == 0); while (pRowInfo) { STSchema *pTSchema = NULL; @@ -1587,7 +1587,7 @@ static int32_t tsdbCommitFileDataImpl(SCommitter *pCommitter) { SRowInfo *pRowInfo; TABLEID id = {0}; while ((pRowInfo = tsdbGetCommitRow(pCommitter)) != NULL) { - tAssert(pRowInfo->suid != id.suid || pRowInfo->uid != id.uid); + ASSERT(pRowInfo->suid != id.suid || pRowInfo->uid != id.uid); id.suid = pRowInfo->suid; id.uid = pRowInfo->uid; diff --git a/source/dnode/vnode/src/tsdb/tsdbDiskData.c b/source/dnode/vnode/src/tsdb/tsdbDiskData.c index 091d14ccea..b46a003638 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDiskData.c +++ b/source/dnode/vnode/src/tsdb/tsdbDiskData.c @@ -92,7 +92,7 @@ static int32_t tDiskColBuilderInit(SDiskColBuilder *pBuilder, int16_t cid, int8_ static int32_t tGnrtDiskCol(SDiskColBuilder *pBuilder, SDiskCol *pDiskCol) { int32_t code = 0; - tAssert(pBuilder->flag && pBuilder->flag != HAS_NONE); + ASSERT(pBuilder->flag && pBuilder->flag != HAS_NONE); *pDiskCol = (SDiskCol){(SBlockCol){.cid = pBuilder->cid, .type = pBuilder->type, @@ -489,7 +489,7 @@ int32_t tDiskDataBuilderInit(SDiskDataBuilder *pBuilder, STSchema *pTSchema, TAB uint8_t calcSma) { int32_t code = 0; - tAssert(pId->suid || pId->uid); + ASSERT(pId->suid || pId->uid); pBuilder->suid = pId->suid; pBuilder->uid = pId->uid; @@ -560,8 +560,8 @@ int32_t tDiskDataBuilderClear(SDiskDataBuilder *pBuilder) { int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTSchema, TABLEID *pId) { int32_t code = 0; - tAssert(pBuilder->suid || pBuilder->uid); - tAssert(pId->suid == pBuilder->suid); + ASSERT(pBuilder->suid || pBuilder->uid); + ASSERT(pId->suid == pBuilder->suid); TSDBKEY kRow = TSDBROW_KEY(pRow); if (tsdbKeyCmprFn(&pBuilder->bi.minTKey, &kRow) > 0) pBuilder->bi.minTKey = kRow; @@ -569,7 +569,7 @@ int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTS // uid if (pBuilder->uid && pBuilder->uid != pId->uid) { - tAssert(pBuilder->suid); + ASSERT(pBuilder->suid); for (int32_t iRow = 0; iRow < pBuilder->nRow; iRow++) { code = tCompress(pBuilder->pUidC, &pBuilder->uid, sizeof(int64_t)); if (code) return code; @@ -623,7 +623,7 @@ int32_t tDiskDataAddRow(SDiskDataBuilder *pBuilder, TSDBROW *pRow, STSchema *pTS int32_t tGnrtDiskData(SDiskDataBuilder *pBuilder, const SDiskData **ppDiskData, const SBlkInfo **ppBlkInfo) { int32_t code = 0; - tAssert(pBuilder->nRow); + ASSERT(pBuilder->nRow); *ppDiskData = NULL; *ppBlkInfo = NULL; diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 6379c6b648..72d9c4f69e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -82,7 +82,7 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) { } } - tAssert(n + sizeof(TSCKSUM) == nData); + ASSERT(n + sizeof(TSCKSUM) == nData); _exit: return code; @@ -512,7 +512,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe // stt if (sameDisk) { if (pSetNew->nSttF > pSetOld->nSttF) { - tAssert(pSetNew->nSttF == pSetOld->nSttF + 1); + ASSERT(pSetNew->nSttF == pSetOld->nSttF + 1); pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile)); if (pSetOld->aSttF[pSetOld->nSttF] == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -522,7 +522,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe pSetOld->aSttF[pSetOld->nSttF]->nRef = 1; pSetOld->nSttF++; } else if (pSetNew->nSttF < pSetOld->nSttF) { - tAssert(pSetNew->nSttF == 1); + ASSERT(pSetNew->nSttF == 1); for (int32_t iStt = 0; iStt < pSetOld->nSttF; iStt++) { SSttFile *pSttFile = pSetOld->aSttF[iStt]; nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1); @@ -561,8 +561,8 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe *pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt]; pSetOld->aSttF[iStt]->nRef = 1; } else { - tAssert(pSetOld->aSttF[iStt]->size == pSetOld->aSttF[iStt]->size); - tAssert(pSetOld->aSttF[iStt]->offset == pSetOld->aSttF[iStt]->offset); + ASSERT(pSetOld->aSttF[iStt]->size == pSetOld->aSttF[iStt]->size); + ASSERT(pSetOld->aSttF[iStt]->offset == pSetOld->aSttF[iStt]->offset); } } } @@ -634,7 +634,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) { } } } else { - tAssert(pTsdb->fs.pDelFile == NULL); + ASSERT(pTsdb->fs.pDelFile == NULL); } // aDFileSet @@ -783,7 +783,7 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) { code = tsdbSaveFSToFile(&pTsdb->fs, current); TSDB_CHECK_CODE(code, lino, _exit); - tAssert(!rollback); + ASSERT(!rollback); } // scan and fix FS @@ -801,7 +801,7 @@ int32_t tsdbFSClose(STsdb *pTsdb) { int32_t code = 0; if (pTsdb->fs.pDelFile) { - tAssert(pTsdb->fs.pDelFile->nRef == 1); + ASSERT(pTsdb->fs.pDelFile->nRef == 1); taosMemoryFree(pTsdb->fs.pDelFile); } @@ -809,20 +809,20 @@ int32_t tsdbFSClose(STsdb *pTsdb) { SDFileSet *pSet = (SDFileSet *)taosArrayGet(pTsdb->fs.aDFileSet, iSet); // head - tAssert(pSet->pHeadF->nRef == 1); + ASSERT(pSet->pHeadF->nRef == 1); taosMemoryFree(pSet->pHeadF); // data - tAssert(pSet->pDataF->nRef == 1); + ASSERT(pSet->pDataF->nRef == 1); taosMemoryFree(pSet->pDataF); // sma - tAssert(pSet->pSmaF->nRef == 1); + ASSERT(pSet->pSmaF->nRef == 1); taosMemoryFree(pSet->pSmaF); // stt for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { - tAssert(pSet->aSttF[iStt]->nRef == 1); + ASSERT(pSet->aSttF[iStt]->nRef == 1); taosMemoryFree(pSet->aSttF[iStt]); } } @@ -939,7 +939,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { *pDFileSet->pSmaF = *pSet->pSmaF; // stt if (pSet->nSttF > pDFileSet->nSttF) { - tAssert(pSet->nSttF == pDFileSet->nSttF + 1); + ASSERT(pSet->nSttF == pDFileSet->nSttF + 1); pDFileSet->aSttF[pDFileSet->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile)); if (pDFileSet->aSttF[pDFileSet->nSttF] == NULL) { @@ -949,7 +949,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { *pDFileSet->aSttF[pDFileSet->nSttF] = *pSet->aSttF[pSet->nSttF - 1]; pDFileSet->nSttF++; } else if (pSet->nSttF < pDFileSet->nSttF) { - tAssert(pSet->nSttF == 1); + ASSERT(pSet->nSttF == 1); for (int32_t iStt = 1; iStt < pDFileSet->nSttF; iStt++) { taosMemoryFree(pDFileSet->aSttF[iStt]); } @@ -966,7 +966,7 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { } } - tAssert(pSet->nSttF == 1); + ASSERT(pSet->nSttF == 1); SDFileSet fSet = {.diskId = pSet->diskId, .fid = pSet->fid, .nSttF = 1}; // head @@ -1041,7 +1041,7 @@ int32_t tsdbFSRef(STsdb *pTsdb, STsdbFS *pFS) { pFS->pDelFile = pTsdb->fs.pDelFile; if (pFS->pDelFile) { nRef = atomic_fetch_add_32(&pFS->pDelFile->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); } SDFileSet fSet; @@ -1050,17 +1050,17 @@ int32_t tsdbFSRef(STsdb *pTsdb, STsdbFS *pFS) { fSet = *pSet; nRef = atomic_fetch_add_32(&pSet->pHeadF->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); nRef = atomic_fetch_add_32(&pSet->pDataF->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); nRef = atomic_fetch_add_32(&pSet->pSmaF->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { nRef = atomic_fetch_add_32(&pSet->aSttF[iStt]->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); } if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) { @@ -1079,7 +1079,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { if (pFS->pDelFile) { nRef = atomic_sub_fetch_32(&pFS->pDelFile->nRef, 1); - tAssert(nRef >= 0); + ASSERT(nRef >= 0); if (nRef == 0) { tsdbDelFileName(pTsdb, pFS->pDelFile, fname); (void)taosRemoveFile(fname); @@ -1092,7 +1092,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // head nRef = atomic_sub_fetch_32(&pSet->pHeadF->nRef, 1); - tAssert(nRef >= 0); + ASSERT(nRef >= 0); if (nRef == 0) { tsdbHeadFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pHeadF, fname); (void)taosRemoveFile(fname); @@ -1101,7 +1101,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // data nRef = atomic_sub_fetch_32(&pSet->pDataF->nRef, 1); - tAssert(nRef >= 0); + ASSERT(nRef >= 0); if (nRef == 0) { tsdbDataFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pDataF, fname); (void)taosRemoveFile(fname); @@ -1110,7 +1110,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // sma nRef = atomic_sub_fetch_32(&pSet->pSmaF->nRef, 1); - tAssert(nRef >= 0); + ASSERT(nRef >= 0); if (nRef == 0) { tsdbSmaFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pSmaF, fname); (void)taosRemoveFile(fname); @@ -1120,7 +1120,7 @@ void tsdbFSUnref(STsdb *pTsdb, STsdbFS *pFS) { // stt for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { nRef = atomic_sub_fetch_32(&pSet->aSttF[iStt]->nRef, 1); - tAssert(nRef >= 0); + ASSERT(nRef >= 0); if (nRef == 0) { tsdbSttFileName(pTsdb, pSet->diskId, pSet->fid, pSet->aSttF[iStt], fname); (void)taosRemoveFile(fname); diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c index e177a0b513..3c944584de 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/tsdbFile.c @@ -135,7 +135,7 @@ int32_t tsdbDFileRollback(STsdb *pTsdb, SDFileSet *pSet, EDataFileT ftype) { tPutSmaFile(hdr, pSet->pSmaF); break; default: - tAssert(0); + ASSERT(0); } taosCalcChecksumAppend(0, hdr, TSDB_FHDR_SIZE); diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 371ec2fecd..0a7f59e429 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -168,7 +168,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid goto _err; } - tAssert(pPool != NULL); + ASSERT(pPool != NULL); // do delete SDelData *pDelData = (SDelData *)vnodeBufPoolMalloc(pPool, sizeof(*pDelData)); if (pDelData == NULL) { @@ -180,7 +180,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid pDelData->eKey = eKey; pDelData->pNext = NULL; if (pTbData->pHead == NULL) { - tAssert(pTbData->pTail == NULL); + ASSERT(pTbData->pTail == NULL); pTbData->pHead = pTbData->pTail = pDelData; } else { pTbData->pTail->pNext = pDelData; @@ -265,7 +265,7 @@ void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, STbDa bool tsdbTbDataIterNext(STbDataIter *pIter) { pIter->pRow = NULL; if (pIter->backward) { - tAssert(pIter->pNode != pIter->pTbData->sl.pTail); + ASSERT(pIter->pNode != pIter->pTbData->sl.pTail); if (pIter->pNode == pIter->pTbData->sl.pHead) { return false; @@ -276,7 +276,7 @@ bool tsdbTbDataIterNext(STbDataIter *pIter) { return false; } } else { - tAssert(pIter->pNode != pIter->pTbData->sl.pHead); + ASSERT(pIter->pNode != pIter->pTbData->sl.pHead); if (pIter->pNode == pIter->pTbData->sl.pTail) { return false; @@ -334,7 +334,7 @@ static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid SVBufPool *pPool = pMemTable->pTsdb->pVnode->inUse; int8_t maxLevel = pMemTable->pTsdb->pVnode->config.tsdbCfg.slLevel; - tAssert(pPool != NULL); + ASSERT(pPool != NULL); pTbData = vnodeBufPoolMalloc(pPool, sizeof(*pTbData) + SL_NODE_SIZE(maxLevel) * 2); if (pTbData == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -477,7 +477,7 @@ static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListN // node level = tsdbMemSkipListRandLevel(&pTbData->sl); - tAssert(pPool != NULL); + ASSERT(pPool != NULL); pNode = (SMemSkipListNode *)vnodeBufPoolMalloc(pPool, SL_NODE_SIZE(level)); if (pNode == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -620,7 +620,7 @@ int32_t tsdbGetNRowsInTbData(STbData *pTbData) { return pTbData->sl.size; } void tsdbRefMemTable(SMemTable *pMemTable) { int32_t nRef = atomic_fetch_add_32(&pMemTable->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); } void tsdbUnrefMemTable(SMemTable *pMemTable) { diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 80500f7c68..01fbcf657f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -561,7 +561,7 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead pMTree->pLoadInfo = pBlockLoadInfo; pMTree->destroyLoadInfo = destroyLoadInfo; - tAssert(pMTree->pLoadInfo != NULL); + ASSERT(pMTree->pLoadInfo != NULL); for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file struct SLDataIter *pIter = NULL; @@ -607,7 +607,7 @@ bool tMergeTreeNext(SMergeTree *pMTree) { tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter); pMTree->pIter = NULL; } else { - tAssert(c); + ASSERT(c); } } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 42e39c7fa2..a4581f5472 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -260,7 +260,7 @@ static void updateBlockSMAInfo(STSchema* pSchema, SBlockLoadSuppInfo* pSupInfo) // do nothing i += 1; } else { - tAssert(0); + ASSERT(0); } } } @@ -396,7 +396,7 @@ static void destroyAllBlockScanInfo(SHashObj* pTableMap) { } static bool isEmptyQueryTimeWindow(STimeWindow* pWindow) { - tAssert(pWindow != NULL); + ASSERT(pWindow != NULL); return pWindow->skey > pWindow->ekey; } @@ -595,7 +595,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->type = pCond->type; pReader->window = updateQueryTimeWindow(pReader->pTsdb, &pCond->twindows); pReader->blockInfoBuf.numPerBucket = 1000; // 1000 tables per bucket - tAssert(pCond->numOfCols > 0); + ASSERT(pCond->numOfCols > 0); if (pReader->pResBlock == NULL) { pReader->freeBlock = true; @@ -782,7 +782,7 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ colDataAppendNULL(pColInfoData, rowIndex); } else { varDataSetLen(pSup->buildBuf[colIndex], pColVal->value.nData); - tAssert(pColVal->value.nData <= pColInfoData->info.bytes); + ASSERT(pColVal->value.nData <= pColInfoData->info.bytes); if (pColVal->value.nData > 0) { // pData may be null, if nData is 0 memcpy(varDataVal(pSup->buildBuf[colIndex]), pColVal->value.pData, pColVal->value.nData); } @@ -796,7 +796,7 @@ static void doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_ static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { if (taosArrayGetSize(pBlockIter->blockList) == 0) { - tAssert(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); + ASSERT(pBlockIter->numOfBlocks == taosArrayGetSize(pBlockIter->blockList)); return NULL; } @@ -810,7 +810,7 @@ int32_t binarySearchForTs(char* pValue, int num, TSKEY key, int order) { int32_t midPos = -1; int32_t numOfRows; - tAssert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); + ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); TSKEY* keyList = (TSKEY*)pValue; int32_t firstPos = 0; @@ -974,7 +974,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo int32_t step = asc? 1:-1; // make sure it is aligned to 8bit - tAssert((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); + ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); // 1. copy data in a batch model memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); @@ -1183,7 +1183,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - tAssert(pBlockInfo != NULL); + ASSERT(pBlockInfo != NULL); SDataBlk* pBlock = getCurrentBlock(pBlockIter); code = tsdbReadDataBlock(pReader->pFileReader, pBlock, pBlockData); @@ -1221,7 +1221,7 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) { } static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) { - tAssert(numOfTables >= 1); + ASSERT(numOfTables >= 1); pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables); @@ -1329,7 +1329,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte sup.numOfTables += 1; } - tAssert(numOfBlocks == cnt); + ASSERT(numOfBlocks == cnt); // since there is only one table qualified, blocks are not sorted if (sup.numOfTables == 1) { @@ -1351,7 +1351,7 @@ static int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIte tsdbDebug("%p create data blocks info struct completed, %d blocks in %d tables %s", pReader, cnt, sup.numOfTables, pReader->idStr); - tAssert(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); + ASSERT(cnt <= numOfBlocks && sup.numOfTables <= numOfTables); SMultiwayMergeTreeInfo* pTree = NULL; uint8_t ret = tMergeTreeCreate(&pTree, sup.numOfTables, &sup, fileDataBlockOrderCompar); @@ -1432,7 +1432,7 @@ static bool getNeighborBlockOfSameTable(SFileDataBlockInfo* pBlockInfo, STableBl } static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlockInfo* pFBlockInfo) { - tAssert(pBlockIter != NULL && pFBlockInfo != NULL); + ASSERT(pBlockIter != NULL && pFBlockInfo != NULL); int32_t step = ASCENDING_TRAVERSE(pBlockIter->order) ? 1 : -1; int32_t index = pBlockIter->index; @@ -1446,7 +1446,7 @@ static int32_t findFileBlockInfoIndex(SDataBlockIter* pBlockIter, SFileDataBlock index += step; } - tAssert(0); + ASSERT(0); return -1; } @@ -1463,7 +1463,7 @@ static int32_t setFileBlockActiveInBlockIter(SDataBlockIter* pBlockIter, int32_t taosArrayInsert(pBlockIter->blockList, pBlockIter->index, &fblock); SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index); - tAssert(pBlockInfo->uid == fblock.uid && pBlockInfo->tbBlockIdx == fblock.tbBlockIdx); + ASSERT(pBlockInfo->uid == fblock.uid && pBlockInfo->tbBlockIdx == fblock.tbBlockIdx); } doSetCurrentBlock(pBlockIter, ""); @@ -1510,7 +1510,7 @@ static bool doCheckforDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, cons return true; } } else { // it must be the last point - tAssert(p->version == 0); + ASSERT(p->version == 0); } } } else { // (p->ts > pBlock->maxKey.ts) { @@ -1925,7 +1925,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader, } doMergeRowsInLastBlock(pLastBlockReader, pBlockScanInfo, tsLastBlock, &merge, &pReader->verRange); - tAssert(mergeBlockData); + ASSERT(mergeBlockData); // merge with block data if ts == key if (tsLastBlock == pBlockData->aTSKEY[pDumpInfo->rowIndex]) { @@ -1959,7 +1959,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader // row in last file block TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); int64_t ts = getCurrentKeyInLastBlock(pLastBlockReader); - tAssert(ts >= key); + ASSERT(ts >= key); if (ASCENDING_TRAVERSE(pReader->order)) { if (key < ts) { // imem, mem are all empty, file blocks (data blocks and last block) exist @@ -1991,7 +1991,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader tRowMergerClear(&merge); return code; } else { - tAssert(0); + ASSERT(0); return TSDB_CODE_SUCCESS; } } else { // desc order @@ -2012,7 +2012,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* TSDBROW* pRow = getValidMemRow(&pBlockScanInfo->iter, pDelList, pReader); TSDBROW* piRow = getValidMemRow(&pBlockScanInfo->iiter, pDelList, pReader); - tAssert(pRow != NULL && piRow != NULL); + ASSERT(pRow != NULL && piRow != NULL); int64_t tsLast = INT64_MIN; if (hasDataInLastBlock(pLastBlockReader)) { @@ -2236,7 +2236,7 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea if (pReader->pReadSnap->pMem != NULL) { d = tsdbGetTbDataFromMemTable(pReader->pReadSnap->pMem, pReader->suid, pBlockScanInfo->uid); if (d != NULL) { - tAssert(pBlockScanInfo->iter.iter == NULL); + ASSERT(pBlockScanInfo->iter.iter == NULL); code = tsdbTbDataIterCreate(d, &startKey, backward, &pBlockScanInfo->iter.iter); if (code == TSDB_CODE_SUCCESS) { pBlockScanInfo->iter.hasVal = (tsdbTbDataIterGet(pBlockScanInfo->iter.iter) != NULL); @@ -2351,7 +2351,7 @@ static bool hasDataInLastBlock(SLastBlockReader* pLastBlockReader) { return pLas bool hasDataInFileBlock(const SBlockData* pBlockData, const SFileBlockDumpInfo* pDumpInfo) { if (pBlockData->nRow > 0) { - tAssert(pBlockData->nRow == pDumpInfo->totalRows); + ASSERT(pBlockData->nRow == pDumpInfo->totalRows); } return pBlockData->nRow > 0 && (!pDumpInfo->allDumped); @@ -2566,7 +2566,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* int32_t code = 0; SArray* pDelData = taosArrayInit(4, sizeof(SDelData)); - tAssert(pReader->pReadSnap != NULL); + ASSERT(pReader->pReadSnap != NULL); SDelFile* pDelFile = pReader->pReadSnap->fs.pDelFile; if (pDelFile && taosArrayGetSize(pReader->pDelIdx) > 0) { @@ -2773,7 +2773,7 @@ static bool moveToNextTable(SUidOrderCheckInfo* pOrderedCheckInfo, SReaderStatus uint64_t uid = pOrderedCheckInfo->tableUidList[pOrderedCheckInfo->currentIndex]; pStatus->pTableIter = taosHashGet(pStatus->pTableMap, &uid, sizeof(uid)); - tAssert(pStatus->pTableIter != NULL); + ASSERT(pStatus->pTableIter != NULL); return true; } @@ -2847,7 +2847,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); if (pBlockInfo == NULL) { // build data block from last data file - tAssert(pBlockIter->numOfBlocks == 0); + ASSERT(pBlockIter->numOfBlocks == 0); code = buildComposedDataBlock(pReader); } else if (fileBlockShouldLoad(pReader, pBlockInfo, pBlock, pScanInfo, keyInBuf, pLastBlockReader)) { code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pScanInfo->uid); @@ -2866,7 +2866,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { if (hasDataInLastBlock(pLastBlockReader) && !ASCENDING_TRAVERSE(pReader->order)) { // only return the rows in last block int64_t tsLast = getCurrentKeyInLastBlock(pLastBlockReader); - tAssert(tsLast >= pBlock->maxKey.ts); + ASSERT(tsLast >= pBlock->maxKey.ts); tBlockDataReset(&pReader->status.fileBlockData); tsdbDebug("load data in last block firstly, due to desc scan data, %s", pReader->idStr); @@ -3112,7 +3112,7 @@ SVersionRange getQueryVerRange(SVnode* pVnode, SQueryTableDataCond* pCond, int8_ } bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32_t order, SVersionRange* pVerRange) { - tAssert(pKey != NULL); + ASSERT(pKey != NULL); if (pDelList == NULL) { return false; } @@ -3123,7 +3123,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 if (asc) { if (*index >= num - 1) { TSDBKEY* last = taosArrayGetLast(pDelList); - tAssert(pKey->ts >= last->ts); + ASSERT(pKey->ts >= last->ts); if (pKey->ts > last->ts) { return false; @@ -3174,7 +3174,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 } else if (pKey->ts == pFirst->ts) { return pFirst->version >= pKey->version; } else { - tAssert(0); + ASSERT(0); } } else { TSDBKEY* pCurrent = taosArrayGet(pDelList, *index); @@ -3700,13 +3700,13 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e } } while (1); - tAssert(pBlock->info.rows <= capacity); + ASSERT(pBlock->info.rows <= capacity); return TSDB_CODE_SUCCESS; } // TODO refactor: with createDataBlockScanInfo int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t num) { - tAssert(pReader != NULL); + ASSERT(pReader != NULL); int32_t size = taosHashGetSize(pReader->status.pTableMap); STableBlockScanInfo** p = NULL; @@ -3715,7 +3715,7 @@ int32_t tsdbSetTableList(STsdbReader* pReader, const void* pTableList, int32_t n } // todo handle the case where size is less than the value of num - tAssert(size >= num); + ASSERT(size >= num); taosHashClear(pReader->status.pTableMap); @@ -4067,7 +4067,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) { } static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) { - tAssert(pReader != NULL); + ASSERT(pReader != NULL); *rows = pReader->pResBlock->info.rows; *uid = pReader->pResBlock->info.id.uid; *pWindow = pReader->pResBlock->info.window; @@ -4130,7 +4130,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockS SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pReader->status.blockIter); SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - tAssert(pReader->pResBlock->info.id.uid == pFBlock->uid); + ASSERT(pReader->pResBlock->info.id.uid == pFBlock->uid); SDataBlk* pBlock = getCurrentBlock(&pReader->status.blockIter); if (tDataBlkHasSma(pBlock)) { @@ -4180,7 +4180,7 @@ int32_t tsdbRetrieveDatablockSMA(STsdbReader* pReader, SColumnDataAgg ***pBlockS } else if (pAgg->colId < pSup->colId[j]) { i += 1; } else if (pSup->colId[j] < pAgg->colId) { - tAssert(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); + ASSERT(pSup->colId[j] == PRIMARYKEY_TIMESTAMP_COL_ID); pResBlock->pBlockAgg[pSup->slotId[j]] = &pSup->tsColAgg; j += 1; } @@ -4412,7 +4412,7 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6 } sversion = mr.me.stbEntry.schemaRow.version; } else { - tAssert(mr.me.type == TSDB_NORMAL_TABLE); + ASSERT(mr.me.type == TSDB_NORMAL_TABLE); sversion = mr.me.ntbEntry.schemaRow.version; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 3390f6abae..c7bce6182a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -54,7 +54,7 @@ static int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsd taosMemoryFree(pFD); goto _exit; } - tAssert(pFD->szFile % szPage == 0); + ASSERT(pFD->szFile % szPage == 0); pFD->szFile = pFD->szFile / szPage; *ppFD = pFD; @@ -103,7 +103,7 @@ _exit: static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { int32_t code = 0; - tAssert(pgno <= pFD->szFile); + ASSERT(pgno <= pFD->szFile); // seek int64_t offset = PAGE_OFFSET(pgno, pFD->szPage); @@ -175,8 +175,8 @@ static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage); int64_t bOffset = fOffset % pFD->szPage; - tAssert(pgno && pgno <= pFD->szFile); - tAssert(bOffset < szPgCont); + ASSERT(pgno && pgno <= pFD->szFile); + ASSERT(bOffset < szPgCont); while (n < size) { if (pFD->pgno != pgno) { @@ -284,7 +284,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS } // stt - tAssert(pWriter->fStt[pSet->nSttF - 1].size == 0); + ASSERT(pWriter->fStt[pSet->nSttF - 1].size == 0); flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC; tsdbSttFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fStt[pSet->nSttF - 1], fname); code = tsdbOpenFile(fname, szPage, flag, &pWriter->pSttFD); @@ -404,7 +404,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SArray *aBlockIdx) { for (int32_t iBlockIdx = 0; iBlockIdx < taosArrayGetSize(aBlockIdx); iBlockIdx++) { n += tPutBlockIdx(pWriter->aBuf[0] + n, taosArrayGet(aBlockIdx, iBlockIdx)); } - tAssert(n == size); + ASSERT(n == size); // write code = tsdbWriteFile(pWriter->pHeadFD, pHeadFile->size, pWriter->aBuf[0], size); @@ -431,7 +431,7 @@ int32_t tsdbWriteDataBlk(SDataFWriter *pWriter, SMapData *mDataBlk, SBlockIdx *p int64_t size; int64_t n; - tAssert(mDataBlk->nItem > 0); + ASSERT(mDataBlk->nItem > 0); // alloc size = tPutMapData(NULL, mDataBlk); @@ -547,7 +547,7 @@ int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, SBlock int8_t cmprAlg, int8_t toLast) { int32_t code = 0; - tAssert(pBlockData->nRow > 0); + ASSERT(pBlockData->nRow > 0); if (toLast) { pBlkInfo->offset = pWriter->fStt[pWriter->wSet.nSttF - 1].size; @@ -666,7 +666,7 @@ int32_t tsdbWriteDiskData(SDataFWriter *pWriter, const SDiskData *pDiskData, SBl SDiskCol *pDiskCol = (SDiskCol *)taosArrayGet(pDiskData->aDiskCol, iDiskCol); n += tPutBlockCol(pWriter->aBuf[0] + n, pDiskCol); } - tAssert(n == pDiskData->hdr.szBlkCol); + ASSERT(n == pDiskData->hdr.szBlkCol); code = tsdbWriteFile(pFD, pBlkInfo->offset + pBlkInfo->szBlock, pWriter->aBuf[0], pDiskData->hdr.szBlkCol); TSDB_CHECK_CODE(code, lino, _exit); @@ -953,7 +953,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) { goto _err; } } - tAssert(n == size); + ASSERT(n == size); return code; @@ -990,7 +990,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) { goto _err; } } - tAssert(n == size); + ASSERT(n == size); return code; @@ -1018,7 +1018,7 @@ int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *m code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - tAssert(n == size); + ASSERT(n == size); return code; @@ -1031,7 +1031,7 @@ int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pDataBlk, SArray *aCol int32_t code = 0; SSmaInfo *pSmaInfo = &pDataBlk->smaInfo; - tAssert(pSmaInfo->size > 0); + ASSERT(pSmaInfo->size > 0); taosArrayClear(aColumnDataAgg); @@ -1054,7 +1054,7 @@ int32_t tsdbReadBlockSma(SDataFReader *pReader, SDataBlk *pDataBlk, SArray *aCol goto _err; } } - tAssert(n == pSmaInfo->size); + ASSERT(n == pSmaInfo->size); return code; _err: @@ -1080,20 +1080,20 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo SDiskDataHdr hdr; uint8_t *p = pReader->aBuf[0] + tGetDiskDataHdr(pReader->aBuf[0], &hdr); - tAssert(hdr.delimiter == TSDB_FILE_DLMT); - tAssert(pBlockData->suid == hdr.suid); + ASSERT(hdr.delimiter == TSDB_FILE_DLMT); + ASSERT(pBlockData->suid == hdr.suid); pBlockData->uid = hdr.uid; pBlockData->nRow = hdr.nRow; // uid if (hdr.uid == 0) { - tAssert(hdr.szUid); + ASSERT(hdr.szUid); code = tsdbDecmprData(p, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid, sizeof(int64_t) * hdr.nRow, &pReader->aBuf[1]); if (code) goto _err; } else { - tAssert(!hdr.szUid); + ASSERT(!hdr.szUid); } p += hdr.szUid; @@ -1109,7 +1109,7 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (code) goto _err; p += hdr.szKey; - tAssert(p - pReader->aBuf[0] == pBlkInfo->szKey); + ASSERT(p - pReader->aBuf[0] == pBlkInfo->szKey); // read and decode columns if (pBlockData->nColData == 0) goto _exit; @@ -1135,7 +1135,7 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (n < hdr.szBlkCol) { n += tGetBlockCol(pReader->aBuf[0] + n, pBlockCol); } else { - tAssert(n == hdr.szBlkCol); + ASSERT(n == hdr.szBlkCol); pBlockCol = NULL; } } @@ -1147,8 +1147,8 @@ static int32_t tsdbReadBlockDataImpl(SDataFReader *pReader, SBlockInfo *pBlkInfo if (code) goto _err; } } else { - tAssert(pBlockCol->type == pColData->type); - tAssert(pBlockCol->flag && pBlockCol->flag != HAS_NONE); + ASSERT(pBlockCol->type == pColData->type); + ASSERT(pBlockCol->flag && pBlockCol->flag != HAS_NONE); if (pBlockCol->flag == HAS_NULL) { // add a lot of NULL @@ -1210,7 +1210,7 @@ int32_t tsdbReadDataBlock(SDataFReader *pReader, SDataBlk *pDataBlk, SBlockData code = tsdbReadBlockDataImpl(pReader, &pDataBlk->aSubBlock[0], pBlockData, -1); if (code) goto _err; - tAssert(pDataBlk->nSubBlock == 1); + ASSERT(pDataBlk->nSubBlock == 1); return code; @@ -1349,7 +1349,7 @@ int32_t tsdbWriteDelData(SDelFWriter *pWriter, SArray *aDelData, SDelIdx *pDelId for (int32_t iDelData = 0; iDelData < taosArrayGetSize(aDelData); iDelData++) { n += tPutDelData(pWriter->aBuf[0] + n, taosArrayGet(aDelData, iDelData)); } - tAssert(n == size); + ASSERT(n == size); // write code = tsdbWriteFile(pWriter->pWriteH, pWriter->fDel.size, pWriter->aBuf[0], size); @@ -1388,7 +1388,7 @@ int32_t tsdbWriteDelIdx(SDelFWriter *pWriter, SArray *aDelIdx) { for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) { n += tPutDelIdx(pWriter->aBuf[0] + n, taosArrayGet(aDelIdx, iDelIdx)); } - tAssert(n == size); + ASSERT(n == size); // write code = tsdbWriteFile(pWriter->pWriteH, pWriter->fDel.size, pWriter->aBuf[0], size); @@ -1509,7 +1509,7 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData goto _err; } } - tAssert(n == size); + ASSERT(n == size); return code; @@ -1547,7 +1547,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) { } } - tAssert(n == size); + ASSERT(n == size); return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 2235cef836..c6e1ed99f1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -106,7 +106,7 @@ _exit: _err: tsdbError("vgId:%d, tsdb do retention failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); - tAssert(0); + ASSERT(0); // tsdbFSRollback(pTsdb->pFS); return code; } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 99b2bc06ab..f4bdeeb387 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -110,8 +110,8 @@ static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) { code = tsdbReadDataBlockEx(pReader->pDataFReader, &dataBlk, &pIter->bData); if (code) goto _err; - tAssert(pIter->pBlockIdx->suid == pIter->bData.suid); - tAssert(pIter->pBlockIdx->uid == pIter->bData.uid); + ASSERT(pIter->pBlockIdx->suid == pIter->bData.suid); + ASSERT(pIter->pBlockIdx->uid == pIter->bData.uid); for (pIter->iRow = 0; pIter->iRow < pIter->bData.nRow; pIter->iRow++) { int64_t rowVer = pIter->bData.aVersion[pIter->iRow]; @@ -239,7 +239,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { pReader->pIter = NULL; } else { - tAssert(0); + ASSERT(0); } } @@ -251,7 +251,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { tRBTreePut(&pReader->rbt, (SRBTreeNode*)pReader->pIter); pReader->pIter = NULL; } else { - tAssert(c); + ASSERT(c); } } } @@ -272,7 +272,7 @@ _err: static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; - tAssert(pReader->bData.nRow); + ASSERT(pReader->bData.nRow); int32_t aBufN[5] = {0}; code = tCmprBlockData(&pReader->bData, TWO_STAGE_COMP, NULL, NULL, pReader->aBuf, aBufN); @@ -674,7 +674,7 @@ extern int32_t tsdbWriteSttBlock(SDataFWriter* pWriter, SBlockData* pBlockData, static int32_t tsdbSnapNextTableData(STsdbSnapWriter* pWriter) { int32_t code = 0; - tAssert(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow); + ASSERT(pWriter->dReader.iRow >= pWriter->dReader.bData.nRow); if (pWriter->dReader.iBlockIdx < taosArrayGetSize(pWriter->dReader.aBlockIdx)) { pWriter->dReader.pBlockIdx = (SBlockIdx*)taosArrayGet(pWriter->dReader.aBlockIdx, pWriter->dReader.iBlockIdx); @@ -750,7 +750,7 @@ static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWriter) { int32_t c = 1; if (pWriter->dReader.pBlockIdx) { c = tTABLEIDCmprFn(pWriter->dReader.pBlockIdx, &pWriter->id); - tAssert(c >= 0); + ASSERT(c >= 0); } if (c == 0) { @@ -806,7 +806,7 @@ static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) { int32_t code = 0; STsdb* pTsdb = pWriter->pTsdb; - tAssert(pWriter->dWriter.pWriter == NULL); + ASSERT(pWriter->dWriter.pWriter == NULL); pWriter->fid = fid; pWriter->id = (TABLEID){0}; @@ -820,7 +820,7 @@ static int32_t tsdbSnapWriteOpenFile(STsdbSnapWriter* pWriter, int32_t fid) { code = tsdbReadBlockIdx(pWriter->dReader.pReader, pWriter->dReader.aBlockIdx); if (code) goto _err; } else { - tAssert(pWriter->dReader.pReader == NULL); + ASSERT(pWriter->dReader.pReader == NULL); taosArrayClear(pWriter->dReader.aBlockIdx); } pWriter->dReader.iBlockIdx = 0; // point to the next one @@ -867,7 +867,7 @@ _err: static int32_t tsdbSnapWriteCloseFile(STsdbSnapWriter* pWriter) { int32_t code = 0; - tAssert(pWriter->dWriter.pWriter); + ASSERT(pWriter->dWriter.pWriter); code = tsdbSnapWriteTableDataEnd(pWriter); if (code) goto _err; @@ -925,7 +925,7 @@ static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, i TSDBROW trow = tsdbRowFromBlockData(&pWriter->dReader.bData, pWriter->dReader.iRow); TSDBKEY tKey = TSDBROW_KEY(&trow); - tAssert(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid); + ASSERT(pWriter->dReader.bData.suid == id.suid && pWriter->dReader.bData.uid == id.uid); int32_t c = tsdbKeyCmprFn(&key, &tKey); if (c < 0) { @@ -935,7 +935,7 @@ static int32_t tsdbSnapWriteToDataFile(STsdbSnapWriter* pWriter, int32_t iRow, i code = tBlockDataAppendRow(&pWriter->dWriter.bData, &trow, NULL, id.uid); if (code) goto _err; } else { - tAssert(0); + ASSERT(0); } if (pWriter->dWriter.bData.nRow >= pWriter->maxRow) { @@ -1086,7 +1086,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 code = tDecmprBlockData(pHdr->data, pHdr->size, pBlockData, pWriter->aBuf); if (code) goto _err; - tAssert(pBlockData->nRow > 0); + ASSERT(pBlockData->nRow > 0); // Loop to handle each row for (int32_t iRow = 0; iRow < pBlockData->nRow; iRow++) { @@ -1095,7 +1095,7 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3 if (pWriter->dWriter.pWriter == NULL || pWriter->fid != fid) { if (pWriter->dWriter.pWriter) { - tAssert(fid > pWriter->fid); + ASSERT(fid > pWriter->fid); code = tsdbSnapWriteCloseFile(pWriter); if (code) goto _err; @@ -1177,7 +1177,7 @@ static int32_t tsdbSnapWriteDel(STsdbSnapWriter* pWriter, uint8_t* pData, uint32 SSnapDataHdr* pHdr = (SSnapDataHdr*)pData; TABLEID id = *(TABLEID*)pHdr->data; - tAssert(pHdr->size + sizeof(SSnapDataHdr) == nData); + ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData); // Move write data < id code = tsdbSnapMoveWriteDelData(pWriter, &id); @@ -1368,7 +1368,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { STsdb* pTsdb = pWriter->pTsdb; if (rollback) { - tAssert(0); + ASSERT(0); // code = tsdbFSRollback(pWriter->pTsdb->pFS); // if (code) goto _err; } else { diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 12ce42242b..55703002b8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -97,7 +97,7 @@ _exit: } void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) { - tAssert(idx >= 0 && idx < pMapData->nItem); + ASSERT(idx >= 0 && idx < pMapData->nItem); tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem); } @@ -379,7 +379,7 @@ int32_t tPutBlockCol(uint8_t *p, void *ph) { int32_t n = 0; SBlockCol *pBlockCol = (SBlockCol *)ph; - tAssert(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); + ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); n += tPutI16v(p ? p + n : p, pBlockCol->cid); n += tPutI8(p ? p + n : p, pBlockCol->type); @@ -417,7 +417,7 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) { n += tGetI8(p + n, &pBlockCol->flag); n += tGetI32v(p + n, &pBlockCol->szOrigin); - tAssert(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); + ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE)); pBlockCol->szBitmap = 0; pBlockCol->szOffset = 0; @@ -544,7 +544,7 @@ int32_t tsdbFidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int64_t now) { } else if (pKeepCfg->precision == TSDB_TIME_PRECISION_NANO) { now = now * 1000000000l; } else { - tAssert(0); + ASSERT(0); } key = now - pKeepCfg->keep0 * tsTickPerMin[pKeepCfg->precision]; @@ -570,7 +570,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * STColumn *pTColumn = &pTSchema->columns[iCol]; SValue value; - tAssert(iCol > 0); + ASSERT(iCol > 0); if (pRow->type == 0) { tTSRowGetVal(pRow->pTSRow, pTSchema, iCol, pColVal); @@ -585,7 +585,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * *pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type); } } else { - tAssert(0); + ASSERT(0); } } @@ -607,14 +607,14 @@ int32_t tsdbRowCmprFn(const void *p1, const void *p2) { void tsdbRowIterInit(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema) { pIter->pRow = pRow; if (pRow->type == 0) { - tAssert(pTSchema); + ASSERT(pTSchema); pIter->pTSchema = pTSchema; pIter->i = 1; } else if (pRow->type == 1) { pIter->pTSchema = NULL; pIter->i = 0; } else { - tAssert(0); + ASSERT(0); } } @@ -661,7 +661,7 @@ int32_t tRowMergerInit2(SRowMerger *pMerger, STSchema *pResTSchema, TSDBROW *pRo // ts pTColumn = &pTSchema->columns[jCol++]; - tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = key.ts}); if (taosArrayPush(pMerger->pArray, pColVal) == NULL) { @@ -704,7 +704,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { STColumn *pTColumn; int32_t iCol, jCol = 1; - tAssert(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); + ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); for (iCol = 1; iCol < pMerger->pTSchema->numOfCols && jCol < pTSchema->numOfCols; ++iCol) { pTColumn = &pMerger->pTSchema->columns[iCol]; @@ -728,7 +728,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { - tAssert(0 && "dup versions not allowed"); + ASSERT(0 && "dup versions not allowed"); } } @@ -754,7 +754,7 @@ int32_t tRowMergerInit(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) { // ts pTColumn = &pTSchema->columns[0]; - tAssert(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pTColumn->type == TSDB_DATA_TYPE_TIMESTAMP); *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = key.ts}); if (taosArrayPush(pMerger->pArray, pColVal) == NULL) { @@ -782,7 +782,7 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) { TSDBKEY key = TSDBROW_KEY(pRow); SColVal *pColVal = &(SColVal){0}; - tAssert(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); + ASSERT(((SColVal *)pMerger->pArray->pData)->value.val == key.ts); for (int32_t iCol = 1; iCol < pMerger->pTSchema->numOfCols; iCol++) { tsdbRowGetColVal(pRow, pMerger->pTSchema, iCol, pColVal); @@ -797,7 +797,7 @@ int32_t tRowMerge(SRowMerger *pMerger, TSDBROW *pRow) { taosArraySet(pMerger->pArray, iCol, pColVal); } } else { - tAssert(0); + ASSERT(0); } } @@ -828,7 +828,7 @@ static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aS int64_t version1 = 0; int64_t version2 = 0; - tAssert(n1 > 0 && n2 > 0); + ASSERT(n1 > 0 && n2 > 0); taosArrayClear(aSkyline); @@ -955,7 +955,7 @@ void tBlockDataDestroy(SBlockData *pBlockData, int8_t deepClear) { int32_t tBlockDataInit(SBlockData *pBlockData, TABLEID *pId, STSchema *pTSchema, int16_t *aCid, int32_t nCid) { int32_t code = 0; - tAssert(pId->suid || pId->uid); + ASSERT(pId->suid || pId->uid); pBlockData->suid = pId->suid; pBlockData->uid = pId->uid; @@ -1007,7 +1007,7 @@ void tBlockDataReset(SBlockData *pBlockData) { } void tBlockDataClear(SBlockData *pBlockData) { - tAssert(pBlockData->suid || pBlockData->uid); + ASSERT(pBlockData->suid || pBlockData->uid); pBlockData->nRow = 0; for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { @@ -1095,7 +1095,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NONE(pColData->cid, pColData->type)); if (code) goto _exit; } else { - tAssert(pTColumn->type == pColData->type); + ASSERT(pTColumn->type == pColData->type); SColVal cv = {.cid = pTColumn->colId, .type = pTColumn->type}; @@ -1123,7 +1123,7 @@ static int32_t tBlockDataAppendTPRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NULL(pColData->cid, pColData->type)); if (code) goto _exit; } else { - tAssert(0); + ASSERT(0); } } else { cv.flag = CV_FLAG_VALUE; @@ -1171,7 +1171,7 @@ static int32_t tBlockDataAppendKVRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NONE(pColData->cid, pColData->type)); if (code) goto _exit; } else { - tAssert(pTColumn->type == pColData->type); + ASSERT(pTColumn->type == pColData->type); SColVal cv = {.cid = pTColumn->colId, .type = pTColumn->type}; TDRowValT vt = TD_VTYPE_NONE; // default is NONE @@ -1211,7 +1211,7 @@ static int32_t tBlockDataAppendKVRow(SBlockData *pBlockData, STSRow *pRow, STSch code = tColDataAppendValue(pColData, &COL_VAL_NULL(pColData->cid, pColData->type)); if (code) goto _exit; } else { - tAssert(0); + ASSERT(0); } iTColumn++; @@ -1226,11 +1226,11 @@ _exit: int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTSchema, int64_t uid) { int32_t code = 0; - tAssert(pBlockData->suid || pBlockData->uid); + ASSERT(pBlockData->suid || pBlockData->uid); // uid if (pBlockData->uid == 0) { - tAssert(uid); + ASSERT(uid); code = tRealloc((uint8_t **)&pBlockData->aUid, sizeof(int64_t) * (pBlockData->nRow + 1)); if (code) goto _err; pBlockData->aUid[pBlockData->nRow] = uid; @@ -1253,7 +1253,7 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS code = tBlockDataAppendKVRow(pBlockData, pRow->pTSRow, pTSchema); if (code) goto _err; } else { - tAssert(0); + ASSERT(0); } } else { code = tBlockDataAppendBlockRow(pBlockData, pRow->pBlockData, pRow->iRow); @@ -1310,10 +1310,10 @@ _exit: int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlockData *pBlockData) { int32_t code = 0; - tAssert(pBlockData->suid == pBlockData1->suid); - tAssert(pBlockData->uid == pBlockData1->uid); - tAssert(pBlockData1->nRow > 0); - tAssert(pBlockData2->nRow > 0); + ASSERT(pBlockData->suid == pBlockData1->suid); + ASSERT(pBlockData->uid == pBlockData1->uid); + ASSERT(pBlockData1->nRow > 0); + ASSERT(pBlockData2->nRow > 0); tBlockDataClear(pBlockData); @@ -1348,7 +1348,7 @@ int32_t tBlockDataMerge(SBlockData *pBlockData1, SBlockData *pBlockData2, SBlock pRow2 = NULL; } } else { - tAssert(0); + ASSERT(0); } } @@ -1383,12 +1383,12 @@ _exit: } SColData *tBlockDataGetColDataByIdx(SBlockData *pBlockData, int32_t idx) { - tAssert(idx >= 0 && idx < pBlockData->nColData); + ASSERT(idx >= 0 && idx < pBlockData->nColData); return (SColData *)taosArrayGet(pBlockData->aColData, idx); } void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData) { - tAssert(cid != PRIMARYKEY_TIMESTAMP_COL_ID); + ASSERT(cid != PRIMARYKEY_TIMESTAMP_COL_ID); int32_t lidx = 0; int32_t ridx = pBlockData->nColData - 1; @@ -1427,7 +1427,7 @@ int32_t tCmprBlockData(SBlockData *pBlockData, int8_t cmprAlg, uint8_t **ppOut, for (int32_t iColData = 0; iColData < pBlockData->nColData; iColData++) { SColData *pColData = tBlockDataGetColDataByIdx(pBlockData, iColData); - tAssert(pColData->flag); + ASSERT(pColData->flag); if (pColData->flag == HAS_NONE) continue; @@ -1508,7 +1508,7 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin // SDiskDataHdr n += tGetDiskDataHdr(pIn + n, &hdr); - tAssert(hdr.delimiter == TSDB_FILE_DLMT); + ASSERT(hdr.delimiter == TSDB_FILE_DLMT); pBlockData->suid = hdr.suid; pBlockData->uid = hdr.uid; @@ -1516,12 +1516,12 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin // uid if (hdr.uid == 0) { - tAssert(hdr.szUid); + ASSERT(hdr.szUid); code = tsdbDecmprData(pIn + n, hdr.szUid, TSDB_DATA_TYPE_BIGINT, hdr.cmprAlg, (uint8_t **)&pBlockData->aUid, sizeof(int64_t) * hdr.nRow, &aBuf[0]); if (code) goto _exit; } else { - tAssert(!hdr.szUid); + ASSERT(!hdr.szUid); } n += hdr.szUid; @@ -1544,7 +1544,7 @@ int32_t tDecmprBlockData(uint8_t *pIn, int32_t szIn, SBlockData *pBlockData, uin while (nt < hdr.szBlkCol) { SBlockCol blockCol = {0}; nt += tGetBlockCol(pIn + n + nt, &blockCol); - tAssert(nt <= hdr.szBlkCol); + ASSERT(nt <= hdr.szBlkCol); SColData *pColData; code = tBlockDataAddColData(pBlockData, &pColData); @@ -1632,7 +1632,7 @@ int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, ui int32_t *szOut, uint8_t **ppBuf) { int32_t code = 0; - tAssert(szIn > 0 && ppOut); + ASSERT(szIn > 0 && ppOut); if (cmprAlg == NO_COMPRESSION) { code = tRealloc(ppOut, nOut + szIn); @@ -1647,7 +1647,7 @@ int32_t tsdbCmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, ui if (code) goto _exit; if (cmprAlg == TWO_STAGE_COMP) { - tAssert(ppBuf); + ASSERT(ppBuf); code = tRealloc(ppBuf, size); if (code) goto _exit; } @@ -1672,7 +1672,7 @@ int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, if (code) goto _exit; if (cmprAlg == NO_COMPRESSION) { - tAssert(szIn == szOut); + ASSERT(szIn == szOut); memcpy(*ppOut, pIn, szOut); } else { if (cmprAlg == TWO_STAGE_COMP) { @@ -1687,7 +1687,7 @@ int32_t tsdbDecmprData(uint8_t *pIn, int32_t szIn, int8_t type, int8_t cmprAlg, goto _exit; } - tAssert(size == szOut); + ASSERT(size == szOut); } _exit: @@ -1698,7 +1698,7 @@ int32_t tsdbCmprColData(SColData *pColData, int8_t cmprAlg, SBlockCol *pBlockCol uint8_t **ppBuf) { int32_t code = 0; - tAssert(pColData->flag && (pColData->flag != HAS_NONE) && (pColData->flag != HAS_NULL)); + ASSERT(pColData->flag && (pColData->flag != HAS_NONE) && (pColData->flag != HAS_NULL)); pBlockCol->szBitmap = 0; pBlockCol->szOffset = 0; @@ -1744,8 +1744,8 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in uint8_t **ppBuf) { int32_t code = 0; - tAssert(pColData->cid == pBlockCol->cid); - tAssert(pColData->type == pBlockCol->type); + ASSERT(pColData->cid == pBlockCol->cid); + ASSERT(pColData->type == pBlockCol->type); pColData->smaOn = pBlockCol->smaOn; pColData->flag = pBlockCol->flag; pColData->nVal = nVal; diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c index dbc36369f2..49d5eaac43 100644 --- a/source/dnode/vnode/src/tsdb/tsdbWrite.c +++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c @@ -32,7 +32,7 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq *pMsg, SSubmitRsp * int32_t affectedrows = 0; int32_t numOfRows = 0; - tAssert(pTsdb->mem != NULL); + ASSERT(pTsdb->mem != NULL); // scan and convert if (tsdbScanAndConvertSubmitMsg(pTsdb, pMsg) < 0) { @@ -97,7 +97,7 @@ static FORCE_INLINE int tsdbCheckRowRange(STsdb *pTsdb, tb_uid_t uid, STSRow *ro } int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); // STsdbMeta * pMeta = pTsdb->tsdbMeta; SSubmitMsgIter msgIter = {0}; SSubmitBlk *pBlock = NULL; diff --git a/source/dnode/vnode/src/vnd/vnodeBufPool.c b/source/dnode/vnode/src/vnd/vnodeBufPool.c index e26f56cded..dcc323f778 100644 --- a/source/dnode/vnode/src/vnd/vnodeBufPool.c +++ b/source/dnode/vnode/src/vnd/vnodeBufPool.c @@ -72,7 +72,7 @@ int vnodeOpenBufPool(SVnode *pVnode) { SVBufPool *pPool = NULL; int64_t size = pVnode->config.szBuf / VNODE_BUFPOOL_SEGMENTS; - tAssert(pVnode->pPool == NULL); + ASSERT(pVnode->pPool == NULL); for (int i = 0; i < 3; i++) { // create pool @@ -110,14 +110,14 @@ int vnodeCloseBufPool(SVnode *pVnode) { void vnodeBufPoolReset(SVBufPool *pPool) { for (SVBufPoolNode *pNode = pPool->pTail; pNode->prev; pNode = pPool->pTail) { - tAssert(pNode->pnext == &pPool->pTail); + ASSERT(pNode->pnext == &pPool->pTail); pNode->prev->pnext = &pPool->pTail; pPool->pTail = pNode->prev; pPool->size = pPool->size - sizeof(*pNode) - pNode->size; taosMemoryFree(pNode); } - tAssert(pPool->size == pPool->ptr - pPool->node.data); + ASSERT(pPool->size == pPool->ptr - pPool->node.data); pPool->size = 0; pPool->ptr = pPool->node.data; @@ -126,7 +126,7 @@ void vnodeBufPoolReset(SVBufPool *pPool) { void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) { SVBufPoolNode *pNode; void *p = NULL; - tAssert(pPool != NULL); + ASSERT(pPool != NULL); if (pPool->lock) taosThreadSpinLock(pPool->lock); if (pPool->node.size >= pPool->ptr - pPool->node.data + size) { @@ -172,7 +172,7 @@ void vnodeBufPoolFree(SVBufPool *pPool, void *p) { void vnodeBufPoolRef(SVBufPool *pPool) { int32_t nRef = atomic_fetch_add_32(&pPool->nRef, 1); - tAssert(nRef > 0); + ASSERT(nRef > 0); } void vnodeBufPoolUnRef(SVBufPool *pPool) { diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 6e67f02a32..5adb2eb359 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -195,7 +195,7 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) { } for (int32_t i = 0; i < nRetention; ++i) { SJson *pNodeRetention = tjsonGetArrayItem(pNodeRetentions, i); - tAssert(pNodeRetention != NULL); + ASSERT(pNodeRetention != NULL); tjsonGetNumberValue(pNodeRetention, "freq", (pCfg->tsdbCfg.retentions)[i].freq, code); tjsonGetNumberValue(pNodeRetention, "freqUnit", (pCfg->tsdbCfg.retentions)[i].freqUnit, code); tjsonGetNumberValue(pNodeRetention, "keep", (pCfg->tsdbCfg.retentions)[i].keep, code); diff --git a/source/dnode/vnode/src/vnd/vnodeModule.c b/source/dnode/vnode/src/vnd/vnodeModule.c index ff5e500ebd..782ffd788d 100644 --- a/source/dnode/vnode/src/vnd/vnodeModule.c +++ b/source/dnode/vnode/src/vnd/vnodeModule.c @@ -115,7 +115,7 @@ void vnodeCleanup() { int vnodeScheduleTask(int (*execute)(void*), void* arg) { SVnodeTask* pTask; - tAssert(!vnodeGlobal.stop); + ASSERT(!vnodeGlobal.stop); pTask = taosMemoryMalloc(sizeof(*pTask)); if (pTask == NULL) { diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 20d181b63b..1199127f6d 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -18,7 +18,7 @@ #define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \ do { \ int##vType##_t newVal = atomic_sub_fetch_##vType(&(pVar), (oVal)); \ - tAssert(newVal >= 0); \ + ASSERT(newVal >= 0); \ if (newVal < 0) { \ vWarn("vgId:%d %s, abnormal val:%" PRIi64 ", old val:%" PRIi64, TD_VID(pVnode), tags, newVal, (oVal)); \ } \ @@ -89,7 +89,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { } else if (mer1.me.type == TSDB_NORMAL_TABLE) { schema = mer1.me.ntbEntry.schemaRow; } else { - tAssert(0); + ASSERT(0); } metaRsp.numOfTags = schemaTag.nCols; @@ -210,7 +210,7 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { cfgRsp.pComment = strdup(mer1.me.ntbEntry.comment); } } else { - tAssert(0); + ASSERT(0); } cfgRsp.numOfTags = schemaTag.nCols; diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index 40cb871795..a34744a1da 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -321,7 +321,7 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot * vnodeBegin(pVnode); } else { - tAssert(0); + ASSERT(0); } _exit: @@ -339,8 +339,8 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { SSnapDataHdr *pHdr = (SSnapDataHdr *)pData; SVnode *pVnode = pWriter->pVnode; - tAssert(pHdr->size + sizeof(SSnapDataHdr) == nData); - tAssert(pHdr->index == pWriter->index + 1); + ASSERT(pHdr->size + sizeof(SSnapDataHdr) == nData); + ASSERT(pHdr->index == pWriter->index + 1); pWriter->index = pHdr->index; vInfo("vgId:%d, vnode snapshot write data, index:%" PRId64 " type:%d nData:%d", TD_VID(pVnode), pHdr->index, diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 71cca88ffb..0fc42f3744 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -189,8 +189,8 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp vDebug("vgId:%d, start to process write request %s, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version); - tAssert(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); - tAssert(pVnode->state.applied + 1 == version); + ASSERT(pVnode->state.applyTerm <= pMsg->info.conn.applyTerm); + ASSERT(pVnode->state.applied + 1 == version); pVnode->state.applied = version; pVnode->state.applyTerm = pMsg->info.conn.applyTerm; @@ -853,7 +853,7 @@ static int32_t vnodeDebugPrintSingleSubmitMsg(SMeta *pMeta, SSubmitBlk *pBlock, } static int32_t vnodeDebugPrintSubmitMsg(SVnode *pVnode, SSubmitReq *pMsg, const char *tags) { - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); SSubmitMsgIter msgIter = {0}; SMeta *pMeta = pVnode->pMeta; SSubmitBlk *pBlock = NULL; @@ -1231,7 +1231,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq tDecoderInit(pCoder, pReq, len); tDecodeDeleteRes(pCoder, pRes); - tAssert(taosArrayGetSize(pRes->uidList) == 0 || (pRes->skey != 0 && pRes->ekey != 0)); + ASSERT(taosArrayGetSize(pRes->uidList) == 0 || (pRes->skey != 0 && pRes->ekey != 0)); for (int32_t iUid = 0; iUid < taosArrayGetSize(pRes->uidList); iUid++) { code = tsdbDeleteTableData(pVnode->pTsdb, version, pRes->suid, *(uint64_t *)taosArrayGet(pRes->uidList, iUid), diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index 11e46c23a7..aa215a852f 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -122,7 +122,7 @@ static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize); bool wait = (code == 0 && vnodeIsBlockMsg(pLastMsg->msgType)); if (wait) { - tAssert(!pVnode->blocked); + ASSERT(!pVnode->blocked); pVnode->blocked = true; } taosThreadMutexUnlock(&pVnode->lock); @@ -221,7 +221,7 @@ static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak int32_t code = syncPropose(pVnode->sync, pMsg, isWeak); bool wait = (code == 0 && vnodeIsMsgBlock(pMsg->msgType)); if (wait) { - tAssert(!pVnode->blocked); + ASSERT(!pVnode->blocked); pVnode->blocked = true; } taosThreadMutexUnlock(&pVnode->lock); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index f595964dc4..b6ff1c8b98 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -22,7 +22,7 @@ extern SCatalogMgmt gCtgMgmt; SCtgDebug gCTGDebug = {0}; void ctgdUserCallback(SMetaData *pResult, void *param, int32_t code) { - tAssert(*(int32_t *)param == 1); + ASSERT(*(int32_t *)param == 1); taosMemoryFree(param); qDebug("async call result: %s", tstrerror(code)); diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 849bbf8be9..7cc6c90d30 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -40,7 +40,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu msgNum = taosArrayGetSize(batchRsp.pRsps); } - tAssert(taskNum == msgNum || 0 == msgNum); + ASSERT(taskNum == msgNum || 0 == msgNum); ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1)); @@ -62,7 +62,7 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu taskMsg.pData = pRsp->msg; taskMsg.len = pRsp->msgLen; - tAssert(pRsp->msgIdx == *msgIdx); + ASSERT(pRsp->msgIdx == *msgIdx); } else { pRsp = &rsp; pRsp->msgIdx = *msgIdx; diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 29892c05cb..5f1b87a138 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -40,7 +40,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe (*pRsp)->numOfCols = htonl(numOfCols); int32_t len = blockEncode(pBlock, (*pRsp)->data, numOfCols); - tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); + ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 922bb2788d..253718048d 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1666,7 +1666,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { rsp->numOfRows = htobe64((int64_t)rowNum); int32_t len = blockEncode(pBlock, rsp->data, taosArrayGetSize(pBlock->pDataBlock)); - tAssert(len == rspSize - sizeof(SRetrieveTableRsp)); + ASSERT(len == rspSize - sizeof(SRetrieveTableRsp)); rsp->compLen = htonl(len); diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index e1dff38e2a..51150ede3c 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -27,7 +27,7 @@ #define T_LONG_JMP(_obj, _c) \ do { \ - tAssert((_c) != -1); \ + ASSERT((_c) != -1); \ longjmp((_obj), (_c)); \ } while (0) diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index b2b71fa928..672bb09b14 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -163,7 +163,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { int32_t resultRows = pInfo->pBufferredRes->info.rows; // the results may be null, if last values are all null - tAssert(resultRows == 0 || resultRows == taosArrayGetSize(pInfo->pUidList)); + ASSERT(resultRows == 0 || resultRows == taosArrayGetSize(pInfo->pUidList)); pInfo->indexOfBufferedRes = 0; } @@ -235,7 +235,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { pInfo->pRes->info.id.groupId = pKeyInfo->groupId; if (taosArrayGetSize(pInfo->pUidList) > 0) { - tAssert((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW); + ASSERT((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW); pInfo->pRes->info.id.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0); code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, pInfo->pRes->info.rows, diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 03f8b496ce..12fb449238 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -62,8 +62,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pEntry->numOfCols = taosArrayGetSize(pInput->pData->pDataBlock); pEntry->dataLen = sizeof(SDeleterRes); - tAssert(1 == pEntry->numOfRows); - tAssert(3 == pEntry->numOfCols); + ASSERT(1 == pEntry->numOfRows); + ASSERT(3 == pEntry->numOfCols); pBuf->useSize = sizeof(SDataCacheEntry); @@ -81,7 +81,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp if (pRes->affectedRows) { pRes->skey = *(int64_t*)pColSKey->pData; pRes->ekey = *(int64_t*)pColEKey->pData; - tAssert(pRes->skey <= pRes->ekey); + ASSERT(pRes->skey <= pRes->ekey); } else { pRes->skey = pHandle->pDeleter->deleteTimeRange.skey; pRes->ekey = pHandle->pDeleter->deleteTimeRange.ekey; @@ -167,7 +167,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDeleterBuf* pBuf = NULL; taosReadQitem(pDeleter->pDataBlocks, (void**)&pBuf); - tAssert(NULL != pBuf); + ASSERT(NULL != pBuf); memcpy(&pDeleter->nextOutput, pBuf, sizeof(SDataDeleterBuf)); taosFreeQitem(pBuf); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index 0176e18e2d..c45226e02b 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn pBuf->useSize = sizeof(SDataCacheEntry); pEntry->dataLen = blockEncode(pInput->pData, pEntry->data, numOfCols); - tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); pBuf->useSize += pEntry->dataLen; @@ -162,15 +162,15 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE SDataDispatchBuf* pBuf = NULL; taosReadQitem(pDispatcher->pDataBlocks, (void**)&pBuf); - tAssert(NULL != pBuf); + ASSERT(NULL != pBuf); memcpy(&pDispatcher->nextOutput, pBuf, sizeof(SDataDispatchBuf)); taosFreeQitem(pBuf); SDataCacheEntry* pEntry = (SDataCacheEntry*)pDispatcher->nextOutput.pData; *pLen = pEntry->dataLen; - tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); *pQueryEnd = pDispatcher->queryEnd; qDebug("got data len %" PRId64 ", row num %d in sink", *pLen, @@ -193,8 +193,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) { pOutput->numOfCols = pEntry->numOfCols; pOutput->compressed = pEntry->compressed; - tAssert(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); - tAssert(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); + ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8)); + ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4)); atomic_sub_fetch_64(&pDispatcher->cachedSize, pEntry->dataLen); atomic_sub_fetch_64(&gDataSinkStat.cachedSize, pEntry->dataLen); diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index a2dfa533c3..8423b77906 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -373,7 +373,7 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { pRsp->useconds = htobe64(pRsp->useconds); pRsp->numOfBlocks = htonl(pRsp->numOfBlocks); - tAssert(pRsp != NULL); + ASSERT(pRsp != NULL); qDebug("%s fetch rsp received, index:%d, blocks:%d, rows:%" PRId64 ", %p", pSourceDataInfo->taskId, index, pRsp->numOfBlocks, pRsp->numOfRows, pExchangeInfo); } else { @@ -401,7 +401,7 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas SSourceDataInfo* pDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, sourceIndex); pDataInfo->startTime = taosGetTimestampUs(); - tAssert(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); + ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); SFetchRspHandleWrapper* pWrapper = taosMemoryCalloc(1, sizeof(SFetchRspHandleWrapper)); pWrapper->exchangeId = pExchangeInfo->self; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 0af7815558..fc3cfbd0f6 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -160,7 +160,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - tAssert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); + ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } bool hasRemainResults(SGroupResInfo* pGroupResInfo) { @@ -314,10 +314,10 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, return code; } - tAssert(nodeType(pNew) == QUERY_NODE_VALUE); + ASSERT(nodeType(pNew) == QUERY_NODE_VALUE); SValueNode* pValue = (SValueNode*)pNew; - tAssert(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL); + ASSERT(pValue->node.resType.type == TSDB_DATA_TYPE_BOOL); *pQualified = pValue->datum.b; nodesDestroyNode(pNew); @@ -626,7 +626,7 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis #endif } else { void* tag = taosHashGet(tags, uid, sizeof(int64_t)); - tAssert(tag); + ASSERT(tag); STagVal tagVal = {0}; tagVal.cid = pColInfo->info.colId; @@ -1056,7 +1056,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode, } if (!pTagCond) { // no tag condition exists, let's fetch all tables of this super table - tAssert(pTagIndexCond == NULL); + ASSERT(pTagIndexCond == NULL); vnodeGetCtbIdList(pVnode, pScanNode->suid, res); } else { // failed to find the result in the cache, let try to calculate the results @@ -1150,7 +1150,7 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, return code; } - tAssert(nodeType(pNew) == QUERY_NODE_VALUE); + ASSERT(nodeType(pNew) == QUERY_NODE_VALUE); SValueNode* pValue = (SValueNode*)pNew; if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL || pValue->isNull) { @@ -1364,7 +1364,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { if (!pFuncNode->pParameterList && (memcmp(pExprNode->_function.functionName, name, len) == 0) && pExprNode->_function.functionName[len] == 0) { pFuncNode->pParameterList = nodesMakeList(); - tAssert(LIST_LENGTH(pFuncNode->pParameterList) == 0); + ASSERT(LIST_LENGTH(pFuncNode->pParameterList) == 0); SValueNode* res = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); if (NULL == res) { // todo handle error } else { @@ -1416,7 +1416,7 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) { createResSchema(pType->type, pType->bytes, slotId, pType->scale, pType->precision, pCaseNode->node.aliasName); pExp->pExpr->_optrRoot.pRootNode = pNode; } else { - tAssert(0); + ASSERT(0); } } @@ -1572,7 +1572,7 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray } else if (p->info.colId < pmInfo->colId) { i++; } else { - tAssert(0); + ASSERT(0); } } } @@ -1758,7 +1758,7 @@ void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimit } uint64_t tableListGetSize(const STableListInfo* pTableList) { - tAssert(taosArrayGetSize(pTableList->pTableList) == taosHashGetSize(pTableList->map)); + ASSERT(taosArrayGetSize(pTableList->pTableList) == taosHashGetSize(pTableList->map)); return taosArrayGetSize(pTableList->pTableList); } @@ -1774,10 +1774,10 @@ STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) uint64_t getTableGroupId(const STableListInfo* pTableList, uint64_t tableUid) { int32_t* slot = taosHashGet(pTableList->map, &tableUid, sizeof(tableUid)); - tAssert(pTableList->map != NULL && slot != NULL); + ASSERT(pTableList->map != NULL && slot != NULL); STableKeyInfo* pKeyInfo = taosArrayGet(pTableList->pTableList, *slot); - tAssert(pKeyInfo->uid == tableUid); + ASSERT(pKeyInfo->uid == tableUid); return pKeyInfo->groupId; } @@ -1785,7 +1785,7 @@ uint64_t getTableGroupId(const STableListInfo* pTableList, uint64_t tableUid) { // TODO handle the group offset info, fix it, the rule of group output will be broken by this function int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t gid) { if (pTableList->map == NULL) { - tAssert(taosArrayGetSize(pTableList->pTableList) == 0); + ASSERT(taosArrayGetSize(pTableList->pTableList) == 0); pTableList->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); } @@ -1933,7 +1933,7 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) { int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* group, bool groupSort) { int32_t code = TSDB_CODE_SUCCESS; - tAssert(pTableListInfo->map != NULL); + ASSERT(pTableListInfo->map != NULL); bool groupByTbname = groupbyTbname(group); size_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList); @@ -1990,7 +1990,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags } int32_t numOfTables = taosArrayGetSize(pTableListInfo->pTableList); - tAssert(pTableListInfo->numOfOuputGroups == 1); + ASSERT(pTableListInfo->numOfOuputGroups == 1); int64_t st1 = taosGetTimestampUs(); pTaskInfo->cost.extractListTime = (st1 - st) / 1000.0; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 630216fbdb..6fca2858dc 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -31,7 +31,7 @@ static void cleanupRefPool() { } static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { - tAssert(pOperator != NULL); + ASSERT(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -72,7 +72,7 @@ static int32_t doSetSMABlock(SOperatorInfo* pOperator, void* input, size_t numOf static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { { - tAssert(pOperator != NULL); + ASSERT(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -91,7 +91,7 @@ static int32_t doSetStreamOpOpen(SOperatorInfo* pOperator, char* id) { } static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { - tAssert(pOperator != NULL); + ASSERT(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { qError("failed to find stream scan operator to set the input data block, %s" PRIx64, id); @@ -109,18 +109,18 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu SStreamScanInfo* pInfo = pOperator->info; - tAssert(pInfo->validBlockIndex == 0); - tAssert(taosArrayGetSize(pInfo->pBlockLists) == 0); + ASSERT(pInfo->validBlockIndex == 0); + ASSERT(taosArrayGetSize(pInfo->pBlockLists) == 0); if (type == STREAM_INPUT__MERGED_SUBMIT) { - // tAssert(numOfBlocks > 1); + // ASSERT(numOfBlocks > 1); for (int32_t i = 0; i < numOfBlocks; i++) { SSubmitReq* pReq = *(void**)POINTER_SHIFT(input, i * sizeof(void*)); taosArrayPush(pInfo->pBlockLists, &pReq); } pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; } else if (type == STREAM_INPUT__DATA_SUBMIT) { - tAssert(numOfBlocks == 1); + ASSERT(numOfBlocks == 1); taosArrayPush(pInfo->pBlockLists, &input); pInfo->blockType = STREAM_INPUT__DATA_SUBMIT; } else if (type == STREAM_INPUT__DATA_BLOCK) { @@ -130,7 +130,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } pInfo->blockType = STREAM_INPUT__DATA_BLOCK; } else { - tAssert(0); + ASSERT(0); } return TSDB_CODE_SUCCESS; @@ -413,7 +413,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, int32_t* tversion) { - tAssert(tinfo != NULL && dbName != NULL && tableName != NULL); + ASSERT(tinfo != NULL && dbName != NULL && tableName != NULL); SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if (pTaskInfo->schemaInfo.sw == NULL) { @@ -546,7 +546,7 @@ int32_t qExecTaskOpt(qTaskInfo_t tinfo, SArray* pResList, uint64_t* useconds, bo blockIndex += 1; current += p->info.rows; - tAssert(p->info.rows > 0); + ASSERT(p->info.rows > 0); taosArrayPush(pResList, &p); if (current >= 4096) { @@ -776,7 +776,7 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) { *scanner = pOperator->info; return 0; } else { - tAssert(pOperator->numOfDownstream == 1); + ASSERT(pOperator->numOfDownstream == 1); pOperator = pOperator->pDownstream[0]; } } @@ -785,7 +785,7 @@ int32_t qExtractStreamScanner(qTaskInfo_t tinfo, void** scanner) { #if 0 int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); taosWriteQitem(pTaskInfo->streamInfo.inputQueue->queue, pItem); return 0; } @@ -793,7 +793,7 @@ int32_t qStreamInput(qTaskInfo_t tinfo, void* pItem) { int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.fillHistoryVer1 = ver; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE1; return 0; @@ -801,7 +801,7 @@ int32_t qStreamSourceRecoverStep1(qTaskInfo_t tinfo, int64_t ver) { int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.fillHistoryVer2 = ver; pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__PREPARE2; return 0; @@ -809,7 +809,7 @@ int32_t qStreamSourceRecoverStep2(qTaskInfo_t tinfo, int64_t ver) { int32_t qStreamRecoverFinish(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM); pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__NONE; return 0; } @@ -823,10 +823,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - tAssert(pInfo->twAggSup.calTriggerSaved == 0); - tAssert(pInfo->twAggSup.deleteMarkSaved == 0); + ASSERT(pInfo->twAggSup.calTriggerSaved == 0); + ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -839,10 +839,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - tAssert(pInfo->twAggSup.calTriggerSaved == 0); - tAssert(pInfo->twAggSup.deleteMarkSaved == 0); + ASSERT(pInfo->twAggSup.calTriggerSaved == 0); + ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -852,10 +852,10 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { pInfo->twAggSup.deleteMark = INT64_MAX; } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { SStreamStateAggOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); - tAssert(pInfo->twAggSup.calTriggerSaved == 0); - tAssert(pInfo->twAggSup.deleteMarkSaved == 0); + ASSERT(pInfo->twAggSup.calTriggerSaved == 0); + ASSERT(pInfo->twAggSup.deleteMarkSaved == 0); qInfo("save stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); @@ -869,7 +869,7 @@ int32_t qStreamSetParamForRecover(qTaskInfo_t tinfo) { if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) { if (pOperator->numOfDownstream > 1) { qError("unexpected stream, multiple downstream"); - tAssert(0); + ASSERT(0); return -1; } return 0; @@ -890,34 +890,34 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for interval: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION || pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) { SStreamSessionAggOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for session: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } else if (pOperator->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) { SStreamStateAggOperatorInfo* pInfo = pOperator->info; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); - tAssert(pInfo->twAggSup.deleteMark == INT64_MAX); + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERT(pInfo->twAggSup.deleteMark == INT64_MAX); pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; - tAssert(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || + ASSERT(pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE || pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE); qInfo("restore stream param for state: %d, %" PRId64, pInfo->twAggSup.calTrigger, pInfo->twAggSup.deleteMark); } @@ -926,7 +926,7 @@ int32_t qStreamRestoreParam(qTaskInfo_t tinfo) { if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) { if (pOperator->numOfDownstream > 1) { qError("unexpected stream, multiple downstream"); - tAssert(0); + ASSERT(0); return -1; } return 0; @@ -954,19 +954,19 @@ const char* qExtractTbnameFromTask(qTaskInfo_t tinfo) { SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); return &pTaskInfo->streamInfo.metaRsp; } int64_t qStreamExtractPrepareUid(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); return pTaskInfo->streamInfo.prepareStatus.uid; } int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); memcpy(pOffset, &pTaskInfo->streamInfo.lastStatus, sizeof(STqOffsetVal)); return 0; } @@ -1004,8 +1004,8 @@ int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* s int32_t qStreamScanMemData(qTaskInfo_t tinfo, const SSubmitReq* pReq) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); - tAssert(pTaskInfo->streamInfo.pReq == NULL); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + ASSERT(pTaskInfo->streamInfo.pReq == NULL); pTaskInfo->streamInfo.pReq = pReq; return 0; } @@ -1013,7 +1013,7 @@ int32_t qStreamScanMemData(qTaskInfo_t tinfo, const SSubmitReq* pReq) { int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SOperatorInfo* pOperator = pTaskInfo->pRoot; - tAssert(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); + ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); pTaskInfo->streamInfo.prepareStatus = *pOffset; pTaskInfo->streamInfo.returned = 0; if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus)) { @@ -1024,7 +1024,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT pOperator->status = OP_OPENED; // TODO add more check if (type != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - tAssert(pOperator->numOfDownstream == 1); + ASSERT(pOperator->numOfDownstream == 1); pOperator = pOperator->pDownstream[0]; } @@ -1038,13 +1038,13 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT pInfo->tqReader->pWalReader->curVersion != pOffset->version) { qError("prepare scan ver %" PRId64 " actual ver %" PRId64 ", last %" PRId64, pOffset->version, pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version); - tAssert(0); + ASSERT(0); } #endif if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { return -1; } - tAssert(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); + ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { /*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/ int64_t uid = pOffset->uid; @@ -1082,7 +1082,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT } // TODO after dropping table, table may not found - tAssert(found); + ASSERT(found); if (pTableScanInfo->base.dataReader == NULL) { STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0); @@ -1091,7 +1091,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT if (tsdbReaderOpen(pTableScanInfo->base.readHandle.vnode, &pTableScanInfo->base.cond, pList, num, pTableScanInfo->pResBlock, &pTableScanInfo->base.dataReader, NULL) < 0 || pTableScanInfo->base.dataReader == NULL) { - tAssert(0); + ASSERT(0); } } @@ -1107,7 +1107,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT ts, pTableScanInfo->currentTable, numOfTables); /*}*/ } else { - tAssert(0); + ASSERT(0); } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { SStreamRawScanInfo* pInfo = pOperator->info; @@ -1139,7 +1139,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT STableKeyInfo* pList = tableListGetInfo(pTaskInfo->pTableInfoList, 0); int32_t size = tableListGetSize(pTaskInfo->pTableInfoList); - tAssert(size == 1); + ASSERT(size == 1); tsdbReaderOpen(pInfo->vnode, &pTaskInfo->streamInfo.tableCond, pList, size, NULL, &pInfo->dataReader, NULL); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 759ba37fad..043cc396b5 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -102,7 +102,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int void setOperatorCompleted(SOperatorInfo* pOperator) { pOperator->status = OP_EXEC_DONE; - tAssert(pOperator->pTaskInfo != NULL); + ASSERT(pOperator->pTaskInfo != NULL); pOperator->cost.totalCost = (taosGetTimestampUs() - pOperator->pTaskInfo->cost.start) / 1000.0; setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); @@ -202,7 +202,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR if (isIntervalQuery) { if (masterscan && p1 != NULL) { // the *p1 may be NULL in case of sliding+offset exists. pResult = getResultRowByPos(pResultBuf, p1, true); - tAssert(pResult->pageId == p1->pageId && pResult->offset == p1->offset); + ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset); } } else { // In case of group by column query, the required SResultRow object must be existInCurrentResusltRowInfo in the @@ -210,7 +210,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR if (p1 != NULL) { // todo pResult = getResultRowByPos(pResultBuf, p1, true); - tAssert(pResult->pageId == p1->pageId && pResult->offset == p1->offset); + ASSERT(pResult->pageId == p1->pageId && pResult->offset == p1->offset); } } @@ -223,7 +223,7 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR // allocate a new buffer page if (pResult == NULL) { - tAssert(pSup->resultRowSize > 0); + ASSERT(pSup->resultRowSize > 0); pResult = getNewResultRow(pResultBuf, &pSup->currentPageId, pSup->resultRowSize); // add a new result set for a new group @@ -463,9 +463,9 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int // todo: refactor this if (fmIsImplicitTsFunc(pCtx[i].functionId) && (j == pOneExpr->base.numOfParams - 1)) { pInput->pPTS = pInput->pData[j]; // in case of merge function, this is not always the ts column data. - // tAssert(pInput->pPTS->info.type == TSDB_DATA_TYPE_TIMESTAMP); + // ASSERT(pInput->pPTS->info.type == TSDB_DATA_TYPE_TIMESTAMP); } - tAssert(pInput->pData[j] != NULL); + ASSERT(pInput->pData[j] != NULL); } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { // todo avoid case: top(k, 12), 12 is the value parameter. // sum(11), 11 is also the value parameter. @@ -549,7 +549,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF da = pInput->pColumnDataAgg[paramIndex]; } - tAssert(!IS_VAR_DATA_TYPE(type)); + ASSERT(!IS_VAR_DATA_TYPE(type)); if (type == TSDB_DATA_TYPE_BIGINT) { int64_t v = pFuncParam->param.i; @@ -571,7 +571,7 @@ static int32_t doCreateConstantValColumnAggInfo(SInputColumnInfoData* pInput, SF } else if (type == TSDB_DATA_TYPE_TIMESTAMP) { // do nothing } else { - tAssert(0); + ASSERT(0); } return TSDB_CODE_SUCCESS; @@ -890,7 +890,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD if (pBlock->info.rows == totalRows) { pBlock->info.rows = numOfRows; } else { - tAssert(pBlock->info.rows == numOfRows); + ASSERT(pBlock->info.rows == numOfRows); } } @@ -1066,7 +1066,7 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - tAssert(pBlock->info.rows > 0); + ASSERT(pBlock->info.rows > 0); releaseBufPage(pBuf, page); break; } @@ -1100,7 +1100,7 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr // clear the existed group id pBlock->info.id.groupId = 0; - tAssert(!pbInfo->mergeResultBlock); + ASSERT(!pbInfo->mergeResultBlock); doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo); void* tbname = NULL; @@ -1579,7 +1579,7 @@ void destroyOperatorInfo(SOperatorInfo* pOperator) { // each operator should be set their own function to return total cost buffer int32_t optrDefaultBufFn(SOperatorInfo* pOperator) { if (pOperator->blocking) { - tAssert(0); + ASSERT(0); return 0; } else { return 0; @@ -1662,7 +1662,7 @@ int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo } void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows) { - tAssert(numOfRows != 0); + ASSERT(numOfRows != 0); pResultInfo->capacity = numOfRows; pResultInfo->threshold = numOfRows * 0.75; @@ -2090,7 +2090,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_PROJECT == type) { pOperator = createProjectOperatorInfo(NULL, (SProjectPhysiNode*)pPhyNode, pTaskInfo); } else { - tAssert(0); + ASSERT(0); } if (pOperator != NULL) { @@ -2182,7 +2182,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo } else if (QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC == type) { pOptr = createTimeSliceOperatorInfo(ops[0], pPhyNode, pTaskInfo); } else { - tAssert(0); + ASSERT(0); } taosMemoryFree(ops); @@ -2207,7 +2207,7 @@ static int32_t extractTbscanInStreamOpTree(SOperatorInfo* pOperator, STableScanI return extractTbscanInStreamOpTree(pOperator->pDownstream[0], ppInfo); } else { SStreamScanInfo* pInfo = pOperator->info; - tAssert(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); + ASSERT(pInfo->pTableScanOp->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN); *ppInfo = pInfo->pTableScanOp->info; return 0; } @@ -2219,13 +2219,13 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) { *ppNode = (STableScanPhysiNode*)pNode; return 0; } else { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } } else { if (LIST_LENGTH(pNode->pChildren) != 1) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_APP_ERROR; return -1; } @@ -2244,7 +2244,7 @@ int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHa STableScanPhysiNode* pNode = NULL; if (extractTableScanNode(plan->pNode, &pNode) < 0) { - tAssert(0); + ASSERT(0); } tsdbReaderClose(pTableScanInfo->dataReader); @@ -2252,7 +2252,7 @@ int32_t rebuildReader(SOperatorInfo* pOperator, SSubplan* plan, SReadHandle* pHa STableListInfo info = {0}; pTableScanInfo->dataReader = doCreateDataReader(pNode, pHandle, &info, NULL); if (pTableScanInfo->dataReader == NULL) { - tAssert(0); + ASSERT(0); qError("failed to create data reader"); return TSDB_CODE_APP_ERROR; } @@ -2449,7 +2449,7 @@ int32_t setOutputBuf(SStreamState* pState, STimeWindow* win, SResultRow** pResul return TSDB_CODE_OUT_OF_MEMORY; } *pResult = (SResultRow*)value; - tAssert(*pResult); + ASSERT(*pResult); // set time window for current result (*pResult)->win = (*win); setResultRowInitCtx(*pResult, pCtx, numOfOutput, rowEntryInfoOffset); @@ -2485,7 +2485,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat .groupId = pPos->groupId, }; int32_t code = streamStateGet(pState, &key, &pVal, &size); - tAssert(code == 0); + ASSERT(code == 0); SResultRow* pRow = (SResultRow*)pVal; doUpdateNumOfRows(pCtx, pRow, numOfExprs, rowEntryOffset); // no results, continue to check the next one @@ -2513,7 +2513,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - tAssert(pBlock->info.rows > 0); + ASSERT(pBlock->info.rows > 0); releaseOutputBuf(pState, &key, pRow); break; } @@ -2571,7 +2571,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta int32_t size = 0; void* pVal = NULL; int32_t code = streamStateSessionGet(pState, pKey, &pVal, &size); - tAssert(code == 0); + ASSERT(code == 0); if (code == -1) { // coverity scan pGroupResInfo->index += 1; @@ -2605,7 +2605,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta } if (pBlock->info.rows + pRow->numOfRows > pBlock->info.capacity) { - tAssert(pBlock->info.rows > 0); + ASSERT(pBlock->info.rows > 0); releaseOutputBuf(pState, NULL, pRow); break; } diff --git a/source/libs/executor/src/filloperator.c b/source/libs/executor/src/filloperator.c index 240c6f7e9f..8d5af64777 100644 --- a/source/libs/executor/src/filloperator.c +++ b/source/libs/executor/src/filloperator.c @@ -496,7 +496,7 @@ void getCurWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupI SWinKey key = {.ts = ts, .groupId = groupId}; int32_t curVLen = 0; int32_t code = streamStateFillGet(pState, &key, (void**)&pFillSup->cur.pRowVal, &curVLen); - tAssert(code == TSDB_CODE_SUCCESS); + ASSERT(code == TSDB_CODE_SUCCESS); pFillSup->cur.key = key.ts; } @@ -508,7 +508,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, void* curVal = NULL; int32_t curVLen = 0; int32_t code = streamStateFillGet(pState, &key, (void**)&curVal, &curVLen); - tAssert(code == TSDB_CODE_SUCCESS); + ASSERT(code == TSDB_CODE_SUCCESS); pFillSup->cur.key = key.ts; pFillSup->cur.pRowVal = curVal; @@ -523,7 +523,7 @@ void getWindowFromDiscBuf(SOperatorInfo* pOperator, TSKEY ts, uint64_t groupId, pFillSup->prev.pRowVal = preVal; code = streamStateCurNext(pState, pCur); - tAssert(code == TSDB_CODE_SUCCESS); + ASSERT(code == TSDB_CODE_SUCCESS); code = streamStateCurNext(pState, pCur); if (code != TSDB_CODE_SUCCESS) { @@ -680,7 +680,7 @@ void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillS pFillInfo->pLinearInfo->winIndex = 0; } break; default: - tAssert(0); + ASSERT(0); break; } } @@ -764,7 +764,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS pFillSup->next.pRowVal = pFillSup->cur.pRowVal; pFillInfo->preRowKey = INT64_MIN; } else { - tAssert(hasNextWindow(pFillSup)); + ASSERT(hasNextWindow(pFillSup)); setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; } @@ -798,7 +798,7 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS pFillInfo->pResRow = &pFillSup->prev; pFillInfo->pLinearInfo->hasNext = false; } else { - tAssert(hasNextWindow(pFillSup)); + ASSERT(hasNextWindow(pFillSup)); setFillKeyInfo(ts, nextWKey, &pFillSup->interval, pFillInfo); pFillInfo->pos = FILL_POS_START; pFillInfo->pLinearInfo->nextEnd = INT64_MIN; @@ -811,10 +811,10 @@ void setFillValueInfo(SSDataBlock* pBlock, TSKEY ts, int32_t rowId, SStreamFillS } } break; default: - tAssert(0); + ASSERT(0); break; } - tAssert(pFillInfo->pos != FILL_POS_INVALID); + ASSERT(pFillInfo->pos != FILL_POS_INVALID); } static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t groupId) { @@ -916,7 +916,7 @@ static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* static void keepResultInDiscBuf(SOperatorInfo* pOperator, uint64_t groupId, SResultRowData* pRow, int32_t len) { SWinKey key = {.groupId = groupId, .ts = pRow->key}; int32_t code = streamStateFillPut(pOperator->pTaskInfo->streamInfo.pState, &key, pRow->pRowVal, len); - tAssert(code == TSDB_CODE_SUCCESS); + ASSERT(code == TSDB_CODE_SUCCESS); } static void doStreamFillRange(SStreamFillInfo* pFillInfo, SStreamFillSupporter* pFillSup, SSDataBlock* pRes) { @@ -1269,7 +1269,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { pInfo->srcRowIndex = 0; } break; default: - tAssert(0); + ASSERT(0); break; } } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index de9f170092..2cd1bd7dec 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -195,7 +195,7 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData memcpy(pkey->pData, val, dataLen); } else if (IS_VAR_DATA_TYPE(pkey->type)) { memcpy(pkey->pData, val, varDataTLen(val)); - tAssert(varDataTLen(val) <= pkey->bytes); + ASSERT(varDataTLen(val) <= pkey->bytes); } else { memcpy(pkey->pData, val, pkey->bytes); } @@ -204,7 +204,7 @@ static void recordNewGroupKeys(SArray* pGroupCols, SArray* pGroupColVals, SSData } static int32_t buildGroupKeys(void* pKey, const SArray* pGroupColVals) { - tAssert(pKey != NULL); + ASSERT(pKey != NULL); size_t numOfGroupCols = taosArrayGetSize(pGroupColVals); char* isNull = (char*)pKey; @@ -224,7 +224,7 @@ static int32_t buildGroupKeys(void* pKey, const SArray* pGroupColVals) { } else if (IS_VAR_DATA_TYPE(pkey->type)) { varDataCopy(pStart, pkey->pData); pStart += varDataTLen(pkey->pData); - tAssert(varDataTLen(pkey->pData) <= pkey->bytes); + ASSERT(varDataTLen(pkey->pData) <= pkey->bytes); } else { memcpy(pStart, pkey->pData, pkey->bytes); pStart += pkey->bytes; @@ -535,7 +535,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { memcpy(data + (*columnLen), src, dataLen); int32_t v = (data + (*columnLen) + dataLen - (char*)pPage); - tAssert(v > 0); + ASSERT(v > 0); contentLen = dataLen; } else { @@ -543,7 +543,7 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { char* src = colDataGetData(pColInfoData, j); memcpy(data + (*columnLen), src, varDataTLen(src)); int32_t v = (data + (*columnLen) + varDataTLen(src) - (char*)pPage); - tAssert(v > 0); + ASSERT(v > 0); contentLen = varDataTLen(src); } @@ -557,13 +557,13 @@ static void doHashPartition(SOperatorInfo* pOperator, SSDataBlock* pBlock) { colDataSetNull_f(bitmap, (*rows)); } else { memcpy(data + (*columnLen), colDataGetData(pColInfoData, j), bytes); - tAssert((data + (*columnLen) + bytes - (char*)pPage) <= getBufPageSize(pInfo->pBuf)); + ASSERT((data + (*columnLen) + bytes - (char*)pPage) <= getBufPageSize(pInfo->pBuf)); } contentLen = bytes; } (*columnLen) += contentLen; - tAssert(*columnLen >= 0); + ASSERT(*columnLen >= 0); } (*rows) += 1; @@ -662,7 +662,7 @@ static int compareDataGroupInfo(const void* group1, const void* group2) { const SDataGroupInfo* pGroupInfo2 = group2; if (pGroupInfo1->groupId == pGroupInfo2->groupId) { - tAssert(0); + ASSERT(0); return 0; } @@ -897,7 +897,7 @@ static bool hasRemainPartion(SStreamPartitionOperatorInfo* pInfo) { return pInfo static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { SStreamPartitionOperatorInfo* pInfo = pOperator->info; SSDataBlock* pDest = pInfo->binfo.pRes; - tAssert(hasRemainPartion(pInfo)); + ASSERT(hasRemainPartion(pInfo)); SPartitionDataInfo* pParInfo = (SPartitionDataInfo*)pInfo->parIte; blockDataCleanup(pDest); int32_t rows = taosArrayGetSize(pParInfo->rowIds); @@ -926,10 +926,10 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { taosArrayPush(pResBlock->pDataBlock, &data); blockDataEnsureCapacity(pResBlock, 1); projectApplyFunctions(pInfo->tbnameCalSup.pExprInfo, pResBlock, pTmpBlock, pInfo->tbnameCalSup.pCtx, 1, NULL); - tAssert(pResBlock->info.rows == 1); - tAssert(taosArrayGetSize(pResBlock->pDataBlock) == 1); + ASSERT(pResBlock->info.rows == 1); + ASSERT(taosArrayGetSize(pResBlock->pDataBlock) == 1); SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, 0); - tAssert(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); void* pData = colDataGetVarData(pCol, 0); // TODO check tbname validity if (pData != (void*)-1) { @@ -955,7 +955,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) { pDest->info.id.groupId = pParInfo->groupId; pOperator->resultInfo.totalRows += pDest->info.rows; pInfo->parIte = taosHashIterate(pInfo->pPartitions, pInfo->parIte); - tAssert(pDest->info.rows > 0); + ASSERT(pDest->info.rows > 0); printDataBlock(pDest, "stream partitionby"); return pDest; } diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 10a05d2ba3..d460af971c 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -59,12 +59,12 @@ static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDown rightTsCol = col2; } else { if (col1->dataBlockId == pDownstream[0]->resultDataBlockId) { - tAssert(col2->dataBlockId == pDownstream[1]->resultDataBlockId); + ASSERT(col2->dataBlockId == pDownstream[1]->resultDataBlockId); leftTsCol = col1; rightTsCol = col2; } else { - tAssert(col1->dataBlockId == pDownstream[1]->resultDataBlockId); - tAssert(col2->dataBlockId == pDownstream[0]->resultDataBlockId); + ASSERT(col1->dataBlockId == pDownstream[1]->resultDataBlockId); + ASSERT(col2->dataBlockId == pDownstream[0]->resultDataBlockId); leftTsCol = col2; rightTsCol = col1; } @@ -72,7 +72,7 @@ static void extractTimeCondition(SJoinOperatorInfo* pInfo, SOperatorInfo** pDown setJoinColumnInfo(&pInfo->leftCol, leftTsCol); setJoinColumnInfo(&pInfo->rightCol, rightTsCol); } else { - tAssert(false); + ASSERT(false); }} SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, @@ -210,7 +210,7 @@ typedef struct SRowLocation { static int32_t mergeJoinGetBlockRowsEqualTs(SSDataBlock* pBlock, int16_t tsSlotId, int32_t startPos, int64_t timestamp, int32_t* pEndPos, SArray* rowLocations, SArray* createdBlocks) { int32_t numRows = pBlock->info.rows; - tAssert(startPos < numRows); + ASSERT(startPos < numRows); SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, tsSlotId); int32_t i = startPos; @@ -248,7 +248,7 @@ static int32_t mergeJoinGetDownStreamRowsEqualTimeStamp(SOperatorInfo* pOperator SSDataBlock* startDataBlock, int32_t startPos, int64_t timestamp, SArray* rowLocations, SArray* createdBlocks) { - tAssert(whichChild == 0 || whichChild == 1); + ASSERT(whichChild == 0 || whichChild == 1); SJoinOperatorInfo* pJoinInfo = pOperator->info; int32_t endPos = -1; @@ -364,8 +364,8 @@ static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); *pRightTs = *(int64_t*)pRightVal; - tAssert(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - tAssert(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); return true; } diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index f1829b466c..65bb40b195 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -162,7 +162,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, SOperatorInfo* pOperator) { // remainGroupOffset == 0 // here check for a new group data, we need to handle the data of the previous group. - tAssert(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1); + ASSERT(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1); if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.id.groupId) { pLimitInfo->numOfOutputGroups += 1; @@ -618,7 +618,7 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) { for (int32_t k = 0; k < pSup->numOfExprs; ++k) { int32_t outputSlotId = pExpr[k].base.resSchema.slotId; - tAssert(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); SColumnInfoData* pColInfoData = taosArrayGet(pRes->pDataBlock, outputSlotId); int32_t type = pExpr[k].base.pParam[0].param.nType; @@ -659,7 +659,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc for (int32_t k = 0; k < numOfOutput; ++k) { int32_t outputSlotId = pExpr[k].base.resSchema.slotId; - tAssert(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); + ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE); SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId); int32_t type = pExpr[k].base.pParam[0].param.nType; @@ -734,7 +734,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc } int32_t startOffset = createNewColModel ? 0 : pResult->info.rows; - tAssert(pResult->info.capacity > 0); + ASSERT(pResult->info.capacity > 0); colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows); colDataDestroy(&idata); @@ -804,7 +804,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc } int32_t startOffset = createNewColModel ? 0 : pResult->info.rows; - tAssert(pResult->info.capacity > 0); + ASSERT(pResult->info.capacity > 0); colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows); colDataDestroy(&idata); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f6b2b9c98b..0f35d3778d 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -348,7 +348,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca } } - tAssert(*status == FUNC_DATA_REQUIRED_DATA_LOAD); + ASSERT(*status == FUNC_DATA_REQUIRED_DATA_LOAD); // try to filter data block according to sma info if (pOperator->exprSupp.pFilterInfo != NULL && (!loadSMA)) { @@ -389,7 +389,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca return terrno; } - tAssert(p == pBlock); + ASSERT(p == pBlock); doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo, pBlock->info.rows); // restore the previous value @@ -638,7 +638,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { continue; } - tAssert(pBlock->info.id.uid != 0); + ASSERT(pBlock->info.id.uid != 0); pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid); uint32_t status = 0; @@ -665,7 +665,7 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) { pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid; pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey; - tAssert(pBlock->info.id.uid != 0); + ASSERT(pBlock->info.id.uid != 0); return pBlock; } return NULL; @@ -766,7 +766,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { int32_t num = 0; STableKeyInfo* pList = NULL; tableListGetGroupList(pTaskInfo->pTableInfoList, pInfo->currentGroupId, &pList, &num); - tAssert(pInfo->base.dataReader == NULL); + ASSERT(pInfo->base.dataReader == NULL); int32_t code = tsdbReaderOpen(pInfo->base.readHandle.vnode, &pInfo->base.cond, pList, num, pInfo->pResBlock, (STsdbReader**)&pInfo->base.dataReader, GET_TASKID(pTaskInfo)); @@ -777,7 +777,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) { SSDataBlock* result = doGroupedTableScan(pOperator); if (result != NULL) { - tAssert(result->info.id.uid != 0); + ASSERT(result->info.id.uid != 0); return result; } @@ -959,7 +959,7 @@ static bool isSlidingWindow(SStreamScanInfo* pInfo) { static void setGroupId(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t groupColIndex, int32_t rowIndex) { SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, groupColIndex); uint64_t* groupCol = (uint64_t*)pColInfo->pData; - tAssert(rowIndex < pBlock->info.rows); + ASSERT(rowIndex < pBlock->info.rows); pInfo->groupId = groupCol[rowIndex]; } @@ -1013,7 +1013,7 @@ static uint64_t getGroupIdByCol(SStreamScanInfo* pInfo, uint64_t uid, TSKEY ts, if (!pPreRes || pPreRes->info.rows == 0) { return 0; } - tAssert(pPreRes->info.rows == 1); + ASSERT(pPreRes->info.rows == 1); return calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pPreRes, 0); } @@ -1037,7 +1037,7 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ return false; } - tAssert(taosArrayGetSize(pBlock->pDataBlock) >= 3); + ASSERT(taosArrayGetSize(pBlock->pDataBlock) >= 3); SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1068,7 +1068,7 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_ win.skey = TMIN(win.skey, startData[*pRowIndex]); continue; } - tAssert(!(win.skey > startData[*pRowIndex] && win.ekey < endData[*pRowIndex]) || + ASSERT(!(win.skey > startData[*pRowIndex] && win.ekey < endData[*pRowIndex]) || !(isInTimeWindow(&win, startData[*pRowIndex], 0) || isInTimeWindow(&win, endData[*pRowIndex], 0))); break; } @@ -1173,7 +1173,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr if (code != TSDB_CODE_SUCCESS) { return code; } - tAssert(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); + ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3); SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX); TSKEY* startData = (TSKEY*)pStartTsCol->pData; SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX); @@ -1199,7 +1199,7 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr } SSessionKey endWin = {0}; getCurSessionWindow(pInfo->windowSup.pStreamAggSup, endData[i], endData[i], groupId, &endWin); - tAssert(!IS_INVALID_SESSION_WIN_KEY(endWin)); + ASSERT(!IS_INVALID_SESSION_WIN_KEY(endWin)); colDataAppend(pDestStartCol, i, (const char*)&startWin.win.skey, false); colDataAppend(pDestEndCol, i, (const char*)&endWin.win.ekey, false); @@ -1225,7 +1225,7 @@ static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pS SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; - tAssert(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t version = pSrcBlock->info.version - 1; @@ -1306,7 +1306,7 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS uint64_t* srcUidData = (uint64_t*)pSrcUidCol->pData; SColumnInfoData* pSrcGpCol = taosArrayGet(pSrcBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* srcGp = (uint64_t*)pSrcGpCol->pData; - tAssert(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pSrcStartTsCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* srcStartTsCol = (TSKEY*)pSrcStartTsCol->pData; TSKEY* srcEndTsCol = (TSKEY*)pSrcEndTsCol->pData; int64_t version = pSrcBlock->info.version - 1; @@ -1361,7 +1361,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { tdbFree(tbname); SSDataBlock* pSrcBlock = blockCopyOneRow(pBlock, 0); - tAssert(pSrcBlock->info.rows == 1); + ASSERT(pSrcBlock->info.rows == 1); SSDataBlock* pResBlock = createDataBlock(); pResBlock->info.rowSize = VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN; @@ -1370,10 +1370,10 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) { blockDataEnsureCapacity(pResBlock, 1); projectApplyFunctions(pTbNameCalSup->pExprInfo, pResBlock, pSrcBlock, pTbNameCalSup->pCtx, 1, NULL); - tAssert(pResBlock->info.rows == 1); - tAssert(taosArrayGetSize(pResBlock->pDataBlock) == 1); + ASSERT(pResBlock->info.rows == 1); + ASSERT(taosArrayGetSize(pResBlock->pDataBlock) == 1); SColumnInfoData* pCol = taosArrayGet(pResBlock->pDataBlock, 0); - tAssert(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_VARCHAR); void* pData = colDataGetData(pCol, 0); // TODO check tbname validation @@ -1419,7 +1419,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock blockDataEnsureCapacity(pInfo->pUpdateDataRes, pBlock->info.rows * 2); } SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex); - tAssert(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP); TSKEY* tsCol = (TSKEY*)pColDataInfo->pData; bool tableInserted = updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.id.uid); for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) { @@ -1533,7 +1533,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { qError("submit msg messed up when initing stream submit block %p", pSubmit); pInfo->tqReader->pMsg = NULL; pTaskInfo->streamInfo.pReq = NULL; - tAssert(0); + ASSERT(0); } } @@ -1578,7 +1578,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { tqOffsetResetToLog(&pTaskInfo->streamInfo.lastStatus, pTaskInfo->streamInfo.snapshotVer); return NULL; } - tAssert(pInfo->tqReader->pWalReader->curVersion == pTaskInfo->streamInfo.snapshotVer + 1); + ASSERT(pInfo->tqReader->pWalReader->curVersion == pTaskInfo->streamInfo.snapshotVer + 1); } else { return NULL; } @@ -1592,7 +1592,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (ret.fetchType == FETCH_TYPE__DATA) { blockDataCleanup(pInfo->pRes); if (setBlockIntoRes(pInfo, &ret.data, true) < 0) { - tAssert(0); + ASSERT(0); } if (pInfo->pRes->info.rows > 0) { pOperator->status = OP_EXEC_RECV; @@ -1600,15 +1600,15 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return pInfo->pRes; } } else if (ret.fetchType == FETCH_TYPE__META) { - tAssert(0); + ASSERT(0); // pTaskInfo->streamInfo.lastStatus = ret.offset; // pTaskInfo->streamInfo.metaBlk = ret.meta; // return NULL; } else if (ret.fetchType == FETCH_TYPE__NONE || (ret.fetchType == FETCH_TYPE__SEP && pOperator->status == OP_EXEC_RECV)) { pTaskInfo->streamInfo.lastStatus = ret.offset; - tAssert(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); - tAssert(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); + ASSERT(pTaskInfo->streamInfo.lastStatus.version >= pTaskInfo->streamInfo.prepareStatus.version); + ASSERT(pTaskInfo->streamInfo.lastStatus.version + 1 == pInfo->tqReader->pWalReader->curVersion); char formatBuf[80]; tFormatOffset(formatBuf, 80, &ret.offset); qDebug("queue scan log return null, offset %s", formatBuf); @@ -1627,7 +1627,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { return NULL; #endif } else { - tAssert(0); + ASSERT(0); return NULL; } } @@ -1701,26 +1701,26 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { }; char tmp[100] = "abcdefg1"; if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) { - tAssert(0); + ASSERT(0); } key.ts = 2; char tmp2[100] = "abcdefg2"; if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) { - tAssert(0); + ASSERT(0); } key.groupId = 5; key.ts = 1; char tmp3[100] = "abcdefg3"; if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) { - tAssert(0); + ASSERT(0); } char* val2 = NULL; int32_t sz; if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) { - tAssert(0); + ASSERT(0); } printf("stream read %s %d\n", val2, sz); streamFreeVal(val2); @@ -2001,7 +2001,7 @@ FETCH_NEXT_BLOCK: goto NEXT_SUBMIT_BLK; } else { - tAssert(0); + ASSERT(0); return NULL; } } @@ -2115,8 +2115,8 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { // fetchVer++; // } // } else{ - // tAssert(pInfo->sContext->withMeta); - // tAssert(IS_META_MSG(pHead->msgType)); + // ASSERT(pInfo->sContext->withMeta); + // ASSERT(IS_META_MSG(pHead->msgType)); // qDebug("tmqsnap fetch meta msg, ver:%" PRId64 ", type:%d", pHead->version, pHead->msgType); // pTaskInfo->streamInfo.metaRsp.rspOffset.version = fetchVer; // pTaskInfo->streamInfo.metaRsp.rspOffset.type = TMQ_OFFSET__LOG; @@ -2289,11 +2289,11 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys } if (pHandle->initTqReader) { - tAssert(pHandle->tqReader == NULL); + ASSERT(pHandle->tqReader == NULL); pInfo->tqReader = tqOpenReader(pHandle->vnode); - tAssert(pInfo->tqReader); + ASSERT(pInfo->tqReader); } else { - tAssert(pHandle->tqReader); + ASSERT(pHandle->tqReader); pInfo->tqReader = pHandle->tqReader; } @@ -2805,7 +2805,7 @@ void destroyTableMergeScanOperatorInfo(void* param) { } int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - tAssert(pOptr != NULL); + ASSERT(pOptr != NULL); // TODO: merge these two info into one struct STableMergeScanExecInfo* execInfo = taosMemoryCalloc(1, sizeof(STableMergeScanExecInfo)); STableMergeScanInfo* pInfo = pOptr->info; @@ -3052,7 +3052,7 @@ _error: void fillTableCountScanDataBlock(STableCountScanSupp* pSupp, char* dbName, char* stbName, int64_t count, SSDataBlock* pRes) { if (pSupp->dbNameSlotId != -1) { - tAssert(strlen(dbName)); + ASSERT(strlen(dbName)); SColumnInfoData* colInfoData = taosArrayGet(pRes->pDataBlock, pSupp->dbNameSlotId); char varDbName[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index 42f668eb48..005b794f0b 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -138,7 +138,7 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // tAssert(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -271,7 +271,7 @@ void destroySortOperatorInfo(void* param) { } int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - tAssert(pOptr != NULL); + ASSERT(pOptr != NULL); SSortExecInfo* pInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SSortOperatorInfo* pOperatorInfo = (SSortOperatorInfo*)pOptr->info; @@ -328,7 +328,7 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); - // tAssert(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + // ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); @@ -447,7 +447,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) { SSDataBlock* pBlock = NULL; while (pInfo->pCurrSortHandle != NULL) { // beginSortGroup would fetch all child blocks of pInfo->currGroupId; - tAssert(pInfo->childOpStatus != CHILD_OP_SAME_GROUP); + ASSERT(pInfo->childOpStatus != CHILD_OP_SAME_GROUP); pBlock = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, pInfo->matchInfo.pList, pInfo); if (pBlock != NULL) { @@ -744,7 +744,7 @@ void destroyMultiwayMergeOperatorInfo(void* param) { } int32_t getMultiwayMergeExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* len) { - tAssert(pOptr != NULL); + ASSERT(pOptr != NULL); SSortExecInfo* pSortExecInfo = taosMemoryCalloc(1, sizeof(SSortExecInfo)); SMultiwayMergeOperatorInfo* pInfo = (SMultiwayMergeOperatorInfo*)pOptr->info; @@ -774,7 +774,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size pInfo->binfo.pRes = createDataBlockFromDescNode(pDescNode); int32_t rowSize = pInfo->binfo.pRes->info.rowSize; - tAssert(rowSize < 100 * 1024 * 1024); + ASSERT(rowSize < 100 * 1024 * 1024); int32_t numOfOutputCols = 0; code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 8150424104..d30c1fbfa1 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -272,7 +272,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SRowVa saveColData(pRowVal->pRowVal, i, p, isNull); } else { - tAssert(0); + ASSERT(0); } } } @@ -286,7 +286,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t bool ascFill = FILL_IS_ASC_FILL(pFillInfo); #if 0 - tAssert(ascFill && (pFillInfo->currentKey >= pFillInfo->start) || (!ascFill && (pFillInfo->currentKey <= pFillInfo->start))); + ASSERT(ascFill && (pFillInfo->currentKey >= pFillInfo->start) || (!ascFill && (pFillInfo->currentKey <= pFillInfo->start))); #endif while (pFillInfo->numOfCurrent < outputRows) { @@ -311,7 +311,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t return outputRows; } } else { - tAssert(pFillInfo->currentKey == ts); + ASSERT(pFillInfo->currentKey == ts); int32_t index = pBlock->info.rows; if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) { diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 28b026aa23..072a96fa83 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -95,7 +95,7 @@ static void doKeepLinearInfo(STimeSliceOperatorInfo* pSliceInfo, const SSDataBlo // TODO: optimize to ignore null values for linear interpolation. if (!pLinearInfo->isStartSet) { if (!colDataIsNull_s(pColInfoData, rowIndex)) { - tAssert(IS_MATHABLE_TYPE(pColInfoData->info.type)); + ASSERT(IS_MATHABLE_TYPE(pColInfoData->info.type)); pLinearInfo->start.key = *(int64_t*)colDataGetData(pTsCol, rowIndex); memcpy(pLinearInfo->start.val, colDataGetData(pColInfoData, rowIndex), pLinearInfo->bytes); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 5202076ed4..d9a011a892 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -312,7 +312,7 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr SFunctParam* pParam = &pCtx[k].param[0]; SColumnInfoData* pColInfo = taosArrayGet(pDataBlock, pParam->pCol->slotId); - tAssert(pColInfo->info.type == pParam->pCol->type && curTs != windowKey); + ASSERT(pColInfo->info.type == pParam->pCol->type && curTs != windowKey); double v1 = 0, v2 = 0, v = 0; if (prevRowIndex == -1) { @@ -520,7 +520,7 @@ static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, } static bool isResultRowInterpolated(SResultRow* pResult, SResultTsInterpType type) { - tAssert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); + ASSERT(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); if (type == RESULT_ROW_START_INTERP) { return pResult->startInterp == true; } else { @@ -543,7 +543,7 @@ static void doWindowBorderInterpolation(SIntervalAggOperatorInfo* pInfo, SSDataB return; } - tAssert(pBlock != NULL); + ASSERT(pBlock != NULL); if (pBlock->pDataBlock == NULL) { // tscError("pBlock->pDataBlock == NULL"); return; @@ -602,7 +602,7 @@ static void saveDataBlockLastRow(SArray* pPrevKeys, const SSDataBlock* pBlock, S char* val = colDataGetData(pColInfo, i); if (IS_VAR_DATA_TYPE(pkey->type)) { memcpy(pkey->pData, val, varDataTLen(val)); - tAssert(varDataTLen(val) <= pkey->bytes); + ASSERT(varDataTLen(val) <= pkey->bytes); } else { memcpy(pkey->pData, val, pkey->bytes); } @@ -634,10 +634,10 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num } SResultRow* pr = getResultRowByPos(pInfo->aggSup.pResultBuf, p1, false); - tAssert(pr->offset == p1->offset && pr->pageId == p1->pageId); + ASSERT(pr->offset == p1->offset && pr->pageId == p1->pageId); if (pr->closed) { - tAssert(isResultRowInterpolated(pr, RESULT_ROW_START_INTERP) && + ASSERT(isResultRowInterpolated(pr, RESULT_ROW_START_INTERP) && isResultRowInterpolated(pr, RESULT_ROW_END_INTERP)); SListNode* pNode = tdListPopHead(pResultRowInfo->openWindow); taosMemoryFree(pNode); @@ -651,7 +651,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); } - tAssert(!isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)); + ASSERT(!isResultRowInterpolated(pResult, RESULT_ROW_END_INTERP)); SGroupKeys* pTsKey = taosArrayGet(pInfo->pPrevValues, 0); int64_t prevTs = *(int64_t*)pTsKey->pData; @@ -897,7 +897,7 @@ static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { } bool isOverdue(TSKEY ekey, STimeWindowAggSupp* pTwSup) { - tAssert(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); + ASSERT(pTwSup->maxTs == INT64_MIN || pTwSup->maxTs > 0); return pTwSup->maxTs != INT64_MIN && ekey < pTwSup->maxTs - pTwSup->waterMark; } @@ -932,7 +932,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, pInfo->inputOrder); - tAssert(forwardRows > 0); + ASSERT(forwardRows > 0); // prev time window not interpolation yet. if (pInfo->timeWindowInterpo) { @@ -1387,7 +1387,7 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); uint64_t groupId = *(uint64_t*)key; - tAssert(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); + ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))); TSKEY ts = *(int64_t*)((char*)key + sizeof(uint64_t)); SResultRowPosition* pPos = (SResultRowPosition*)pIte; int32_t code = saveWinResult(ts, pPos->pageId, pPos->offset, groupId, resWins); @@ -1536,7 +1536,7 @@ static void closeChildIntervalWindow(SOperatorInfo* pOperator, SArray* pChildren for (int32_t i = 0; i < size; i++) { SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); SStreamIntervalOperatorInfo* pChInfo = pChildOp->info; - tAssert(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); + ASSERT(pChInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE); pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); closeStreamIntervalWindow(pChInfo->aggSup.pResultRowHashTable, &pChInfo->twAggSup, &pChInfo->interval, NULL, NULL, NULL, pOperator); @@ -1756,7 +1756,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh .maxTs = INT64_MIN, }; - tAssert(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERT(as.calTrigger != STREAM_TRIGGER_MAX_DELAY); pInfo->win = pTaskInfo->window; pInfo->inputOrder = (pPhyNode->window.inputTsOrder == ORDER_ASC) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; @@ -2241,7 +2241,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB return; } blockDataEnsureCapacity(pBlock, size - (*pIndex)); - tAssert(3 <= taosArrayGetSize(pBlock->pDataBlock)); + ASSERT(3 <= taosArrayGetSize(pBlock->pDataBlock)); SColumnInfoData* pStartTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX); SColumnInfoData* pEndTs = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX); SColumnInfoData* pGroupId = (SColumnInfoData*)taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); @@ -2341,7 +2341,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p SResultRow* pResult = NULL; int32_t forwardRows = 0; - tAssert(pSDataBlock->pDataBlock != NULL); + ASSERT(pSDataBlock->pDataBlock != NULL); SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; @@ -2436,7 +2436,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p pInfo->delKey = key; } int32_t prevEndPos = (forwardRows - 1) * step + startPos; - tAssert(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); + ASSERT(pSDataBlock->info.window.skey > 0 && pSDataBlock->info.window.ekey > 0); startPos = getNextQualifiedWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCols, prevEndPos, TSDB_ORDER_ASC); if (startPos < 0) { @@ -2463,7 +2463,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - tAssert(IS_FINAL_OP(pInfo)); + ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2524,7 +2524,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->numOfDatapack++; printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "interval final recv" : "interval semi recv"); - tAssert(pBlock->info.type != STREAM_INVERT); + ASSERT(pBlock->info.type != STREAM_INVERT); if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || @@ -2614,7 +2614,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doBuildPullDataBlock(pInfo->pPullWins, &pInfo->pullIndex, pInfo->pPullDataRes); if (pInfo->pPullDataRes->info.rows != 0) { // process the rest of the data - tAssert(IS_FINAL_OP(pInfo)); + ASSERT(IS_FINAL_OP(pInfo)); printDataBlock(pInfo->pPullDataRes, IS_FINAL_OP(pInfo) ? "interval final" : "interval semi"); return pInfo->pPullDataRes; } @@ -2662,7 +2662,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, .deleteMarkSaved = 0, .calTriggerSaved = 0, }; - tAssert(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERT(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY); pInfo->primaryTsIndex = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId; size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -2687,7 +2687,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, initStreamFunciton(pOperator->exprSupp.pCtx, pOperator->exprSupp.numOfExprs); - tAssert(numOfCols > 0); + ASSERT(numOfCols > 0); initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window); pInfo->pState = taosMemoryCalloc(1, sizeof(SStreamState)); @@ -2720,7 +2720,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, // semi interval operator does not catch result pInfo->isFinal = false; pOperator->name = "StreamSemiIntervalOperator"; - tAssert(pInfo->aggSup.currentPageId == -1); + ASSERT(pInfo->aggSup.currentPageId == -1); } if (!IS_FINAL_OP(pInfo) || numOfChild == 0) { @@ -2806,7 +2806,7 @@ int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* pSup->pCtx[i].saveHandle.pBuf = NULL; } - tAssert(numOfCols > 0); + ASSERT(numOfCols > 0); return TSDB_CODE_SUCCESS; } @@ -2985,7 +2985,7 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs, TS static int32_t initSessionOutputBuf(SResultWindowInfo* pWinInfo, SResultRow** pResult, SqlFunctionCtx* pCtx, int32_t numOfOutput, int32_t* rowEntryInfoOffset) { - tAssert(pWinInfo->sessionWin.win.skey <= pWinInfo->sessionWin.win.ekey); + ASSERT(pWinInfo->sessionWin.win.skey <= pWinInfo->sessionWin.win.ekey); *pResult = (SResultRow*)pWinInfo->pOutputBuf; // set time window for current result (*pResult)->win = pWinInfo->sessionWin.win; @@ -3137,7 +3137,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData } void deleteWindow(SArray* pWinInfos, int32_t index, FDelete fp) { - tAssert(index >= 0 && index < taosArrayGetSize(pWinInfos)); + ASSERT(index >= 0 && index < taosArrayGetSize(pWinInfos)); if (fp) { void* ptr = taosArrayGet(pWinInfos, index); fp(ptr); @@ -3192,7 +3192,7 @@ static int32_t copyUpdateResult(SSHashObj* pStUpdated, SArray* pUpdated) { int32_t iter = 0; while ((pIte = tSimpleHashIterate(pStUpdated, pIte, &iter)) != NULL) { void* key = tSimpleHashGetKey(pIte, &keyLen); - tAssert(keyLen == sizeof(SSessionKey)); + ASSERT(keyLen == sizeof(SSessionKey)); taosArrayPush(pUpdated, key); } taosArraySort(pUpdated, sessionKeyCompareAsc); @@ -3253,7 +3253,7 @@ static void rebuildSessionWindow(SOperatorInfo* pOperator, SArray* pWinArray, SS SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; int32_t numOfOutput = pSup->numOfExprs; int32_t numOfChildren = taosArrayGetSize(pInfo->pChildren); - tAssert(pInfo->pChildren); + ASSERT(pInfo->pChildren); for (int32_t i = 0; i < size; i++) { SSessionKey* pWinKey = taosArrayGet(pWinArray, i); @@ -3354,7 +3354,7 @@ static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) { void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) { pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; - tAssert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); + ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroupResInfo* pGroupResInfo, @@ -4221,7 +4221,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) { } else { if (pMiaInfo->groupId != pBlock->info.id.groupId) { // if there are unclosed time window, close it firstly. - tAssert(pMiaInfo->curTs != INT64_MIN); + ASSERT(pMiaInfo->curTs != INT64_MIN); finalizeResultRows(pIaInfo->aggSup.pResultBuf, &pResultRowInfo->cur, pSup, pRes, pTaskInfo); resetResultRow(pMiaInfo->pResultRow, pIaInfo->aggSup.resultRowSize - sizeof(SResultRow)); @@ -4391,7 +4391,7 @@ static int32_t finalizeWindowResult(SOperatorInfo* pOperatorInfo, uint64_t table SET_RES_WINDOW_KEY(iaInfo->aggSup.keyBuf, &win->skey, TSDB_KEYSIZE, tableGroupId); SResultRowPosition* p1 = (SResultRowPosition*)tSimpleHashGet( iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE)); - tAssert(p1 != NULL); + ASSERT(p1 != NULL); // finalizeResultRows(iaInfo->aggSup.pResultBuf, p1, pResultBlock, pTaskInfo); tSimpleHashRemove(iaInfo->aggSup.pResultRowHashTable, iaInfo->aggSup.keyBuf, GET_RES_WINDOW_KEY_LEN(TSDB_KEYSIZE)); return TSDB_CODE_SUCCESS; @@ -4454,7 +4454,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo* TSKEY ekey = ascScan ? win.ekey : win.skey; int32_t forwardRows = getNumOfRowsInTimeWindow(&pBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, iaInfo->inputOrder); - tAssert(forwardRows > 0); + ASSERT(forwardRows > 0); // prev time window not interpolation yet. if (iaInfo->timeWindowInterpo) { @@ -4785,7 +4785,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys int32_t code = TSDB_CODE_SUCCESS; int32_t numOfCols = 0; SExprInfo* pExprInfo = createExprInfo(pIntervalPhyNode->window.pFuncs, NULL, &numOfCols); - tAssert(numOfCols > 0); + ASSERT(numOfCols > 0); SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); SInterval interval = { @@ -4805,7 +4805,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .deleteMark = INT64_MAX, }; - tAssert(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); + ASSERT(twAggSupp.calTrigger != STREAM_TRIGGER_MAX_DELAY); pOperator->pTaskInfo = pTaskInfo; pInfo->interval = interval; diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c index 8caa0b4e34..4204692514 100644 --- a/source/libs/executor/src/tlinearhash.c +++ b/source/libs/executor/src/tlinearhash.c @@ -17,7 +17,6 @@ #include "taoserror.h" #include "tdef.h" #include "tpagedbuf.h" -#include "tlog.h" #define LHASH_CAP_RATIO 0.85 @@ -59,7 +58,7 @@ static int32_t doGetBucketIdFromHashVal(int32_t hashv, int32_t bits) { return ha static int32_t doGetAlternativeBucketId(int32_t bucketId, int32_t bits, int32_t numOfBuckets) { int32_t v = bucketId - (1ul << (bits - 1)); - tAssert(v < numOfBuckets); + ASSERT(v < numOfBuckets); return v; } @@ -85,11 +84,11 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t int32_t pageId = *(int32_t*)taosArrayGetLast(pBucket->pPageIdList); SFilePage* pPage = getBufPage(pHashObj->pBuf, pageId); - tAssert(pPage != NULL); + ASSERT(pPage != NULL); // put to current buf page size_t nodeSize = sizeof(SLHashNode) + keyLen + size; - tAssert(nodeSize + sizeof(SFilePage) <= getBufPageSize(pHashObj->pBuf)); + ASSERT(nodeSize + sizeof(SFilePage) <= getBufPageSize(pHashObj->pBuf)); if (pPage->num + nodeSize > getBufPageSize(pHashObj->pBuf)) { releaseBufPage(pHashObj->pBuf, pPage); @@ -123,7 +122,7 @@ static int32_t doAddToBucket(SLHashObj* pHashObj, SLHashBucket* pBucket, int32_t } static void doRemoveFromBucket(SFilePage* pPage, SLHashNode* pNode, SLHashBucket* pBucket) { - tAssert(pPage != NULL && pNode != NULL && pBucket->size >= 1); + ASSERT(pPage != NULL && pNode != NULL && pBucket->size >= 1); int32_t len = GET_LHASH_NODE_LEN(pNode); char* p = (char*)pNode + len; @@ -172,7 +171,7 @@ static void doTrimBucketPages(SLHashObj* pHashObj, SLHashBucket* pBucket) { setBufPageDirty(pFirst, true); setBufPageDirty(pLast, true); - tAssert(pLast->num >= nodeSize + sizeof(SFilePage)); + ASSERT(pLast->num >= nodeSize + sizeof(SFilePage)); pFirst->num += nodeSize; pLast->num -= nodeSize; @@ -301,7 +300,7 @@ void* tHashCleanup(SLHashObj* pHashObj) { } int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data, size_t size) { - tAssert(pHashObj != NULL && key != NULL); + ASSERT(pHashObj != NULL && key != NULL); if (pHashObj->bits == 0) { SLHashBucket* pBucket = pHashObj->pBucket[0]; @@ -337,7 +336,7 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data int32_t numOfBits = ceil(log(pHashObj->numOfBuckets) / log(2)); if (numOfBits > pHashObj->bits) { // printf("extend the bits from %d to %d, new bucket:%d\n", pHashObj->bits, numOfBits, newBucketId); - tAssert(numOfBits == pHashObj->bits + 1); + ASSERT(numOfBits == pHashObj->bits + 1); pHashObj->bits = numOfBits; } @@ -354,14 +353,14 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data char* pStart = p->data; while (pStart - ((char*)p) < p->num) { SLHashNode* pNode = (SLHashNode*)pStart; - tAssert(pNode->keyLen > 0); + ASSERT(pNode->keyLen > 0); char* k = GET_LHASH_NODE_KEY(pNode); int32_t hashv = pHashObj->hashFn(k, pNode->keyLen); int32_t v1 = doGetBucketIdFromHashVal(hashv, pHashObj->bits); if (v1 != splitBucketId) { // place it into the new bucket - tAssert(v1 == newBucketId); + ASSERT(v1 == newBucketId); // printf("move key:%d to 0x%x bucket, remain items:%d\n", *(int32_t*)k, v1, pBucket->size - 1); SLHashBucket* pNewBucket = pHashObj->pBucket[newBucketId]; @@ -385,7 +384,7 @@ int32_t tHashPut(SLHashObj* pHashObj, const void* key, size_t keyLen, void* data } char* tHashGet(SLHashObj* pHashObj, const void* key, size_t keyLen) { - tAssert(pHashObj != NULL && key != NULL && keyLen > 0); + ASSERT(pHashObj != NULL && key != NULL && keyLen > 0); int32_t hashv = pHashObj->hashFn(key, keyLen); int32_t bucketId = doGetBucketIdFromHashVal(hashv, pHashObj->bits); diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index 04694b0511..484d917069 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -49,7 +49,7 @@ static FORCE_INLINE int32_t taosHashCapacity(int32_t length) { } SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { - tAssert(fn != NULL); + ASSERT(fn != NULL); if (capacity == 0) { capacity = 4; @@ -66,7 +66,7 @@ SSHashObj *tSimpleHashInit(size_t capacity, _hash_fn_t fn) { pHashObj->equalFp = memcmp; pHashObj->hashFp = fn; - tAssert((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); + ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHNode **)taosMemoryCalloc(pHashObj->capacity, sizeof(void *)); if (!pHashObj->hashList) { @@ -214,7 +214,7 @@ static FORCE_INLINE SHNode *doSearchInEntryList(SSHashObj *pHashObj, const void SHNode *pNode = pHashObj->hashList[index]; while (pNode) { const char* p = GET_SHASH_NODE_KEY(pNode, pNode->dataLen); - tAssert(keyLen > 0); + ASSERT(keyLen > 0); if (pNode->keyLen == keyLen && ((*(pHashObj->equalFp))(p, key, keyLen) == 0)) { break; diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index e93aa48a12..30911887bb 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -170,7 +170,7 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf* pBuf, SArray* pAllSource // The value of numOfRows must be greater than 0, which is guaranteed by the previous memory allocation int32_t numOfRows = (getBufPageSize(pBuf) - blockDataGetSerialMetaSize(taosArrayGetSize(pBlock->pDataBlock))) / rowSize; - tAssert(numOfRows > 0); + ASSERT(numOfRows > 0); return blockDataEnsureCapacity(pSource->src.pBlock, numOfRows); } @@ -735,7 +735,7 @@ int32_t tsortOpen(SSortHandle* pHandle) { int32_t numOfSources = taosArrayGetSize(pHandle->pOrderedSource); if (pHandle->pBuf != NULL) { - tAssert(numOfSources <= getNumOfInMemBufPages(pHandle->pBuf)); + ASSERT(numOfSources <= getNumOfInMemBufPages(pHandle->pBuf)); } if (numOfSources == 0) { @@ -808,7 +808,7 @@ STupleHandle* tsortNextTuple(SSortHandle* pHandle) { index = tMergeTreeGetChosenIndex(pHandle->pMergeTree); pSource = pHandle->cmpParam.pSources[index]; - tAssert(pSource->src.pBlock != NULL); + ASSERT(pSource->src.pBlock != NULL); pHandle->tupleHandle.rowIndex = pSource->src.rowIndex; pHandle->tupleHandle.pBlock = pSource->src.pBlock; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index ac8457805c..07e480ee1d 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -20,7 +20,6 @@ #include "scalar.h" #include "taoserror.h" #include "ttime.h" -#include "tlog.h" static int32_t buildFuncErrMsg(char* pErrBuf, int32_t len, int32_t errCode, const char* pFormat, ...) { va_list vArgList; @@ -1010,7 +1009,7 @@ static bool validateHistogramBinDesc(char* binDescStr, int8_t binType, char* err intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - tAssert(numOfBins >= 4); + ASSERT(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } @@ -1355,7 +1354,7 @@ static int32_t translateCsum(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { } else if (IS_FLOAT_TYPE(colType)) { resType = TSDB_DATA_TYPE_DOUBLE; } else { - tAssert(0); + ASSERT(0); } } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 51c3a02cff..111da6d6ba 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -506,7 +506,7 @@ static int32_t getNumOfElems(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; if (pInput->colDataSMAIsSet && pInput->totalRows == pInput->numOfRows && !IS_VAR_DATA_TYPE(pInputCol->info.type)) { numOfElem = pInput->numOfRows - pInput->pColumnDataAgg[0]->numOfNull; - tAssert(numOfElem >= 0); + ASSERT(numOfElem >= 0); } else { if (pInputCol->hasNull) { for (int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { @@ -596,7 +596,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { if (pInput->colDataSMAIsSet) { numOfElem = pInput->numOfRows - pAgg->numOfNull; - tAssert(numOfElem >= 0); + ASSERT(numOfElem >= 0); if (IS_SIGNED_NUMERIC_TYPE(type)) { pSumRes->isum += pAgg->sum; @@ -661,7 +661,7 @@ int32_t sumInvertFunction(SqlFunctionCtx* pCtx) { if (pInput->colDataSMAIsSet) { numOfElem = pInput->numOfRows - pAgg->numOfNull; - tAssert(numOfElem >= 0); + ASSERT(numOfElem >= 0); if (IS_SIGNED_NUMERIC_TYPE(type)) { pSumRes->isum -= pAgg->sum; @@ -832,7 +832,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; SColumnInfoData* pDstCol = taosArrayGet(pBlock->pDataBlock, dstSlotId); - tAssert(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); + ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (nullList[j]) { colDataAppendNULL(pDstCol, rowIndex); } else { @@ -873,7 +873,7 @@ void appendSelectivityValue(SqlFunctionCtx* pCtx, int32_t rowIndex, int32_t pos) int32_t dstSlotId = pc->pExpr->base.resSchema.slotId; SColumnInfoData* pDstCol = taosArrayGet(pCtx->pDstBlock->pDataBlock, dstSlotId); - tAssert(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); + ASSERT(pc->pExpr->base.resSchema.bytes == pDstCol->info.bytes); if (colDataIsNull_s(pSrcCol, rowIndex) == true) { colDataAppendNULL(pDstCol, pos); @@ -1142,7 +1142,7 @@ static void stddevTransferInfo(SStddevRes* pInput, SStddevRes* pOutput) { int32_t stddevFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SStddevRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -1838,7 +1838,7 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); @@ -2003,8 +2003,8 @@ static void firstlastSaveTupleData(const SSDataBlock* pSrcBlock, int32_t rowInde if (!pInfo->hasResult) { pInfo->pos = saveTupleData(pCtx, rowIndex, pSrcBlock, NULL); - tAssert(pCtx->subsidiaries.buf != NULL); - tAssert(pCtx->subsidiaries.rowLen > 0); + ASSERT(pCtx->subsidiaries.buf != NULL); + ASSERT(pCtx->subsidiaries.rowLen > 0); } else { updateTupleData(pCtx, rowIndex, pSrcBlock, &pInfo->pos); } @@ -2044,7 +2044,7 @@ int32_t firstFunction(SqlFunctionCtx* pCtx) { // All null data column, return directly. if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows)) { - tAssert(pInputCol->hasNull == true); + ASSERT(pInputCol->hasNull == true); // save selectivity value for column consisted of all null values firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); return TSDB_CODE_SUCCESS; @@ -2152,7 +2152,7 @@ int32_t lastFunction(SqlFunctionCtx* pCtx) { // All null data column, return directly. if (pInput->colDataSMAIsSet && (pInput->pColumnDataAgg[0]->numOfNull == pInput->totalRows)) { - tAssert(pInputCol->hasNull == true); + ASSERT(pInputCol->hasNull == true); // save selectivity value for column consisted of all null values firstlastSaveTupleData(pCtx->pSrcBlock, pInput->startRowIndex, pCtx, pInfo); return TSDB_CODE_SUCCESS; @@ -2315,7 +2315,7 @@ static void firstLastTransferInfo(SqlFunctionCtx* pCtx, SFirstLastRes* pInput, S static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuery) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SFirstLastRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -2535,7 +2535,7 @@ static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv, int pDiffInfo->prev.d64 = *(double*)pv; break; default: - tAssert(0); + ASSERT(0); } pDiffInfo->prevTs = ts; } @@ -2615,7 +2615,7 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo break; } default: - tAssert(0); + ASSERT(0); } } @@ -2951,7 +2951,7 @@ static STuplePos doSaveTupleData(SSerializeDataHandle* pHandle, const void* pBuf } else { // other tuple save policy if (streamStateFuncPut(pHandle->pState, pKey, pBuf, length) < 0) { - tAssert(0); + ASSERT(0); } p.streamTupleKey = *pKey; } @@ -3204,7 +3204,7 @@ static void spreadTransferInfo(SSpreadInfo* pInput, SSpreadInfo* pOutput) { int32_t spreadFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SSpreadInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3383,7 +3383,7 @@ static void elapsedTransferInfo(SElapsedInfo* pInput, SElapsedInfo* pOutput) { int32_t elapsedFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3553,7 +3553,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - tAssert(numOfBins >= 4); + ASSERT(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } @@ -3696,7 +3696,7 @@ static void histogramTransferInfo(SHistoFuncInfo* pInput, SHistoFuncInfo* pOutpu int32_t histogramFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -4079,7 +4079,7 @@ static bool checkStateOp(int8_t op, SColumnInfoData* pCol, int32_t index, SVaria break; } default: { - tAssert(0); + ASSERT(0); } } return false; @@ -4881,10 +4881,10 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { int32_t i = pInput->startRowIndex; if (pCtx->start.key != INT64_MIN) { - // tAssert((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || + // ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) || // (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC)); - tAssert(last->key == INT64_MIN); + ASSERT(last->key == INT64_MIN); for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -5104,7 +5104,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { } default: - tAssert(0); + ASSERT(0); } // the last interpolated time window value diff --git a/source/libs/function/src/detail/tavgfunction.c b/source/libs/function/src/detail/tavgfunction.c index 2645eff88a..1c74d22a82 100644 --- a/source/libs/function/src/detail/tavgfunction.c +++ b/source/libs/function/src/detail/tavgfunction.c @@ -18,7 +18,6 @@ #include "tdatablock.h" #include "tfunctionInt.h" #include "tglobal.h" -#include "tlog.h" #define SET_VAL(_info, numOfElem, res) \ do { \ @@ -316,7 +315,7 @@ bool avgFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { static int32_t calculateAvgBySMAInfo(SAvgRes* pRes, int32_t numOfRows, int32_t type, const SColumnDataAgg* pAgg) { int32_t numOfElem = numOfRows - pAgg->numOfNull; - tAssert(numOfElem >= 0); + ASSERT(numOfElem >= 0); pRes->count += numOfElem; if (IS_SIGNED_NUMERIC_TYPE(type)) { @@ -621,7 +620,7 @@ int32_t avgFunction(SqlFunctionCtx* pCtx) { break; } default: - tAssert(0); + ASSERT(0); } } else { numOfElem = doAddNumericVector(pCol, type, pInput, pAvgRes); @@ -653,7 +652,7 @@ static void avgTransferInfo(SAvgRes* pInput, SAvgRes* pOutput) { int32_t avgFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - tAssert(pCol->info.type == TSDB_DATA_TYPE_BINARY); + ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SAvgRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index 9e467747e1..b2cb36cba0 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -720,7 +720,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { // data in current data block are qualified to the query if (pInput->colDataSMAIsSet) { numOfElems = pInput->numOfRows - pAgg->numOfNull; - tAssert(pInput->numOfRows == pInput->totalRows && numOfElems >= 0); + ASSERT(pInput->numOfRows == pInput->totalRows && numOfElems >= 0); if (numOfElems == 0) { goto _over; @@ -826,7 +826,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { } if (i >= end) { - tAssert(numOfElems == 0); + ASSERT(numOfElems == 0); goto _over; } diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index a4c341d6d0..e5727f1472 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -22,7 +22,6 @@ #include "tpagedbuf.h" #include "tpercentile.h" #include "ttypes.h" -#include "tlog.h" #define DEFAULT_NUM_OF_SLOT 1024 @@ -496,7 +495,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction) int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times - 1); SArray* list = taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId)); - tAssert(list != NULL && list->size > 0); + ASSERT(list != NULL && list->size > 0); for (int32_t f = 0; f < list->size; ++f) { SPageInfo *pgInfo = *(SPageInfo **)taosArrayGet(list, f); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 060101f596..2f3db636c8 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -392,7 +392,7 @@ void udfdProcessTeardownRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { SUdfdRpcSendRecvInfo *msgInfo = (SUdfdRpcSendRecvInfo *)pMsg->info.ahandle; - tAssert(pMsg->info.ahandle != NULL); + ASSERT(pMsg->info.ahandle != NULL); if (pEpSet) { if (!isEpsetEqual(&global.mgmtEp.epSet, pEpSet)) { diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index 9a6be3fa9e..e3f140047a 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -367,7 +367,7 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) { tlen = taosEncodeBinary(dst, src, strlen(src)); break; default: - tAssert(0); + ASSERT(0); break; } *dst = (char*)*dst - tlen; @@ -459,7 +459,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { *dst = (char*)*dst - tlen; break; default: - tAssert(0); + ASSERT(0); break; } return tlen; diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 9ca2766f25..73cedfeb3d 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -80,7 +80,7 @@ static int32_t rowDataComparStable(const void* lhs, const void* rhs) { int32_t insGetExtendedRowSize(STableDataBlocks* pBlock) { STableComInfo* pTableInfo = &pBlock->pTableMeta->tableInfo; - tAssert(pBlock->rowSize == pTableInfo->rowSize); + ASSERT(pBlock->rowSize == pTableInfo->rowSize); return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); } @@ -98,7 +98,7 @@ void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo* spd, col_id_t i *colIdx = idx; } } else { - tAssert(idx == (spd->colIdxInfo + idx)->boundIdx); + ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; if (TD_IS_TP_ROW_T(rowType)) { *toffset = (spd->cols + schemaIdx)->toffset; @@ -409,7 +409,7 @@ static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { if (pBlkRowMerger && (pBlkRowMerger->index >= 0)) { - tAssert(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); + ASSERT(pBlkRowMerger->index < taosArrayGetSize(pBlkRowMerger->rowArray)); return *(void**)taosArrayGet(pBlkRowMerger->rowArray, pBlkRowMerger->index); } return NULL; @@ -417,9 +417,9 @@ static void* tdGetCurRowFromBlockMerger(SBlockRowMerger* pBlkRowMerger) { static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp, int32_t nDupRows, SBlockRowMerger** pBlkRowMerger, int32_t rowSize) { - tAssert(nDupRows > 1); + ASSERT(nDupRows > 1); SBlockKeyTuple* pStartKeyTp = pEndKeyTp - (nDupRows - 1); - tAssert(pStartKeyTp->skey == pEndKeyTp->skey); + ASSERT(pStartKeyTp->skey == pEndKeyTp->skey); // TODO: optimization if end row is all normal #if 0 @@ -583,7 +583,7 @@ static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* p } if ((j - i) > 1) { - tAssert((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); + ASSERT((pBlkKeyTuple + i)->skey == (pBlkKeyTuple + j - 1)->skey); if (tdBlockRowMerge(pTableMeta, (pBlkKeyTuple + j - 1), j - i, ppBlkRowMerger, extendedRowSize) < 0) { return TSDB_CODE_FAILED; } @@ -651,7 +651,7 @@ int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return ret; } - tAssert(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); + ASSERT(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); // the maximum expanded size in byte when a row-wise data is converted to SDataRow format int64_t destSize = dataBuf->size + pOneTableBlock->size + sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + @@ -680,7 +680,7 @@ int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return code; } - tAssert(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); + ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); // erase the empty space reserved for binary data int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple); @@ -729,7 +729,7 @@ int32_t insAllocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { } int32_t insInitRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { - tAssert(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); + ASSERT(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); tdSRowInit(pBuilder, schemaVer); tdSRowSetExtendedInfo(pBuilder, pColInfo->numOfCols, pColInfo->numOfBound, pColInfo->flen, pColInfo->allNullLen, pColInfo->boundNullLen); diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index f887709765..c74882cf23 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -393,7 +393,7 @@ char* parseTagDatatoJson(void* p) { } else if (pTagVal->nData == 0) { value = cJSON_CreateString(""); } else { - tAssert(0); + ASSERT(0); } cJSON_AddItemToObject(json, tagJsonKey, value); @@ -412,7 +412,7 @@ char* parseTagDatatoJson(void* p) { } cJSON_AddItemToObject(json, tagJsonKey, value); } else { - tAssert(0); + ASSERT(0); } } string = cJSON_PrintUnformatted(json); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 15916f1d79..c5db4105d7 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -147,7 +147,7 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { size_t numOfResBlock = taosArrayGetSize(pResList); for (int32_t j = 0; j < numOfResBlock; ++j) { SSDataBlock *pRes = taosArrayGetP(pResList, j); - tAssert(pRes->info.rows > 0); + ASSERT(pRes->info.rows > 0); SInputData inputData = {.pData = pRes}; code = dsPutDataBlock(sinkHandle, &inputData, &qcontinue); diff --git a/source/libs/scalar/inc/sclvector.h b/source/libs/scalar/inc/sclvector.h index 66d6c8201e..e633b39223 100644 --- a/source/libs/scalar/inc/sclvector.h +++ b/source/libs/scalar/inc/sclvector.h @@ -98,7 +98,7 @@ static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType) } else if (srcType == TSDB_DATA_TYPE_NULL) { p = NULL; } else { - tAssert(0); + ASSERT(0); } return p; } diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 870e094ea3..e3436c83c1 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -327,7 +327,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t case QUERY_NODE_VALUE: { SValueNode *valueNode = (SValueNode *)node; - tAssert(param->columnData == NULL); + ASSERT(param->columnData == NULL); param->numOfRows = 1; int32_t code = sclCreateColumnInfoData(&valueNode->node.resType, 1, param); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 9e9c9d79f9..1de8a35308 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -361,7 +361,7 @@ static int32_t doLengthFunction(SScalarParam *pInput, int32_t inputNum, SScalarP SColumnInfoData *pInputData = pInput->columnData; SColumnInfoData *pOutputData = pOutput->columnData; - tAssert(pOutputData->info.type == TSDB_DATA_TYPE_BIGINT); + ASSERT(pOutputData->info.type == TSDB_DATA_TYPE_BIGINT); int64_t *out = (int64_t *)pOutputData->pData; for (int32_t i = 0; i < pInput->numOfRows; ++i) { @@ -1729,37 +1729,37 @@ bool getTimePseudoFuncEnv(SFunctionNode *UNUSED_PARAM(pFunc), SFuncExecEnv *pEnv } int32_t qStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 0)); return TSDB_CODE_SUCCESS; } int32_t qEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 1)); return TSDB_CODE_SUCCESS; } int32_t winDurFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 2)); return TSDB_CODE_SUCCESS; } int32_t winStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 3)); return TSDB_CODE_SUCCESS; } int32_t winEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t *)colDataGetData(pInput->columnData, 4)); return TSDB_CODE_SUCCESS; } int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - tAssert(inputNum == 1); + ASSERT(inputNum == 1); char* p = colDataGetVarData(pInput->columnData, 0); colDataAppendNItems(pOutput->columnData, pOutput->numOfRows, p, pInput->numOfRows); @@ -2598,7 +2598,7 @@ static bool checkStateOp(int8_t op, SColumnInfoData *pCol, int32_t index, SScala break; } default: { - tAssert(0); + ASSERT(0); } } return false; @@ -2771,7 +2771,7 @@ static bool getHistogramBinDesc(SHistoFuncBin **bins, int32_t *binNum, char *bin intervals[0] = -INFINITY; intervals[numOfBins - 1] = INFINITY; // in case of desc bin orders, -inf/inf should be swapped - tAssert(numOfBins >= 4); + ASSERT(numOfBins >= 4); if (intervals[1] > intervals[numOfBins - 2]) { TSWAP(intervals[0], intervals[numOfBins - 1]); } diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index dc26e17804..a1995bdf50 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -85,7 +85,7 @@ void convertNumberToNumber(const void *inData, void *outData, int8_t inType, int break; } default: { - tAssert(0); + ASSERT(0); } } } @@ -132,7 +132,7 @@ int64_t getVectorBigintValue_DOUBLE(void *src, int32_t index) { return (int64_t) int64_t getVectorBigintValue_BOOL(void *src, int32_t index) { return (int64_t) * ((bool *)src + index); } int64_t getVectorBigintValue_JSON(void *src, int32_t index) { - tAssert(!colDataIsNull_var(((SColumnInfoData *)src), index)); + ASSERT(!colDataIsNull_var(((SColumnInfoData *)src), index)); char *data = colDataGetVarData((SColumnInfoData *)src, index); double out = 0; if (*data == TSDB_DATA_TYPE_NULL) { @@ -179,7 +179,7 @@ _getBigintValue_fn_t getVectorBigintValueFn(int32_t srcType) { } else if (srcType == TSDB_DATA_TYPE_NULL) { p = NULL; } else { - tAssert(0); + ASSERT(0); } return p; } @@ -384,11 +384,11 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { } else if (IS_FLOAT_TYPE(pCtx->outType)) { func = varToFloat; } else if (pCtx->outType == TSDB_DATA_TYPE_BINARY) { // nchar -> binary - tAssert(pCtx->inType == TSDB_DATA_TYPE_NCHAR); + ASSERT(pCtx->inType == TSDB_DATA_TYPE_NCHAR); func = ncharToVar; vton = true; } else if (pCtx->outType == TSDB_DATA_TYPE_NCHAR) { // binary -> nchar - tAssert(pCtx->inType == TSDB_DATA_TYPE_VARCHAR); + ASSERT(pCtx->inType == TSDB_DATA_TYPE_VARCHAR); func = varToNchar; vton = true; } else if (TSDB_DATA_TYPE_TIMESTAMP == pCtx->outType) { @@ -409,7 +409,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { int32_t convertType = pCtx->inType; if (pCtx->inType == TSDB_DATA_TYPE_JSON) { if (*data == TSDB_DATA_TYPE_NULL) { - tAssert(0); + ASSERT(0); } else if (*data == TSDB_DATA_TYPE_NCHAR) { data += CHAR_BYTES; convertType = TSDB_DATA_TYPE_NCHAR; @@ -434,7 +434,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { memcpy(tmp, varDataVal(data), varDataLen(data)); tmp[varDataLen(data)] = 0; } else if (TSDB_DATA_TYPE_NCHAR == convertType) { - tAssert(varDataLen(data) <= bufSize); + ASSERT(varDataLen(data) <= bufSize); int len = taosUcs4ToMbs((TdUcs4 *)varDataVal(data), varDataLen(data), tmp); if (len < 0) { @@ -543,11 +543,11 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t if (IS_NUMERIC_TYPE(type)) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { - tAssert(0); + ASSERT(0); // convertNcharToDouble(*pLeftData, pLeftOut); // *pLeftData = pLeftOut; } else if (typeLeft == TSDB_DATA_TYPE_BINARY) { - tAssert(0); + ASSERT(0); // convertBinaryToDouble(*pLeftData, pLeftOut); // *pLeftData = pLeftOut; } else if (typeLeft != type) { @@ -556,11 +556,11 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (typeRight == TSDB_DATA_TYPE_NCHAR) { - tAssert(0); + ASSERT(0); // convertNcharToDouble(*pRightData, pRightOut); // *pRightData = pRightOut; } else if (typeRight == TSDB_DATA_TYPE_BINARY) { - tAssert(0); + ASSERT(0); // convertBinaryToDouble(*pRightData, pRightOut); // *pRightData = pRightOut; } else if (typeRight != type) { @@ -577,7 +577,7 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t *freeRight = true; } } else { - tAssert(0); + ASSERT(0); } return true; @@ -668,7 +668,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, } if (overflow) { - tAssert(1 == pIn->numOfRows); + ASSERT(1 == pIn->numOfRows); pOut->numOfRows = 0; @@ -1429,7 +1429,7 @@ void vectorAssign(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, } } - tAssert(pRight->numOfQualified == 1 || pRight->numOfQualified == 0); + ASSERT(pRight->numOfQualified == 1 || pRight->numOfQualified == 0); pOut->numOfQualified = pRight->numOfQualified * pOut->numOfRows; } @@ -1602,7 +1602,7 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa bool result = convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull, &freeLeft, &freeRight); if (isJsonnull) { - tAssert(0); + ASSERT(0); } if (!pLeftData || !pRightData) { @@ -1913,7 +1913,7 @@ _bin_scalar_fn_t getBinScalarOperatorFn(int32_t binFunctionId) { case OP_TYPE_JSON_CONTAINS: return vectorJsonContains; default: - tAssert(0); + ASSERT(0); return NULL; } } diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index c176306545..dae26d3d58 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -94,7 +94,7 @@ void scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *s res->info.capacity = rows; res->info.rows = rows; SColumnInfoData *p = static_cast(taosArrayGet(res->pDataBlock, 0)); - tAssert(p->pData != NULL && p->nullbitmap != NULL); + ASSERT(p->pData != NULL && p->nullbitmap != NULL); taosArrayPush(pBlockList, &res); *dataBlockId = taosArrayGetSize(pBlockList) - 1; diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 4f5f918a5c..79549675a3 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -82,7 +82,7 @@ void streamSchedByTimer(void* param, void* tmrId) { int32_t streamSetupTrigger(SStreamTask* pTask) { if (pTask->triggerParam != 0) { int32_t ref = atomic_add_fetch_32(&pTask->refCnt, 1); - tAssert(ref == 2); + ASSERT(ref == 2); pTask->timer = taosTmrStart(streamSchedByTimer, (int32_t)pTask->triggerParam, pTask, streamEnv.timer); pTask->triggerStatus = TASK_TRIGGER_STATUS__INACTIVE; } @@ -210,7 +210,7 @@ int32_t streamProcessDispatchReq(SStreamTask* pTask, SStreamDispatchReq* pReq, S } int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code) { - tAssert(pRsp->inputStatus == TASK_OUTPUT_STATUS__NORMAL || pRsp->inputStatus == TASK_OUTPUT_STATUS__BLOCKED); + ASSERT(pRsp->inputStatus == TASK_OUTPUT_STATUS__NORMAL || pRsp->inputStatus == TASK_OUTPUT_STATUS__BLOCKED); qDebug("task %d receive dispatch rsp, code: %x", pTask->taskId, code); @@ -221,10 +221,10 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, i } int8_t old = atomic_exchange_8(&pTask->outputStatus, pRsp->inputStatus); - tAssert(old == TASK_OUTPUT_STATUS__WAIT); + ASSERT(old == TASK_OUTPUT_STATUS__WAIT); if (pRsp->inputStatus == TASK_INPUT_STATUS__BLOCKED) { // TODO: init recover timer - tAssert(0); + ASSERT(0); return 0; } // continue dispatch @@ -248,7 +248,7 @@ int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, S streamTaskEnqueueRetrieve(pTask, pReq, pRsp); - tAssert(pTask->taskLevel != TASK_LEVEL__SINK); + ASSERT(pTask->taskLevel != TASK_LEVEL__SINK); streamSchedExec(pTask); /*streamTryExec(pTask);*/ diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index cc11232493..efd19074da 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -125,7 +125,7 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask, int64_t checkpointId, i pTask->checkpointAlignCnt = taosArrayGetSize(pTask->childEpInfo); } - tAssert(pTask->checkpointingId == checkpointId); + ASSERT(pTask->checkpointingId == checkpointId); return atomic_sub_fetch_32(&pTask->checkpointAlignCnt, 1); } @@ -170,7 +170,7 @@ int32_t streamProcessCheckpointReq(SStreamMeta* pMeta, SStreamTask* pTask, SStre return 0; } if (code < 0) { - tAssert(0); + ASSERT(0); return -1; } } diff --git a/source/libs/stream/src/streamData.c b/source/libs/stream/src/streamData.c index ab441e5e44..2fea5b9eca 100644 --- a/source/libs/stream/src/streamData.c +++ b/source/libs/stream/src/streamData.c @@ -23,8 +23,8 @@ int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock } taosArraySetSize(pArray, blockNum); - tAssert(pReq->blockNum == taosArrayGetSize(pReq->data)); - tAssert(pReq->blockNum == taosArrayGetSize(pReq->dataLen)); + ASSERT(pReq->blockNum == taosArrayGetSize(pReq->data)); + ASSERT(pReq->blockNum == taosArrayGetSize(pReq->dataLen)); for (int32_t i = 0; i < blockNum; i++) { SRetrieveTableRsp* pRetrieve = taosArrayGetP(pReq->data, i); @@ -118,7 +118,7 @@ SStreamDataSubmit* streamSubmitRefClone(SStreamDataSubmit* pSubmit) { void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { int32_t ref = atomic_sub_fetch_32(pDataSubmit->dataRef, 1); - tAssert(ref >= 0); + ASSERT(ref >= 0); if (ref == 0) { taosMemoryFree(pDataSubmit->data); taosMemoryFree(pDataSubmit->dataRef); @@ -126,7 +126,7 @@ void streamDataSubmitRefDec(SStreamDataSubmit* pDataSubmit) { } SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem) { - tAssert(elem); + ASSERT(elem); if (dst->type == STREAM_INPUT__DATA_BLOCK && elem->type == STREAM_INPUT__DATA_BLOCK) { SStreamDataBlock* pBlock = (SStreamDataBlock*)dst; SStreamDataBlock* pBlockSrc = (SStreamDataBlock*)elem; @@ -142,7 +142,7 @@ SStreamQueueItem* streamMergeQueueItem(SStreamQueueItem* dst, SStreamQueueItem* return dst; } else if (dst->type == STREAM_INPUT__DATA_SUBMIT && elem->type == STREAM_INPUT__DATA_SUBMIT) { SStreamMergedSubmit* pMerged = streamMergedSubmitNew(); - tAssert(pMerged); + ASSERT(pMerged); streamMergeSubmit(pMerged, (SStreamDataSubmit*)dst); streamMergeSubmit(pMerged, (SStreamDataSubmit*)elem); taosFreeQitem(dst); @@ -170,7 +170,7 @@ void streamFreeQitem(SStreamQueueItem* data) { for (int32_t i = 0; i < sz; i++) { int32_t* pRef = taosArrayGetP(pMerge->dataRefs, i); int32_t ref = atomic_sub_fetch_32(pRef, 1); - tAssert(ref >= 0); + ASSERT(ref >= 0); if (ref == 0) { void* dataStr = taosArrayGetP(pMerge->reqs, i); taosMemoryFree(dataStr); @@ -184,7 +184,7 @@ void streamFreeQitem(SStreamQueueItem* data) { SStreamRefDataBlock* pRefBlock = (SStreamRefDataBlock*)data; int32_t ref = atomic_sub_fetch_32(pRefBlock->dataRef, 1); - tAssert(ref >= 0); + ASSERT(ref >= 0); if (ref == 0) { blockDataDestroy(pRefBlock->pBlock); taosMemoryFree(pRefBlock->dataRef); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index dffdfbaeb2..4e0b0630bc 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -24,8 +24,8 @@ int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* p if (tEncodeI32(pEncoder, pReq->upstreamChildId) < 0) return -1; if (tEncodeI32(pEncoder, pReq->upstreamNodeId) < 0) return -1; if (tEncodeI32(pEncoder, pReq->blockNum) < 0) return -1; - tAssert(taosArrayGetSize(pReq->data) == pReq->blockNum); - tAssert(taosArrayGetSize(pReq->dataLen) == pReq->blockNum); + ASSERT(taosArrayGetSize(pReq->data) == pReq->blockNum); + ASSERT(taosArrayGetSize(pReq->dataLen) == pReq->blockNum); for (int32_t i = 0; i < pReq->blockNum; i++) { int32_t len = *(int32_t*)taosArrayGet(pReq->dataLen, i); void* data = taosArrayGetP(pReq->data, i); @@ -45,7 +45,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { if (tDecodeI32(pDecoder, &pReq->upstreamChildId) < 0) return -1; if (tDecodeI32(pDecoder, &pReq->upstreamNodeId) < 0) return -1; if (tDecodeI32(pDecoder, &pReq->blockNum) < 0) return -1; - tAssert(pReq->blockNum > 0); + ASSERT(pReq->blockNum > 0); pReq->data = taosArrayInit(pReq->blockNum, sizeof(void*)); pReq->dataLen = taosArrayInit(pReq->blockNum, sizeof(int32_t)); for (int32_t i = 0; i < pReq->blockNum; i++) { @@ -54,7 +54,7 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { void* data; if (tDecodeI32(pDecoder, &len1) < 0) return -1; if (tDecodeBinaryAlloc(pDecoder, &data, &len2) < 0) return -1; - tAssert(len1 == len2); + ASSERT(len1 == len2); taosArrayPush(pReq->dataLen, &len1); taosArrayPush(pReq->data, &data); } @@ -129,7 +129,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) }; int32_t sz = taosArrayGetSize(pTask->childEpInfo); - tAssert(sz > 0); + ASSERT(sz > 0); for (int32_t i = 0; i < sz; i++) { req.reqId = tGenIdPI64(); SStreamChildEpInfo* pEpInfo = taosArrayGetP(pTask->childEpInfo, i); @@ -139,7 +139,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) int32_t len; tEncodeSize(tEncodeStreamRetrieveReq, &req, len, code); if (code < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -163,7 +163,7 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) }; if (tmsgSendReq(&pEpInfo->epSet, &rpcMsg) < 0) { - tAssert(0); + ASSERT(0); goto CLEAR; } buf = NULL; @@ -201,7 +201,7 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); actualLen += sizeof(SRetrieveTableRsp); - tAssert(actualLen <= dataStrLen); + ASSERT(actualLen <= dataStrLen); taosArrayPush(pReq->dataLen, &actualLen); taosArrayPush(pReq->data, &buf); @@ -357,7 +357,7 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S int32_t j; for (j = 0; j < vgSz; j++) { SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, j); - tAssert(pVgInfo->vgId > 0); + ASSERT(pVgInfo->vgId > 0); if (hashValue >= pVgInfo->hashBegin && hashValue <= pVgInfo->hashEnd) { if (streamAddBlockToDispatchMsg(pDataBlock, &pReqs[j]) < 0) { return -1; @@ -370,14 +370,14 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S break; } } - tAssert(found); + ASSERT(found); return 0; } int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pData) { int32_t code = -1; int32_t blockNum = taosArrayGetSize(pData->blocks); - tAssert(blockNum != 0); + ASSERT(blockNum != 0); if (pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH) { SStreamDispatchReq req = { @@ -421,7 +421,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } else if (pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH) { int32_t rspCnt = atomic_load_32(&pTask->shuffleDispatcher.waitingRspCnt); - tAssert(rspCnt == 0); + ASSERT(rspCnt == 0); SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos; int32_t vgSz = taosArrayGetSize(vgInfo); @@ -488,13 +488,13 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } return code; } else { - tAssert(0); + ASSERT(0); } return 0; } int32_t streamDispatch(SStreamTask* pTask) { - tAssert(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH); + ASSERT(pTask->outputType == TASK_OUTPUT__FIXED_DISPATCH || pTask->outputType == TASK_OUTPUT__SHUFFLE_DISPATCH); int8_t old = atomic_val_compare_exchange_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL, TASK_OUTPUT_STATUS__WAIT); @@ -508,13 +508,13 @@ int32_t streamDispatch(SStreamTask* pTask) { atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); return 0; } - tAssert(pBlock->type == STREAM_INPUT__DATA_BLOCK); + ASSERT(pBlock->type == STREAM_INPUT__DATA_BLOCK); qDebug("stream dispatching: task %d", pTask->taskId); int32_t code = 0; if (streamDispatchAllBlocks(pTask, pBlock) < 0) { - tAssert(0); + ASSERT(0); code = -1; streamQueueProcessFail(pTask->outputQueue); atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL); diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index f2ceb83dc2..6a83a9a4da 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -25,7 +25,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* const SStreamTrigger* pTrigger = (const SStreamTrigger*)data; qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) { - tAssert(pTask->taskLevel == TASK_LEVEL__SOURCE); + ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE); const SStreamDataSubmit* pSubmit = (const SStreamDataSubmit*)data; qDebug("task %d %p set submit input %p %p %d 1", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef); qSetMultiStreamInput(exec, pSubmit->data, 1, STREAM_INPUT__DATA_SUBMIT); @@ -43,7 +43,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* const SStreamRefDataBlock* pRefBlock = (const SStreamRefDataBlock*)data; qSetMultiStreamInput(exec, pRefBlock->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else { - tAssert(0); + ASSERT(0); } // exec @@ -51,7 +51,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* SSDataBlock* output = NULL; uint64_t ts = 0; if ((code = qExecTask(exec, &output, &ts)) < 0) { - /*tAssert(false);*/ + /*ASSERT(false);*/ qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId, terrstr()); } @@ -59,7 +59,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* if (pItem->type == STREAM_INPUT__DATA_RETRIEVE) { SSDataBlock block = {0}; const SStreamDataBlock* pRetrieveBlock = (const SStreamDataBlock*)data; - tAssert(taosArrayGetSize(pRetrieveBlock->blocks) == 1); + ASSERT(taosArrayGetSize(pRetrieveBlock->blocks) == 1); assignOneDataBlock(&block, taosArrayGet(pRetrieveBlock->blocks, 0)); block.info.type = STREAM_PULL_OVER; block.info.childId = pTask->selfChildId; @@ -89,7 +89,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* } int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { - tAssert(pTask->taskLevel == TASK_LEVEL__SOURCE); + ASSERT(pTask->taskLevel == TASK_LEVEL__SOURCE); void* exec = pTask->exec.executor; @@ -108,7 +108,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) { SSDataBlock* output = NULL; uint64_t ts = 0; if (qExecTask(exec, &output, &ts) < 0) { - tAssert(0); + ASSERT(0); } if (output == NULL) { finished = true; @@ -171,7 +171,7 @@ int32_t streamBatchExec(SStreamTask* pTask, int32_t batchLimit) { } if (pTask->taskLevel == TASK_LEVEL__SINK) { - tAssert(((SStreamQueueItem*)pItem)->type == STREAM_INPUT__DATA_BLOCK); + ASSERT(((SStreamQueueItem*)pItem)->type == STREAM_INPUT__DATA_BLOCK); streamTaskOutput(pTask, (SStreamDataBlock*)pItem); } @@ -222,7 +222,7 @@ int32_t streamExecForAll(SStreamTask* pTask) { } if (pTask->taskLevel == TASK_LEVEL__SINK) { - tAssert(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK); + ASSERT(((SStreamQueueItem*)input)->type == STREAM_INPUT__DATA_BLOCK); streamTaskOutput(pTask, input); continue; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 04f687e75e..afad78c5e5 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -107,7 +107,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg, tDecoderClear(&decoder); if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) { - tAssert(0); + ASSERT(0); goto FAIL; } @@ -117,7 +117,7 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg, if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), msg, msgLen, pMeta->txn) < 0) { taosHashRemove(pMeta->pTasks, &pTask->taskId, sizeof(int32_t)); - tAssert(0); + ASSERT(0); goto FAIL; } @@ -153,7 +153,7 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) { tEncoderClear(&encoder); if (tdbTbUpsert(pMeta->pTaskDb, &pTask->taskId, sizeof(int32_t), buf, len, pMeta->txn) < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -167,7 +167,7 @@ int32_t streamMetaAddTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTask) { SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId) { SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasks, &taskId, sizeof(int32_t)); if (ppTask) { - tAssert((*ppTask)->taskId == taskId); + ASSERT((*ppTask)->taskId == taskId); return *ppTask; } else { return NULL; @@ -195,9 +195,9 @@ SStreamTask* streamMetaAcquireTask(SStreamMeta* pMeta, int32_t taskId) { void streamMetaReleaseTask(SStreamMeta* pMeta, SStreamTask* pTask) { int32_t left = atomic_sub_fetch_32(&pTask->refCnt, 1); - tAssert(left >= 0); + ASSERT(left >= 0); if (left == 0) { - tAssert(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING); + ASSERT(atomic_load_8(&pTask->taskStatus) == TASK_STATUS__DROPPING); tFreeSStreamTask(pTask); } } @@ -257,7 +257,7 @@ int32_t streamMetaAbort(SStreamMeta* pMeta) { int32_t streamLoadTasks(SStreamMeta* pMeta) { TBC* pCur = NULL; if (tdbTbcOpen(pMeta->pTaskDb, &pCur, NULL) < 0) { - tAssert(0); + ASSERT(0); return -1; } diff --git a/source/libs/stream/src/streamRecover.c b/source/libs/stream/src/streamRecover.c index ebfc455a10..6889a870d1 100644 --- a/source/libs/stream/src/streamRecover.c +++ b/source/libs/stream/src/streamRecover.c @@ -40,7 +40,7 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) { }; if (tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &rpcMsg) < 0) { - /*tAssert(0);*/ + /*ASSERT(0);*/ } } else if (pTask->taskLevel == TASK_LEVEL__AGG) { @@ -140,7 +140,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* } if (!found) return -1; int32_t left = atomic_sub_fetch_32(&pTask->recoverTryingDownstream, 1); - tAssert(left >= 0); + ASSERT(left >= 0); if (left == 0) { taosArrayDestroy(pTask->checkReqIds); streamTaskLaunchRecover(pTask, version); @@ -149,7 +149,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* if (pRsp->reqId != pTask->checkReqId) return -1; streamTaskLaunchRecover(pTask, version); } else { - tAssert(0); + ASSERT(0); } } else { streamRecheckOneDownstream(pTask, pRsp); @@ -199,7 +199,7 @@ int32_t streamBuildSourceRecover2Req(SStreamTask* pTask, SStreamRecoverStep2Req* int32_t streamSourceRecoverScanStep2(SStreamTask* pTask, int64_t ver) { void* exec = pTask->exec.executor; if (qStreamSourceRecoverStep2(exec, ver) < 0) { - tAssert(0); + ASSERT(0); } return streamScanExec(pTask, 100); } @@ -247,7 +247,7 @@ int32_t streamAggChildrenRecoverFinish(SStreamTask* pTask) { int32_t streamProcessRecoverFinishReq(SStreamTask* pTask, int32_t childId) { if (pTask->taskLevel == TASK_LEVEL__AGG) { int32_t left = atomic_sub_fetch_32(&pTask->recoverWaitingUpstream, 1); - tAssert(left >= 0); + ASSERT(left >= 0); if (left == 0) { streamAggChildrenRecoverFinish(pTask); } diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 3ee6e6c27e..af1d738de0 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -657,7 +657,7 @@ int32_t streamStateSessionClear(SStreamState* pState) { int32_t size = 0; int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); if (code == 0) { - tAssert(size > 0); + ASSERT(size > 0); memset(buf, 0, size); streamStateSessionPut(pState, &delKey, buf, size); } else { diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 3361e5946c..1ce4a35dff 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -301,7 +301,7 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) { } int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) { - tAssert(pInfo); + ASSERT(pInfo); SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); if (tStartEncode(&encoder) < 0) return -1; @@ -352,7 +352,7 @@ int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) } int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { - tAssert(pInfo); + ASSERT(pInfo); SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); if (tStartDecode(&decoder) < 0) return -1; @@ -394,7 +394,7 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { if (tDecodeI64(&decoder, &ts) < 0) return -1; taosHashPut(pInfo->pMap, &uid, sizeof(uint64_t), &ts, sizeof(TSKEY)); } - tAssert(mapSize == taosHashGetSize(pInfo->pMap)); + ASSERT(mapSize == taosHashGetSize(pInfo->pMap)); if (tDecodeI64(&decoder, &pInfo->scanWindow.skey) < 0) return -1; if (tDecodeI64(&decoder, &pInfo->scanWindow.ekey) < 0) return -1; diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index 47251c8587..1dc6905b88 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -117,10 +117,10 @@ int32_t syncNodeFollowerCommit(SSyncNode* ths, SyncIndex newCommitIndex) { // call back Wal int32_t code = ths->pLogStore->syncLogUpdateCommitIndex(ths->pLogStore, ths->commitIndex); - tAssert(code == 0); + ASSERT(code == 0); code = syncNodeDoCommit(ths, beginIndex, endIndex, ths->state); - tAssert(code == 0); + ASSERT(code == 0); } } @@ -134,7 +134,7 @@ SSyncRaftEntry* syncLogAppendEntriesToRaftEntry(const SyncAppendEntries* pMsg) { return NULL; } (void)memcpy(pEntry, pMsg->data, pMsg->dataLen); - tAssert(pEntry->bytes == pMsg->dataLen); + ASSERT(pEntry->bytes == pMsg->dataLen); return pEntry; } @@ -280,7 +280,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { if (pMsg->prevLogIndex >= startIndex) { SyncTerm myPreLogTerm = syncNodeGetPreTerm(ths, pMsg->prevLogIndex + 1); - // tAssert(myPreLogTerm != SYNC_TERM_INVALID); + // ASSERT(myPreLogTerm != SYNC_TERM_INVALID); if (myPreLogTerm == SYNC_TERM_INVALID) { syncLogRecvAppendEntries(ths, pMsg, "reject, pre-term invalid"); goto _SEND_RESPONSE; @@ -297,7 +297,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { bool hasAppendEntries = pMsg->dataLen > 0; if (hasAppendEntries) { SSyncRaftEntry* pAppendEntry = syncEntryBuildFromAppendEntries(pMsg); - tAssert(pAppendEntry != NULL); + ASSERT(pAppendEntry != NULL); SyncIndex appendIndex = pMsg->prevLogIndex + 1; @@ -352,7 +352,7 @@ int32_t syncNodeOnAppendEntriesOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { goto _IGNORE; } - tAssert(pAppendEntry->index == appendIndex); + ASSERT(pAppendEntry->index == appendIndex); // append code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index 9ff02199b7..524abf3c2a 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -62,7 +62,7 @@ int32_t syncNodeOnAppendEntriesReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return -1; } - tAssert(pMsg->term == ths->pRaftStore->currentTerm); + ASSERT(pMsg->term == ths->pRaftStore->currentTerm); sTrace("vgId:%d received append entries reply. srcId:0x%016" PRIx64 ", term:%" PRId64 ", matchIndex:%" PRId64 "", pMsg->vgId, pMsg->srcId.addr, pMsg->term, pMsg->matchIndex); @@ -112,7 +112,7 @@ int32_t syncNodeOnAppendEntriesReplyOld(SSyncNode* ths, SyncAppendEntriesReply* return -1; } - tAssert(pMsg->term == ths->pRaftStore->currentTerm); + ASSERT(pMsg->term == ths->pRaftStore->currentTerm); if (pMsg->success) { SyncIndex oldMatchIndex = syncIndexMgrGetIndex(ths->pMatchIndex, &(pMsg->srcId)); @@ -135,7 +135,7 @@ int32_t syncNodeOnAppendEntriesReplyOld(SSyncNode* ths, SyncAppendEntriesReply* // send next append entries SPeerState* pState = syncNodeGetPeerState(ths, &(pMsg->srcId)); - tAssert(pState != NULL); + ASSERT(pState != NULL); if (pMsg->lastSendIndex == pState->lastSendIndex) { int64_t timeNow = taosGetTimestampMs(); diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index 7d73a72272..07b1101256 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -84,7 +84,7 @@ void syncOneReplicaAdvance(SSyncNode* pSyncNode) { } void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { - tAssert(false && "deprecated"); + ASSERT(false && "deprecated"); if (pSyncNode == NULL) { sError("pSyncNode is NULL"); return; @@ -202,8 +202,8 @@ bool syncAgreeIndex(SSyncNode* pSyncNode, SRaftId* pRaftId, SyncIndex index) { } static inline int64_t syncNodeAbs64(int64_t a, int64_t b) { - tAssert(a >= 0); - tAssert(b >= 0); + ASSERT(a >= 0); + ASSERT(b >= 0); int64_t c = a > b ? a - b : b - a; return c; @@ -262,7 +262,7 @@ int32_t syncNodeDynamicQuorum(const SSyncNode* pSyncNode) { quorum += addQuorum; } - tAssert(quorum <= pSyncNode->replicaNum); + ASSERT(quorum <= pSyncNode->replicaNum); if (quorum < pSyncNode->quorum) { quorum = pSyncNode->quorum; @@ -290,7 +290,7 @@ bool syncAgree(SSyncNode* pSyncNode, SyncIndex index) { bool syncNodeAgreedUpon(SSyncNode* pNode, SyncIndex index) { int count = 0; SSyncIndexMgr* pMatches = pNode->pMatchIndex; - tAssert(pNode->replicaNum == pMatches->replicaNum); + ASSERT(pNode->replicaNum == pMatches->replicaNum); for (int i = 0; i < pNode->replicaNum; i++) { SyncIndex matchIndex = pMatches->index[i]; diff --git a/source/libs/sync/src/syncElection.c b/source/libs/sync/src/syncElection.c index 39916e1905..8d548114fb 100644 --- a/source/libs/sync/src/syncElection.c +++ b/source/libs/sync/src/syncElection.c @@ -43,7 +43,7 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) { for (int i = 0; i < pNode->peersNum; ++i) { SRpcMsg rpcMsg = {0}; ret = syncBuildRequestVote(&rpcMsg, pNode->vgId); - tAssert(ret == 0); + ASSERT(ret == 0); SyncRequestVote* pMsg = rpcMsg.pCont; pMsg->srcId = pNode->myRaftId; @@ -51,10 +51,10 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) { pMsg->term = pNode->pRaftStore->currentTerm; ret = syncNodeGetLastIndexTerm(pNode, &pMsg->lastLogIndex, &pMsg->lastLogTerm); - tAssert(ret == 0); + ASSERT(ret == 0); ret = syncNodeSendMsgById(&pNode->peersId[i], pNode, &rpcMsg); - tAssert(ret == 0); + ASSERT(ret == 0); } return ret; @@ -83,7 +83,7 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) { syncNodeVoteForSelf(pSyncNode); if (voteGrantedMajority(pSyncNode->pVotesGranted)) { // only myself, to leader - tAssert(!pSyncNode->pVotesGranted->toLeader); + ASSERT(!pSyncNode->pVotesGranted->toLeader); syncNodeCandidate2Leader(pSyncNode); pSyncNode->pVotesGranted->toLeader = true; return ret; @@ -102,7 +102,7 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) { } ret = syncNodeRequestVotePeers(pSyncNode); - tAssert(ret == 0); + ASSERT(ret == 0); syncNodeResetElectTimer(pSyncNode); diff --git a/source/libs/sync/src/syncIndexMgr.c b/source/libs/sync/src/syncIndexMgr.c index 29b6ce42de..7933258e53 100644 --- a/source/libs/sync/src/syncIndexMgr.c +++ b/source/libs/sync/src/syncIndexMgr.c @@ -72,7 +72,7 @@ void syncIndexMgrSetIndex(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftId, } // maybe config change - // tAssert(0); + // ASSERT(0); char host[128]; uint16_t port; @@ -114,7 +114,7 @@ void syncIndexMgrSetStartTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaft } // maybe config change - // tAssert(0); + // ASSERT(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -129,7 +129,7 @@ int64_t syncIndexMgrGetStartTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pR return startTime; } } - tAssert(0); + ASSERT(0); return -1; } @@ -142,7 +142,7 @@ void syncIndexMgrSetRecvTime(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftI } // maybe config change - // tAssert(0); + // ASSERT(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -170,7 +170,7 @@ void syncIndexMgrSetTerm(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftId, S } // maybe config change - // tAssert(0); + // ASSERT(0); char host[128]; uint16_t port; syncUtilU642Addr(pRaftId->addr, host, sizeof(host), &port); @@ -184,6 +184,6 @@ SyncTerm syncIndexMgrGetTerm(SSyncIndexMgr *pSyncIndexMgr, const SRaftId *pRaftI return term; } } - tAssert(0); + ASSERT(0); return -1; } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index f4caf0e9c7..59e5e968e7 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -571,7 +571,7 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho if (pSyncNode == NULL) { return -1; } - tAssert(rid == pSyncNode->rid); + ASSERT(rid == pSyncNode->rid); SSyncRaftEntry* pEntry = NULL; int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry); @@ -582,7 +582,7 @@ int32_t syncGetSnapshotByIndex(int64_t rid, SyncIndex index, SSnapshot* pSnapsho syncNodeRelease(pSyncNode); return -1; } - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); pSnapshot->data = NULL; pSnapshot->lastApplyIndex = index; @@ -599,7 +599,7 @@ int32_t syncGetSnapshotMeta(int64_t rid, struct SSnapshotMeta* sMeta) { if (pSyncNode == NULL) { return -1; } - tAssert(rid == pSyncNode->rid); + ASSERT(rid == pSyncNode->rid); sMeta->lastConfigIndex = pSyncNode->pRaftCfg->lastConfigIndex; sTrace("vgId:%d, get snapshot meta, lastConfigIndex:%" PRId64, pSyncNode->vgId, pSyncNode->pRaftCfg->lastConfigIndex); @@ -613,9 +613,9 @@ int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct if (pSyncNode == NULL) { return -1; } - tAssert(rid == pSyncNode->rid); + ASSERT(rid == pSyncNode->rid); - tAssert(pSyncNode->pRaftCfg->configIndexCount >= 1); + ASSERT(pSyncNode->pRaftCfg->configIndexCount >= 1); SyncIndex lastIndex = (pSyncNode->pRaftCfg->configIndexArr)[0]; for (int32_t i = 0; i < pSyncNode->pRaftCfg->configIndexCount; ++i) { @@ -634,7 +634,7 @@ int32_t syncGetSnapshotMetaByIndex(int64_t rid, SyncIndex snapshotIndex, struct #endif SyncIndex syncNodeGetSnapshotConfigIndex(SSyncNode* pSyncNode, SyncIndex snapshotLastApplyIndex) { - tAssert(pSyncNode->pRaftCfg->configIndexCount >= 1); + ASSERT(pSyncNode->pRaftCfg->configIndexCount >= 1); SyncIndex lastIndex = (pSyncNode->pRaftCfg->configIndexArr)[0]; for (int32_t i = 0; i < pSyncNode->pRaftCfg->configIndexCount; ++i) { @@ -791,9 +791,9 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { } int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) { - tAssertS(pNode->pLogStore != NULL, "log store not created"); - tAssertS(pNode->pFsm != NULL, "pFsm not registered"); - tAssertS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); + ASSERT(pNode->pLogStore != NULL && "log store not created"); + ASSERT(pNode->pFsm != NULL && "pFsm not registered"); + ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { sError("vgId:%d, failed to get snapshot info since %s", pNode->vgId, terrstr()); @@ -1069,7 +1069,7 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) { // snapshot senders for (int32_t i = 0; i < TSDB_MAX_REPLICA; ++i) { SSyncSnapshotSender* pSender = snapshotSenderCreate(pSyncNode, i); - // tAssert(pSender != NULL); + // ASSERT(pSender != NULL); (pSyncNode->senders)[i] = pSender; sSTrace(pSender, "snapshot sender create new while open, data:%p", pSender); } @@ -1136,7 +1136,7 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { SSnapshot snapshot; int32_t code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); - tAssert(code == 0); + ASSERT(code == 0); if (snapshot.lastApplyIndex > pSyncNode->commitIndex) { pSyncNode->commitIndex = snapshot.lastApplyIndex; } @@ -1144,8 +1144,8 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { } int32_t syncNodeRestore(SSyncNode* pSyncNode) { - tAssertS(pSyncNode->pLogStore != NULL, "log store not created"); - tAssertS(pSyncNode->pLogBuf != NULL, "ring log buffer not created"); + ASSERT(pSyncNode->pLogStore != NULL && "log store not created"); + ASSERT(pSyncNode->pLogBuf != NULL && "ring log buffer not created"); SyncIndex lastVer = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); SyncIndex commitIndex = pSyncNode->pLogStore->syncLogCommitIndex(pSyncNode->pLogStore); @@ -1157,7 +1157,7 @@ int32_t syncNodeRestore(SSyncNode* pSyncNode) { return -1; } - tAssert(endIndex == lastVer + 1); + ASSERT(endIndex == lastVer + 1); commitIndex = TMAX(pSyncNode->commitIndex, commitIndex); if (syncLogBufferCommit(pSyncNode->pLogBuf, pSyncNode, commitIndex) < 0) { @@ -1181,7 +1181,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode) { int32_t ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } @@ -1201,7 +1201,7 @@ void syncNodeStartOld(SSyncNode* pSyncNode) { int32_t ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - tAssert(ret == 0); + ASSERT(ret == 0); } int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { @@ -1212,11 +1212,11 @@ int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { // reset elect timer, long enough int32_t electMS = TIMER_MAX_MS; int32_t ret = syncNodeRestartElectTimer(pSyncNode, electMS); - tAssert(ret == 0); + ASSERT(ret == 0); ret = 0; ret = syncNodeStartPingTimer(pSyncNode); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } @@ -1255,7 +1255,7 @@ void syncNodeClose(SSyncNode* pSyncNode) { sNInfo(pSyncNode, "sync close, node:%p", pSyncNode); int32_t ret = raftStoreClose(pSyncNode->pRaftStore); - tAssert(ret == 0); + ASSERT(ret == 0); pSyncNode->pRaftStore = NULL; syncNodeLogReplMgrDestroy(pSyncNode); @@ -1498,7 +1498,7 @@ inline bool syncNodeInConfig(SSyncNode* pSyncNode, const SSyncCfg* config) { } } - tAssert(b1 == b2); + ASSERT(b1 == b2); return b1; } @@ -1812,7 +1812,7 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { SyncIndex lastIndex; SyncTerm lastTerm; int32_t code = syncNodeGetLastIndexTerm(pSyncNode, &lastIndex, &lastTerm); - tAssert(code == 0); + ASSERT(code == 0); pSyncNode->pNextIndex->index[i] = lastIndex + 1; } @@ -1868,8 +1868,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { } void syncNodeCandidate2Leader(SSyncNode* pSyncNode) { - tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); - tAssert(voteGrantedMajority(pSyncNode->pVotesGranted)); + ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted)); syncNodeBecomeLeader(pSyncNode, "candidate to leader"); sNTrace(pSyncNode, "state change syncNodeCandidate2Leader"); @@ -1880,14 +1880,14 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) { } SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); - tAssert(lastIndex >= 0); + ASSERT(lastIndex >= 0); sInfo("vgId:%d, become leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64 "", pSyncNode->vgId, pSyncNode->pRaftStore->currentTerm, pSyncNode->commitIndex, lastIndex); } void syncNodeCandidate2LeaderOld(SSyncNode* pSyncNode) { - tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); - tAssert(voteGrantedMajority(pSyncNode->pVotesGranted)); + ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + ASSERT(voteGrantedMajority(pSyncNode->pVotesGranted)); syncNodeBecomeLeader(pSyncNode, "candidate to leader"); // Raft 3.6.2 Committing entries from previous terms @@ -1911,7 +1911,7 @@ int32_t syncNodePeerStateInit(SSyncNode* pSyncNode) { } void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { - tAssert(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER); + ASSERT(pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER); pSyncNode->state = TAOS_SYNC_STATE_CANDIDATE; SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become candidate from follower. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1921,7 +1921,7 @@ void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { } void syncNodeLeader2Follower(SSyncNode* pSyncNode) { - tAssert(pSyncNode->state == TAOS_SYNC_STATE_LEADER); + ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER); syncNodeBecomeFollower(pSyncNode, "leader to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become follower from leader. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1931,7 +1931,7 @@ void syncNodeLeader2Follower(SSyncNode* pSyncNode) { } void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { - tAssert(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); + ASSERT(pSyncNode->state == TAOS_SYNC_STATE_CANDIDATE); syncNodeBecomeFollower(pSyncNode, "candidate to follower"); SyncIndex lastIndex = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); sInfo("vgId:%d, become follower from candidate. term: %" PRId64 ", commit index: %" PRId64 ", last index: %" PRId64, @@ -1943,8 +1943,8 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { // just called by syncNodeVoteForSelf // need assert void syncNodeVoteForTerm(SSyncNode* pSyncNode, SyncTerm term, SRaftId* pRaftId) { - tAssert(term == pSyncNode->pRaftStore->currentTerm); - tAssert(!raftStoreHasVoted(pSyncNode->pRaftStore)); + ASSERT(term == pSyncNode->pRaftStore->currentTerm); + ASSERT(!raftStoreHasVoted(pSyncNode->pRaftStore)); raftStoreVote(pSyncNode->pRaftStore, pRaftId); } @@ -2084,7 +2084,7 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) { .lastConfigIndex = SYNC_INDEX_INVALID}; if (code == 0) { - tAssert(pPreEntry != NULL); + ASSERT(pPreEntry != NULL); preTerm = pPreEntry->term; if (h) { @@ -2453,7 +2453,7 @@ static int32_t syncNodeAppendNoopOld(SSyncNode* ths) { SyncIndex index = ths->pLogStore->syncLogWriteIndex(ths->pLogStore); SyncTerm term = ths->pRaftStore->currentTerm; SSyncRaftEntry* pEntry = syncEntryBuildNoop(term, index, ths->vgId); - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); LRUHandle* h = NULL; @@ -2663,7 +2663,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn int32_t code = syncNodeAppend(ths, pEntry); if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - tAssertS(false, "failed to append blocking msg"); + ASSERT(false && "failed to append blocking msg"); } return code; } @@ -2819,7 +2819,7 @@ int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* p // reset elect timer now! int32_t electMS = 1; int32_t ret = syncNodeRestartElectTimer(ths, electMS); - tAssert(ret == 0); + ASSERT(ret == 0); sNTrace(ths, "maybe leader transfer to %s:%d %" PRId64, pSyncLeaderTransfer->newNodeInfo.nodeFqdn, pSyncLeaderTransfer->newNodeInfo.nodePort, pSyncLeaderTransfer->newLeaderId.addr); @@ -2865,7 +2865,7 @@ bool syncNodeIsOptimizedOneReplica(SSyncNode* ths, SRpcMsg* pMsg) { } int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, uint64_t flag) { - tAssert(false); + ASSERT(false); if (beginIndex > endIndex) { return 0; } @@ -2909,8 +2909,8 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde sNTrace(ths, "miss cache index:%" PRId64, i); code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry); - // tAssert(code == 0); - // tAssert(pEntry != NULL); + // ASSERT(code == 0); + // ASSERT(pEntry != NULL); if (code != 0 || pEntry == NULL) { sNError(ths, "get log entry error"); sFatal("vgId:%d, get log entry %" PRId64 " error when commit since %s", ths->vgId, i, terrstr()); @@ -2957,7 +2957,7 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde // leader transfer if (pEntry->originalRpcType == TDMT_SYNC_LEADER_TRANSFER) { code = syncDoLeaderTransfer(ths, &rpcMsg, pEntry); - tAssert(code == 0); + ASSERT(code == 0); } #endif diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 5caacd38a4..f8fcdbddb3 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -43,15 +43,15 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt goto _out; } - tAssert(index == pBuf->endIndex); + ASSERT(index == pBuf->endIndex); SSyncRaftEntry* pExist = pBuf->entries[index % pBuf->size].pItem; - tAssert(pExist == NULL); + ASSERT(pExist == NULL); // initial log buffer with at least one item, e.g. commitIndex SSyncRaftEntry* pMatch = pBuf->entries[(index - 1 + pBuf->size) % pBuf->size].pItem; - tAssertS(pMatch != NULL, "no matched log entry"); - tAssert(pMatch->index + 1 == index); + ASSERT(pMatch != NULL && "no matched log entry"); + ASSERT(pMatch->index + 1 == index); SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = pMatch->index, .prevLogTerm = pMatch->term}; pBuf->entries[index % pBuf->size] = tmp; @@ -82,20 +82,20 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S return -1; } - tAssert(index - 1 == prevIndex); + ASSERT(index - 1 == prevIndex); if (prevIndex >= pBuf->startIndex) { pEntry = pBuf->entries[(prevIndex + pBuf->size) % pBuf->size].pItem; - tAssertS(pEntry != NULL, "no log entry found"); + ASSERT(pEntry != NULL && "no log entry found"); prevLogTerm = pEntry->term; return prevLogTerm; } if (pMgr && pMgr->startIndex <= prevIndex && prevIndex < pMgr->endIndex) { int64_t timeMs = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].timeMs; - tAssertS(timeMs != 0, "no log entry found"); + ASSERT(timeMs != 0 && "no log entry found"); prevLogTerm = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].term; - tAssert(prevIndex == 0 || prevLogTerm != 0); + ASSERT(prevIndex == 0 || prevLogTerm != 0); return prevLogTerm; } @@ -141,9 +141,9 @@ int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex } int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - tAssertS(pNode->pLogStore != NULL, "log store not created"); - tAssertS(pNode->pFsm != NULL, "pFsm not registered"); - tAssertS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); + ASSERT(pNode->pLogStore != NULL && "log store not created"); + ASSERT(pNode->pFsm != NULL && "pFsm not registered"); + ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { @@ -158,7 +158,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { } SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - tAssert(lastVer >= commitIndex); + ASSERT(lastVer >= commitIndex); SyncIndex toIndex = lastVer; // update match index pBuf->commitIndex = commitIndex; @@ -206,7 +206,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { // put a dummy record at commitIndex if present in log buffer if (takeDummy) { - tAssert(index == pBuf->commitIndex); + ASSERT(index == pBuf->commitIndex); SSyncRaftEntry* pDummy = syncEntryBuildDummy(commitTerm, commitIndex, pNode->vgId); if (pDummy == NULL) { @@ -264,7 +264,7 @@ int32_t syncLogBufferReInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) { FORCE_INLINE SyncTerm syncLogBufferGetLastMatchTerm(SSyncLogBuffer* pBuf) { SyncIndex index = pBuf->matchIndex; SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); return pEntry->term; } @@ -282,7 +282,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); SyncTerm term = syncLogReplMgrGetPrevLogTerm(NULL, pNode, index + 1); - tAssert(pEntry->term >= 0); + ASSERT(pEntry->term >= 0); if (term == pEntry->term) { ret = 0; } @@ -308,7 +308,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt // check current in buffer SSyncRaftEntry* pExist = pBuf->entries[index % pBuf->size].pItem; if (pExist != NULL) { - tAssert(pEntry->index == pExist->index); + ASSERT(pEntry->index == pExist->index); if (pEntry->term != pExist->term) { (void)syncLogBufferRollback(pBuf, pNode, index); @@ -318,7 +318,7 @@ int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt pNode->vgId, pEntry->index, pEntry->term, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); SyncTerm existPrevTerm = pBuf->entries[index % pBuf->size].prevLogTerm; - tAssert(pEntry->term == pExist->term && prevTerm == existPrevTerm); + ASSERT(pEntry->term == pExist->term && prevTerm == existPrevTerm); ret = 0; goto _out; } @@ -343,14 +343,14 @@ _out: } int32_t syncLogStorePersist(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { - tAssert(pEntry->index >= 0); + ASSERT(pEntry->index >= 0); SyncIndex lastVer = pLogStore->syncLogLastIndex(pLogStore); if (lastVer >= pEntry->index && pLogStore->syncLogTruncate(pLogStore, pEntry->index) < 0) { sError("failed to truncate log store since %s. from index:%" PRId64 "", terrstr(), pEntry->index); return -1; } lastVer = pLogStore->syncLogLastIndex(pLogStore); - tAssert(pEntry->index == lastVer + 1); + ASSERT(pEntry->index == lastVer + 1); if (pLogStore->syncLogAppendEntry(pLogStore, pEntry) < 0) { sError("failed to append sync log entry since %s. index:%" PRId64 ", term:%" PRId64 "", terrstr(), pEntry->index, @@ -359,7 +359,7 @@ int32_t syncLogStorePersist(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry) { } lastVer = pLogStore->syncLogLastIndex(pLogStore); - tAssert(pEntry->index == lastVer); + ASSERT(pEntry->index == lastVer); return 0; } @@ -372,7 +372,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p while (pBuf->matchIndex + 1 < pBuf->endIndex) { int64_t index = pBuf->matchIndex + 1; - tAssert(index >= 0); + ASSERT(index >= 0); // try to proceed SSyncLogBufEntry* pBufEntry = &pBuf->entries[index % pBuf->size]; @@ -385,14 +385,14 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p goto _out; } - tAssert(index == pEntry->index); + ASSERT(index == pEntry->index); // match SSyncRaftEntry* pMatch = pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem; - tAssert(pMatch != NULL); - tAssert(pMatch->index == pBuf->matchIndex); - tAssert(pMatch->index + 1 == pEntry->index); - tAssert(prevLogIndex == pMatch->index); + ASSERT(pMatch != NULL); + ASSERT(pMatch->index == pBuf->matchIndex); + ASSERT(pMatch->index + 1 == pEntry->index); + ASSERT(prevLogIndex == pMatch->index); if (pMatch->term != prevLogTerm) { sInfo( @@ -419,7 +419,7 @@ int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* p pEntry->index); goto _out; } - tAssert(pEntry->index == pBuf->matchIndex); + ASSERT(pEntry->index == pBuf->matchIndex); // update my match index matchIndex = pBuf->matchIndex; @@ -437,7 +437,7 @@ _out: } int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry) { - tAssertS(pFsm->FpCommitCb != NULL, "No commit cb registered for the FSM"); + ASSERT(pFsm->FpCommitCb != NULL && "No commit cb registered for the FSM"); if ((pNode->replicaNum == 1) && pNode->restoreFinish && pNode->vgId != 1) { return 0; @@ -464,16 +464,16 @@ int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, Syn (void)syncRespMgrGetAndDel(pNode->pSyncRespMgr, cbMeta.seqNum, &rpcMsg.info); int32_t code = pFsm->FpCommitCb(pFsm, &rpcMsg, &cbMeta); - tAssert(rpcMsg.pCont == NULL); + ASSERT(rpcMsg.pCont == NULL); return code; } int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf) { - tAssert(pBuf->startIndex <= pBuf->matchIndex); - tAssert(pBuf->commitIndex <= pBuf->matchIndex); - tAssert(pBuf->matchIndex < pBuf->endIndex); - tAssert(pBuf->endIndex - pBuf->startIndex <= pBuf->size); - tAssert(pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem); + ASSERT(pBuf->startIndex <= pBuf->matchIndex); + ASSERT(pBuf->commitIndex <= pBuf->matchIndex); + ASSERT(pBuf->matchIndex < pBuf->endIndex); + ASSERT(pBuf->endIndex - pBuf->startIndex <= pBuf->size); + ASSERT(pBuf->entries[(pBuf->matchIndex + pBuf->size) % pBuf->size].pItem); return 0; } @@ -536,7 +536,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm SyncIndex until = pBuf->commitIndex - (pBuf->size >> 4); for (SyncIndex index = pBuf->startIndex; index < until; index++) { SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); syncEntryDestroy(pEntry); memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); pBuf->startIndex = index + 1; @@ -562,7 +562,7 @@ _out: } int32_t syncLogReplMgrReset(SSyncLogReplMgr* pMgr) { - tAssert(pMgr->startIndex >= 0); + ASSERT(pMgr->startIndex >= 0); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); } @@ -597,7 +597,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { int64_t pos = index % pMgr->size; - tAssert(!pMgr->states[pos].barrier || (index == pMgr->startIndex || index + 1 == pMgr->endIndex)); + ASSERT(!pMgr->states[pos].barrier || (index == pMgr->startIndex || index + 1 == pMgr->endIndex)); if (nowMs < pMgr->states[pos].timeMs + retryWaitMs) { break; @@ -613,7 +613,7 @@ int32_t syncLogReplMgrRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { terrstr(), index, pDestId->addr); goto _out; } - tAssert(barrier == pMgr->states[pos].barrier); + ASSERT(barrier == pMgr->states[pos].barrier); pMgr->states[pos].timeMs = nowMs; pMgr->states[pos].term = term; pMgr->states[pos].acked = false; @@ -639,14 +639,14 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod SyncAppendEntriesReply* pMsg) { SSyncLogBuffer* pBuf = pNode->pLogBuf; SRaftId destId = pMsg->srcId; - tAssert(pMgr->restored == false); + ASSERT(pMgr->restored == false); char host[64]; uint16_t port; syncUtilU642Addr(destId.addr, host, sizeof(host), &port); if (pMgr->endIndex == 0) { - tAssert(pMgr->startIndex == 0); - tAssert(pMgr->matchIndex == 0); + ASSERT(pMgr->startIndex == 0); + ASSERT(pMgr->matchIndex == 0); if (pMsg->matchIndex < 0) { pMgr->restored = true; sInfo("vgId:%d, sync log repl mgr restored. peer: %s:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 @@ -693,7 +693,7 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) { term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1); if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) { - tAssert(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); if (syncNodeStartSnapshot(pNode, &destId) < 0) { sError("vgId:%d, failed to start snapshot for peer %s:%d", pNode->vgId, host, port); return -1; @@ -702,13 +702,13 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod return 0; } - tAssert(index + 1 >= firstVer); + ASSERT(index + 1 >= firstVer); if (term == pMsg->lastMatchTerm) { index = index + 1; - tAssert(index <= pNode->pLogBuf->matchIndex); + ASSERT(index <= pNode->pLogBuf->matchIndex); } else { - tAssert(index > firstVer); + ASSERT(index > firstVer); } } @@ -760,8 +760,8 @@ int32_t syncLogReplMgrReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { } int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) { - tAssert(!pMgr->restored); - tAssert(pMgr->startIndex >= 0); + ASSERT(!pMgr->restored); + ASSERT(pMgr->startIndex >= 0); int64_t retryMaxWaitMs = SYNC_LOG_REPL_RETRY_WAIT_MS * (1 << SYNC_MAX_RETRY_BACKOFF); int64_t nowMs = taosGetMonoTimestampMs(); @@ -780,7 +780,7 @@ int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode return -1; } - tAssert(index >= 0); + ASSERT(index >= 0); pMgr->states[index % pMgr->size].barrier = barrier; pMgr->states[index % pMgr->size].timeMs = nowMs; pMgr->states[index % pMgr->size].term = term; @@ -799,7 +799,7 @@ int32_t syncLogReplMgrReplicateProbeOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode } int32_t syncLogReplMgrReplicateAttemptedOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { - tAssert(pMgr->restored); + ASSERT(pMgr->restored); SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; int32_t batchSize = TMAX(1, pMgr->size / 20); int32_t count = 0; @@ -848,7 +848,7 @@ int32_t syncLogReplMgrReplicateAttemptedOnce(SSyncLogReplMgr* pMgr, SSyncNode* p } int32_t syncLogReplMgrProcessReplyInNormalMode(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) { - tAssert(pMgr->restored == true); + ASSERT(pMgr->restored == true); if (pMgr->startIndex <= pMsg->lastSendIndex && pMsg->lastSendIndex < pMgr->endIndex) { if (pMgr->startIndex < pMgr->matchIndex && pMgr->retryBackoff > 0) { int64_t firstSentMs = pMgr->states[pMgr->startIndex % pMgr->size].timeMs; @@ -878,7 +878,7 @@ SSyncLogReplMgr* syncLogReplMgrCreate() { pMgr->size = sizeof(pMgr->states) / sizeof(pMgr->states[0]); - tAssert(pMgr->size == TSDB_SYNC_LOG_BUFFER_SIZE); + ASSERT(pMgr->size == TSDB_SYNC_LOG_BUFFER_SIZE); return pMgr; @@ -897,10 +897,10 @@ void syncLogReplMgrDestroy(SSyncLogReplMgr* pMgr) { int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) { for (int i = 0; i < TSDB_MAX_REPLICA; i++) { - tAssert(pNode->logReplMgrs[i] == NULL); + ASSERT(pNode->logReplMgrs[i] == NULL); pNode->logReplMgrs[i] = syncLogReplMgrCreate(); pNode->logReplMgrs[i]->peerId = i; - tAssertS(pNode->logReplMgrs[i] != NULL, "Out of memory."); + ASSERT(pNode->logReplMgrs[i] != NULL && "Out of memory."); } return 0; } @@ -921,7 +921,7 @@ SSyncLogBuffer* syncLogBufferCreate() { pBuf->size = sizeof(pBuf->entries) / sizeof(pBuf->entries[0]); - tAssert(pBuf->size == TSDB_SYNC_LOG_BUFFER_SIZE); + ASSERT(pBuf->size == TSDB_SYNC_LOG_BUFFER_SIZE); if (taosThreadMutexAttrInit(&pBuf->attr) < 0) { sError("failed to init log buffer mutexattr due to %s", strerror(errno)); @@ -973,7 +973,7 @@ void syncLogBufferDestroy(SSyncLogBuffer* pBuf) { } int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex toIndex) { - tAssert(pBuf->commitIndex < toIndex && toIndex <= pBuf->endIndex); + ASSERT(pBuf->commitIndex < toIndex && toIndex <= pBuf->endIndex); sInfo("vgId:%d, rollback sync log buffer. toindex: %" PRId64 ", buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", @@ -992,7 +992,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex } pBuf->endIndex = toIndex; pBuf->matchIndex = TMIN(pBuf->matchIndex, index); - tAssert(index + 1 == toIndex); + ASSERT(index + 1 == toIndex); // trunc wal SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); @@ -1001,7 +1001,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex return -1; } lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - tAssert(toIndex == lastVer + 1); + ASSERT(toIndex == lastVer + 1); syncLogBufferValidate(pBuf); return 0; @@ -1010,7 +1010,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) { taosThreadMutexLock(&pBuf->mutex); SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); - tAssert(lastVer == pBuf->matchIndex); + ASSERT(lastVer == pBuf->matchIndex); SyncIndex index = pBuf->endIndex - 1; (void)syncLogBufferRollback(pBuf, pNode, pBuf->matchIndex + 1); diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index 322fd409de..c609bfba93 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -23,7 +23,7 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { snprintf(pRaftCfgIndex->path, sizeof(pRaftCfgIndex->path), "%s", path); pRaftCfgIndex->pFile = taosOpenFile(pRaftCfgIndex->path, TD_FILE_READ | TD_FILE_WRITE); - tAssert(pRaftCfgIndex->pFile != NULL); + ASSERT(pRaftCfgIndex->pFile != NULL); taosLSeekFile(pRaftCfgIndex->pFile, 0, SEEK_SET); @@ -31,10 +31,10 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { char *pBuf = taosMemoryMalloc(bufLen); memset(pBuf, 0, bufLen); int64_t len = taosReadFile(pRaftCfgIndex->pFile, pBuf, bufLen); - tAssert(len > 0); + ASSERT(len > 0); int32_t ret = raftCfgIndexFromStr(pBuf, pRaftCfgIndex); - tAssert(ret == 0); + ASSERT(ret == 0); taosMemoryFree(pBuf); @@ -44,20 +44,20 @@ SRaftCfgIndex *raftCfgIndexOpen(const char *path) { int32_t raftCfgIndexClose(SRaftCfgIndex *pRaftCfgIndex) { if (pRaftCfgIndex != NULL) { int64_t ret = taosCloseFile(&(pRaftCfgIndex->pFile)); - tAssert(ret == 0); + ASSERT(ret == 0); taosMemoryFree(pRaftCfgIndex); } return 0; } int32_t raftCfgIndexPersist(SRaftCfgIndex *pRaftCfgIndex) { - tAssert(pRaftCfgIndex != NULL); + ASSERT(pRaftCfgIndex != NULL); char *s = raftCfgIndex2Str(pRaftCfgIndex); taosLSeekFile(pRaftCfgIndex->pFile, 0, SEEK_SET); int64_t ret = taosWriteFile(pRaftCfgIndex->pFile, s, strlen(s) + 1); - tAssert(ret == strlen(s) + 1); + ASSERT(ret == strlen(s) + 1); taosMemoryFree(s); taosFsyncFile(pRaftCfgIndex->pFile); @@ -65,7 +65,7 @@ int32_t raftCfgIndexPersist(SRaftCfgIndex *pRaftCfgIndex) { } int32_t raftCfgIndexAddConfigIndex(SRaftCfgIndex *pRaftCfgIndex, SyncIndex configIndex) { - tAssert(pRaftCfgIndex->configIndexCount <= MAX_CONFIG_INDEX_COUNT); + ASSERT(pRaftCfgIndex->configIndexCount <= MAX_CONFIG_INDEX_COUNT); (pRaftCfgIndex->configIndexArr)[pRaftCfgIndex->configIndexCount] = configIndex; ++(pRaftCfgIndex->configIndexCount); return 0; @@ -105,15 +105,15 @@ int32_t raftCfgIndexFromJson(const cJSON *pRoot, SRaftCfgIndex *pRaftCfgIndex) { cJSON *pIndexArr = cJSON_GetObjectItem(pJson, "configIndexArr"); int arraySize = cJSON_GetArraySize(pIndexArr); - tAssert(arraySize == pRaftCfgIndex->configIndexCount); + ASSERT(arraySize == pRaftCfgIndex->configIndexCount); memset(pRaftCfgIndex->configIndexArr, 0, sizeof(pRaftCfgIndex->configIndexArr)); for (int i = 0; i < arraySize; ++i) { cJSON *pIndexObj = cJSON_GetArrayItem(pIndexArr, i); - tAssert(pIndexObj != NULL); + ASSERT(pIndexObj != NULL); cJSON *pIndex = cJSON_GetObjectItem(pIndexObj, "index"); - tAssert(cJSON_IsString(pIndex)); + ASSERT(cJSON_IsString(pIndex)); (pRaftCfgIndex->configIndexArr)[i] = atoll(pIndex->valuestring); } @@ -122,10 +122,10 @@ int32_t raftCfgIndexFromJson(const cJSON *pRoot, SRaftCfgIndex *pRaftCfgIndex) { int32_t raftCfgIndexFromStr(const char *s, SRaftCfgIndex *pRaftCfgIndex) { cJSON *pRoot = cJSON_Parse(s); - tAssert(pRoot != NULL); + ASSERT(pRoot != NULL); int32_t ret = raftCfgIndexFromJson(pRoot, pRaftCfgIndex); - tAssert(ret == 0); + ASSERT(ret == 0); cJSON_Delete(pRoot); return 0; @@ -140,7 +140,7 @@ int32_t raftCfgIndexCreateFile(const char *path) { const char *sysErrStr = strerror(errno); sError("create raft cfg index file error, err:%d %X, msg:%s, syserr:%d, sysmsg:%s", err, err, errStr, sysErr, sysErrStr); - tAssert(0); + ASSERT(0); return -1; } @@ -152,7 +152,7 @@ int32_t raftCfgIndexCreateFile(const char *path) { char *s = raftCfgIndex2Str(&raftCfgIndex); int64_t ret = taosWriteFile(pFile, s, strlen(s) + 1); - tAssert(ret == strlen(s) + 1); + ASSERT(ret == strlen(s) + 1); taosMemoryFree(s); taosCloseFile(&pFile); @@ -166,29 +166,29 @@ SRaftCfg *raftCfgOpen(const char *path) { snprintf(pCfg->path, sizeof(pCfg->path), "%s", path); pCfg->pFile = taosOpenFile(pCfg->path, TD_FILE_READ | TD_FILE_WRITE); - tAssert(pCfg->pFile != NULL); + ASSERT(pCfg->pFile != NULL); taosLSeekFile(pCfg->pFile, 0, SEEK_SET); char buf[CONFIG_FILE_LEN] = {0}; int len = taosReadFile(pCfg->pFile, buf, sizeof(buf)); - tAssert(len > 0); + ASSERT(len > 0); int32_t ret = raftCfgFromStr(buf, pCfg); - tAssert(ret == 0); + ASSERT(ret == 0); return pCfg; } int32_t raftCfgClose(SRaftCfg *pRaftCfg) { int64_t ret = taosCloseFile(&(pRaftCfg->pFile)); - tAssert(ret == 0); + ASSERT(ret == 0); taosMemoryFree(pRaftCfg); return 0; } int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { - tAssert(pRaftCfg != NULL); + ASSERT(pRaftCfg != NULL); char *s = raftCfg2Str(pRaftCfg); taosLSeekFile(pRaftCfg->pFile, 0, SEEK_SET); @@ -198,15 +198,15 @@ int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { if (strlen(s) + 1 > CONFIG_FILE_LEN) { sError("too long config str:%s", s); - tAssert(0); + ASSERT(0); } snprintf(buf, sizeof(buf), "%s", s); int64_t ret = taosWriteFile(pRaftCfg->pFile, buf, sizeof(buf)); - tAssert(ret == sizeof(buf)); + ASSERT(ret == sizeof(buf)); // int64_t ret = taosWriteFile(pRaftCfg->pFile, s, strlen(s) + 1); - // tAssert(ret == strlen(s) + 1); + // ASSERT(ret == strlen(s) + 1); taosMemoryFree(s); taosFsyncFile(pRaftCfg->pFile); @@ -214,7 +214,7 @@ int32_t raftCfgPersist(SRaftCfg *pRaftCfg) { } int32_t raftCfgAddConfigIndex(SRaftCfg *pRaftCfg, SyncIndex configIndex) { - tAssert(pRaftCfg->configIndexCount <= MAX_CONFIG_INDEX_COUNT); + ASSERT(pRaftCfg->configIndexCount <= MAX_CONFIG_INDEX_COUNT); (pRaftCfg->configIndexArr)[pRaftCfg->configIndexCount] = configIndex; ++(pRaftCfg->configIndexCount); return 0; @@ -247,27 +247,27 @@ int32_t syncCfgFromJson(const cJSON *pRoot, SSyncCfg *pSyncCfg) { const cJSON *pJson = pRoot; cJSON *pReplicaNum = cJSON_GetObjectItem(pJson, "replicaNum"); - tAssert(cJSON_IsNumber(pReplicaNum)); + ASSERT(cJSON_IsNumber(pReplicaNum)); pSyncCfg->replicaNum = cJSON_GetNumberValue(pReplicaNum); cJSON *pMyIndex = cJSON_GetObjectItem(pJson, "myIndex"); - tAssert(cJSON_IsNumber(pMyIndex)); + ASSERT(cJSON_IsNumber(pMyIndex)); pSyncCfg->myIndex = cJSON_GetNumberValue(pMyIndex); cJSON *pNodeInfoArr = cJSON_GetObjectItem(pJson, "nodeInfo"); int arraySize = cJSON_GetArraySize(pNodeInfoArr); - tAssert(arraySize == pSyncCfg->replicaNum); + ASSERT(arraySize == pSyncCfg->replicaNum); for (int i = 0; i < arraySize; ++i) { cJSON *pNodeInfo = cJSON_GetArrayItem(pNodeInfoArr, i); - tAssert(pNodeInfo != NULL); + ASSERT(pNodeInfo != NULL); cJSON *pNodePort = cJSON_GetObjectItem(pNodeInfo, "nodePort"); - tAssert(cJSON_IsNumber(pNodePort)); + ASSERT(cJSON_IsNumber(pNodePort)); ((pSyncCfg->nodeInfo)[i]).nodePort = cJSON_GetNumberValue(pNodePort); cJSON *pNodeFqdn = cJSON_GetObjectItem(pNodeInfo, "nodeFqdn"); - tAssert(cJSON_IsString(pNodeFqdn)); + ASSERT(cJSON_IsString(pNodeFqdn)); snprintf(((pSyncCfg->nodeInfo)[i]).nodeFqdn, sizeof(((pSyncCfg->nodeInfo)[i]).nodeFqdn), "%s", pNodeFqdn->valuestring); } @@ -332,13 +332,13 @@ int32_t raftCfgCreateFile(SSyncCfg *pCfg, SRaftCfgMeta meta, const char *path) { char buf[CONFIG_FILE_LEN] = {0}; memset(buf, 0, sizeof(buf)); - tAssert(strlen(s) + 1 <= CONFIG_FILE_LEN); + ASSERT(strlen(s) + 1 <= CONFIG_FILE_LEN); snprintf(buf, sizeof(buf), "%s", s); int64_t ret = taosWriteFile(pFile, buf, sizeof(buf)); - tAssert(ret == sizeof(buf)); + ASSERT(ret == sizeof(buf)); // int64_t ret = taosWriteFile(pFile, s, strlen(s) + 1); - // tAssert(ret == strlen(s) + 1); + // ASSERT(ret == strlen(s) + 1); taosMemoryFree(s); taosCloseFile(&pFile); @@ -366,31 +366,31 @@ int32_t raftCfgFromJson(const cJSON *pRoot, SRaftCfg *pRaftCfg) { cJSON *pIndexArr = cJSON_GetObjectItem(pJson, "configIndexArr"); int arraySize = cJSON_GetArraySize(pIndexArr); - tAssert(arraySize == pRaftCfg->configIndexCount); + ASSERT(arraySize == pRaftCfg->configIndexCount); memset(pRaftCfg->configIndexArr, 0, sizeof(pRaftCfg->configIndexArr)); for (int i = 0; i < arraySize; ++i) { cJSON *pIndexObj = cJSON_GetArrayItem(pIndexArr, i); - tAssert(pIndexObj != NULL); + ASSERT(pIndexObj != NULL); cJSON *pIndex = cJSON_GetObjectItem(pIndexObj, "index"); - tAssert(cJSON_IsString(pIndex)); + ASSERT(cJSON_IsString(pIndex)); (pRaftCfg->configIndexArr)[i] = atoll(pIndex->valuestring); } cJSON *pJsonSyncCfg = cJSON_GetObjectItem(pJson, "SSyncCfg"); int32_t code = syncCfgFromJson(pJsonSyncCfg, &(pRaftCfg->cfg)); - tAssert(code == 0); + ASSERT(code == 0); return code; } int32_t raftCfgFromStr(const char *s, SRaftCfg *pRaftCfg) { cJSON *pRoot = cJSON_Parse(s); - tAssert(pRoot != NULL); + ASSERT(pRoot != NULL); int32_t ret = raftCfgFromJson(pRoot, pRaftCfg); - tAssert(ret == 0); + ASSERT(ret == 0); cJSON_Delete(pRoot); return 0; diff --git a/source/libs/sync/src/syncRaftEntry.c b/source/libs/sync/src/syncRaftEntry.c index c746a85418..988a86cc67 100644 --- a/source/libs/sync/src/syncRaftEntry.c +++ b/source/libs/sync/src/syncRaftEntry.c @@ -317,11 +317,11 @@ int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* p } SSkipListNode* pSkipListNode = tSkipListPut(pCache->pSkipList, pEntry); - tAssert(pSkipListNode != NULL); + ASSERT(pSkipListNode != NULL); ++(pCache->currentCount); pEntry->rid = taosAddRef(pCache->refMgr, pEntry); - tAssert(pEntry->rid >= 0); + ASSERT(pEntry->rid >= 0); sNTrace(pCache->pSyncNode, "raft cache add, type:%s,%d, type2:%s,%d, index:%" PRId64 ", bytes:%d", TMSG_INFO(pEntry->msgType), pEntry->msgType, TMSG_INFO(pEntry->originalRpcType), pEntry->originalRpcType, @@ -334,7 +334,7 @@ int32_t raftEntryCachePutEntry(struct SRaftEntryCache* pCache, SSyncRaftEntry* p // not found, return 0 // error, return -1 int32_t raftEntryCacheGetEntry(struct SRaftEntryCache* pCache, SyncIndex index, SSyncRaftEntry** ppEntry) { - tAssert(ppEntry != NULL); + ASSERT(ppEntry != NULL); SSyncRaftEntry* pEntry = NULL; int32_t code = raftEntryCacheGetEntryP(pCache, index, &pEntry); if (code == 1) { @@ -361,7 +361,7 @@ int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, int32_t arraySize = taosArrayGetSize(entryPArray); if (arraySize == 1) { SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); - tAssert(*ppNode != NULL); + ASSERT(*ppNode != NULL); *ppEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); taosAcquireRef(pCache->refMgr, (*ppEntry)->rid); code = 1; @@ -370,7 +370,7 @@ int32_t raftEntryCacheGetEntryP(struct SRaftEntryCache* pCache, SyncIndex index, code = 0; } else { - tAssert(0); + ASSERT(0); code = -1; } @@ -393,7 +393,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - tAssert(pNode != NULL); + ASSERT(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); syncEntryDestroy(pEntry); ++returnCnt; @@ -403,7 +403,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { tSkipListDestroy(pCache->pSkipList); pCache->pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); - tAssert(pCache->pSkipList != NULL); + ASSERT(pCache->pSkipList != NULL); } else { // clear count @@ -414,7 +414,7 @@ int32_t raftEntryCacheClear(struct SRaftEntryCache* pCache, int32_t count) { // free entry while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - tAssert(pNode != NULL); + ASSERT(pNode != NULL); if (i++ >= count) { break; } diff --git a/source/libs/sync/src/syncRaftLog.c b/source/libs/sync/src/syncRaftLog.c index 4a0109c4bd..018ac5bb7d 100644 --- a/source/libs/sync/src/syncRaftLog.c +++ b/source/libs/sync/src/syncRaftLog.c @@ -51,16 +51,16 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) { taosLRUCacheSetStrictCapacity(pLogStore->pCache, false); pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData)); - tAssert(pLogStore->data != NULL); + ASSERT(pLogStore->data != NULL); SSyncLogStoreData* pData = pLogStore->data; pData->pSyncNode = pSyncNode; pData->pWal = pSyncNode->pWal; - tAssert(pData->pWal != NULL); + ASSERT(pData->pWal != NULL); taosThreadMutexInit(&(pData->mutex), NULL); pData->pWalHandle = walOpenReader(pData->pWal, NULL); - tAssert(pData->pWalHandle != NULL); + ASSERT(pData->pWalHandle != NULL); pLogStore->syncLogUpdateCommitIndex = raftLogUpdateCommitIndex; pLogStore->syncLogCommitIndex = raftlogCommitIndex; @@ -103,7 +103,7 @@ void logStoreDestory(SSyncLogStore* pLogStore) { // log[m .. n] static int32_t raftLogRestoreFromSnapshot(struct SSyncLogStore* pLogStore, SyncIndex snapshotIndex) { - tAssert(snapshotIndex >= 0); + ASSERT(snapshotIndex >= 0); SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; @@ -217,7 +217,7 @@ static int32_t raftLogAppendEntry(struct SSyncLogStore* pLogStore, SSyncRaftEntr return -1; } - tAssert(pEntry->index == index); + ASSERT(pEntry->index == index); sNTrace(pData->pSyncNode, "write index:%" PRId64 ", type:%s, origin type:%s, elapsed:%" PRId64, pEntry->index, TMSG_INFO(pEntry->msgType), TMSG_INFO(pEntry->originalRpcType), tsElapsed); @@ -275,14 +275,14 @@ int32_t raftLogGetEntry(struct SSyncLogStore* pLogStore, SyncIndex index, SSyncR } *ppEntry = syncEntryBuild(pWalHandle->pHead->head.bodyLen); - tAssert(*ppEntry != NULL); + ASSERT(*ppEntry != NULL); (*ppEntry)->msgType = TDMT_SYNC_CLIENT_REQUEST; (*ppEntry)->originalRpcType = pWalHandle->pHead->head.msgType; (*ppEntry)->seqNum = pWalHandle->pHead->head.syncMeta.seqNum; (*ppEntry)->isWeak = pWalHandle->pHead->head.syncMeta.isWeek; (*ppEntry)->term = pWalHandle->pHead->head.syncMeta.term; (*ppEntry)->index = index; - tAssert((*ppEntry)->dataLen == pWalHandle->pHead->head.bodyLen); + ASSERT((*ppEntry)->dataLen == pWalHandle->pHead->head.bodyLen); memcpy((*ppEntry)->data, pWalHandle->pHead->head.body, pWalHandle->pHead->head.bodyLen); /* @@ -356,7 +356,7 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** ppLastEntry) { SSyncLogStoreData* pData = pLogStore->data; SWal* pWal = pData->pWal; - tAssert(ppLastEntry != NULL); + ASSERT(ppLastEntry != NULL); *ppLastEntry = NULL; if (walIsEmpty(pWal)) { @@ -364,7 +364,7 @@ static int32_t raftLogGetLastEntry(SSyncLogStore* pLogStore, SSyncRaftEntry** pp return -1; } else { SyncIndex lastIndex = raftLogLastIndex(pLogStore); - tAssert(lastIndex >= SYNC_INDEX_BEGIN); + ASSERT(lastIndex >= SYNC_INDEX_BEGIN); int32_t code = raftLogGetEntry(pLogStore, lastIndex, ppLastEntry); return code; } diff --git a/source/libs/sync/src/syncRaftStore.c b/source/libs/sync/src/syncRaftStore.c index 85761c6b7e..e328ed3d31 100644 --- a/source/libs/sync/src/syncRaftStore.c +++ b/source/libs/sync/src/syncRaftStore.c @@ -34,34 +34,34 @@ SRaftStore *raftStoreOpen(const char *path) { snprintf(pRaftStore->path, sizeof(pRaftStore->path), "%s", path); if (!raftStoreFileExist(pRaftStore->path)) { ret = raftStoreInit(pRaftStore); - tAssert(ret == 0); + ASSERT(ret == 0); } char storeBuf[RAFT_STORE_BLOCK_SIZE] = {0}; pRaftStore->pFile = taosOpenFile(path, TD_FILE_READ | TD_FILE_WRITE); - tAssert(pRaftStore->pFile != NULL); + ASSERT(pRaftStore->pFile != NULL); int len = taosReadFile(pRaftStore->pFile, storeBuf, RAFT_STORE_BLOCK_SIZE); - tAssert(len > 0); + ASSERT(len > 0); ret = raftStoreDeserialize(pRaftStore, storeBuf, len); - tAssert(ret == 0); + ASSERT(ret == 0); return pRaftStore; } static int32_t raftStoreInit(SRaftStore *pRaftStore) { - tAssert(pRaftStore != NULL); + ASSERT(pRaftStore != NULL); pRaftStore->pFile = taosOpenFile(pRaftStore->path, TD_FILE_CREATE | TD_FILE_WRITE); - tAssert(pRaftStore->pFile != NULL); + ASSERT(pRaftStore->pFile != NULL); pRaftStore->currentTerm = 0; pRaftStore->voteFor.addr = 0; pRaftStore->voteFor.vgId = 0; int32_t ret = raftStorePersist(pRaftStore); - tAssert(ret == 0); + ASSERT(ret == 0); taosCloseFile(&pRaftStore->pFile); return 0; @@ -77,17 +77,17 @@ int32_t raftStoreClose(SRaftStore *pRaftStore) { } int32_t raftStorePersist(SRaftStore *pRaftStore) { - tAssert(pRaftStore != NULL); + ASSERT(pRaftStore != NULL); int32_t ret; char storeBuf[RAFT_STORE_BLOCK_SIZE] = {0}; ret = raftStoreSerialize(pRaftStore, storeBuf, sizeof(storeBuf)); - tAssert(ret == 0); + ASSERT(ret == 0); taosLSeekFile(pRaftStore->pFile, 0, SEEK_SET); ret = taosWriteFile(pRaftStore->pFile, storeBuf, sizeof(storeBuf)); - tAssert(ret == RAFT_STORE_BLOCK_SIZE); + ASSERT(ret == RAFT_STORE_BLOCK_SIZE); taosFsyncFile(pRaftStore->pFile); return 0; @@ -99,7 +99,7 @@ static bool raftStoreFileExist(char *path) { } int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { - tAssert(pRaftStore != NULL); + ASSERT(pRaftStore != NULL); cJSON *pRoot = cJSON_CreateObject(); @@ -121,7 +121,7 @@ int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { char *serialized = cJSON_Print(pRoot); int len2 = strlen(serialized); - tAssert(len2 < len); + ASSERT(len2 < len); memset(buf, 0, len); snprintf(buf, len, "%s", serialized); taosMemoryFree(serialized); @@ -131,17 +131,17 @@ int32_t raftStoreSerialize(SRaftStore *pRaftStore, char *buf, size_t len) { } int32_t raftStoreDeserialize(SRaftStore *pRaftStore, char *buf, size_t len) { - tAssert(pRaftStore != NULL); + ASSERT(pRaftStore != NULL); - tAssert(len > 0 && len <= RAFT_STORE_BLOCK_SIZE); + ASSERT(len > 0 && len <= RAFT_STORE_BLOCK_SIZE); cJSON *pRoot = cJSON_Parse(buf); cJSON *pCurrentTerm = cJSON_GetObjectItem(pRoot, "current_term"); - tAssert(cJSON_IsString(pCurrentTerm)); + ASSERT(cJSON_IsString(pCurrentTerm)); sscanf(pCurrentTerm->valuestring, "%" PRIu64 "", &(pRaftStore->currentTerm)); cJSON *pVoteForAddr = cJSON_GetObjectItem(pRoot, "vote_for_addr"); - tAssert(cJSON_IsString(pVoteForAddr)); + ASSERT(cJSON_IsString(pVoteForAddr)); sscanf(pVoteForAddr->valuestring, "%" PRIu64 "", &(pRaftStore->voteFor.addr)); cJSON *pVoteForVgid = cJSON_GetObjectItem(pRoot, "vote_for_vgid"); @@ -157,7 +157,7 @@ bool raftStoreHasVoted(SRaftStore *pRaftStore) { } void raftStoreVote(SRaftStore *pRaftStore, SRaftId *pRaftId) { - tAssert(!syncUtilEmptyId(pRaftId)); + ASSERT(!syncUtilEmptyId(pRaftId)); pRaftStore->voteFor = *pRaftId; raftStorePersist(pRaftStore); } diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 2ba59c4a4f..0f56921ec7 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -49,7 +49,7 @@ int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg); int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot) { - tAssert(false && "deprecated"); + ASSERT(false && "deprecated"); // next index SyncIndex nextIndex = syncIndexMgrGetIndex(pSyncNode->pNextIndex, pDestId); @@ -92,10 +92,10 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } if (code == 0) { - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); code = syncBuildAppendEntries(&rpcMsg, (int32_t)(pEntry->bytes), pSyncNode->vgId); - tAssert(code == 0); + ASSERT(code == 0); pMsg = rpcMsg.pCont; memcpy(pMsg->data, pEntry, pEntry->bytes); @@ -103,7 +103,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { // no entry in log code = syncBuildAppendEntries(&rpcMsg, 0, pSyncNode->vgId); - tAssert(code == 0); + ASSERT(code == 0); pMsg = rpcMsg.pCont; } else { @@ -122,7 +122,7 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh } // prepare msg - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); pMsg->srcId = pSyncNode->myRaftId; pMsg->destId = *pDestId; pMsg->term = pSyncNode->pRaftStore->currentTerm; diff --git a/source/libs/sync/src/syncRequestVote.c b/source/libs/sync/src/syncRequestVote.c index cd0804196f..773befe1e4 100644 --- a/source/libs/sync/src/syncRequestVote.c +++ b/source/libs/sync/src/syncRequestVote.c @@ -105,7 +105,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { syncNodeStepDown(ths, pMsg->term); // syncNodeUpdateTerm(ths, pMsg->term); } - tAssert(pMsg->term <= ths->pRaftStore->currentTerm); + ASSERT(pMsg->term <= ths->pRaftStore->currentTerm); bool grant = (pMsg->term == ths->pRaftStore->currentTerm) && logOK && ((!raftStoreHasVoted(ths->pRaftStore)) || (syncUtilSameId(&(ths->pRaftStore->voteFor), &(pMsg->srcId)))); @@ -124,7 +124,7 @@ int32_t syncNodeOnRequestVote(SSyncNode* ths, const SRpcMsg* pRpcMsg) { // send msg SRpcMsg rpcMsg = {0}; ret = syncBuildRequestVoteReply(&rpcMsg, ths->vgId); - tAssert(ret == 0); + ASSERT(ret == 0); SyncRequestVoteReply* pReply = rpcMsg.pCont; pReply->srcId = ths->myRaftId; diff --git a/source/libs/sync/src/syncRequestVoteReply.c b/source/libs/sync/src/syncRequestVoteReply.c index c65486e779..563f475070 100644 --- a/source/libs/sync/src/syncRequestVoteReply.c +++ b/source/libs/sync/src/syncRequestVoteReply.c @@ -54,7 +54,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return -1; } - // tAssert(!(pMsg->term > ths->pRaftStore->currentTerm)); + // ASSERT(!(pMsg->term > ths->pRaftStore->currentTerm)); // no need this code, because if I receive reply.term, then I must have sent for that term. // if (pMsg->term > ths->pRaftStore->currentTerm) { // syncNodeUpdateTerm(ths, pMsg->term); @@ -67,7 +67,7 @@ int32_t syncNodeOnRequestVoteReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { } syncLogRecvRequestVoteReply(ths, pMsg, ""); - tAssert(pMsg->term == ths->pRaftStore->currentTerm); + ASSERT(pMsg->term == ths->pRaftStore->currentTerm); // This tallies votes even when the current state is not Candidate, // but they won't be looked at, so it doesn't matter. diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 3ef66f9295..42deb2c20a 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -81,7 +81,7 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { bool snapshotSenderIsStart(SSyncSnapshotSender *pSender) { return pSender->start; } int32_t snapshotSenderStart(SSyncSnapshotSender *pSender) { - tAssert(!snapshotSenderIsStart(pSender)); + ASSERT(!snapshotSenderIsStart(pSender)); pSender->start = true; pSender->seq = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -140,7 +140,7 @@ int32_t snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { // close reader if (pSender->pReader != NULL) { int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotStopRead(pSender->pSyncNode->pFsm, pSender->pReader); - tAssert(ret == 0); + ASSERT(ret == 0); pSender->pReader = NULL; } @@ -169,7 +169,7 @@ int32_t snapshotSend(SSyncSnapshotSender *pSender) { // read data int32_t ret = pSender->pSyncNode->pFsm->FpSnapshotDoRead(pSender->pSyncNode->pFsm, pSender->pReader, &(pSender->pCurrentBlock), &(pSender->blockLen)); - tAssert(ret == 0); + ASSERT(ret == 0); if (pSender->blockLen > 0) { // has read data } else { @@ -250,7 +250,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { } static void snapshotSenderUpdateProgress(SSyncSnapshotSender *pSender, SyncSnapshotRsp *pMsg) { - tAssert(pMsg->ack == pSender->seq); + ASSERT(pMsg->ack == pSender->seq); pSender->ack = pMsg->ack; ++(pSender->seq); } @@ -330,7 +330,7 @@ void snapshotReceiverDestroy(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - tAssert(ret == 0); + ASSERT(ret == 0); pReceiver->pWriter = NULL; } @@ -347,7 +347,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - tAssert(ret == 0); + ASSERT(ret == 0); pReceiver->pWriter = NULL; } @@ -358,7 +358,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { } int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { - tAssert(snapshotReceiverIsStart(pReceiver)); + ASSERT(snapshotReceiverIsStart(pReceiver)); // update ack pReceiver->ack = SYNC_SNAPSHOT_SEQ_BEGIN; @@ -372,10 +372,10 @@ int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapsh pReceiver->snapshotParam.end = pBeginMsg->lastIndex; // start writer - tAssert(pReceiver->pWriter == NULL); + ASSERT(pReceiver->pWriter == NULL); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStartWrite(pReceiver->pSyncNode->pFsm, &(pReceiver->snapshotParam), &(pReceiver->pWriter)); - tAssert(ret == 0); + ASSERT(ret == 0); // event log sRTrace(pReceiver, "snapshot receiver start writer"); @@ -407,7 +407,7 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { if (pReceiver->pWriter != NULL) { int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); - tAssert(ret == 0); + ASSERT(ret == 0); pReceiver->pWriter = NULL; } @@ -420,7 +420,7 @@ int32_t snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { // when recv last snapshot block, apply data into snapshot static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - tAssert(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); + ASSERT(pMsg->seq == SYNC_SNAPSHOT_SEQ_END); int32_t code = 0; if (pReceiver->pWriter != NULL) { @@ -478,14 +478,14 @@ static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnap // apply data block // update progress static void snapshotReceiverGotData(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { - tAssert(pMsg->seq == pReceiver->ack + 1); + ASSERT(pMsg->seq == pReceiver->ack + 1); if (pReceiver->pWriter != NULL) { if (pMsg->dataLen > 0) { // apply data block int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotDoWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, pMsg->data, pMsg->dataLen); - tAssert(code == 0); + ASSERT(code == 0); } // update progress @@ -790,7 +790,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { int32_t syncNodeOnSnapshotReplyPre(SSyncNode *pSyncNode, SyncSnapshotRsp *pMsg) { // get sender SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - tAssert(pSender != NULL); + ASSERT(pSender != NULL); SSnapshot snapshot; pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot); @@ -863,7 +863,7 @@ int32_t syncNodeOnSnapshotReply(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) { // get sender SSyncSnapshotSender *pSender = syncNodeGetSnapshotSender(pSyncNode, &(pMsg->srcId)); - tAssert(pSender != NULL); + ASSERT(pSender != NULL); if (pMsg->startTime != pSender->startTime) { syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "sender/receiver start time not match"); diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index c56d5ce045..a034e6ad83 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -120,7 +120,7 @@ static inline bool syncUtilCanPrint(char c) { char* syncUtilPrintBin(char* ptr, uint32_t len) { int64_t memLen = (int64_t)(len + 1); char* s = taosMemoryMalloc(memLen); - tAssert(s != NULL); + ASSERT(s != NULL); memset(s, 0, len + 1); memcpy(s, ptr, len); @@ -135,7 +135,7 @@ char* syncUtilPrintBin(char* ptr, uint32_t len) { char* syncUtilPrintBin2(char* ptr, uint32_t len) { uint32_t len2 = len * 4 + 1; char* s = taosMemoryMalloc(len2); - tAssert(s != NULL); + ASSERT(s != NULL); memset(s, 0, len2); char* p = s; diff --git a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp index b01caeee77..5534803c9c 100644 --- a/source/libs/sync/test/syncAppendEntriesBatchTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesBatchTest.cpp @@ -53,7 +53,7 @@ void test1() { int32_t retArrSize = pMsg->dataCount; for (int i = 0; i < retArrSize; ++i) { SSyncRaftEntry *pEntry = (SSyncRaftEntry*)(pMsg->data + metaArr[i].offset); - tAssert(pEntry->bytes == metaArr[i].contLen); + ASSERT(pEntry->bytes == metaArr[i].contLen); syncEntryPrint(pEntry); } */ diff --git a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp index e1a8a5c832..1eb803e846 100644 --- a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp @@ -19,7 +19,7 @@ SyncAppendEntriesReply *createMsg() { pMsg->success = true; pMsg->matchIndex = 77; pMsg->term = 33; - // pMsg->privateTerm = 44; + pMsg->privateTerm = 44; pMsg->startTime = taosGetTimestampMs(); return pMsg; } diff --git a/source/libs/sync/test/syncEncodeTest.cpp b/source/libs/sync/test/syncEncodeTest.cpp index a2810e1359..528cc1614d 100644 --- a/source/libs/sync/test/syncEncodeTest.cpp +++ b/source/libs/sync/test/syncEncodeTest.cpp @@ -167,7 +167,7 @@ int main(int argc, char **argv) { pSyncNode->pLogStore->syncLogAppendEntry(pSyncNode->pLogStore, pEntry); int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, pEntry->index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); syncEntryLog2((char *)"==pEntry==", pEntry); diff --git a/source/libs/sync/test/syncEntryCacheTest.cpp b/source/libs/sync/test/syncEntryCacheTest.cpp index 828f466d63..b86422b0b1 100644 --- a/source/libs/sync/test/syncEntryCacheTest.cpp +++ b/source/libs/sync/test/syncEntryCacheTest.cpp @@ -26,7 +26,7 @@ SSyncRaftEntry* createEntry(int i) { SSyncNode* createFakeNode() { SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(SSyncNode)); - tAssert(pSyncNode != NULL); + ASSERT(pSyncNode != NULL); memset(pSyncNode, 0, sizeof(SSyncNode)); return pSyncNode; @@ -34,10 +34,10 @@ SSyncNode* createFakeNode() { SRaftEntryCache* createCache(int maxCount) { SSyncNode* pSyncNode = createFakeNode(); - tAssert(pSyncNode != NULL); + ASSERT(pSyncNode != NULL); SRaftEntryCache* pCache = raftEntryCacheCreate(pSyncNode, maxCount); - tAssert(pCache != NULL); + ASSERT(pCache != NULL); return pCache; } @@ -73,12 +73,12 @@ void test2() { SSyncRaftEntry* pEntry = NULL; code = raftEntryCacheGetEntryP(pCache, index, &pEntry); - tAssert(code == 1 && index == pEntry->index); + ASSERT(code == 1 && index == pEntry->index); sTrace("get entry:%p for %" PRId64, pEntry, index); syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); code = raftEntryCacheGetEntry(pCache, index, &pEntry); - tAssert(code == 1 && index == pEntry->index); + ASSERT(code == 1 && index == pEntry->index); sTrace("get entry:%p for %" PRId64, pEntry, index); syncEntryLog2((char*)"==test2 get entry 2==", pEntry); syncEntryDestory(pEntry); @@ -86,14 +86,14 @@ void test2() { // not found index = 8; code = raftEntryCacheGetEntry(pCache, index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); sTrace("get entry:%p for %" PRId64, pEntry, index); sTrace("==test2 get entry 8 not found=="); // not found index = 9; code = raftEntryCacheGetEntry(pCache, index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); sTrace("get entry:%p for %" PRId64, pEntry, index); sTrace("==test2 get entry 9 not found=="); } @@ -124,7 +124,7 @@ void test4() { int32_t testRefId = taosOpenRef(200, freeObj); SSyncRaftEntry* pEntry = createEntry(10); - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); int64_t rid = taosAddRef(testRefId, pEntry); sTrace("rid: %" PRId64, rid); @@ -153,7 +153,7 @@ void test5() { int32_t testRefId = taosOpenRef(5, freeObj); for (int i = 0; i < 100; i++) { SSyncRaftEntry* pEntry = createEntry(i); - tAssert(pEntry != NULL); + ASSERT(pEntry != NULL); int64_t rid = taosAddRef(testRefId, pEntry); sTrace("rid: %" PRId64, rid); diff --git a/source/libs/sync/test/syncHashCacheTest.cpp b/source/libs/sync/test/syncHashCacheTest.cpp index 0f8998775f..14a29c9a1e 100644 --- a/source/libs/sync/test/syncHashCacheTest.cpp +++ b/source/libs/sync/test/syncHashCacheTest.cpp @@ -26,7 +26,7 @@ SSyncRaftEntry* createEntry(int i) { SSyncNode* createFakeNode() { SSyncNode* pSyncNode = (SSyncNode*)taosMemoryMalloc(sizeof(SSyncNode)); - tAssert(pSyncNode != NULL); + ASSERT(pSyncNode != NULL); memset(pSyncNode, 0, sizeof(SSyncNode)); return pSyncNode; @@ -34,10 +34,10 @@ SSyncNode* createFakeNode() { SRaftEntryHashCache* createCache(int maxCount) { SSyncNode* pSyncNode = createFakeNode(); - tAssert(pSyncNode != NULL); + ASSERT(pSyncNode != NULL); SRaftEntryHashCache* pCache = raftCacheCreate(pSyncNode, maxCount); - tAssert(pCache != NULL); + ASSERT(pCache != NULL); return pCache; } @@ -48,7 +48,7 @@ void test1() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - tAssert(code == 1); + ASSERT(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test1 write 5 entries==", pCache); @@ -56,14 +56,14 @@ void test1() { SyncIndex index; index = 1; code = raftCacheDelEntry(pCache, index); - tAssert(code == 0); + ASSERT(code == 0); index = 3; code = raftCacheDelEntry(pCache, index); - tAssert(code == 0); + ASSERT(code == 0); raftCacheLog2((char*)"==test1 delete 1,3==", pCache); code = raftCacheClear(pCache); - tAssert(code == 0); + ASSERT(code == 0); raftCacheLog2((char*)"==clear all==", pCache); } @@ -73,7 +73,7 @@ void test2() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - tAssert(code == 1); + ASSERT(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test2 write 5 entries==", pCache); @@ -82,25 +82,25 @@ void test2() { index = 1; SSyncRaftEntry* pEntry; code = raftCacheGetEntry(pCache, index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); syncEntryDestory(pEntry); syncEntryLog2((char*)"==test2 get entry 1==", pEntry); index = 2; code = raftCacheGetEntryP(pCache, index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); syncEntryLog2((char*)"==test2 get entry pointer 2==", pEntry); // not found index = 8; code = raftCacheGetEntry(pCache, index, &pEntry); - tAssert(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); sTrace("==test2 get entry 8 not found=="); // not found index = 9; code = raftCacheGetEntryP(pCache, index, &pEntry); - tAssert(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); + ASSERT(code == -1 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST); sTrace("==test2 get entry pointer 9 not found=="); } @@ -110,13 +110,13 @@ void test3() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - tAssert(code == 1); + ASSERT(code == 1); syncEntryDestory(pEntry); } for (int i = 6; i < 10; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - tAssert(code == 0); + ASSERT(code == 0); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test3 write 10 entries, max count is 5==", pCache); @@ -128,7 +128,7 @@ void test4() { for (int i = 0; i < 5; ++i) { SSyncRaftEntry* pEntry = createEntry(i); code = raftCachePutEntry(pCache, pEntry); - tAssert(code == 1); + ASSERT(code == 1); syncEntryDestory(pEntry); } raftCacheLog2((char*)"==test4 write 5 entries==", pCache); @@ -137,7 +137,7 @@ void test4() { index = 3; SSyncRaftEntry* pEntry; code = raftCacheGetAndDel(pCache, index, &pEntry); - tAssert(code == 0); + ASSERT(code == 0); syncEntryLog2((char*)"==test4 get-and-del entry 3==", pEntry); raftCacheLog2((char*)"==test4 after get-and-del entry 3==", pCache); } @@ -150,19 +150,19 @@ static char* keyFn(const void* pData) { static int cmpFn(const void* p1, const void* p2) { return memcmp(p1, p2, sizeof(SyncIndex)); } void printSkipList(SSkipList* pSkipList) { - tAssert(pSkipList != NULL); + ASSERT(pSkipList != NULL); SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - tAssert(pNode != NULL); + ASSERT(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); syncEntryPrint2((char*)"", pEntry); } } void delSkipListFirst(SSkipList* pSkipList, int n) { - tAssert(pSkipList != NULL); + ASSERT(pSkipList != NULL); sTrace("delete first %d -------------", n); SSkipListIterator* pIter = tSkipListCreateIter(pSkipList); @@ -182,7 +182,7 @@ SSyncRaftEntry* getLogEntry2(SSkipList* pSkipList, SyncIndex index) { arraySize = taosArrayGetSize(entryPArray); if (arraySize > 0) { SSkipListNode** ppNode = (SSkipListNode**)taosArrayGet(entryPArray, 0); - tAssert(*ppNode != NULL); + ASSERT(*ppNode != NULL); pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(*ppNode); } taosArrayDestroy(entryPArray); @@ -200,7 +200,7 @@ SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { tSkipListCreateIterFromVal(pSkipList, (const char*)&index2, TSDB_DATA_TYPE_BINARY, TSDB_ORDER_ASC); if (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - tAssert(pNode != NULL); + ASSERT(pNode != NULL); pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); } @@ -211,7 +211,7 @@ SSyncRaftEntry* getLogEntry(SSkipList* pSkipList, SyncIndex index) { void test5() { SSkipList* pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_BINARY, sizeof(SyncIndex), cmpFn, SL_ALLOW_DUP_KEY, keyFn); - tAssert(pSkipList != NULL); + ASSERT(pSkipList != NULL); sTrace("insert 9 - 5"); for (int i = 9; i >= 5; --i) { diff --git a/source/libs/sync/test/syncRaftCfgIndexTest.cpp b/source/libs/sync/test/syncRaftCfgIndexTest.cpp index 6595f1fd1b..e6d3f23b58 100644 --- a/source/libs/sync/test/syncRaftCfgIndexTest.cpp +++ b/source/libs/sync/test/syncRaftCfgIndexTest.cpp @@ -52,7 +52,7 @@ const char* pFile = "./raft_config_index.json"; void test1() { int32_t code = raftCfgIndexCreateFile(pFile); - tAssert(code == 0); + ASSERT(code == 0); SRaftCfgIndex* pRaftCfgIndex = raftCfgIndexOpen(pFile); diff --git a/source/libs/sync/test/syncTest.cpp b/source/libs/sync/test/syncTest.cpp index 7b636085f2..9ae79e11fb 100644 --- a/source/libs/sync/test/syncTest.cpp +++ b/source/libs/sync/test/syncTest.cpp @@ -1,5 +1,5 @@ #include "syncTest.h" -// #include +#include /* typedef enum { diff --git a/source/libs/sync/test/sync_test_lib/inc/syncIO.h b/source/libs/sync/test/sync_test_lib/inc/syncIO.h index 98b013b46d..19f896182e 100644 --- a/source/libs/sync/test/sync_test_lib/inc/syncIO.h +++ b/source/libs/sync/test/sync_test_lib/inc/syncIO.h @@ -81,8 +81,6 @@ int32_t syncIOQTimerStop(); int32_t syncIOPingTimerStart(); int32_t syncIOPingTimerStop(); -void syncEntryDestory(SSyncRaftEntry* pEntry); - #ifdef __cplusplus } #endif diff --git a/source/libs/sync/test/sync_test_lib/src/syncBatch.c b/source/libs/sync/test/sync_test_lib/src/syncBatch.c index d3640680ff..cb4bed1e67 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncBatch.c +++ b/source/libs/sync/test/sync_test_lib/src/syncBatch.c @@ -25,8 +25,8 @@ SyncClientRequestBatch* syncClientRequestBatchBuild(SRpcMsg** rpcMsgPArr, SRaftMeta* raftArr, int32_t arrSize, int32_t vgId) { - tAssert(rpcMsgPArr != NULL); - tAssert(arrSize > 0); + ASSERT(rpcMsgPArr != NULL); + ASSERT(arrSize > 0); int32_t dataLen = 0; int32_t raftMetaArrayLen = sizeof(SRaftMeta) * arrSize; @@ -100,9 +100,9 @@ SRpcMsg* syncClientRequestBatchRpcMsgArr(const SyncClientRequestBatch* pSyncMsg) SyncClientRequestBatch* syncClientRequestBatchFromRpcMsg(const SRpcMsg* pRpcMsg) { SyncClientRequestBatch* pSyncMsg = taosMemoryMalloc(pRpcMsg->contLen); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); memcpy(pSyncMsg, pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pRpcMsg->contLen == pSyncMsg->bytes); + ASSERT(pRpcMsg->contLen == pSyncMsg->bytes); return pSyncMsg; } @@ -194,8 +194,8 @@ void syncClientRequestBatchLog2(char* s, const SyncClientRequestBatch* pMsg) { // block3: entry Array SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, int32_t arrSize, int32_t vgId) { - tAssert(entryPArr != NULL); - tAssert(arrSize >= 0); + ASSERT(entryPArr != NULL); + ASSERT(arrSize >= 0); int32_t dataLen = 0; int32_t metaArrayLen = sizeof(SOffsetAndContLen) * arrSize; // @@ -229,7 +229,7 @@ SyncAppendEntriesBatch* syncAppendEntriesBatchBuild(SSyncRaftEntry** entryPArr, } // init entry array - tAssert(metaArr[i].contLen == entryPArr[i]->bytes); + ASSERT(metaArr[i].contLen == entryPArr[i]->bytes); memcpy(pData + metaArr[i].offset, entryPArr[i], metaArr[i].contLen); } @@ -247,19 +247,19 @@ void syncAppendEntriesBatchDestroy(SyncAppendEntriesBatch* pMsg) { } void syncAppendEntriesBatchSerialize(const SyncAppendEntriesBatch* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesBatchDeserialize(const char* buf, uint32_t len, SyncAppendEntriesBatch* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); - tAssert(pMsg->bytes == sizeof(SyncAppendEntriesBatch) + pMsg->dataLen); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncAppendEntriesBatch) + pMsg->dataLen); } char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncAppendEntriesBatchSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -270,9 +270,9 @@ char* syncAppendEntriesBatchSerialize2(const SyncAppendEntriesBatch* pMsg, uint3 SyncAppendEntriesBatch* syncAppendEntriesBatchDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntriesBatch* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncAppendEntriesBatchDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -290,7 +290,7 @@ void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesB SyncAppendEntriesBatch* syncAppendEntriesBatchFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntriesBatch* pMsg = syncAppendEntriesBatchDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } diff --git a/source/libs/sync/test/sync_test_lib/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c index 18bf26cc33..2c24451713 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -48,11 +48,11 @@ static void syncIOTickPing(void *param, void *tmrId); int32_t syncIOStart(char *host, uint16_t port) { int32_t ret = 0; gSyncIO = syncIOCreate(host, port); - tAssert(gSyncIO != NULL); + ASSERT(gSyncIO != NULL); taosSeedRand(taosGetTimestampSec()); ret = syncIOStartInternal(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); sTrace("syncIOStart ok, gSyncIO:%p", gSyncIO); return ret; @@ -60,16 +60,16 @@ int32_t syncIOStart(char *host, uint16_t port) { int32_t syncIOStop() { int32_t ret = syncIOStopInternal(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); ret = syncIODestroy(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } int32_t syncIOSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) { - tAssert(pEpSet->inUse == 0); - tAssert(pEpSet->numOfEps == 1); + ASSERT(pEpSet->inUse == 0); + ASSERT(pEpSet->numOfEps == 1); int32_t ret = 0; { @@ -108,25 +108,25 @@ int32_t syncIOEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) { int32_t syncIOQTimerStart() { int32_t ret = syncIOStartQ(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } int32_t syncIOQTimerStop() { int32_t ret = syncIOStopQ(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } int32_t syncIOPingTimerStart() { int32_t ret = syncIOStartPing(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } int32_t syncIOPingTimerStop() { int32_t ret = syncIOStopPing(gSyncIO); - tAssert(ret == 0); + ASSERT(ret == 0); return ret; } @@ -152,7 +152,7 @@ static SSyncIO *syncIOCreate(char *host, uint16_t port) { static int32_t syncIODestroy(SSyncIO *io) { int32_t ret = 0; int8_t start = atomic_load_8(&io->isStart); - tAssert(start == 0); + ASSERT(start == 0); if (io->serverRpc != NULL) { rpcClose(io->serverRpc); @@ -265,7 +265,7 @@ static void *syncIOConsumerFunc(void *param) { if (pRpcMsg->msgType == TDMT_SYNC_PING) { if (io->FpOnSyncPing != NULL) { SyncPing *pSyncMsg = syncPingFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncPing(io->pSyncNode, pSyncMsg); syncPingDestroy(pSyncMsg); } @@ -273,7 +273,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_PING_REPLY) { if (io->FpOnSyncPingReply != NULL) { SyncPingReply *pSyncMsg = syncPingReplyFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncPingReply(io->pSyncNode, pSyncMsg); syncPingReplyDestroy(pSyncMsg); } @@ -286,7 +286,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE) { if (io->FpOnSyncRequestVote != NULL) { SyncRequestVote *pSyncMsg = syncRequestVoteFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncRequestVote(io->pSyncNode, pSyncMsg); syncRequestVoteDestroy(pSyncMsg); } @@ -294,7 +294,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_REQUEST_VOTE_REPLY) { if (io->FpOnSyncRequestVoteReply != NULL) { SyncRequestVoteReply *pSyncMsg = syncRequestVoteReplyFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncRequestVoteReply(io->pSyncNode, pSyncMsg); syncRequestVoteReplyDestroy(pSyncMsg); } @@ -302,7 +302,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES) { if (io->FpOnSyncAppendEntries != NULL) { SyncAppendEntries *pSyncMsg = syncAppendEntriesFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncAppendEntries(io->pSyncNode, pSyncMsg); syncAppendEntriesDestroy(pSyncMsg); } @@ -310,7 +310,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_APPEND_ENTRIES_REPLY) { if (io->FpOnSyncAppendEntriesReply != NULL) { SyncAppendEntriesReply *pSyncMsg = syncAppendEntriesReplyFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncAppendEntriesReply(io->pSyncNode, pSyncMsg); syncAppendEntriesReplyDestroy(pSyncMsg); } @@ -318,7 +318,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_TIMEOUT) { if (io->FpOnSyncTimeout != NULL) { SyncTimeout *pSyncMsg = syncTimeoutFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncTimeout(io->pSyncNode, pSyncMsg); syncTimeoutDestroy(pSyncMsg); } @@ -326,7 +326,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_SEND) { if (io->FpOnSyncSnapshot != NULL) { SyncSnapshotSend *pSyncMsg = syncSnapshotSendFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncSnapshot(io->pSyncNode, pSyncMsg); syncSnapshotSendDestroy(pSyncMsg); } @@ -334,7 +334,7 @@ static void *syncIOConsumerFunc(void *param) { } else if (pRpcMsg->msgType == TDMT_SYNC_SNAPSHOT_RSP) { if (io->FpOnSyncSnapshotReply != NULL) { SyncSnapshotRsp *pSyncMsg = syncSnapshotRspFromRpcMsg2(pRpcMsg); - tAssert(pSyncMsg != NULL); + ASSERT(pSyncMsg != NULL); io->FpOnSyncSnapshotReply(io->pSyncNode, pSyncMsg); syncSnapshotRspDestroy(pSyncMsg); } @@ -469,5 +469,3 @@ static void syncIOTickPing(void *param, void *tmrId) { taosTmrReset(syncIOTickPing, io->pingTimerMS, io, io->timerMgr, &io->pingTimer); } - -void syncEntryDestory(SSyncRaftEntry* pEntry) {} \ No newline at end of file diff --git a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c index ec9de67ff5..6b461da0e5 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMainDebug.c @@ -223,7 +223,7 @@ int32_t syncNodePingSelf(SSyncNode* pSyncNode) { int32_t ret = 0; SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, &pSyncNode->myRaftId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, &pMsg->destId, pMsg); - tAssert(ret == 0); + ASSERT(ret == 0); syncPingDestroy(pMsg); return ret; @@ -235,7 +235,7 @@ int32_t syncNodePingPeers(SSyncNode* pSyncNode) { SRaftId* destId = &(pSyncNode->peersId[i]); SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, destId, pMsg); - tAssert(ret == 0); + ASSERT(ret == 0); syncPingDestroy(pMsg); } return ret; @@ -247,7 +247,7 @@ int32_t syncNodePingAll(SSyncNode* pSyncNode) { SRaftId* destId = &(pSyncNode->replicasId[i]); SyncPing* pMsg = syncPingBuild3(&pSyncNode->myRaftId, destId, pSyncNode->vgId); ret = syncNodePing(pSyncNode, destId, pMsg); - tAssert(ret == 0); + ASSERT(ret == 0); syncPingDestroy(pMsg); } return ret; diff --git a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c index 74ab09aa31..1ea7629601 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c @@ -44,7 +44,7 @@ SyncPing* syncPingBuild3(const SRaftId* srcId, const SRaftId* destId, int32_t vg char* syncPingSerialize2(const SyncPing* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncPingSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -78,7 +78,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) { } pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); pMsg->bytes = bytes; if (tDecodeI32(&decoder, &pMsg->vgId) < 0) { @@ -115,7 +115,7 @@ SyncPing* syncPingDeserialize3(void* buf, int32_t bufLen) { taosMemoryFree(pMsg); return NULL; } - tAssert(len == pMsg->dataLen); + ASSERT(len == pMsg->dataLen); memcpy(pMsg->data, data, len); tEndDecode(&decoder); @@ -261,28 +261,28 @@ void syncPingDestroy(SyncPing* pMsg) { } void syncPingSerialize(const SyncPing* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPingDeserialize(const char* buf, uint32_t len, SyncPing* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); - tAssert(pMsg->bytes == sizeof(SyncPing) + pMsg->dataLen); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncPing) + pMsg->dataLen); } SyncPing* syncPingDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPing* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncPingDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } SyncPing* syncPingFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPing* pMsg = syncPingDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -319,19 +319,19 @@ void syncPingReplyDestroy(SyncPingReply* pMsg) { } void syncPingReplySerialize(const SyncPingReply* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPingReplyDeserialize(const char* buf, uint32_t len, SyncPingReply* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); - tAssert(pMsg->bytes == sizeof(SyncPingReply) + pMsg->dataLen); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncPingReply) + pMsg->dataLen); } char* syncPingReplySerialize2(const SyncPingReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncPingReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -342,9 +342,9 @@ char* syncPingReplySerialize2(const SyncPingReply* pMsg, uint32_t* len) { SyncPingReply* syncPingReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPingReply* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncPingReplyDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -403,7 +403,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) { } pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); pMsg->bytes = bytes; if (tDecodeI32(&decoder, &pMsg->vgId) < 0) { @@ -440,7 +440,7 @@ SyncPingReply* syncPingReplyDeserialize3(void* buf, int32_t bufLen) { taosMemoryFree(pMsg); return NULL; } - tAssert(len == pMsg->dataLen); + ASSERT(len == pMsg->dataLen); memcpy(pMsg->data, data, len); tEndDecode(&decoder); @@ -462,7 +462,7 @@ void syncPingReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPingReply* pMsg) { SyncPingReply* syncPingReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPingReply* pMsg = syncPingReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -902,7 +902,7 @@ SyncTimeout* syncTimeoutBuild2(ESyncTimeoutType timeoutType, uint64_t logicClock char* syncTimeoutSerialize2(const SyncTimeout* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncTimeoutSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -917,21 +917,21 @@ void syncTimeoutDestroy(SyncTimeout* pMsg) { } void syncTimeoutSerialize(const SyncTimeout* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncTimeoutDeserialize(const char* buf, uint32_t len, SyncTimeout* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } SyncTimeout* syncTimeoutDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncTimeout* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncTimeoutDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -949,7 +949,7 @@ void syncTimeoutFromRpcMsg(const SRpcMsg* pRpcMsg, SyncTimeout* pMsg) { SyncTimeout* syncTimeoutFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncTimeout* pMsg = syncTimeoutDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1028,18 +1028,18 @@ void syncRequestVoteDestroy(SyncRequestVote* pMsg) { } void syncRequestVoteSerialize(const SyncRequestVote* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncRequestVoteDeserialize(const char* buf, uint32_t len, SyncRequestVote* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncRequestVoteSerialize2(const SyncRequestVote* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncRequestVoteSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1050,9 +1050,9 @@ char* syncRequestVoteSerialize2(const SyncRequestVote* pMsg, uint32_t* len) { SyncRequestVote* syncRequestVoteDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncRequestVote* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncRequestVoteDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1070,7 +1070,7 @@ void syncRequestVoteFromRpcMsg(const SRpcMsg* pRpcMsg, SyncRequestVote* pMsg) { SyncRequestVote* syncRequestVoteFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncRequestVote* pMsg = syncRequestVoteDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1179,18 +1179,18 @@ void syncRequestVoteReplyDestroy(SyncRequestVoteReply* pMsg) { } void syncRequestVoteReplySerialize(const SyncRequestVoteReply* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncRequestVoteReplyDeserialize(const char* buf, uint32_t len, SyncRequestVoteReply* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncRequestVoteReplySerialize2(const SyncRequestVoteReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncRequestVoteReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1201,9 +1201,9 @@ char* syncRequestVoteReplySerialize2(const SyncRequestVoteReply* pMsg, uint32_t* SyncRequestVoteReply* syncRequestVoteReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncRequestVoteReply* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncRequestVoteReplyDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1221,7 +1221,7 @@ void syncRequestVoteReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncRequestVoteReply SyncRequestVoteReply* syncRequestVoteReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncRequestVoteReply* pMsg = syncRequestVoteReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1328,19 +1328,19 @@ void syncAppendEntriesDestroy(SyncAppendEntries* pMsg) { } void syncAppendEntriesSerialize(const SyncAppendEntries* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesDeserialize(const char* buf, uint32_t len, SyncAppendEntries* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); - tAssert(pMsg->bytes == sizeof(SyncAppendEntries) + pMsg->dataLen); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncAppendEntries) + pMsg->dataLen); } char* syncAppendEntriesSerialize2(const SyncAppendEntries* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncAppendEntriesSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1351,9 +1351,9 @@ char* syncAppendEntriesSerialize2(const SyncAppendEntries* pMsg, uint32_t* len) SyncAppendEntries* syncAppendEntriesDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntries* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncAppendEntriesDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1371,7 +1371,7 @@ void syncAppendEntriesFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntries* pMsg SyncAppendEntries* syncAppendEntriesFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntries* pMsg = syncAppendEntriesDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1498,18 +1498,18 @@ void syncAppendEntriesReplyDestroy(SyncAppendEntriesReply* pMsg) { } void syncAppendEntriesReplySerialize(const SyncAppendEntriesReply* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncAppendEntriesReplyDeserialize(const char* buf, uint32_t len, SyncAppendEntriesReply* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncAppendEntriesReplySerialize2(const SyncAppendEntriesReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncAppendEntriesReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1520,9 +1520,9 @@ char* syncAppendEntriesReplySerialize2(const SyncAppendEntriesReply* pMsg, uint3 SyncAppendEntriesReply* syncAppendEntriesReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncAppendEntriesReply* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncAppendEntriesReplyDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1540,7 +1540,7 @@ void syncAppendEntriesReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncAppendEntriesR SyncAppendEntriesReply* syncAppendEntriesReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncAppendEntriesReply* pMsg = syncAppendEntriesReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1583,8 +1583,8 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) { cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); cJSON_AddItemToObject(pRoot, "destId", pDestId); - // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); - // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); + cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); cJSON_AddStringToObject(pRoot, "term", u64buf); @@ -1654,18 +1654,18 @@ void syncHeartbeatDestroy(SyncHeartbeat* pMsg) { } void syncHeartbeatSerialize(const SyncHeartbeat* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncHeartbeatDeserialize(const char* buf, uint32_t len, SyncHeartbeat* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncHeartbeatSerialize2(const SyncHeartbeat* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncHeartbeatSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1676,9 +1676,9 @@ char* syncHeartbeatSerialize2(const SyncHeartbeat* pMsg, uint32_t* len) { SyncHeartbeat* syncHeartbeatDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncHeartbeat* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncHeartbeatDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1696,7 +1696,7 @@ void syncHeartbeatFromRpcMsg(const SRpcMsg* pRpcMsg, SyncHeartbeat* pMsg) { SyncHeartbeat* syncHeartbeatFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncHeartbeat* pMsg = syncHeartbeatDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1807,18 +1807,18 @@ void syncHeartbeatReplyDestroy(SyncHeartbeatReply* pMsg) { } void syncHeartbeatReplySerialize(const SyncHeartbeatReply* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncHeartbeatReplyDeserialize(const char* buf, uint32_t len, SyncHeartbeatReply* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncHeartbeatReplySerialize2(const SyncHeartbeatReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncHeartbeatReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1829,9 +1829,9 @@ char* syncHeartbeatReplySerialize2(const SyncHeartbeatReply* pMsg, uint32_t* len SyncHeartbeatReply* syncHeartbeatReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncHeartbeatReply* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncHeartbeatReplyDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -1849,7 +1849,7 @@ void syncHeartbeatReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncHeartbeatReply* pM SyncHeartbeatReply* syncHeartbeatReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncHeartbeatReply* pMsg = syncHeartbeatReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -1961,18 +1961,18 @@ void syncPreSnapshotDestroy(SyncPreSnapshot* pMsg) { } void syncPreSnapshotSerialize(const SyncPreSnapshot* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPreSnapshotDeserialize(const char* buf, uint32_t len, SyncPreSnapshot* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncPreSnapshotSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -1983,9 +1983,9 @@ char* syncPreSnapshotSerialize2(const SyncPreSnapshot* pMsg, uint32_t* len) { SyncPreSnapshot* syncPreSnapshotDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPreSnapshot* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncPreSnapshotDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2003,7 +2003,7 @@ void syncPreSnapshotFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshot* pMsg) { SyncPreSnapshot* syncPreSnapshotFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPreSnapshot* pMsg = syncPreSnapshotDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -2108,18 +2108,18 @@ void syncPreSnapshotReplyDestroy(SyncPreSnapshotReply* pMsg) { } void syncPreSnapshotReplySerialize(const SyncPreSnapshotReply* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncPreSnapshotReplyDeserialize(const char* buf, uint32_t len, SyncPreSnapshotReply* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncPreSnapshotReplySerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2130,9 +2130,9 @@ char* syncPreSnapshotReplySerialize2(const SyncPreSnapshotReply* pMsg, uint32_t* SyncPreSnapshotReply* syncPreSnapshotReplyDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncPreSnapshotReply* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncPreSnapshotReplyDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2150,7 +2150,7 @@ void syncPreSnapshotReplyFromRpcMsg(const SRpcMsg* pRpcMsg, SyncPreSnapshotReply SyncPreSnapshotReply* syncPreSnapshotReplyFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncPreSnapshotReply* pMsg = syncPreSnapshotReplyDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -2267,18 +2267,18 @@ void syncApplyMsgDestroy(SyncApplyMsg* pMsg) { } void syncApplyMsgSerialize(const SyncApplyMsg* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncApplyMsgDeserialize(const char* buf, uint32_t len, SyncApplyMsg* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncApplyMsgSerialize2(const SyncApplyMsg* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncApplyMsgSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2289,9 +2289,9 @@ char* syncApplyMsgSerialize2(const SyncApplyMsg* pMsg, uint32_t* len) { SyncApplyMsg* syncApplyMsgDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncApplyMsg* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncApplyMsgDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2412,19 +2412,19 @@ void syncSnapshotSendDestroy(SyncSnapshotSend* pMsg) { } void syncSnapshotSendSerialize(const SyncSnapshotSend* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncSnapshotSendDeserialize(const char* buf, uint32_t len, SyncSnapshotSend* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); - tAssert(pMsg->bytes == sizeof(SyncSnapshotSend) + pMsg->dataLen); + ASSERT(len == pMsg->bytes); + ASSERT(pMsg->bytes == sizeof(SyncSnapshotSend) + pMsg->dataLen); } char* syncSnapshotSendSerialize2(const SyncSnapshotSend* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncSnapshotSendSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2435,9 +2435,9 @@ char* syncSnapshotSendSerialize2(const SyncSnapshotSend* pMsg, uint32_t* len) { SyncSnapshotSend* syncSnapshotSendDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncSnapshotSend* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncSnapshotSendDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2455,7 +2455,7 @@ void syncSnapshotSendFromRpcMsg(const SRpcMsg* pRpcMsg, SyncSnapshotSend* pMsg) SyncSnapshotSend* syncSnapshotSendFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncSnapshotSend* pMsg = syncSnapshotSendDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -2476,18 +2476,18 @@ void syncSnapshotRspDestroy(SyncSnapshotRsp* pMsg) { } void syncSnapshotRspSerialize(const SyncSnapshotRsp* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncSnapshotRspDeserialize(const char* buf, uint32_t len, SyncSnapshotRsp* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncSnapshotRspSerialize2(const SyncSnapshotRsp* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncSnapshotRspSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2498,9 +2498,9 @@ char* syncSnapshotRspSerialize2(const SyncSnapshotRsp* pMsg, uint32_t* len) { SyncSnapshotRsp* syncSnapshotRspDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncSnapshotRsp* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncSnapshotRspDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2518,7 +2518,7 @@ void syncSnapshotRspFromRpcMsg(const SRpcMsg* pRpcMsg, SyncSnapshotRsp* pMsg) { SyncSnapshotRsp* syncSnapshotRspFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncSnapshotRsp* pMsg = syncSnapshotRspDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -2639,18 +2639,18 @@ void syncLeaderTransferDestroy(SyncLeaderTransfer* pMsg) { } void syncLeaderTransferSerialize(const SyncLeaderTransfer* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncLeaderTransferDeserialize(const char* buf, uint32_t len, SyncLeaderTransfer* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncLeaderTransferSerialize2(const SyncLeaderTransfer* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncLeaderTransferSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2661,9 +2661,9 @@ char* syncLeaderTransferSerialize2(const SyncLeaderTransfer* pMsg, uint32_t* len SyncLeaderTransfer* syncLeaderTransferDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncLeaderTransfer* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncLeaderTransferDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2681,7 +2681,7 @@ void syncLeaderTransferFromRpcMsg(const SRpcMsg* pRpcMsg, SyncLeaderTransfer* pM SyncLeaderTransfer* syncLeaderTransferFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncLeaderTransfer* pMsg = syncLeaderTransferDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } @@ -2771,18 +2771,18 @@ void syncLocalCmdDestroy(SyncLocalCmd* pMsg) { } void syncLocalCmdSerialize(const SyncLocalCmd* pMsg, char* buf, uint32_t bufLen) { - tAssert(pMsg->bytes <= bufLen); + ASSERT(pMsg->bytes <= bufLen); memcpy(buf, pMsg, pMsg->bytes); } void syncLocalCmdDeserialize(const char* buf, uint32_t len, SyncLocalCmd* pMsg) { memcpy(pMsg, buf, len); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); } char* syncLocalCmdSerialize2(const SyncLocalCmd* pMsg, uint32_t* len) { char* buf = taosMemoryMalloc(pMsg->bytes); - tAssert(buf != NULL); + ASSERT(buf != NULL); syncLocalCmdSerialize(pMsg, buf, pMsg->bytes); if (len != NULL) { *len = pMsg->bytes; @@ -2793,9 +2793,9 @@ char* syncLocalCmdSerialize2(const SyncLocalCmd* pMsg, uint32_t* len) { SyncLocalCmd* syncLocalCmdDeserialize2(const char* buf, uint32_t len) { uint32_t bytes = *((uint32_t*)buf); SyncLocalCmd* pMsg = taosMemoryMalloc(bytes); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); syncLocalCmdDeserialize(buf, len, pMsg); - tAssert(len == pMsg->bytes); + ASSERT(len == pMsg->bytes); return pMsg; } @@ -2813,7 +2813,7 @@ void syncLocalCmdFromRpcMsg(const SRpcMsg* pRpcMsg, SyncLocalCmd* pMsg) { SyncLocalCmd* syncLocalCmdFromRpcMsg2(const SRpcMsg* pRpcMsg) { SyncLocalCmd* pMsg = syncLocalCmdDeserialize2(pRpcMsg->pCont, pRpcMsg->contLen); - tAssert(pMsg != NULL); + ASSERT(pMsg != NULL); return pMsg; } diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c index 31e325424b..50ecc5d478 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftCfgDebug.c @@ -25,10 +25,10 @@ char *syncCfg2Str(SSyncCfg *pSyncCfg) { int32_t syncCfgFromStr(const char *s, SSyncCfg *pSyncCfg) { cJSON *pRoot = cJSON_Parse(s); - tAssert(pRoot != NULL); + ASSERT(pRoot != NULL); int32_t ret = syncCfgFromJson(pRoot, pSyncCfg); - tAssert(ret == 0); + ASSERT(ret == 0); cJSON_Delete(pRoot); return 0; diff --git a/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c index 7eb1bbe401..8179b24d29 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncRaftEntryDebug.c @@ -172,7 +172,7 @@ cJSON* raftEntryCache2Json(SRaftEntryCache* pCache) { SSkipListIterator* pIter = tSkipListCreateIter(pCache->pSkipList); while (tSkipListIterNext(pIter)) { SSkipListNode* pNode = tSkipListIterGet(pIter); - tAssert(pNode != NULL); + ASSERT(pNode != NULL); SSyncRaftEntry* pEntry = (SSyncRaftEntry*)SL_GET_NODE_DATA(pNode); cJSON_AddItemToArray(pEntries, syncEntry2Json(pEntry)); } diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 09bbfae6ab..8c62f89b64 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -43,7 +43,7 @@ struct SBTree { #define TDB_BTREE_PAGE_IS_LEAF(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_LEAF) #define TDB_BTREE_PAGE_IS_OVFL(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_OVFL) #define TDB_BTREE_ASSERT_FLAG(flags) \ - tAssert(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ + ASSERT(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ TDB_FLAG_IS(flags, TDB_BTREE_ROOT | TDB_BTREE_LEAF) || TDB_FLAG_IS(flags, 0) || \ TDB_FLAG_IS(flags, TDB_BTREE_OVFL)) @@ -74,7 +74,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg SBTree *pBt; int ret; - tAssert(keyLen != 0); + ASSERT(keyLen != 0); *ppBt = NULL; @@ -148,7 +148,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg tdbPostCommit(pPager->pEnv, txn); } - tAssert(pgno != 0); + ASSERT(pgno != 0); pBt->root = pgno; /* // TODO: pBt->root @@ -188,7 +188,7 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - tAssert(0); + ASSERT(0); return -1; } @@ -200,14 +200,14 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in } else if (c == 0) { // dup key not allowed tdbError("unable to insert dup key. pKey: %p, kLen: %d, btc: %p, pTxn: %p", pKey, kLen, &btc, pTxn); - // tAssert(0); + // ASSERT(0); return -1; } } ret = tdbBtcUpsert(&btc, pKey, kLen, pVal, vLen, 1); if (ret < 0) { - tAssert(0); + ASSERT(0); tdbBtcClose(&btc); return -1; } @@ -229,7 +229,7 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) { ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { tdbBtcClose(&btc); - tAssert(0); + ASSERT(0); return -1; } @@ -260,7 +260,7 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i // move the cursor ret = tdbBtcMoveTo(&btc, pKey, nKey, &c); if (ret < 0) { - tAssert(0); + ASSERT(0); tdbBtcClose(&btc); return -1; } @@ -276,7 +276,7 @@ int tdbBtreeUpsert(SBTree *pBt, const void *pKey, int nKey, const void *pData, i ret = tdbBtcUpsert(&btc, pKey, nKey, pData, nData, c); if (ret < 0) { - tAssert(0); + ASSERT(0); tdbBtcClose(&btc); return -1; } @@ -305,7 +305,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL ret = tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (ret < 0) { tdbBtcClose(&btc); - tAssert(0); + ASSERT(0); } if (btc.idx < 0 || cret) { @@ -321,7 +321,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTKey = tdbRealloc(*ppKey, cd.kLen); if (pTKey == NULL) { tdbBtcClose(&btc); - tAssert(0); + ASSERT(0); return -1; } *ppKey = pTKey; @@ -333,7 +333,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL pTVal = tdbRealloc(*ppVal, cd.vLen); if (pTVal == NULL) { tdbBtcClose(&btc); - tAssert(0); + ASSERT(0); return -1; } *ppVal = pTVal; @@ -362,7 +362,7 @@ static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2 int mlen; int cret; - tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -387,7 +387,7 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { { // 1. TODO: Search the main DB to check if the DB exists ret = tdbPagerOpenDB(pBt->pPager, &pgno, true, pBt); - tAssert(ret == 0); + ASSERT(ret == 0); } if (pgno != 0) { @@ -398,11 +398,11 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { // Try to create a new database ret = tdbPagerAllocPage(pBt->pPager, &pgno); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } - tAssert(pgno != 0); + ASSERT(pgno != 0); pBt->root = pgno; return 0; } @@ -542,11 +542,11 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx nOlds = 3; } for (int i = 0; i < nOlds; i++) { - tAssert(sIdx + i <= nCells); + ASSERT(sIdx + i <= nCells); SPgno pgno; if (sIdx + i == nCells) { - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pParent)); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pParent)); pgno = ((SIntHdr *)(pParent->pData))->pgno; } else { pCell = tdbPageGetCell(pParent, sIdx + i); @@ -556,7 +556,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx ret = tdbPagerFetchPage(pBt->pPager, &pgno, pOlds + i, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = 0}), pTxn); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -628,7 +628,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx // page is full, use a new page nNews++; - tAssert(infoNews[nNews].size + cellBytes <= TDB_PAGE_USABLE_SIZE(pPage)); + ASSERT(infoNews[nNews].size + cellBytes <= TDB_PAGE_USABLE_SIZE(pPage)); if (childNotLeaf) { // for non-child page, this cell is used as the right-most child, @@ -675,7 +675,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx szRCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); } - tAssert(infoNews[iNew - 1].cnt > 0); + ASSERT(infoNews[iNew - 1].cnt > 0); if (infoNews[iNew].size + szRCell >= infoNews[iNew - 1].size - szRCell) { break; @@ -718,7 +718,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx iarg.flags = flags; ret = tdbPagerFetchPage(pBt->pPager, &pgno, pNews + iNew, tdbBtreeInitPage, &iarg, pTxn); if (ret < 0) { - tAssert(0); + ASSERT(0); } ret = tdbPagerWrite(pBt->pPager, pNews[iNew]); @@ -762,8 +762,8 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx pCell = tdbPageGetCell(pPage, oIdx); szCell = tdbBtreeCellSize(pPage, pCell, 0, NULL, NULL); - tAssert(nNewCells <= infoNews[iNew].cnt); - tAssert(iNew < nNews); + ASSERT(nNewCells <= infoNews[iNew].cnt); + ASSERT(iNew < nNews); if (nNewCells < infoNews[iNew].cnt) { tdbPageInsertCell(pNews[iNew], nNewCells, pCell, szCell, 0); @@ -802,14 +802,14 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } } } else { - tAssert(childNotLeaf); - tAssert(iNew < nNews - 1); + ASSERT(childNotLeaf); + ASSERT(iNew < nNews - 1); // set current new page right-most child ((SIntHdr *)pNews[iNew]->pData)->pgno = ((SPgno *)pCell)[0]; // insert to parent as divider cell - tAssert(iNew < nNews - 1); + ASSERT(iNew < nNews - 1); ((SPgno *)pCell)[0] = TDB_PAGE_PGNO(pNews[iNew]); tdbPageInsertCell(pParent, sIdx++, pCell, szCell, 0); @@ -824,7 +824,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx } if (childNotLeaf) { - tAssert(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); + ASSERT(TDB_PAGE_TOTAL_CELLS(pNews[nNews - 1]) == infoNews[nNews - 1].cnt); ((SIntHdr *)(pNews[nNews - 1]->pData))->pgno = rPgno; SIntHdr *pIntHdr = (SIntHdr *)pParent->pData; @@ -1014,7 +1014,7 @@ static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const nLeft -= kLen; // pack partial val to local if any space left if (nLocal > nHeader + kLen + sizeof(SPgno)) { - tAssert(pVal != NULL && vLen != 0); + ASSERT(pVal != NULL && vLen != 0); memcpy(pCell + nHeader + kLen, pVal, nLocal - nHeader - kLen - sizeof(SPgno)); nLeft -= nLocal - nHeader - kLen - sizeof(SPgno); } @@ -1176,9 +1176,9 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo int nPayload; int ret; - tAssert(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); - tAssert(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); - tAssert(pKey != NULL && kLen > 0); + ASSERT(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); + ASSERT(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); + ASSERT(pKey != NULL && kLen > 0); nPayload = 0; nHeader = 0; @@ -1187,7 +1187,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo // 1. Encode Header part /* Encode SPgno if interior page */ if (!leaf) { - tAssert(pPage->vLen == sizeof(SPgno)); + ASSERT(pPage->vLen == sizeof(SPgno)); ((SPgno *)(pCell + nHeader))[0] = ((SPgno *)pVal)[0]; nHeader = nHeader + sizeof(SPgno); @@ -1212,7 +1212,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo ret = tdbBtreeEncodePayload(pPage, pCell, nHeader, pKey, kLen, pVal, vLen, &nPayload, pTxn, pBt); if (ret < 0) { // TODO - tAssert(0); + ASSERT(0); return 0; } @@ -1230,7 +1230,7 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader, int vLen = pDecoder->vLen; if (pDecoder->pVal) { - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); nPayload = pDecoder->kLen; } else { nPayload = pDecoder->kLen + pDecoder->vLen; @@ -1431,7 +1431,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD // 1. Decode header part if (!leaf) { - tAssert(pPage->vLen == sizeof(SPgno)); + ASSERT(pPage->vLen == sizeof(SPgno)); pDecoder->pgno = ((SPgno *)(pCell + nHeader))[0]; pDecoder->pVal = (u8 *)(&(pDecoder->pgno)); @@ -1445,7 +1445,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD } if (pPage->vLen == TDB_VARIANT_LEN) { - tAssert(leaf); + ASSERT(leaf); nHeader += tdbGetVarInt(pCell + nHeader, &(pDecoder->vLen)); } else { pDecoder->vLen = pPage->vLen; @@ -1477,7 +1477,7 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell, int dropOfp, TXN * } if (pPage->vLen == TDB_VARIANT_LEN) { - tAssert(leaf); + ASSERT(leaf); nHeader += tdbGetVarInt(pCell + nHeader, &vLen); } else if (leaf) { vLen = pPage->vLen; @@ -1573,29 +1573,29 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } - tAssert(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); + ASSERT(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); pBtc->iPage = 0; if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0) { pBtc->idx = 0; } else { // no any data, point to an invalid position - tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); pBtc->idx = -1; return 0; } } else { - tAssert(0); + ASSERT(0); #if 0 // move from a position int iPage = 0; for (; iPage < pBtc->iPage; iPage++) { - tAssert(pBtc->idxStack[iPage] >= 0); + ASSERT(pBtc->idxStack[iPage] >= 0); if (pBtc->idxStack[iPage]) break; } @@ -1617,7 +1617,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1642,7 +1642,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbPagerFetchPage(pPager, &pBt->root, &(pBtc->pPage), tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1652,18 +1652,18 @@ int tdbBtcMoveToLast(SBTC *pBtc) { pBtc->idx = TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage) ? nCells - 1 : nCells; } else { // no data at all, point to an invalid position - tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); pBtc->idx = -1; return 0; } } else { - tAssert(0); + ASSERT(0); #if 0 int iPage = 0; // downward search for (; iPage < pBtc->iPage; iPage++) { - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pgStack[iPage]); if (pBtc->idxStack[iPage] != nCells) break; } @@ -1690,7 +1690,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1748,7 +1748,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToNext(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1794,7 +1794,7 @@ int tdbBtreePrev(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { ret = tdbBtcMoveToPrev(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1806,7 +1806,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { int ret; SCell *pCell; - tAssert(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx < 0) return -1; @@ -1825,7 +1825,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { tdbBtcMoveUpward(pBtc); pBtc->idx++; - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx <= TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { break; } @@ -1837,7 +1837,7 @@ int tdbBtcMoveToNext(SBTC *pBtc) { ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1889,8 +1889,8 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { SPgno pgno; SCell *pCell; - tAssert(pBtc->idx >= 0); - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + ASSERT(pBtc->idx >= 0); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx < TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); @@ -1899,7 +1899,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; } - tAssert(pgno); + ASSERT(pgno); pBtc->pgStack[pBtc->iPage] = pBtc->pPage; pBtc->idxStack[pBtc->iPage] = pBtc->idx; @@ -1910,7 +1910,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc) { ret = tdbPagerFetchPage(pBtc->pBt->pPager, &pgno, &pBtc->pPage, tdbBtreeInitPage, &((SBtreeInitPageArg){.pBt = pBtc->pBt, .flags = 0}), pBtc->pTxn); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -1965,7 +1965,7 @@ int tdbBtcDelete(SBTC *pBtc) { int nKey; int ret; - tAssert(idx >= 0 && idx < nCells); + ASSERT(idx >= 0 && idx < nCells); // drop the cell on the leaf ret = tdbPagerWrite(pPager, pBtc->pPage); @@ -2003,7 +2003,7 @@ int tdbBtcDelete(SBTC *pBtc) { ret = tdbPageUpdateCell(pPage, idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { tdbOsFree(pCell); - tAssert(0); + ASSERT(0); return -1; } tdbOsFree(pCell); @@ -2014,11 +2014,11 @@ int tdbBtcDelete(SBTC *pBtc) { } } else { // delete the leaf page and do balance - tAssert(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); + ASSERT(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); ret = tdbBtreeBalance(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } } @@ -2035,13 +2035,13 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int void *pBuf; int ret; - tAssert(pBtc->idx >= 0); + ASSERT(pBtc->idx >= 0); // alloc space szBuf = kLen + nData + 14; pBuf = tdbRealloc(pBtc->pBt->pBuf, pBtc->pBt->pageSize > szBuf ? szBuf : pBtc->pBt->pageSize); if (pBuf == NULL) { - tAssert(0); + ASSERT(0); return -1; } pBtc->pBt->pBuf = pBuf; @@ -2050,7 +2050,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // encode cell ret = tdbBtreeEncodeCell(pBtc->pPage, pKey, kLen, pData, nData, pCell, &szCell, pBtc->pTxn, pBtc->pBt); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -2063,16 +2063,16 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int // insert or update if (insert) { - tAssert(pBtc->idx <= nCells); + ASSERT(pBtc->idx <= nCells); ret = tdbPageInsertCell(pBtc->pPage, pBtc->idx, pCell, szCell, 0); } else { - tAssert(pBtc->idx < nCells); + ASSERT(pBtc->idx < nCells); ret = tdbPageUpdateCell(pBtc->pPage, pBtc->idx, pCell, szCell, pBtc->pTxn, pBtc->pBt); } if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } @@ -2080,7 +2080,7 @@ int tdbBtcUpsert(SBTC *pBtc, const void *pKey, int kLen, const void *pData, int if (pBtc->pPage->nOverflow > 0) { ret = tdbBtreeBalance(pBtc); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } } @@ -2105,7 +2105,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { &((SBtreeInitPageArg){.pBt = pBt, .flags = TDB_BTREE_ROOT | TDB_BTREE_LEAF}), pBtc->pTxn); if (ret < 0) { // TODO - tAssert(0); + ASSERT(0); return 0; } @@ -2114,7 +2114,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { // for empty tree, just return with an invalid position if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) return 0; } else { - tAssert(0); + ASSERT(0); #if 0 SPage *pPage; int idx; @@ -2126,7 +2126,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { idx = pBtc->idxStack[iPage]; nCells = TDB_PAGE_TOTAL_CELLS(pPage); - tAssert(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); // check if key <= current position if (idx < nCells) { @@ -2164,7 +2164,7 @@ int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { lidx = 0; ridx = nCells - 1; - tAssert(nCells > 0); + ASSERT(nCells > 0); // compare first cell pBtc->idx = lidx; @@ -2229,7 +2229,7 @@ int tdbBtcClose(SBTC *pBtc) { if (pBtc->iPage < 0) return 0; for (;;) { - tAssert(pBtc->pPage); + ASSERT(pBtc->pPage); tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage, pBtc->pTxn); diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index 053e0358e2..c79279c658 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -247,7 +247,7 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { // remove from the list for (ppPager = &pDb->pgrList; *ppPager && (*ppPager != pPager); ppPager = &((*ppPager)->pNext)) { } - tAssert(*ppPager == pPager); + ASSERT(*ppPager == pPager); *ppPager = pPager->pNext; // remove from hash @@ -255,7 +255,7 @@ void tdbEnvRemovePager(TDB *pDb, SPager *pPager) { ppPager = &pDb->pgrHash[hash % pDb->nPgrHash]; for (; *ppPager && *ppPager != pPager; ppPager = &((*ppPager)->pHashNext)) { } - tAssert(*ppPager == pPager); + ASSERT(*ppPager == pPager); *ppPager = pPager->pNext; // decrease the counter diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index c9268d89e3..b67fe562eb 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -195,10 +195,10 @@ SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) { void tdbPCacheRelease(SPCache *pCache, SPage *pPage, TXN *pTxn) { i32 nRef; - tAssert(pTxn); + ASSERT(pTxn); // nRef = tdbUnrefPage(pPage); - // tAssert(nRef >= 0); + // ASSERT(nRef >= 0); tdbPCacheLock(pCache); nRef = tdbUnrefPage(pPage); @@ -230,7 +230,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) SPage *pPage = NULL; SPage *pPageH = NULL; - tAssert(pTxn); + ASSERT(pTxn); // 1. Search the hash table pPage = pCache->pgHash[tdbPCachePageHash(pPgid) % pCache->nHash]; @@ -271,7 +271,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) ret = tdbPageCreate(pCache->szPage, &pPage, pTxn->xMalloc, pTxn->xArg); if (ret < 0 || pPage == NULL) { // TODO - tAssert(0); + ASSERT(0); return NULL; } @@ -325,7 +325,7 @@ static SPage *tdbPCacheFetchImpl(SPCache *pCache, const SPgid *pPgid, TXN *pTxn) static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { if (pPage->pLruNext != NULL) { - tAssert(tdbGetPageRef(pPage) == 0); + ASSERT(tdbGetPageRef(pPage) == 0); pPage->pLruPrev->pLruNext = pPage->pLruNext; pPage->pLruNext->pLruPrev = pPage->pLruPrev; @@ -340,11 +340,11 @@ static void tdbPCachePinPage(SPCache *pCache, SPage *pPage) { static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) { i32 nRef; - tAssert(pPage->isLocal); - tAssert(!pPage->isDirty); - tAssert(tdbGetPageRef(pPage) == 0); + ASSERT(pPage->isLocal); + ASSERT(!pPage->isDirty); + ASSERT(tdbGetPageRef(pPage) == 0); - tAssert(pPage->pLruNext == NULL); + ASSERT(pPage->pLruNext == NULL); tdbTrace("pCache:%p unpin page %p/%d/%d, nPages:%d", pCache, pPage, TDB_PAGE_PGNO(pPage), pPage->id, pCache->nPages); if (pPage->id < pCache->nPages) { diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index 9aafa458af..ac2725d8ec 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -43,9 +43,9 @@ int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t) u8 *ptr; int size; - tAssert(xMalloc); + ASSERT(xMalloc); - tAssert(TDB_IS_PGSIZE_VLD(pageSize)); + ASSERT(TDB_IS_PGSIZE_VLD(pageSize)); *ppPage = NULL; size = pageSize + sizeof(*pPage); @@ -77,8 +77,8 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) u8 *ptr; tdbTrace("page/destroy: %p/%d %p", pPage, pPage->id, xFree); - tAssert(!pPage->isDirty); - tAssert(xFree); + ASSERT(!pPage->isDirty); + ASSERT(xFree); for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) { tdbTrace("tdbPage/destroy/free ovfl cell: %p/%p", pPage->apOvfl[iOvfl], pPage); @@ -105,7 +105,7 @@ void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - tAssert((u8 *)pPage->pPageFtr == pPage->pFreeEnd); + ASSERT((u8 *)pPage->pPageFtr == pPage->pFreeEnd); } void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) { @@ -118,8 +118,8 @@ void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell pPage->nOverflow = 0; pPage->xCellSize = xCellSize; - tAssert(pPage->pFreeEnd >= pPage->pFreeStart); - tAssert(pPage->pFreeEnd - pPage->pFreeStart <= TDB_PAGE_NFREE(pPage)); + ASSERT(pPage->pFreeEnd >= pPage->pFreeStart); + ASSERT(pPage->pFreeEnd - pPage->pFreeStart <= TDB_PAGE_NFREE(pPage)); } int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl) { @@ -129,7 +129,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl int lidx; // local idx SCell *pNewCell; - tAssert(szCell <= TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); + ASSERT(szCell <= TDB_PAGE_MAX_FREE_BLOCK(pPage, pPage->pPageHdr - pPage->pData)); nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); @@ -173,7 +173,7 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl TDB_PAGE_CELL_OFFSET_AT_SET(pPage, lidx, pNewCell - pPage->pData); TDB_PAGE_NCELLS_SET(pPage, nCells + 1); - tAssert(pPage->pFreeStart == pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)); + ASSERT(pPage->pFreeStart == pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * (nCells + 1)); } for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -197,7 +197,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { nCells = TDB_PAGE_NCELLS(pPage); - tAssert(idx >= 0 && idx < nCells + pPage->nOverflow); + ASSERT(idx >= 0 && idx < nCells + pPage->nOverflow); iOvfl = 0; for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -225,7 +225,7 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { for (; iOvfl < pPage->nOverflow; iOvfl++) { pPage->aiOvfl[iOvfl]--; - tAssert(pPage->aiOvfl[iOvfl] > 0); + ASSERT(pPage->aiOvfl[iOvfl] > 0); } return 0; @@ -237,12 +237,12 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage, int deepCopyOvfl) { pToPage->pFreeStart = pToPage->pPageHdr + (pFromPage->pFreeStart - pFromPage->pPageHdr); pToPage->pFreeEnd = (u8 *)(pToPage->pPageFtr) - ((u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - tAssert(pToPage->pFreeEnd >= pToPage->pFreeStart); + ASSERT(pToPage->pFreeEnd >= pToPage->pFreeStart); memcpy(pToPage->pPageHdr, pFromPage->pPageHdr, pFromPage->pFreeStart - pFromPage->pPageHdr); memcpy(pToPage->pFreeEnd, pFromPage->pFreeEnd, (u8 *)pFromPage->pPageFtr - pFromPage->pFreeEnd); - tAssert(TDB_PAGE_CCELLS(pToPage) == pToPage->pFreeEnd - pToPage->pData); + ASSERT(TDB_PAGE_CCELLS(pToPage) == pToPage->pFreeEnd - pToPage->pData); delta = (pToPage->pPageHdr - pToPage->pData) - (pFromPage->pPageHdr - pFromPage->pData); if (delta != 0) { @@ -292,8 +292,8 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { *ppCell = NULL; nFree = TDB_PAGE_NFREE(pPage); - tAssert(nFree >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)); - tAssert(TDB_PAGE_CCELLS(pPage) == pPage->pFreeEnd - pPage->pData); + ASSERT(nFree >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)); + ASSERT(TDB_PAGE_CCELLS(pPage) == pPage->pFreeEnd - pPage->pData); // 1. Try to allocate from the free space block area if (pPage->pFreeEnd - pPage->pFreeStart >= szCell + TDB_PAGE_OFFSET_SIZE(pPage)) { @@ -305,7 +305,7 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 2. Try to allocate from the page free list cellFree = TDB_PAGE_FCELL(pPage); - tAssert(cellFree == 0 || cellFree >= pPage->pFreeEnd - pPage->pData); + ASSERT(cellFree == 0 || cellFree >= pPage->pFreeEnd - pPage->pData); if (cellFree && pPage->pFreeEnd - pPage->pFreeStart >= TDB_PAGE_OFFSET_SIZE(pPage)) { SCell *pPrevFreeCell = NULL; int szPrevFreeCell; @@ -350,16 +350,16 @@ static int tdbPageAllocate(SPage *pPage, int szCell, SCell **ppCell) { // 3. Try to dfragment and allocate again tdbPageDefragment(pPage); - tAssert(pPage->pFreeEnd - pPage->pFreeStart == nFree); - tAssert(nFree == TDB_PAGE_NFREE(pPage)); - tAssert(pPage->pFreeEnd - pPage->pData == TDB_PAGE_CCELLS(pPage)); + ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); + ASSERT(nFree == TDB_PAGE_NFREE(pPage)); + ASSERT(pPage->pFreeEnd - pPage->pData == TDB_PAGE_CCELLS(pPage)); pPage->pFreeEnd -= szCell; pCell = pPage->pFreeEnd; TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); _alloc_finish: - tAssert(pCell); + ASSERT(pCell); pPage->pFreeStart += TDB_PAGE_OFFSET_SIZE(pPage); TDB_PAGE_NFREE_SET(pPage, nFree - szCell - TDB_PAGE_OFFSET_SIZE(pPage)); *ppCell = pCell; @@ -372,9 +372,9 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { u8 *dest; u8 *src; - tAssert(pCell >= pPage->pFreeEnd); - tAssert(pCell + szCell <= (u8 *)(pPage->pPageFtr)); - tAssert(pCell == TDB_PAGE_CELL_AT(pPage, idx)); + ASSERT(pCell >= pPage->pFreeEnd); + ASSERT(pCell + szCell <= (u8 *)(pPage->pPageFtr)); + ASSERT(pCell == TDB_PAGE_CELL_AT(pPage, idx)); nFree = TDB_PAGE_NFREE(pPage); @@ -387,7 +387,7 @@ static int tdbPageFree(SPage *pPage, int idx, SCell *pCell, int szCell) { pPage->pPageMethods->setFreeCellInfo(pCell, szCell, cellFree); TDB_PAGE_FCELL_SET(pPage, pCell - pPage->pData); } else { - tAssert(0); + ASSERT(0); } } @@ -414,7 +414,7 @@ static int tdbPageDefragment(SPage *pPage) { nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); - tAssert(pPage->pFreeEnd - pPage->pFreeStart < nFree); + ASSERT(pPage->pFreeEnd - pPage->pFreeStart < nFree); // Loop to compact the page content // Here we use an O(n^2) algorithm to do the job since @@ -440,11 +440,11 @@ static int tdbPageDefragment(SPage *pPage) { } } - tAssert(pCell != NULL); + ASSERT(pCell != NULL); szCell = (*pPage->xCellSize)(pPage, pCell, 0, NULL, NULL); - tAssert(pCell + szCell <= pNextCell); + ASSERT(pCell + szCell <= pNextCell); if (pCell + szCell < pNextCell) { memmove(pNextCell - szCell, pCell, szCell); } @@ -454,7 +454,7 @@ static int tdbPageDefragment(SPage *pPage) { TDB_PAGE_CELL_OFFSET_AT_SET(pPage, idx, pNextCell - pPage->pData); } - tAssert(pPage->pFreeEnd - pPage->pFreeStart == nFree); + ASSERT(pPage->pFreeEnd - pPage->pFreeStart == nFree); TDB_PAGE_CCELLS_SET(pPage, pPage->pFreeEnd - pPage->pData); TDB_PAGE_FCELL_SET(pPage, 0); @@ -480,39 +480,39 @@ typedef struct { // cellNum static inline int getPageCellNum(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellNum; } static inline void setPageCellNum(SPage *pPage, int cellNum) { - tAssert(cellNum < 65536); + ASSERT(cellNum < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellNum = (u16)cellNum; } // cellBody static inline int getPageCellBody(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellBody; } static inline void setPageCellBody(SPage *pPage, int cellBody) { - tAssert(cellBody < 65536); + ASSERT(cellBody < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellBody = (u16)cellBody; } // cellFree static inline int getPageCellFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].cellFree; } static inline void setPageCellFree(SPage *pPage, int cellFree) { - tAssert(cellFree < 65536); + ASSERT(cellFree < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].cellFree = (u16)cellFree; } // nFree static inline int getPageNFree(SPage *pPage) { return ((SPageHdr *)(pPage->pPageHdr))[0].nFree; } static inline void setPageNFree(SPage *pPage, int nFree) { - tAssert(nFree < 65536); + ASSERT(nFree < 65536); ((SPageHdr *)(pPage->pPageHdr))[0].nFree = (u16)nFree; } // cell offset static inline int getPageCellOffset(SPage *pPage, int idx) { - tAssert(idx >= 0 && idx < getPageCellNum(pPage)); + ASSERT(idx >= 0 && idx < getPageCellNum(pPage)); return ((u16 *)pPage->pCellIdx)[idx]; } static inline void setPageCellOffset(SPage *pPage, int idx, int offset) { - tAssert(offset < 65536); + ASSERT(offset < 65536); ((u16 *)pPage->pCellIdx)[idx] = (u16)offset; } @@ -587,7 +587,7 @@ static inline void setLPageNFree(SPage *pPage, int nFree) { // cell offset static inline int getLPageCellOffset(SPage *pPage, int idx) { - tAssert(idx >= 0 && idx < getLPageCellNum(pPage)); + ASSERT(idx >= 0 && idx < getLPageCellNum(pPage)); return TDB_GET_U24(pPage->pCellIdx + 3 * idx); } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 00f8b9451f..f638ec25a3 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -234,7 +234,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { int ret; SPage **ppPage; - // tAssert(pPager->inTran); + // ASSERT(pPager->inTran); if (pPage->isDirty) return 0; // ref page one more time so the page will not be release @@ -255,7 +255,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { return 0; } - tAssert(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); + ASSERT(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); pPage->pDirtyNext = *ppPage; *ppPage = pPage; */ @@ -324,7 +324,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) { while ((pNode = tRBTreeIterNext(&iter)) != NULL) { pPage = (SPage *)pNode; - tAssert(pPage->nOverflow == 0); + ASSERT(pPage->nOverflow == 0); ret = tdbPagerPWritePageToDB(pPager, pPage); if (ret < 0) { tdbError("failed to write page to db since %s", tstrerror(terrno)); @@ -632,12 +632,12 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa loadPage = 0; ret = tdbPagerAllocPage(pPager, &pgno); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } } - tAssert(pgno > 0); + ASSERT(pgno > 0); // fetch a page container memcpy(&pgid, pPager->fid, TDB_FILE_ID_LEN); @@ -651,7 +651,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa if (!TDB_PAGE_INITIALIZED(pPage)) { ret = tdbPagerInitPage(pPager, pPage, initPage, arg, loadPage); if (ret < 0) { - tAssert(0); + ASSERT(0); return -1; } } @@ -659,8 +659,8 @@ int tdbPagerFetchPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPa // printf("thread %" PRId64 " pager fetch page %d pgno %d ppage %p\n", taosGetSelfPthreadId(), pPage->id, // TDB_PAGE_PGNO(pPage), pPage); - tAssert(TDB_PAGE_INITIALIZED(pPage)); - tAssert(pPage->pPager == pPager); + ASSERT(TDB_PAGE_INITIALIZED(pPage)); + ASSERT(pPage->pPager == pPager); *ppgno = pgno; *ppPage = pPage; @@ -702,7 +702,7 @@ int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno) { return -1; } - tAssert(*ppgno != 0); + ASSERT(*ppgno != 0); return 0; } @@ -732,7 +732,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage nRead = tdbOsPRead(pPager->fd, pPage->pData, pPage->pageSize, ((i64)pPage->pageSize) * (pgno - 1)); tdbTrace("tdbttl pager:%p, pgno:%d, nRead:%" PRId64, pPager, pgno, nRead); if (nRead < pPage->pageSize) { - tAssert(0); + ASSERT(0); return -1; } } else { @@ -741,7 +741,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage ret = (*initPage)(pPage, arg, init); if (ret < 0) { - tAssert(0); + ASSERT(0); TDB_UNLOCK_PAGE(pPage); return -1; } @@ -760,7 +760,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage } } } else { - tAssert(0); + ASSERT(0); return -1; } diff --git a/source/libs/tdb/src/db/tdbTable.c b/source/libs/tdb/src/db/tdbTable.c index 9eff5f9238..c5c2d6aebe 100644 --- a/source/libs/tdb/src/db/tdbTable.c +++ b/source/libs/tdb/src/db/tdbTable.c @@ -105,7 +105,7 @@ int tdbTbOpen(const char *tbname, int keyLen, int valLen, tdb_cmpr_fn_t keyCmprF #endif - tAssert(pPager != NULL); + ASSERT(pPager != NULL); // pTb->pBt ret = tdbBtreeOpen(keyLen, valLen, pPager, tbname, pgno, keyCmprFn, pEnv, &(pTb->pBt)); diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 10345be962..77c87d18f2 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -18,7 +18,7 @@ int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void (*xFree)(void *, void *), void *xArg, int flags) { // not support read-committed version at the moment - tAssert(flags == 0 || flags == (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)); + ASSERT(flags == 0 || flags == (TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED)); pTxn->flags = flags; pTxn->txnId = txnid; diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index fb5f18dcb3..055a8a1062 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -310,7 +310,7 @@ static inline int tdbTryLockPage(tdb_spinlock_t *pLock) { } else if (ret == EBUSY) { return P_LOCK_BUSY; } else { - tAssert(0); + ASSERT(0); return P_LOCK_FAIL; } } @@ -345,7 +345,7 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) { int iOvfl; int lidx; - tAssert(idx >= 0 && idx < TDB_PAGE_TOTAL_CELLS(pPage)); + ASSERT(idx >= 0 && idx < TDB_PAGE_TOTAL_CELLS(pPage)); iOvfl = 0; for (; iOvfl < pPage->nOverflow; iOvfl++) { @@ -358,7 +358,7 @@ static inline SCell *tdbPageGetCell(SPage *pPage, int idx) { } lidx = idx - iOvfl; - tAssert(lidx >= 0 && lidx < pPage->pPageMethods->getCellNum(pPage)); + ASSERT(lidx >= 0 && lidx < pPage->pPageMethods->getCellNum(pPage)); pCell = pPage->pData + pPage->pPageMethods->getCellOffset(pPage, lidx); return pCell; diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index b8275686fc..fe97f9c986 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -56,7 +56,7 @@ static inline int tdbPutVarInt(u8 *p, int v) { v >>= 7; } - tAssert(n < 6); + ASSERT(n < 6); return n; } @@ -79,7 +79,7 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { n++; } - tAssert(n < 6); + ASSERT(n < 6); *v = tv; return n; diff --git a/source/libs/tdb/test/tdbExOVFLTest.cpp b/source/libs/tdb/test/tdbExOVFLTest.cpp index 8900462c34..f4f09b20b8 100644 --- a/source/libs/tdb/test/tdbExOVFLTest.cpp +++ b/source/libs/tdb/test/tdbExOVFLTest.cpp @@ -3,7 +3,6 @@ #define ALLOW_FORBID_FUNC #include "os.h" #include "tdb.h" -#include "tlog.h" #include #include @@ -104,7 +103,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in int mlen; int cret; - tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -225,7 +224,7 @@ TEST(TdbOVFLPagesTest, TbGetTest) { // char const *key = "key1"; char const *key = "key123456789"; ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - tAssert(ret == 0); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, valLen); @@ -277,7 +276,7 @@ TEST(TdbOVFLPagesTest, TbDeleteTest) { int vLen; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - tAssert(ret == 0); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, valLen); @@ -303,7 +302,7 @@ tdbBegin(pEnv, &txn); int vLen; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - tAssert(ret == 0); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, strlen("value1")); @@ -322,7 +321,7 @@ tdbBegin(pEnv, &txn); int vLen = -1; ret = tdbTbGet(pDb, "key1", strlen("key1"), &pVal, &vLen); - tAssert(ret == -1); + ASSERT(ret == -1); GTEST_ASSERT_EQ(ret, -1); GTEST_ASSERT_EQ(vLen, -1); @@ -416,7 +415,7 @@ TEST(tdb_test, simple_insert1) { // sprintf(val, "value%d", i); ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - tAssert(ret == 0); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, sizeof(val) / sizeof(val[0])); diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 944d0adff6..54e80a0009 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -3,7 +3,6 @@ #define ALLOW_FORBID_FUNC #include "os.h" #include "tdb.h" -#include "tlog.h" #include #include @@ -104,7 +103,7 @@ static int tDefaultKeyCmpr(const void *pKey1, int keyLen1, const void *pKey2, in int mlen; int cret; - tAssert(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); + ASSERT(keyLen1 > 0 && keyLen2 > 0 && pKey1 != NULL && pKey2 != NULL); mlen = keyLen1 < keyLen2 ? keyLen1 : keyLen2; cret = memcmp(pKey1, pKey2, mlen); @@ -182,7 +181,7 @@ TEST(tdb_test, DISABLED_simple_insert1) { sprintf(val, "value%d", i); ret = tdbTbGet(pDb, key, strlen(key), &pVal, &vLen); - tAssert(ret == 0); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, strlen(val)); diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 6e048317c7..943611ee27 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -284,7 +284,7 @@ int32_t tfsMkdir(STfs *pTfs, const char *rname) { } int32_t tfsRmdir(STfs *pTfs, const char *rname) { - tAssert(rname[0] != 0); + ASSERT(rname[0] != 0); char aname[TMPNAME_LEN] = "\0"; diff --git a/source/libs/transport/src/tmsgcb.c b/source/libs/transport/src/tmsgcb.c index 428399235d..95bc532994 100644 --- a/source/libs/transport/src/tmsgcb.c +++ b/source/libs/transport/src/tmsgcb.c @@ -24,7 +24,7 @@ static SMsgCb defaultMsgCb; void tmsgSetDefault(const SMsgCb* msgcb) { defaultMsgCb = *msgcb; } int32_t tmsgPutToQueue(const SMsgCb* msgcb, EQueueType qtype, SRpcMsg* pMsg) { - tAssert(msgcb != NULL); + ASSERT(msgcb != NULL); int32_t code = (*msgcb->putToQueueFp)(msgcb->mgmt, qtype, pMsg); if (code != 0) { rpcFreeCont(pMsg->pCont); diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index fa86905a51..8e6628bb21 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -49,7 +49,7 @@ static FORCE_INLINE int walBuildTmpMetaName(SWal* pWal, char* buf) { static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { int32_t sz = taosArrayGetSize(pWal->fileInfoSet); terrno = TSDB_CODE_SUCCESS; - tAssert(fileIdx >= 0 && fileIdx < sz); + ASSERT(fileIdx >= 0 && fileIdx < sz); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx); char fnameStr[WAL_FILE_LEN]; @@ -101,7 +101,7 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { offsetBackward = offset; } - tAssert(offset <= end); + ASSERT(offset <= end); readSize = end - offset; capacity = readSize + sizeof(magic); @@ -257,7 +257,7 @@ static void walRebuildFileInfoSet(SArray* metaLogList, SArray* actualLogList) { SWalFileInfo* pLogInfo = taosArrayGet(actualLogList, i); while (j < metaFileNum) { SWalFileInfo* pMetaInfo = taosArrayGet(metaLogList, j); - tAssert(pMetaInfo != NULL); + ASSERT(pMetaInfo != NULL); if (pMetaInfo->firstVer < pLogInfo->firstVer) { j++; } else if (pMetaInfo->firstVer == pLogInfo->firstVer) { @@ -385,7 +385,7 @@ int walCheckAndRepairMeta(SWal* pWal) { taosArrayDestroy(actualLog); int32_t sz = taosArrayGetSize(pWal->fileInfoSet); - tAssert(sz == actualFileNum); + ASSERT(sz == actualFileNum); // scan and determine the lastVer int32_t fileIdx = sz; @@ -403,7 +403,7 @@ int walCheckAndRepairMeta(SWal* pWal) { return -1; } - tAssert(pFileInfo->firstVer >= 0); + ASSERT(pFileInfo->firstVer >= 0); if (pFileInfo->lastVer >= pFileInfo->firstVer && fileSize == pFileInfo->fileSize) { totSize += pFileInfo->fileSize; @@ -417,7 +417,7 @@ int walCheckAndRepairMeta(SWal* pWal) { wError("failed to scan wal last ver since %s", terrstr()); return -1; } - tAssert(pFileInfo->fileSize == 0); + ASSERT(pFileInfo->fileSize == 0); // remove the empty wal log, and its idx wInfo("vgId:%d, wal remove empty file %s", pWal->cfg.vgId, fnameStr); taosRemoveFile(fnameStr); @@ -478,7 +478,7 @@ int walReadLogHead(TdFilePtr pLogFile, int64_t offset, SWalCkHead* pCkHead) { int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { int32_t sz = taosArrayGetSize(pWal->fileInfoSet); - tAssert(fileIdx >= 0 && fileIdx < sz); + ASSERT(fileIdx >= 0 && fileIdx < sz); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, fileIdx); char fnameStr[WAL_FILE_LEN]; walBuildIdxName(pWal, pFileInfo->firstVer, fnameStr); @@ -492,7 +492,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { return -1; } - tAssert(pFileInfo->fileSize > 0 && pFileInfo->firstVer >= 0 && pFileInfo->lastVer >= pFileInfo->firstVer); + ASSERT(pFileInfo->fileSize > 0 && pFileInfo->firstVer >= 0 && pFileInfo->lastVer >= pFileInfo->firstVer); if (fileSize == (pFileInfo->lastVer - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)) { return 0; } @@ -556,7 +556,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { } offset += sizeof(SWalIdxEntry); - tAssert(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)); + ASSERT(offset == (idxEntry.ver - pFileInfo->firstVer + 1) * sizeof(SWalIdxEntry)); // ftruncate idx file if (offset < fileSize) { @@ -577,7 +577,7 @@ int walCheckAndRepairIdxFile(SWal* pWal, int32_t fileIdx) { } while (idxEntry.ver < pFileInfo->lastVer) { - tAssert(idxEntry.ver == ckHead.head.version); + ASSERT(idxEntry.ver == ckHead.head.version); idxEntry.ver += 1; idxEntry.offset += sizeof(SWalCkHead) + ckHead.head.bodyLen; @@ -650,7 +650,7 @@ int walRollFileInfo(SWal* pWal) { char* walMetaSerialize(SWal* pWal) { char buf[30]; - tAssert(pWal->fileInfoSet); + ASSERT(pWal->fileInfoSet); int sz = taosArrayGetSize(pWal->fileInfoSet); cJSON* pRoot = cJSON_CreateObject(); cJSON* pMeta = cJSON_CreateObject(); @@ -707,7 +707,7 @@ char* walMetaSerialize(SWal* pWal) { } int walMetaDeserialize(SWal* pWal, const char* bytes) { - tAssert(taosArrayGetSize(pWal->fileInfoSet) == 0); + ASSERT(taosArrayGetSize(pWal->fileInfoSet) == 0); cJSON *pRoot, *pMeta, *pFiles, *pInfoJson, *pField; pRoot = cJSON_Parse(bytes); if (!pRoot) goto _err; @@ -823,7 +823,7 @@ int walSaveMeta(SWal* pWal) { // flush to a tmpfile n = walBuildTmpMetaName(pWal, tmpFnameStr); - tAssert(n < sizeof(tmpFnameStr) && "Buffer overflow of file name"); + ASSERT(n < sizeof(tmpFnameStr) && "Buffer overflow of file name"); TdFilePtr pMetaFile = taosOpenFile(tmpFnameStr, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pMetaFile == NULL) { @@ -854,7 +854,7 @@ int walSaveMeta(SWal* pWal) { // rename it n = walBuildMetaName(pWal, metaVer + 1, fnameStr); - tAssert(n < sizeof(fnameStr) && "Buffer overflow of file name"); + ASSERT(n < sizeof(fnameStr) && "Buffer overflow of file name"); if (taosRenameFile(tmpFnameStr, fnameStr) < 0) { wError("failed to rename file due to %s. dest:%s", strerror(errno), fnameStr); @@ -877,7 +877,7 @@ _err: } int walLoadMeta(SWal* pWal) { - tAssert(pWal->fileInfoSet->size == 0); + ASSERT(pWal->fileInfoSet->size == 0); // find existing meta file int metaVer = walFindCurMetaVer(pWal); if (metaVer == -1) { diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index d518550b8e..ed02d29e3b 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -97,7 +97,7 @@ int32_t walNextValidMsg(SWalReader *pReader) { return -1; } fetchVer++; - tAssert(fetchVer == pReader->curVersion); + ASSERT(fetchVer == pReader->curVersion); } } pReader->curStopped = 1; @@ -132,7 +132,7 @@ static int64_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int return -1; } - tAssert(entry.ver == ver); + ASSERT(entry.ver == ver); ret = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); if (ret < 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -241,7 +241,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curInvalid || pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { - tAssert(0); + ASSERT(0); pRead->curVersion = fetchVer; pRead->curInvalid = 1; return -1; @@ -262,7 +262,7 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - tAssert(0); + ASSERT(0); pRead->curInvalid = 1; return -1; } @@ -299,7 +299,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } pRead->curInvalid = 1; - tAssert(0); + ASSERT(0); return -1; } @@ -308,7 +308,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { pRead->pHead->head.version, ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - tAssert(0); + ASSERT(0); return -1; } @@ -316,7 +316,7 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { wError("vgId:%d, wal fetch body error:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); pRead->curInvalid = 1; terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - tAssert(0); + ASSERT(0); return -1; } @@ -328,14 +328,14 @@ static int32_t walFetchBodyNew(SWalReader *pRead) { static int32_t walSkipFetchBodyNew(SWalReader *pRead) { int64_t code; - tAssert(pRead->curVersion == pRead->pHead->head.version); - tAssert(pRead->curInvalid == 0); + ASSERT(pRead->curVersion == pRead->pHead->head.version); + ASSERT(pRead->curInvalid == 0); code = taosLSeekFile(pRead->pLogFile, pRead->pHead->head.bodyLen, SEEK_CUR); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); pRead->curInvalid = 1; - tAssert(0); + ASSERT(0); return -1; } @@ -384,7 +384,7 @@ int32_t walFetchHead(SWalReader *pRead, int64_t ver, SWalCkHead *pHead) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } - tAssert(0); + ASSERT(0); pRead->curInvalid = 1; return -1; } @@ -410,8 +410,8 @@ int32_t walSkipFetchBody(SWalReader *pRead, const SWalCkHead *pHead) { pRead->pWal->cfg.vgId, pHead->head.version, pRead->pWal->vers.firstVer, pRead->pWal->vers.commitVer, pRead->pWal->vers.lastVer, pRead->pWal->vers.appliedVer); - tAssert(pRead->curVersion == pHead->head.version); - tAssert(pRead->curInvalid == 0); + ASSERT(pRead->curVersion == pHead->head.version); + ASSERT(pRead->curInvalid == 0); code = taosLSeekFile(pRead->pLogFile, pHead->head.bodyLen, SEEK_CUR); if (code < 0) { @@ -447,7 +447,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { if (pReadHead->bodyLen != taosReadFile(pRead->pLogFile, pReadHead->body, pReadHead->bodyLen)) { if (pReadHead->bodyLen < 0) { - tAssert(0); + ASSERT(0); terrno = TAOS_SYSTEM_ERROR(errno); wError("vgId:%d, wal fetch body error:%" PRId64 ", read request index:%" PRId64 ", since %s", pRead->pWal->cfg.vgId, pReadHead->version, ver, tstrerror(terrno)); @@ -457,12 +457,12 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } pRead->curInvalid = 1; - tAssert(0); + ASSERT(0); return -1; } if (pReadHead->version != ver) { - tAssert(0); + ASSERT(0); wError("vgId:%d, wal fetch body error, index:%" PRId64 ", read request index:%" PRId64, pRead->pWal->cfg.vgId, pReadHead->version, ver); pRead->curInvalid = 1; @@ -471,7 +471,7 @@ int32_t walFetchBody(SWalReader *pRead, SWalCkHead **ppHead) { } if (walValidBodyCksum(*ppHead) != 0) { - tAssert(0); + ASSERT(0); wError("vgId:%d, wal fetch body error, index:%" PRId64 ", since body checksum not passed", pRead->pWal->cfg.vgId, ver); pRead->curInvalid = 1; diff --git a/source/libs/wal/src/walRef.c b/source/libs/wal/src/walRef.c index 1c3ebe89fd..eae5d9f1a7 100644 --- a/source/libs/wal/src/walRef.c +++ b/source/libs/wal/src/walRef.c @@ -58,7 +58,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) { SWalFileInfo tmpInfo; tmpInfo.firstVer = ver; SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - tAssert(pRet != NULL); + ASSERT(pRet != NULL); pRef->refFile = pRet->firstVer; taosThreadMutexUnlock(&pWal->mutex); @@ -88,7 +88,7 @@ SWalRef *walRefCommittedVer(SWal *pWal) { SWalFileInfo tmpInfo; tmpInfo.firstVer = ver; SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - tAssert(pRet != NULL); + ASSERT(pRet != NULL); pRef->refFile = pRet->firstVer; taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/libs/wal/src/walSeek.c b/source/libs/wal/src/walSeek.c index 26256df3d3..2cb6614b01 100644 --- a/source/libs/wal/src/walSeek.c +++ b/source/libs/wal/src/walSeek.c @@ -40,7 +40,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { terrno = TAOS_SYSTEM_ERROR(errno); return -1; } - tAssert(entry.ver == ver); + ASSERT(entry.ver == ver); code = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); if (code < 0) { terrno = TAOS_SYSTEM_ERROR(errno); @@ -53,7 +53,7 @@ static int64_t walSeekWritePos(SWal* pWal, int64_t ver) { int walInitWriteFile(SWal* pWal) { TdFilePtr pIdxTFile, pLogTFile; SWalFileInfo* pRet = taosArrayGetLast(pWal->fileInfoSet); - tAssert(pRet != NULL); + ASSERT(pRet != NULL); int64_t fileFirstVer = pRet->firstVer; char fnameStr[WAL_FILE_LEN]; @@ -109,9 +109,9 @@ int64_t walChangeWrite(SWal* pWal, int64_t ver) { tmpInfo.firstVer = ver; // bsearch in fileSet int32_t idx = taosArraySearchIdx(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE); - tAssert(idx != -1); + ASSERT(idx != -1); SWalFileInfo* pFileInfo = taosArrayGet(pWal->fileInfoSet, idx); - /*tAssert(pFileInfo != NULL);*/ + /*ASSERT(pFileInfo != NULL);*/ int64_t fileFirstVer = pFileInfo->firstVer; walBuildIdxName(pWal, fileFirstVer, fnameStr); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 39c4503cdd..a5c7bf1abd 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -87,8 +87,8 @@ int32_t walApplyVer(SWal *pWal, int64_t ver) { } int32_t walCommit(SWal *pWal, int64_t ver) { - tAssert(pWal->vers.commitVer >= pWal->vers.snapshotVer); - tAssert(pWal->vers.commitVer <= pWal->vers.lastVer); + ASSERT(pWal->vers.commitVer >= pWal->vers.snapshotVer); + ASSERT(pWal->vers.commitVer <= pWal->vers.lastVer); if (ver < pWal->vers.commitVer) { return 0; } @@ -138,25 +138,25 @@ int32_t walRollback(SWal *pWal, int64_t ver) { TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); if (pIdxFile == NULL) { - tAssert(0); + ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } int64_t idxOff = walGetVerIdxOffset(pWal, ver); code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET); if (code < 0) { - tAssert(0); + ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } // read idx file and get log file pos SWalIdxEntry entry; if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) { - tAssert(0); + ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } - tAssert(entry.ver == ver); + ASSERT(entry.ver == ver); walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); @@ -176,24 +176,24 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } // validate offset SWalCkHead head; - tAssert(taosValidFile(pLogFile)); + ASSERT(taosValidFile(pLogFile)); int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead)); if (size != sizeof(SWalCkHead)) { - tAssert(0); + ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } code = walValidHeadCksum(&head); - tAssert(code == 0); + ASSERT(code == 0); if (code != 0) { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - tAssert(0); + ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; } if (head.head.version != ver) { - tAssert(0); + ASSERT(0); terrno = TSDB_CODE_WAL_FILE_CORRUPTED; taosThreadMutexUnlock(&pWal->mutex); return -1; @@ -202,21 +202,21 @@ int32_t walRollback(SWal *pWal, int64_t ver) { // truncate old files code = taosFtruncateFile(pLogFile, entry.offset); if (code < 0) { - tAssert(0); + ASSERT(0); terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } code = taosFtruncateFile(pIdxFile, idxOff); if (code < 0) { - tAssert(0); + ASSERT(0); terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } pWal->vers.lastVer = ver - 1; if (pWal->vers.lastVer < pWal->vers.firstVer) { - tAssert(pWal->vers.lastVer == pWal->vers.firstVer - 1); + ASSERT(pWal->vers.lastVer == pWal->vers.firstVer - 1); } ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->lastVer = ver - 1; ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize = entry.offset; @@ -386,7 +386,7 @@ int32_t walEndSnapshot(SWal *pWal) { walBuildIdxName(pWal, pInfo->firstVer, fnameStr); wDebug("vgId:%d, wal remove file %s", pWal->cfg.vgId, fnameStr); if (taosRemoveFile(fnameStr) < 0 && errno != ENOENT) { - tAssert(0); + ASSERT(0); } } taosArrayClear(pWal->toDeleteFiles); @@ -441,7 +441,7 @@ int32_t walRollImpl(SWal *pWal) { pWal->pIdxFile = pIdxFile; pWal->pLogFile = pLogFile; pWal->writeCur = taosArrayGetSize(pWal->fileInfoSet) - 1; - tAssert(pWal->writeCur >= 0); + ASSERT(pWal->writeCur >= 0); pWal->lastRollSeq = walGetSeq(); @@ -458,8 +458,8 @@ END: static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { SWalIdxEntry entry = {.ver = ver, .offset = offset}; SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal); - tAssert(pFileInfo != NULL); - tAssert(pFileInfo->firstVer >= 0); + ASSERT(pFileInfo != NULL); + ASSERT(pFileInfo->firstVer >= 0); int64_t idxOffset = (entry.ver - pFileInfo->firstVer) * sizeof(SWalIdxEntry); wDebug("vgId:%d, write index, index:%" PRId64 ", offset:%" PRId64 ", at %" PRId64, pWal->cfg.vgId, ver, offset, idxOffset); @@ -476,7 +476,7 @@ static int32_t walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { if (endOffset < 0) { wFatal("vgId:%d, failed to seek end of idxfile due to %s. ver:%" PRId64 "", pWal->cfg.vgId, strerror(errno), ver); } - tAssert(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned"); + ASSERT(endOffset == idxOffset + sizeof(SWalIdxEntry) && "Offset of idx entries misaligned"); return 0; } @@ -486,9 +486,9 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy int64_t offset = walGetCurFileOffset(pWal); SWalFileInfo *pFileInfo = walGetCurFileInfo(pWal); - tAssert(pFileInfo != NULL); + ASSERT(pFileInfo != NULL); - tAssert(pFileInfo->firstVer != -1); + ASSERT(pFileInfo->firstVer != -1); pWal->writeHead.head.version = index; pWal->writeHead.head.bodyLen = bodyLen; pWal->writeHead.head.msgType = msgType; @@ -525,7 +525,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy // set status if (pWal->vers.firstVer == -1) { - tAssert(index == 0); + ASSERT(index == 0); pWal->vers.firstVer = 0; } pWal->vers.lastVer = index; @@ -541,7 +541,7 @@ END: wFatal("vgId:%d, failed to ftruncate logfile to offset:%" PRId64 " during recovery due to %s", pWal->cfg.vgId, offset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); - tAssert(0 && "failed to recover from error"); + ASSERT(0 && "failed to recover from error"); } int64_t idxOffset = (index - pFileInfo->firstVer) * sizeof(SWalIdxEntry); @@ -549,7 +549,7 @@ END: wFatal("vgId:%d, failed to ftruncate idxfile to offset:%" PRId64 "during recovery due to %s", pWal->cfg.vgId, idxOffset, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); - tAssert(0 && "failed to recover from error"); + ASSERT(0 && "failed to recover from error"); } return -1; } @@ -576,7 +576,7 @@ int64_t walAppendLog(SWal *pWal, int64_t index, tmsg_t msgType, SWalSyncInfo syn } } - tAssert(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0); + ASSERT(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0); if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) { taosThreadMutexUnlock(&pWal->mutex); @@ -614,7 +614,7 @@ int32_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SWalSync } } - tAssert(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0); + ASSERT(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0); if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) { taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/libs/wal/test/walMetaTest.cpp b/source/libs/wal/test/walMetaTest.cpp index 89313a1f72..891e7dcdae 100644 --- a/source/libs/wal/test/walMetaTest.cpp +++ b/source/libs/wal/test/walMetaTest.cpp @@ -12,7 +12,7 @@ class WalCleanEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - tAssert(code == 0); + ASSERT(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -28,7 +28,7 @@ class WalCleanEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - tAssert(pWal != NULL); + ASSERT(pWal != NULL); } void TearDown() override { @@ -44,7 +44,7 @@ class WalCleanDeleteEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - tAssert(code == 0); + ASSERT(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -58,7 +58,7 @@ class WalCleanDeleteEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - tAssert(pWal != NULL); + ASSERT(pWal != NULL); } void TearDown() override { @@ -74,7 +74,7 @@ class WalKeepEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - tAssert(code == 0); + ASSERT(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -95,7 +95,7 @@ class WalKeepEnv : public ::testing::Test { pCfg->level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, pCfg); taosMemoryFree(pCfg); - tAssert(pWal != NULL); + ASSERT(pWal != NULL); } void TearDown() override { @@ -111,7 +111,7 @@ class WalRetentionEnv : public ::testing::Test { protected: static void SetUpTestCase() { int code = walInit(); - tAssert(code == 0); + ASSERT(code == 0); } static void TearDownTestCase() { walCleanUp(); } @@ -132,7 +132,7 @@ class WalRetentionEnv : public ::testing::Test { cfg.vgId = 0; cfg.level = TAOS_WAL_FSYNC; pWal = walOpen(pathName, &cfg); - tAssert(pWal != NULL); + ASSERT(pWal != NULL); } void TearDown() override { @@ -146,7 +146,7 @@ class WalRetentionEnv : public ::testing::Test { TEST_F(WalCleanEnv, createNew) { walRollFileInfo(pWal); - tAssert(pWal->fileInfoSet != NULL); + ASSERT(pWal->fileInfoSet != NULL); ASSERT_EQ(pWal->fileInfoSet->size, 1); SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); ASSERT_EQ(pInfo->firstVer, 0); @@ -157,36 +157,36 @@ TEST_F(WalCleanEnv, createNew) { TEST_F(WalCleanEnv, serialize) { int code = walRollFileInfo(pWal); - tAssert(code == 0); - tAssert(pWal->fileInfoSet != NULL); + ASSERT(code == 0); + ASSERT(pWal->fileInfoSet != NULL); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); char* ss = walMetaSerialize(pWal); printf("%s\n", ss); taosMemoryFree(ss); code = walSaveMeta(pWal); - tAssert(code == 0); + ASSERT(code == 0); } TEST_F(WalCleanEnv, removeOldMeta) { int code = walRollFileInfo(pWal); - tAssert(code == 0); - tAssert(pWal->fileInfoSet != NULL); + ASSERT(code == 0); + ASSERT(pWal->fileInfoSet != NULL); code = walSaveMeta(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walRollFileInfo(pWal); - tAssert(code == 0); + ASSERT(code == 0); code = walSaveMeta(pWal); - tAssert(code == 0); + ASSERT(code == 0); } TEST_F(WalKeepEnv, readOldMeta) { @@ -327,7 +327,7 @@ TEST_F(WalKeepEnv, readHandleRead) { walResetEnv(); int code; SWalReader* pRead = walOpenReader(pWal, NULL); - tAssert(pRead != NULL); + ASSERT(pRead != NULL); int i; for (i = 0; i < 100; i++) { @@ -388,7 +388,7 @@ TEST_F(WalRetentionEnv, repairMeta1) { ASSERT_EQ(pWal->vers.lastVer, 99); SWalReader* pRead = walOpenReader(pWal, NULL); - tAssert(pRead != NULL); + ASSERT(pRead != NULL); for (int i = 0; i < 1000; i++) { int ver = taosRand() % 100; diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index d219873b5a..421901184b 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -163,7 +163,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -179,7 +179,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return code; } } @@ -225,7 +225,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -241,7 +241,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return code; } } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 8c2170239f..68365be481 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -313,7 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { assert(!(tdFileOptions & TD_FILE_EXCL)); fp = fopen(path, mode); if (fp == NULL) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } else { @@ -336,14 +336,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { fd = open(path, access, S_IRWXU | S_IRWXG | S_IRWXO); #endif if (fd == -1) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } TdFilePtr pFile = (TdFilePtr)taosMemoryMalloc(sizeof(TdFile)); if (pFile == NULL) { - // terrno = TSDB_CODE_OUT_OF_MEMORY; + terrno = TSDB_CODE_OUT_OF_MEMORY; if (fd >= 0) close(fd); if (fp != NULL) fclose(fp); return NULL; diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 2e68bd5ccd..230ca5b968 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) { void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) { #ifdef USE_TD_MEMORY - assert(0); + ASSERT(0); #else #if defined(LINUX) void* p = memalign(alignment, size); diff --git a/source/os/src/osString.c b/source/os/src/osString.c index f03778de2f..e2d8ce95db 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -143,17 +143,15 @@ SConv *gConv = NULL; int32_t convUsed = 0; int32_t gConvMaxNum = 0; -int32_t taosConvInit(void) { +void taosConvInit(void) { gConvMaxNum = 512; gConv = taosMemoryCalloc(gConvMaxNum, sizeof(SConv)); for (int32_t i = 0; i < gConvMaxNum; ++i) { gConv[i].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); if ((iconv_t)-1 == gConv[i].conv || (iconv_t)0 == gConv[i].conv) { - return -1; + ASSERT(0); } } - - return 0; } void taosConvDestroy() { diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index e28abf131d..7ec1da0530 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -617,14 +617,14 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { return 0; } else { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return -1; } #elif defined(_TD_DARWIN_64) struct statvfs info; if (statvfs(dataDir, &info)) { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; @@ -635,7 +635,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { #else struct statvfs info; if (statvfs(dataDir, &info)) { - // terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c index a1d86a8bc9..4d6875d263 100644 --- a/source/util/src/talgo.c +++ b/source/util/src/talgo.c @@ -15,7 +15,6 @@ #define _DEFAULT_SOURCE #include "talgo.h" -#include "tlog.h" #define doswap(__left, __right, __size, __buf) \ do { \ @@ -201,7 +200,7 @@ void *taosbsearch(const void *key, const void *base, int32_t nmemb, int32_t size } else if (flags == TD_LT) { return (c > 0) ? p : (midx > 0 ? p - size : NULL); } else { - tAssert(0); + ASSERT(0); return NULL; } } diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 68137dee19..4bd8294423 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -317,7 +317,7 @@ SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn) { if (fn == NULL) { memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size); } else { - tAssert(pSrc->elemSize == sizeof(void*)); + ASSERT(pSrc->elemSize == sizeof(void*)); for (int32_t i = 0; i < pSrc->size; ++i) { void* p = fn(taosArrayGetP(pSrc, i)); @@ -399,7 +399,7 @@ void taosArrayDestroyEx(SArray* pArray, FDelete fp) { } void taosArraySort(SArray* pArray, __compar_fn_t compar) { - tAssert(pArray != NULL && compar != NULL); + ASSERT(pArray != NULL && compar != NULL); taosSort(pArray->pData, pArray->size, pArray->elemSize, compar); } diff --git a/source/util/src/tbloomfilter.c b/source/util/src/tbloomfilter.c index 40dac37283..84a78f3477 100644 --- a/source/util/src/tbloomfilter.c +++ b/source/util/src/tbloomfilter.c @@ -70,7 +70,7 @@ SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate) { } int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len) { - tAssert(!tBloomFilterIsFull(pBF)); + ASSERT(!tBloomFilterIsFull(pBF)); uint64_t h1 = (uint64_t)pBF->hashFn1(keyBuf, len); uint64_t h2 = (uint64_t)pBF->hashFn2(keyBuf, len); bool hasChange = false; diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index 068ba77157..7d1686ef80 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -266,12 +266,12 @@ static void pushfrontNodeInEntryList(SCacheEntry *pEntry, SCacheNode *pNode) { pNode->pNext = pEntry->next; pEntry->next = pNode; pEntry->num += 1; - tAssert((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); + ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); } static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode *pNode) { if (prev == NULL) { - tAssert(pe->next == pNode); + ASSERT(pe->next == pNode); pe->next = pNode->pNext; } else { prev->pNext = pNode->pNext; @@ -279,7 +279,7 @@ static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode pNode->pNext = NULL; pe->num -= 1; - tAssert((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0)); + ASSERT((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0)); } static FORCE_INLINE SCacheEntry *doFindEntry(SCacheObj *pCacheObj, const void *key, size_t keyLen) { @@ -471,7 +471,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen SCacheNode *pNode = doSearchInEntryList(pe, key, keyLen, &prev); if (pNode != NULL) { int32_t ref = T_REF_INC(pNode); - tAssert(ref > 0); + ASSERT(ref > 0); } taosRUnLockLatch(&pe->latch); @@ -670,7 +670,7 @@ void doTraverseElems(SCacheObj *pCacheObj, bool (*fp)(void *param, SCacheNode *p } else { *pPre = next; pEntry->num -= 1; - tAssert((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); + ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); atomic_sub_fetch_ptr(&pCacheObj->numOfElems, 1); pNode = next; @@ -928,7 +928,7 @@ void taosStopCacheRefreshWorker(void) { size_t taosCacheGetNumOfObj(const SCacheObj *pCacheObj) { return pCacheObj->numOfElems + pCacheObj->numOfElemsInTrash; } SCacheIter *taosCacheCreateIter(const SCacheObj *pCacheObj) { - tAssert(pCacheObj != NULL); + ASSERT(pCacheObj != NULL); SCacheIter *pIter = taosMemoryCalloc(1, sizeof(SCacheIter)); pIter->pCacheObj = (SCacheObj *)pCacheObj; pIter->entryIndex = -1; @@ -978,11 +978,11 @@ bool taosCacheIterNext(SCacheIter *pIter) { SCacheNode *pNode = pEntry->next; for (int32_t i = 0; i < pEntry->num; ++i) { - tAssert(pNode != NULL); + ASSERT(pNode != NULL); pIter->pCurrent[i] = pNode; int32_t ref = T_REF_INC(pIter->pCurrent[i]); - tAssert(ref >= 1); + ASSERT(ref >= 1); pNode = pNode->pNext; } diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 16f71f0b84..18305e594b 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1323,7 +1323,7 @@ static int32_t tCompTSSwitchToCopy(SCompressor *pCmprsor) { } } - tAssert(n == pCmprsor->nBuf && nBuf == sizeof(int64_t) * pCmprsor->nVal + 1); + ASSERT(n == pCmprsor->nBuf && nBuf == sizeof(int64_t) * pCmprsor->nVal + 1); uint8_t *pBuf = pCmprsor->pBuf; pCmprsor->pBuf = pCmprsor->aBuf[0]; @@ -1338,7 +1338,7 @@ static int32_t tCompTimestamp(SCompressor *pCmprsor, const void *pData, int32_t int32_t code = 0; int64_t ts = *(int64_t *)pData; - tAssert(nData == 8); + ASSERT(nData == 8); if (pCmprsor->pBuf[0] == 1) { if (pCmprsor->nVal == 0) { @@ -1416,7 +1416,7 @@ static int32_t tCompTimestampEnd(SCompressor *pCmprsor, const uint8_t **ppData, *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - tAssert(0); + ASSERT(0); } return code; @@ -1502,7 +1502,7 @@ static int32_t tCompIntSwitchToCopy(SCompressor *pCmprsor) { pCmprsor->i_nEle--; } - tAssert(n == pCmprsor->nBuf && nBuf == size); + ASSERT(n == pCmprsor->nBuf && nBuf == size); uint8_t *pBuf = pCmprsor->pBuf; pCmprsor->pBuf = pCmprsor->aBuf[0]; @@ -1517,7 +1517,7 @@ _exit: static int32_t tCompInt(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - tAssert(nData == DATA_TYPE_INFO[pCmprsor->type].bytes); + ASSERT(nData == DATA_TYPE_INFO[pCmprsor->type].bytes); if (pCmprsor->pBuf[0] == 0) { int64_t val = DATA_TYPE_INFO[pCmprsor->type].getI64(pData); @@ -1659,7 +1659,7 @@ static int32_t tCompIntEnd(SCompressor *pCmprsor, const uint8_t **ppData, int32_ *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - tAssert(0); + ASSERT(0); } return code; @@ -1738,7 +1738,7 @@ _exit: static int32_t tCompFloat(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - tAssert(nData == sizeof(float)); + ASSERT(nData == sizeof(float)); union { float f; @@ -1812,7 +1812,7 @@ static int32_t tCompFloatEnd(SCompressor *pCmprsor, const uint8_t **ppData, int3 *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - tAssert(0); + ASSERT(0); } return code; @@ -1891,7 +1891,7 @@ _exit: static int32_t tCompDouble(SCompressor *pCmprsor, const void *pData, int32_t nData) { int32_t code = 0; - tAssert(nData == sizeof(double)); + ASSERT(nData == sizeof(double)); union { double d; @@ -1965,7 +1965,7 @@ static int32_t tCompDoubleEnd(SCompressor *pCmprsor, const uint8_t **ppData, int *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - tAssert(0); + ASSERT(0); } return code; @@ -2059,7 +2059,7 @@ static int32_t tCompBoolEnd(SCompressor *pCmprsor, const uint8_t **ppData, int32 *ppData = pCmprsor->pBuf; *nData = pCmprsor->nBuf; } else { - tAssert(0); + ASSERT(0); } return code; diff --git a/source/util/src/tencode.c b/source/util/src/tencode.c index 71f47bccd0..7f8a0edfdd 100644 --- a/source/util/src/tencode.c +++ b/source/util/src/tencode.c @@ -100,7 +100,7 @@ void tEndEncode(SEncoder* pCoder) { if (pCoder->data) { pNode = pCoder->eStack; - tAssert(pNode); + ASSERT(pNode); pCoder->eStack = pNode->pNext; len = pCoder->pos; @@ -142,7 +142,7 @@ void tEndDecode(SDecoder* pCoder) { SDecoderNode* pNode; pNode = pCoder->dStack; - tAssert(pNode); + ASSERT(pNode); pCoder->dStack = pNode->pNext; pCoder->data = pNode->data; diff --git a/source/util/src/thash.c b/source/util/src/thash.c index 427581d6f1..e9548613aa 100644 --- a/source/util/src/thash.c +++ b/source/util/src/thash.c @@ -194,14 +194,14 @@ static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SH atomic_sub_fetch_16(&pNode->refCount, 1); if (prev != NULL) { prev->next = pNewNode; - tAssert(prev->next != prev); + ASSERT(prev->next != prev); } else { pe->next = pNewNode; } if (pNode->refCount <= 0) { pNewNode->next = pNode->next; - tAssert(pNewNode->next != pNewNode); + ASSERT(pNewNode->next != pNewNode); FREE_HASH_NODE(pHashObj->freeFp, pNode); } else { @@ -262,7 +262,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp pHashObj->freeFp = NULL; pHashObj->callbackFp = NULL; - tAssert((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); + ASSERT((pHashObj->capacity & (pHashObj->capacity - 1)) == 0); pHashObj->hashList = (SHashEntry **)taosMemoryMalloc(pHashObj->capacity * sizeof(void *)); if (pHashObj->hashList == NULL) { @@ -533,7 +533,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) { pe->next = pNode->next; } else { prevNode->next = pNode->next; - tAssert(prevNode->next != prevNode); + ASSERT(prevNode->next != prevNode); } pe->num--; @@ -729,7 +729,7 @@ void pushfrontNodeInEntryList(SHashEntry *pEntry, SHashNode *pNode) { pNode->next = pEntry->next; pEntry->next = pNode; - tAssert(pNode->next != pNode); + ASSERT(pNode->next != pNode); pEntry->num += 1; } @@ -780,12 +780,12 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) { if (pOld->refCount <= 0) { if (prevNode) { prevNode->next = pOld->next; - tAssert(prevNode->next != prevNode); + ASSERT(prevNode->next != prevNode); } else { pe->next = pOld->next; SHashNode *x = pe->next; if (x != NULL) { - tAssert(x->next != x); + ASSERT(x->next != x); } } @@ -844,7 +844,7 @@ void *taosHashIterate(SHashObj *pHashObj, void *p) { /*uint16_t prevRef = atomic_load_16(&pNode->refCount);*/ uint16_t afterRef = atomic_add_fetch_16(&pNode->refCount, 1); #if 0 - tAssert(prevRef < afterRef); + ASSERT(prevRef < afterRef); // the reference count value is overflow, which will cause the delete node operation immediately. if (prevRef > afterRef) { diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 251b508040..be1db74f1a 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -72,7 +72,6 @@ static int32_t tsDaylightActive; /* Currently in daylight saving time. */ bool tsLogEmbedded = 0; bool tsAsyncLog = true; -bool tsAssert = true; int32_t tsNumOfLogLines = 10000000; int32_t tsLogKeepDays = 0; LogFp tsLogFp = NULL; @@ -779,37 +778,3 @@ cmp_end: return ret; } - -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { - if (condition) return false; - - const char *flags = "UTL FATAL "; - ELogLevel level = DEBUG_FATAL; - int32_t dflag = 255; // tsLogEmbedded ? 255 : uDebugFlag - char buffer[LOG_MAX_LINE_BUFFER_SIZE]; - int32_t len = taosBuildLogHead(buffer, flags); - - va_list argpointer; - va_start(argpointer, format); - len = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); - va_end(argpointer); - buffer[len++] = '\n'; - buffer[len] = 0; - taosPrintLogImp(1, 255, buffer, len); - - taosPrintLog(flags, level, dflag, "tAssert at file %s:%d exit:%d", file, line, tsAssert); - taosPrintTrace(flags, level, dflag); - - if (tsAssert) { - taosCloseLog(); - taosMsleep(300); - -#ifdef NDEBUG - abort(); -#else - assert(0); -#endif - } - - return true; -} diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 33761740b2..37874ae250 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -197,7 +197,7 @@ static char* doFlushPageToDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) { size = pg->length; } - tAssert(size > 0 || (pg->offset == -1 && pg->length == -1)); + ASSERT(size > 0 || (pg->offset == -1 && pg->length == -1)); char* pDataBuf = pg->pData; memset(pDataBuf, 0, getAllocPageSize(pBuf->pageSize)); @@ -500,7 +500,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) { size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; } SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { - tAssert(pBuf != NULL); + ASSERT(pBuf != NULL); return pBuf->pIdList; } @@ -578,7 +578,7 @@ SPageInfo* getLastPageInfo(SArray* pList) { } int32_t getPageId(const SPageInfo* pPgInfo) { - tAssert(pPgInfo != NULL); + ASSERT(pPgInfo != NULL); return pPgInfo->pageId; } diff --git a/source/util/src/tscalablebf.c b/source/util/src/tscalablebf.c index 6c562d3b6d..797f3a924d 100644 --- a/source/util/src/tscalablebf.c +++ b/source/util/src/tscalablebf.c @@ -51,7 +51,7 @@ int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) { } SBloomFilter *pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); - tAssert(pNormalBf); + ASSERT(pNormalBf); if (tBloomFilterIsFull(pNormalBf)) { pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO); diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index a34520aaaf..467f26b362 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -137,7 +137,7 @@ void *taosProcessSchedQueue(void *scheduler) { while (1) { if ((ret = tsem_wait(&pSched->fullSem)) != 0) { uFatal("wait %s fullSem failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } if (atomic_load_8(&pSched->stop)) { break; @@ -145,7 +145,7 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } msg = pSched->queue[pSched->fullSlot]; @@ -154,12 +154,12 @@ void *taosProcessSchedQueue(void *scheduler) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } if ((ret = tsem_post(&pSched->emptySem)) != 0) { uFatal("post %s emptySem failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } if (msg.fp) @@ -187,12 +187,12 @@ int taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = tsem_wait(&pSched->emptySem)) != 0) { uFatal("wait %s emptySem failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } if ((ret = taosThreadMutexLock(&pSched->queueMutex)) != 0) { uFatal("lock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } pSched->queue[pSched->emptySlot] = *pMsg; @@ -200,12 +200,12 @@ int taosScheduleTask(void *queueScheduler, SSchedMsg *pMsg) { if ((ret = taosThreadMutexUnlock(&pSched->queueMutex)) != 0) { uFatal("unlock %s queueMutex failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } if ((ret = tsem_post(&pSched->fullSem)) != 0) { uFatal("post %s fullSem failed(%s)", pSched->label, strerror(errno)); - tAssert(0); + ASSERT(0); } return ret; } diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index 14ffa052fe..c72c5c70ae 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -268,8 +268,8 @@ SSkipListIterator *tSkipListCreateIter(SSkipList *pSkipList) { } SSkipListIterator *tSkipListCreateIterFromVal(SSkipList *pSkipList, const char *val, int32_t type, int32_t order) { - tAssert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); - tAssert(pSkipList != NULL); + ASSERT(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); + ASSERT(pSkipList != NULL); SSkipListIterator *iter = doCreateSkipListIterator(pSkipList, order); if (val == NULL) { @@ -362,7 +362,7 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { while (p != pSkipList->pTail) { char *key = SL_GET_NODE_KEY(pSkipList, p); if (prev != NULL) { - tAssert(pSkipList->comparFn(prev, key) < 0); + ASSERT(pSkipList->comparFn(prev, key) < 0); } switch (pSkipList->type) { @@ -516,7 +516,7 @@ static bool tSkipListGetPosToPut(SSkipList *pSkipList, SSkipListNode **backward, static void tSkipListRemoveNodeImpl(SSkipList *pSkipList, SSkipListNode *pNode) { int32_t level = pNode->level; uint8_t dupMode = SL_DUP_MODE(pSkipList); - tAssert(dupMode != SL_DISCARD_DUP_KEY && dupMode != SL_UPDATE_DUP_KEY); + ASSERT(dupMode != SL_DISCARD_DUP_KEY && dupMode != SL_UPDATE_DUP_KEY); for (int32_t j = level - 1; j >= 0; --j) { SSkipListNode *prev = SL_NODE_GET_BACKWARD_POINTER(pNode, j); @@ -585,7 +585,7 @@ static FORCE_INLINE int32_t getSkipListRandLevel(SSkipList *pSkipList) { } } - tAssert(level <= pSkipList->maxLevel); + ASSERT(level <= pSkipList->maxLevel); return level; } diff --git a/source/util/test/hashTest.cpp b/source/util/test/hashTest.cpp index c7b3750875..76fb9c7067 100644 --- a/source/util/test/hashTest.cpp +++ b/source/util/test/hashTest.cpp @@ -6,7 +6,6 @@ #include "taos.h" #include "taosdef.h" #include "thash.h" -#include "tlog.h" namespace { @@ -251,7 +250,7 @@ void perfTest() { int64_t start1h = taosGetTimestampMs(); int64_t start1hCt = taosHashGetCompTimes(hash1h); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash1h, name + (i % 50) * 9, 9)); + ASSERT(taosHashGet(hash1h, name + (i % 50) * 9, 9)); } int64_t end1h = taosGetTimestampMs(); int64_t end1hCt = taosHashGetCompTimes(hash1h); @@ -259,7 +258,7 @@ void perfTest() { int64_t start1s = taosGetTimestampMs(); int64_t start1sCt = taosHashGetCompTimes(hash1s); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash1s, name + (i % 500) * 9, 9)); + ASSERT(taosHashGet(hash1s, name + (i % 500) * 9, 9)); } int64_t end1s = taosGetTimestampMs(); int64_t end1sCt = taosHashGetCompTimes(hash1s); @@ -267,7 +266,7 @@ void perfTest() { int64_t start10s = taosGetTimestampMs(); int64_t start10sCt = taosHashGetCompTimes(hash10s); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash10s, name + (i % 5000) * 9, 9)); + ASSERT(taosHashGet(hash10s, name + (i % 5000) * 9, 9)); } int64_t end10s = taosGetTimestampMs(); int64_t end10sCt = taosHashGetCompTimes(hash10s); @@ -275,7 +274,7 @@ void perfTest() { int64_t start100s = taosGetTimestampMs(); int64_t start100sCt = taosHashGetCompTimes(hash100s); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash100s, name + (i % 50000) * 9, 9)); + ASSERT(taosHashGet(hash100s, name + (i % 50000) * 9, 9)); } int64_t end100s = taosGetTimestampMs(); int64_t end100sCt = taosHashGetCompTimes(hash100s); @@ -283,7 +282,7 @@ void perfTest() { int64_t start1m = taosGetTimestampMs(); int64_t start1mCt = taosHashGetCompTimes(hash1m); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash1m, name + (i % 500000) * 9, 9)); + ASSERT(taosHashGet(hash1m, name + (i % 500000) * 9, 9)); } int64_t end1m = taosGetTimestampMs(); int64_t end1mCt = taosHashGetCompTimes(hash1m); @@ -291,7 +290,7 @@ void perfTest() { int64_t start10m = taosGetTimestampMs(); int64_t start10mCt = taosHashGetCompTimes(hash10m); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash10m, name + (i % 5000000) * 9, 9)); + ASSERT(taosHashGet(hash10m, name + (i % 5000000) * 9, 9)); } int64_t end10m = taosGetTimestampMs(); int64_t end10mCt = taosHashGetCompTimes(hash10m); @@ -299,7 +298,7 @@ void perfTest() { int64_t start100m = taosGetTimestampMs(); int64_t start100mCt = taosHashGetCompTimes(hash100m); for (int64_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(hash100m, name + (i % 50000000) * 9, 9)); + ASSERT(taosHashGet(hash100m, name + (i % 50000000) * 9, 9)); } int64_t end100m = taosGetTimestampMs(); int64_t end100mCt = taosHashGetCompTimes(hash100m); @@ -324,14 +323,14 @@ void perfTest() { SArray* pArray = sArray[i]; for (int64_t m = 0; m < num; ++m) { char* p = (char*)taosArrayGet(pArray, m); - tAssert(taosArrayPush(slArray, p)); + ASSERT(taosArrayPush(slArray, p)); } } int64_t start100mS = taosGetTimestampMs(); int64_t start100mSCt = taosHashGetCompTimes(hash100m); int32_t num = taosArrayGetSize(slArray); for (int64_t i = 0; i < num; ++i) { - tAssert(taosHashGet(hash100m, (char*)TARRAY_GET_ELEM(slArray, i), 9)); + ASSERT(taosHashGet(hash100m, (char*)TARRAY_GET_ELEM(slArray, i), 9)); } int64_t end100mS = taosGetTimestampMs(); int64_t end100mSCt = taosHashGetCompTimes(hash100m); @@ -378,12 +377,12 @@ void perfTest() { int64_t startMhash = taosGetTimestampMs(); #if 0 for (int32_t i = 0; i < 10000000; ++i) { - tAssert(taosHashGet(mhash[i%1000], name + i * 9, 9)); + ASSERT(taosHashGet(mhash[i%1000], name + i * 9, 9)); } #else // for (int64_t i = 0; i < 10000000; ++i) { for (int64_t i = 0; i < 50000000; i += 5) { - tAssert(taosHashGet(mhash[i / 50000], name + i * 9, 9)); + ASSERT(taosHashGet(mhash[i / 50000], name + i * 9, 9)); } #endif int64_t endMhash = taosGetTimestampMs(); diff --git a/tests/script/tsim/db/alter_replica_13.sim b/tests/script/tsim/db/alter_replica_13.sim index 08006216fb..4eafb86198 100644 --- a/tests/script/tsim/db/alter_replica_13.sim +++ b/tests/script/tsim/db/alter_replica_13.sim @@ -116,25 +116,6 @@ endi print ============= step4: alter database sql alter database db replica 3 -$wt = 0 -stepwt1: - $wt = $wt + 1 - sleep 1000 - if $wt == 200 then - print ====> dnode not ready! - return -1 - endi -sql show transactions -if $rows != 0 then - print wait 1 seconds to alter - goto stepwt1 -endi - -sql show db.vgroups -print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 $leaderIndex = 0 diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index 9c39a624a1..47e1fda79f 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -148,26 +148,6 @@ endi print ============= step3: alter database sql alter database db replica 1 -$wt = 0 -stepwt1: - $wt = $wt + 1 - sleep 1000 - if $wt == 200 then - print ====> dnode not ready! - return -1 - endi -sql show transactions -if $rows != 0 then - print wait 1 seconds to alter - goto stepwt1 -endi - -sql show db.vgroups -print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 - $hasleader = 0 $x = 0 diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 3dabfd42fa..47b7adbf18 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -20,7 +20,6 @@ #include #include "taos.h" #include "types.h" -#include "tlog.h" int smlProcess_influx_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1017,14 +1016,14 @@ int smlProcess_18784_Test() { pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, 0); printf("%s result:%s, rows:%d\n", __FUNCTION__, taos_errstr(pRes), taos_affected_rows(pRes)); int code = taos_errno(pRes); - tAssert(!code); - tAssert(taos_affected_rows(pRes) == 2); + ASSERT(!code); + ASSERT(taos_affected_rows(pRes) == 2); taos_free_result(pRes); pRes = taos_query(taos, "select * from disk"); - tAssert(pRes); + ASSERT(pRes); int fieldNum = taos_field_count(pRes); - tAssert(fieldNum == 5); + ASSERT(fieldNum == 5); printf("fieldNum:%d\n", fieldNum); TAOS_ROW row = NULL; int32_t rowIndex = 0; @@ -1034,10 +1033,10 @@ int smlProcess_18784_Test() { int64_t total = *(int64_t*)row[2]; int64_t freed = *(int64_t*)row[3]; if(rowIndex == 0){ - tAssert(ts == 1661943960000); - tAssert(used == 176059); - tAssert(total == 1081101176832); - tAssert(freed == 66932805); + ASSERT(ts == 1661943960000); + ASSERT(used == 176059); + ASSERT(total == 1081101176832); + ASSERT(freed == 66932805); // ASSERT_EQ(latitude, 24.5208); // ASSERT_EQ(longitude, 28.09377); // ASSERT_EQ(elevation, 428); @@ -1046,7 +1045,7 @@ int smlProcess_18784_Test() { // ASSERT_EQ(grade, 0); // ASSERT_EQ(fuel_consumption, 25); }else{ -// tAssert(0); +// ASSERT(0); } rowIndex++; } @@ -1075,7 +1074,7 @@ int sml_19221_Test() { int32_t totalRows = 0; pRes = taos_schemaless_insert_raw(taos, tmp, strlen(sql[0]), &totalRows, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_NANO_SECONDS); - tAssert(totalRows == 3); + ASSERT(totalRows == 3); printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); int code = taos_errno(pRes); taos_free_result(pRes); @@ -1132,7 +1131,7 @@ int sml_ttl_Test() { printf("%s result2:%s\n", __FUNCTION__, taos_errstr(pRes)); TAOS_ROW row = taos_fetch_row(pRes); int32_t ttl = *(int32_t*)row[0]; - tAssert(ttl == 20); + ASSERT(ttl == 20); int code = taos_errno(pRes); taos_free_result(pRes); @@ -1144,40 +1143,40 @@ int sml_ttl_Test() { int main(int argc, char *argv[]) { int ret = 0; ret = sml_ttl_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_ts2164_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_influx_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_telnet_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_json1_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_json2_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_json3_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_json4_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_TD15662_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_TD15742_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_16384_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_oom_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_16368_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_dup_time_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_16960_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_add_tag_col_Test(); - tAssert(!ret); + ASSERT(!ret); ret = smlProcess_18784_Test(); - tAssert(!ret); + ASSERT(!ret); ret = sml_19221_Test(); - tAssert(!ret); + ASSERT(!ret); return ret; } From 66f4ee9a41315ecdcb44e522f5a68cc28ef84c90 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 21:57:49 +0800 Subject: [PATCH 24/66] enh: alter db replica return quickly, operation executed asynchronously --- source/dnode/mnode/impl/src/mndDb.c | 8 +++++++- tests/script/tsim/db/alter_replica_13.sim | 19 +++++++++++++++++++ tests/script/tsim/db/alter_replica_31.sim | 20 ++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 5fa86dffe2..43155124c1 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -825,7 +825,13 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { dbObj.cfgVersion++; dbObj.updateTime = taosGetTimestampMs(); code = mndAlterDb(pMnode, pReq, pDb, &dbObj); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + + if (dbObj.cfg.replications != pDb->cfg.replications) { + // return quickly, operation executed asynchronously + mInfo("db:%s, alter db replica from %d to %d", pDb->name, pDb->cfg.replications, dbObj.cfg.replications); + } else { + if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; + } _OVER: if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { diff --git a/tests/script/tsim/db/alter_replica_13.sim b/tests/script/tsim/db/alter_replica_13.sim index 4eafb86198..d75acb50ad 100644 --- a/tests/script/tsim/db/alter_replica_13.sim +++ b/tests/script/tsim/db/alter_replica_13.sim @@ -116,6 +116,25 @@ endi print ============= step4: alter database sql alter database db replica 3 +$wt = 0 +stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + +sql show db.vgroups +print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 $leaderIndex = 0 diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index 47e1fda79f..b689c9de10 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -148,6 +148,26 @@ endi print ============= step3: alter database sql alter database db replica 1 +wt = 0 + stepwt1: + $wt = $wt + 1 + sleep 1000 + if $wt == 200 then + print ====> dnode not ready! + return -1 + endi +sql show transactions +if $rows != 0 then + print wait 1 seconds to alter + goto stepwt1 +endi + +sql show db.vgroups +print ---> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data27 $data28 $data29 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data26 $data37 $data38 $data39 +print ---> $data10 $data11 $data12 $data13 $data14 $data15 $data36 $data47 $data48 $data49 + $hasleader = 0 $x = 0 From 1bb1025f7d9b7a22a0712c2c5d1a962b09c78d45 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 22:24:47 +0800 Subject: [PATCH 25/66] enh: add tassert --- include/os/os.h | 1 + include/os/osDef.h | 6 ---- include/os/osString.h | 2 +- include/os/osSystem.h | 20 +++++++++++ include/util/tcoding.h | 1 + include/util/tlog.h | 5 +++ source/client/src/clientEnv.c | 4 ++- source/common/src/tglobal.c | 5 +++ source/common/src/tmsg.c | 2 ++ source/common/src/trow.c | 1 + source/common/src/ttime.c | 2 ++ source/dnode/mgmt/exe/dmMain.c | 7 +++- source/dnode/mgmt/mgmt_snode/src/smWorker.c | 5 +-- source/libs/executor/src/tlinearhash.c | 1 + source/libs/function/src/tpercentile.c | 1 + source/libs/sync/src/syncCommit.c | 2 +- source/libs/sync/src/syncMain.c | 12 +++---- source/libs/sync/src/syncPipeline.c | 16 ++++----- .../sync/test/syncAppendEntriesReplyTest.cpp | 2 +- source/libs/sync/test/syncTest.cpp | 2 +- .../libs/sync/test/sync_test_lib/inc/syncIO.h | 2 ++ .../libs/sync/test/sync_test_lib/src/syncIO.c | 2 ++ .../test/sync_test_lib/src/syncMessageDebug.c | 4 +-- source/libs/tdb/test/tdbExOVFLTest.cpp | 1 + source/libs/tdb/test/tdbTest.cpp | 1 + source/os/src/osMemory.c | 2 +- source/os/src/osString.c | 6 ++-- source/util/src/talgo.c | 1 + source/util/src/tlog.c | 35 +++++++++++++++++++ source/util/test/hashTest.cpp | 1 + utils/test/c/sml_test.c | 1 + 31 files changed, 120 insertions(+), 33 deletions(-) diff --git a/include/os/os.h b/include/os/os.h index 0688eeb9ad..b27fa84406 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -27,6 +27,7 @@ extern "C" { #if !defined(WINDOWS) #include +#include #include #include #include diff --git a/include/os/osDef.h b/include/os/osDef.h index 0bf9c6184e..c18728c9a7 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -120,12 +120,6 @@ void syslog(int unused, const char *format, ...); #define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b))) #define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2)) -#ifndef NDEBUG -#define ASSERT(x) assert(x) -#else -#define ASSERT(x) -#endif - #ifndef UNUSED #define UNUSED(x) ((void)(x)) #endif diff --git a/include/os/osString.h b/include/os/osString.h index 4c3fbe46c3..b609c9d351 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -62,7 +62,7 @@ typedef int32_t TdUcs4; int32_t taosUcs4len(TdUcs4 *ucs4); int64_t taosStr2int64(const char *str); -void taosConvInit(void); +int32_t taosConvInit(void); void taosConvDestroy(); int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs); bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len); diff --git a/include/os/osSystem.h b/include/os/osSystem.h index eca984c41a..31ec513fca 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -46,6 +46,26 @@ void taosSetTerminalMode(); int32_t taosGetOldTerminalMode(); void taosResetTerminalMode(); +#if !defined(WINDOWS) +#define taosPrintTrace(flags, level, dflag) \ + { \ + void* array[100]; \ + int32_t size = backtrace(array, 100); \ + char** strings = backtrace_symbols(array, size); \ + if (strings != NULL) { \ + taosPrintLog(flags, level, dflag, "obtained %d stack frames", size); \ + for (int32_t i = 0; i < size; i++) { \ + taosPrintLog(flags, level, dflag, "frame:%d, %s", i, strings[i]); \ + } \ + } \ + \ + taosMemoryFree(strings); \ + } +#else +#define taosPrintTrace(flags, level, dflag) \ + {} +#endif + #ifdef __cplusplus } #endif diff --git a/include/util/tcoding.h b/include/util/tcoding.h index 38eb0d8fc6..b1bd09e123 100644 --- a/include/util/tcoding.h +++ b/include/util/tcoding.h @@ -17,6 +17,7 @@ #define _TD_UTIL_CODING_H_ #include "os.h" +#include "tlog.h" #ifdef __cplusplus extern "C" { diff --git a/include/util/tlog.h b/include/util/tlog.h index 68b004cda7..b6a389b6d9 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -38,6 +38,7 @@ typedef void (*LogFp)(int64_t ts, ELogLevel level, const char *content); extern bool tsLogEmbedded; extern bool tsAsyncLog; +extern bool tsAssert; extern int32_t tsNumOfLogLines; extern int32_t tsLogKeepDays; extern LogFp tsLogFp; @@ -82,6 +83,10 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #endif ; +bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); +#define ASSERTS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +#define ASSERT(condition) ASSERTS(condition, "assert info not provided") + // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 7564d91330..c694a6c1a0 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -407,7 +407,9 @@ void taos_init_imp(void) { initQueryModuleMsgHandle(); - taosConvInit(); + if (taosConvInit() != 0) { + ASSERTS(0, "failed to init conv"); + } rpcInit(); diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index d1a3f38143..7e9b28939b 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -333,6 +333,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) { if (cfgAddTimezone(pCfg, "timezone", tsTimezoneStr) != 0) return -1; if (cfgAddLocale(pCfg, "locale", tsLocale) != 0) return -1; if (cfgAddCharset(pCfg, "charset", tsCharset) != 0) return -1; + if (cfgAddBool(pCfg, "assert", 1, 1) != 0) return -1; if (cfgAddBool(pCfg, "enableCoreFile", 1, 1) != 0) return -1; if (cfgAddFloat(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1) != 0) return -1; @@ -693,6 +694,8 @@ static void taosSetSystemCfg(SConfig *pCfg) { bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; taosSetCoreDump(enableCore); + tsAssert = cfgGetItem(pCfg, "assert")->bval; + // todo tsVersion = 30000000; } @@ -788,6 +791,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { case 'a': { if (strcasecmp("asyncLog", name) == 0) { tsAsyncLog = cfgGetItem(pCfg, "asyncLog")->bval; + } else if (strcasecmp("assert", name) == 0) { + tsAssert = cfgGetItem(pCfg, "assert")->bval; } break; } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 00929a1836..95625e8d93 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -28,6 +28,8 @@ #undef TD_MSG_SEG_CODE_ #include "tmsgdef.h" +#include "tlog.h" + int32_t tInitSubmitMsgIter(const SSubmitReq *pMsg, SSubmitMsgIter *pIter) { if (pMsg == NULL) { terrno = TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP; diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 52ebd7f879..ca2c056743 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "trow.h" +#include "tlog.h" const uint8_t tdVTypeByte[2][3] = {{ // 2 bits diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index a106a09a69..ec05ef4c44 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -23,6 +23,8 @@ #define _DEFAULT_SOURCE #include "ttime.h" +#include "tlog.h" + /* * mktime64 - Converts date to seconds. * Converts Gregorian date to seconds since 1970-01-01 00:00:00. diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 188677656a..6963803df0 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -201,7 +201,12 @@ int mainWindows(int argc, char **argv) { return -1; } - taosConvInit(); + if (taosConvInit() != 0) { + dError("failed to init conv"); + taosCloseLog(); + taosCleanupArgs(); + return -1; + } if (global.dumpConfig) { dmDumpCfg(); diff --git a/source/dnode/mgmt/mgmt_snode/src/smWorker.c b/source/dnode/mgmt/mgmt_snode/src/smWorker.c index 2d2a121795..2e66aeae37 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smWorker.c +++ b/source/dnode/mgmt/mgmt_snode/src/smWorker.c @@ -139,7 +139,7 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { SSnode *pSnode = pMgmt->pSnode; if (pSnode == NULL) { - dError("snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + dError("msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), TMSG_INFO(pMsg->msgType), qtype); taosFreeQitem(pMsg); rpcFreeCont(pRpc->pCont); @@ -161,7 +161,8 @@ int32_t smPutMsgToQueue(SSnodeMgmt *pMgmt, EQueueType qtype, SRpcMsg *pRpc) { smPutNodeMsgToWriteQueue(pMgmt, pMsg); break; default: - ASSERT(0); + ASSERTS(0, "msg:%p failed to put into snode queue since %s, type:%s qtype:%d", pMsg, terrstr(), + TMSG_INFO(pMsg->msgType), qtype); } return 0; } diff --git a/source/libs/executor/src/tlinearhash.c b/source/libs/executor/src/tlinearhash.c index 4204692514..d97f81c994 100644 --- a/source/libs/executor/src/tlinearhash.c +++ b/source/libs/executor/src/tlinearhash.c @@ -17,6 +17,7 @@ #include "taoserror.h" #include "tdef.h" #include "tpagedbuf.h" +#include "tlog.h" #define LHASH_CAP_RATIO 0.85 diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index e5727f1472..d45d60d50e 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -22,6 +22,7 @@ #include "tpagedbuf.h" #include "tpercentile.h" #include "ttypes.h" +#include "tlog.h" #define DEFAULT_NUM_OF_SLOT 1024 diff --git a/source/libs/sync/src/syncCommit.c b/source/libs/sync/src/syncCommit.c index 07b1101256..5fdcbeb91c 100644 --- a/source/libs/sync/src/syncCommit.c +++ b/source/libs/sync/src/syncCommit.c @@ -84,7 +84,7 @@ void syncOneReplicaAdvance(SSyncNode* pSyncNode) { } void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) { - ASSERT(false && "deprecated"); + ASSERTS(false, "deprecated"); if (pSyncNode == NULL) { sError("pSyncNode is NULL"); return; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 59e5e968e7..6ed9fa66ea 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -791,9 +791,9 @@ static int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer) { } int32_t syncNodeLogStoreRestoreOnNeed(SSyncNode* pNode) { - ASSERT(pNode->pLogStore != NULL && "log store not created"); - ASSERT(pNode->pFsm != NULL && "pFsm not registered"); - ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); + ASSERTS(pNode->pLogStore != NULL, "log store not created"); + ASSERTS(pNode->pFsm != NULL, "pFsm not registered"); + ASSERTS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { sError("vgId:%d, failed to get snapshot info since %s", pNode->vgId, terrstr()); @@ -1144,8 +1144,8 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { } int32_t syncNodeRestore(SSyncNode* pSyncNode) { - ASSERT(pSyncNode->pLogStore != NULL && "log store not created"); - ASSERT(pSyncNode->pLogBuf != NULL && "ring log buffer not created"); + ASSERTS(pSyncNode->pLogStore != NULL, "log store not created"); + ASSERTS(pSyncNode->pLogBuf != NULL, "ring log buffer not created"); SyncIndex lastVer = pSyncNode->pLogStore->syncLogLastIndex(pSyncNode->pLogStore); SyncIndex commitIndex = pSyncNode->pLogStore->syncLogCommitIndex(pSyncNode->pLogStore); @@ -2663,7 +2663,7 @@ int32_t syncNodeOnClientRequest(SSyncNode* ths, SRpcMsg* pMsg, SyncIndex* pRetIn int32_t code = syncNodeAppend(ths, pEntry); if (code < 0 && ths->vgId != 1 && vnodeIsMsgBlock(pEntry->originalRpcType)) { - ASSERT(false && "failed to append blocking msg"); + ASSERTS(false, "failed to append blocking msg"); } return code; } diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index f8fcdbddb3..7bd8d75dd1 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -50,7 +50,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt // initial log buffer with at least one item, e.g. commitIndex SSyncRaftEntry* pMatch = pBuf->entries[(index - 1 + pBuf->size) % pBuf->size].pItem; - ASSERT(pMatch != NULL && "no matched log entry"); + ASSERTS(pMatch != NULL, "no matched log entry"); ASSERT(pMatch->index + 1 == index); SSyncLogBufEntry tmp = {.pItem = pEntry, .prevLogIndex = pMatch->index, .prevLogTerm = pMatch->term}; @@ -86,14 +86,14 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S if (prevIndex >= pBuf->startIndex) { pEntry = pBuf->entries[(prevIndex + pBuf->size) % pBuf->size].pItem; - ASSERT(pEntry != NULL && "no log entry found"); + ASSERTS(pEntry != NULL, "no log entry found"); prevLogTerm = pEntry->term; return prevLogTerm; } if (pMgr && pMgr->startIndex <= prevIndex && prevIndex < pMgr->endIndex) { int64_t timeMs = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].timeMs; - ASSERT(timeMs != 0 && "no log entry found"); + ASSERTS(timeMs != 0, "no log entry found"); prevLogTerm = pMgr->states[(prevIndex + pMgr->size) % pMgr->size].term; ASSERT(prevIndex == 0 || prevLogTerm != 0); return prevLogTerm; @@ -141,9 +141,9 @@ int32_t syncLogValidateAlignmentOfCommit(SSyncNode* pNode, SyncIndex commitIndex } int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - ASSERT(pNode->pLogStore != NULL && "log store not created"); - ASSERT(pNode->pFsm != NULL && "pFsm not registered"); - ASSERT(pNode->pFsm->FpGetSnapshotInfo != NULL && "FpGetSnapshotInfo not registered"); + ASSERTS(pNode->pLogStore != NULL, "log store not created"); + ASSERTS(pNode->pFsm != NULL, "pFsm not registered"); + ASSERTS(pNode->pFsm->FpGetSnapshotInfo != NULL, "FpGetSnapshotInfo not registered"); SSnapshot snapshot; if (pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot) < 0) { @@ -437,7 +437,7 @@ _out: } int32_t syncLogFsmExecute(SSyncNode* pNode, SSyncFSM* pFsm, ESyncState role, SyncTerm term, SSyncRaftEntry* pEntry) { - ASSERT(pFsm->FpCommitCb != NULL && "No commit cb registered for the FSM"); + ASSERTS(pFsm->FpCommitCb != NULL, "No commit cb registered for the FSM"); if ((pNode->replicaNum == 1) && pNode->restoreFinish && pNode->vgId != 1) { return 0; @@ -900,7 +900,7 @@ int32_t syncNodeLogReplMgrInit(SSyncNode* pNode) { ASSERT(pNode->logReplMgrs[i] == NULL); pNode->logReplMgrs[i] = syncLogReplMgrCreate(); pNode->logReplMgrs[i]->peerId = i; - ASSERT(pNode->logReplMgrs[i] != NULL && "Out of memory."); + ASSERTS(pNode->logReplMgrs[i] != NULL, "Out of memory."); } return 0; } diff --git a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp index 1eb803e846..e1a8a5c832 100644 --- a/source/libs/sync/test/syncAppendEntriesReplyTest.cpp +++ b/source/libs/sync/test/syncAppendEntriesReplyTest.cpp @@ -19,7 +19,7 @@ SyncAppendEntriesReply *createMsg() { pMsg->success = true; pMsg->matchIndex = 77; pMsg->term = 33; - pMsg->privateTerm = 44; + // pMsg->privateTerm = 44; pMsg->startTime = taosGetTimestampMs(); return pMsg; } diff --git a/source/libs/sync/test/syncTest.cpp b/source/libs/sync/test/syncTest.cpp index 9ae79e11fb..7b636085f2 100644 --- a/source/libs/sync/test/syncTest.cpp +++ b/source/libs/sync/test/syncTest.cpp @@ -1,5 +1,5 @@ #include "syncTest.h" -#include +// #include /* typedef enum { diff --git a/source/libs/sync/test/sync_test_lib/inc/syncIO.h b/source/libs/sync/test/sync_test_lib/inc/syncIO.h index 19f896182e..98b013b46d 100644 --- a/source/libs/sync/test/sync_test_lib/inc/syncIO.h +++ b/source/libs/sync/test/sync_test_lib/inc/syncIO.h @@ -81,6 +81,8 @@ int32_t syncIOQTimerStop(); int32_t syncIOPingTimerStart(); int32_t syncIOPingTimerStop(); +void syncEntryDestory(SSyncRaftEntry* pEntry); + #ifdef __cplusplus } #endif diff --git a/source/libs/sync/test/sync_test_lib/src/syncIO.c b/source/libs/sync/test/sync_test_lib/src/syncIO.c index 2c24451713..415fecd9f2 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncIO.c +++ b/source/libs/sync/test/sync_test_lib/src/syncIO.c @@ -469,3 +469,5 @@ static void syncIOTickPing(void *param, void *tmrId) { taosTmrReset(syncIOTickPing, io->pingTimerMS, io, io->timerMgr, &io->pingTimer); } + +void syncEntryDestory(SSyncRaftEntry* pEntry) {} \ No newline at end of file diff --git a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c index 1ea7629601..3b6007df6b 100644 --- a/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c +++ b/source/libs/sync/test/sync_test_lib/src/syncMessageDebug.c @@ -1583,8 +1583,8 @@ cJSON* syncAppendEntriesReply2Json(const SyncAppendEntriesReply* pMsg) { cJSON_AddNumberToObject(pDestId, "vgId", pMsg->destId.vgId); cJSON_AddItemToObject(pRoot, "destId", pDestId); - snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); - cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); + // snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->privateTerm); + // cJSON_AddStringToObject(pRoot, "privateTerm", u64buf); snprintf(u64buf, sizeof(u64buf), "%" PRIu64, pMsg->term); cJSON_AddStringToObject(pRoot, "term", u64buf); diff --git a/source/libs/tdb/test/tdbExOVFLTest.cpp b/source/libs/tdb/test/tdbExOVFLTest.cpp index f4f09b20b8..b16bc643d3 100644 --- a/source/libs/tdb/test/tdbExOVFLTest.cpp +++ b/source/libs/tdb/test/tdbExOVFLTest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "tlog.h" typedef struct SPoolMem { int64_t size; diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 54e80a0009..cd02eb8d5e 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "tlog.h" typedef struct SPoolMem { int64_t size; diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 230ca5b968..2e68bd5ccd 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -348,7 +348,7 @@ void taosMemoryTrim(int32_t size) { void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) { #ifdef USE_TD_MEMORY - ASSERT(0); + assert(0); #else #if defined(LINUX) void* p = memalign(alignment, size); diff --git a/source/os/src/osString.c b/source/os/src/osString.c index e2d8ce95db..f03778de2f 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -143,15 +143,17 @@ SConv *gConv = NULL; int32_t convUsed = 0; int32_t gConvMaxNum = 0; -void taosConvInit(void) { +int32_t taosConvInit(void) { gConvMaxNum = 512; gConv = taosMemoryCalloc(gConvMaxNum, sizeof(SConv)); for (int32_t i = 0; i < gConvMaxNum; ++i) { gConv[i].conv = iconv_open(DEFAULT_UNICODE_ENCODEC, tsCharset); if ((iconv_t)-1 == gConv[i].conv || (iconv_t)0 == gConv[i].conv) { - ASSERT(0); + return -1; } } + + return 0; } void taosConvDestroy() { diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c index 4d6875d263..057d3a620c 100644 --- a/source/util/src/talgo.c +++ b/source/util/src/talgo.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "talgo.h" +#include "tlog.h" #define doswap(__left, __right, __size, __buf) \ do { \ diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index be1db74f1a..cea08e46fe 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -72,6 +72,7 @@ static int32_t tsDaylightActive; /* Currently in daylight saving time. */ bool tsLogEmbedded = 0; bool tsAsyncLog = true; +bool tsAssert = true; int32_t tsNumOfLogLines = 10000000; int32_t tsLogKeepDays = 0; LogFp tsLogFp = NULL; @@ -778,3 +779,37 @@ cmp_end: return ret; } + +bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { + if (condition) return false; + + const char *flags = "UTL FATAL "; + ELogLevel level = DEBUG_FATAL; + int32_t dflag = 255; // tsLogEmbedded ? 255 : uDebugFlag + char buffer[LOG_MAX_LINE_BUFFER_SIZE]; + int32_t len = taosBuildLogHead(buffer, flags); + + va_list argpointer; + va_start(argpointer, format); + len = len + vsnprintf(buffer + len, LOG_MAX_LINE_BUFFER_SIZE - len, format, argpointer); + va_end(argpointer); + buffer[len++] = '\n'; + buffer[len] = 0; + taosPrintLogImp(1, 255, buffer, len); + + taosPrintLog(flags, level, dflag, "tAssert at file %s:%d exit:%d", file, line, tsAssert); + taosPrintTrace(flags, level, dflag); + + if (tsAssert) { + taosCloseLog(); + taosMsleep(300); + +#ifdef NDEBUG + abort(); +#else + assert(0); +#endif + } + + return true; +} \ No newline at end of file diff --git a/source/util/test/hashTest.cpp b/source/util/test/hashTest.cpp index 76fb9c7067..00379a755b 100644 --- a/source/util/test/hashTest.cpp +++ b/source/util/test/hashTest.cpp @@ -6,6 +6,7 @@ #include "taos.h" #include "taosdef.h" #include "thash.h" +#include "tlog.h" namespace { diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 47b7adbf18..df416b3822 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -20,6 +20,7 @@ #include #include "taos.h" #include "types.h" +#include "tlog.h" int smlProcess_influx_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); From 7553cd6e65bbf517e73aa6fb3af62060de7f71f4 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 22:28:12 +0800 Subject: [PATCH 26/66] fix: compile errors --- source/os/src/osDir.c | 8 ++++---- source/os/src/osFile.c | 6 +++--- source/os/src/osSysinfo.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index 421901184b..d219873b5a 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -163,7 +163,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -179,7 +179,7 @@ int32_t taosMulMkDir(const char *dirname) { code = mkdir(temp, 0755); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } } @@ -225,7 +225,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } *pos = TD_DIRSEP[0]; @@ -241,7 +241,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { code = mkdir(temp, mode); #endif if (code < 0 && errno != EEXIST) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return code; } } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 68365be481..8c2170239f 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -313,7 +313,7 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { assert(!(tdFileOptions & TD_FILE_EXCL)); fp = fopen(path, mode); if (fp == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } else { @@ -336,14 +336,14 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { fd = open(path, access, S_IRWXU | S_IRWXG | S_IRWXO); #endif if (fd == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return NULL; } } TdFilePtr pFile = (TdFilePtr)taosMemoryMalloc(sizeof(TdFile)); if (pFile == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + // terrno = TSDB_CODE_OUT_OF_MEMORY; if (fd >= 0) close(fd); if (fp != NULL) fclose(fp); return NULL; diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 7ec1da0530..e28abf131d 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -617,14 +617,14 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { return 0; } else { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } #elif defined(_TD_DARWIN_64) struct statvfs info; if (statvfs(dataDir, &info)) { // printf("failed to get disk size, dataDir:%s errno:%s", tsDataDir, strerror(errno)); - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; @@ -635,7 +635,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) { #else struct statvfs info; if (statvfs(dataDir, &info)) { - terrno = TAOS_SYSTEM_ERROR(errno); + // terrno = TAOS_SYSTEM_ERROR(errno); return -1; } else { diskSize->total = info.f_blocks * info.f_frsize; From 82471e1dda435866aa35fc51e24fea1c4c04748a Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 7 Dec 2022 22:40:18 +0800 Subject: [PATCH 27/66] fix: make invalid_commandline.py and demo.py back to test (#18784) * fix: taosbenchmark vgid with tables less than vgroups * fix: update taos-tools 7583475 * fix: update taos-tools ac69142 * fix: make invalid_commandline.py and demo.py back --- tests/parallel_test/cases.task | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c90b2499a4..28ba7ea60f 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1022,9 +1022,9 @@ ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/custom_col_tag.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/default_json.py -#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py +,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/insert_alltypes_json.py -#,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py +,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/invalid_commandline.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/json_tag.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/query_json.py ,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py From 1dd1e497f95f18179b5ac2135481f016ef4f84ea Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 7 Dec 2022 23:57:51 +0800 Subject: [PATCH 28/66] test: update case --- tests/script/tsim/db/alter_replica_31.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/db/alter_replica_31.sim b/tests/script/tsim/db/alter_replica_31.sim index b689c9de10..74e8007791 100644 --- a/tests/script/tsim/db/alter_replica_31.sim +++ b/tests/script/tsim/db/alter_replica_31.sim @@ -148,7 +148,7 @@ endi print ============= step3: alter database sql alter database db replica 1 -wt = 0 +$wt = 0 stepwt1: $wt = $wt + 1 sleep 1000 From 3a3bf89cb819f17069d4e6543c9301b7b06a8c52 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 8 Dec 2022 01:39:01 +0800 Subject: [PATCH 29/66] fix: keep option of database with ns precision --- source/libs/parser/src/parTranslater.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 85a4e70124..2afca5e35c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3879,12 +3879,20 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt pOptions->keep[2] = getBigintFromValueNode((SValueNode*)nodesListGetNode(pOptions->pKeep, 2)); } + int64_t tsdbMaxKeep = TSDB_MAX_KEEP; + if (pOptions->precision == TSDB_TIME_PRECISION_NANO) { + int64_t now = taosGetTimestampSec(); + if (now < 0) now = 0; + tsdbMaxKeep = now / 60 + 292 * 365 * 1440; + tsdbMaxKeep = TMIN(tsdbMaxKeep, TSDB_MAX_KEEP); + } + if (pOptions->keep[0] < TSDB_MIN_KEEP || pOptions->keep[1] < TSDB_MIN_KEEP || pOptions->keep[2] < TSDB_MIN_KEEP || - pOptions->keep[0] > TSDB_MAX_KEEP || pOptions->keep[1] > TSDB_MAX_KEEP || pOptions->keep[2] > TSDB_MAX_KEEP) { + pOptions->keep[0] > tsdbMaxKeep || pOptions->keep[1] > tsdbMaxKeep || pOptions->keep[2] > tsdbMaxKeep) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, "Invalid option keep: %" PRId64 ", %" PRId64 ", %" PRId64 " valid range: [%dm, %dm]", pOptions->keep[0], pOptions->keep[1], pOptions->keep[2], TSDB_MIN_KEEP, - TSDB_MAX_KEEP); + tsdbMaxKeep); } if (!((pOptions->keep[0] <= pOptions->keep[1]) && (pOptions->keep[1] <= pOptions->keep[2]))) { @@ -4036,7 +4044,10 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName TSDB_MAX_MINROWS_FBLOCK); } if (TSDB_CODE_SUCCESS == code) { - code = checkDbKeepOption(pCxt, pOptions); + code = checkDbPrecisionOption(pCxt, pOptions); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbKeepOption(pCxt, pOptions); // use precision } if (TSDB_CODE_SUCCESS == code) { code = checkDbRangeOption(pCxt, "pages", pOptions->pages, TSDB_MIN_PAGES_PER_VNODE, TSDB_MAX_PAGES_PER_VNODE); @@ -4049,9 +4060,6 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName code = checkDbRangeOption(pCxt, "tsdbPagesize", pOptions->tsdbPageSize, TSDB_MIN_TSDB_PAGESIZE, TSDB_MAX_TSDB_PAGESIZE); } - if (TSDB_CODE_SUCCESS == code) { - code = checkDbPrecisionOption(pCxt, pOptions); - } if (TSDB_CODE_SUCCESS == code) { code = checkDbEnumOption(pCxt, "replications", pOptions->replica, TSDB_MIN_DB_REPLICA, TSDB_MAX_DB_REPLICA); } From 2d75447bb214e6badccd34521c523e441e3c518d Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 8 Dec 2022 02:11:39 +0800 Subject: [PATCH 30/66] fix: update diskId when migrate DFileSet --- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 72d9c4f69e..1942634d89 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -962,6 +962,8 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { } } + pDFileSet->diskId = pSet->diskId; + goto _exit; } } From 9789adc439d800b2a3eacaf9cafd1fc75af7157c Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Thu, 8 Dec 2022 07:36:10 +0800 Subject: [PATCH 31/66] fix: fix windows compilation error --- source/libs/function/src/tudf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 73f5f8ce68..32e57565d4 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -88,7 +88,7 @@ static int32_t udfSpawnUdfd(SUdfdData *pData) { } #ifdef WINDOWS if (strlen(path) == 0) { - strcat(path, "C:\\TDengine") + strcat(path, "C:\\TDengine"); } strcat(path, "\\udfd.exe"); #else From 1c04c97362ecc34226f5e3dc9a9a575bfa0dbc99 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 09:11:14 +0800 Subject: [PATCH 32/66] refact: rename taosAssert --- include/util/tlog.h | 4 ++-- source/util/src/tlog.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/tlog.h b/include/util/tlog.h index b6a389b6d9..e6ef7f388f 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -83,8 +83,8 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons #endif ; -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...); -#define ASSERTS(condition, ...) taosAssertLog(condition, __FILE__, __LINE__, __VA_ARGS__) +bool taosAssert(bool condition, const char *file, int32_t line, const char *format, ...); +#define ASSERTS(condition, ...) taosAssert(condition, __FILE__, __LINE__, __VA_ARGS__) #define ASSERT(condition) ASSERTS(condition, "assert info not provided") // clang-format off diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index cea08e46fe..3825b91c6d 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -780,7 +780,7 @@ cmp_end: return ret; } -bool taosAssertLog(bool condition, const char *file, int32_t line, const char *format, ...) { +bool taosAssert(bool condition, const char *file, int32_t line, const char *format, ...) { if (condition) return false; const char *flags = "UTL FATAL "; From dd821a28ee80c888446a5d0f3baa85fa9a10d77d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 09:41:42 +0800 Subject: [PATCH 33/66] enh: collect and record the signal that the dnode was killed in the log file --- source/dnode/mgmt/exe/dmMain.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 6963803df0..175bbc6a39 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -17,6 +17,7 @@ #include "dmMgmt.h" #include "mnode.h" #include "tconfig.h" +#include "tglobal.h" // clang-format off #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." @@ -45,9 +46,30 @@ static struct { SArray *pArgs; // SConfigPair } global = {0}; -static void dmStopDnode(int signum, void *info, void *ctx) { dmStop(); } +static void dmSetDebugFlag(int32_t signum, void *sigInfo, void *context) { taosSetAllDebugFlag(143, true); } +static void dmSetAssert(int32_t signum, void *sigInfo, void *context) { tsAssert = 1; } + +static void dmStopDnode(int signum, void *sigInfo, void *context) { + // taosIgnSignal(SIGUSR1); + // taosIgnSignal(SIGUSR2); + taosIgnSignal(SIGTERM); + taosIgnSignal(SIGHUP); + taosIgnSignal(SIGINT); + taosIgnSignal(SIGABRT); + taosIgnSignal(SIGBREAK); + + dInfo("shut down signal is %d", signum); +#ifndef WINDOWS + dInfo("sender PID:%d cmdline:%s", ((siginfo_t *)sigInfo)->si_pid, + taosGetCmdlineByPID(((siginfo_t *)sigInfo)->si_pid)); +#endif + + dmStop(); +} static void dmSetSignalHandle() { + taosSetSignal(SIGUSR1, dmSetDebugFlag); + taosSetSignal(SIGUSR2, dmSetAssert); taosSetSignal(SIGTERM, dmStopDnode); taosSetSignal(SIGHUP, dmStopDnode); taosSetSignal(SIGINT, dmStopDnode); From 332ecd1d927179a88c6e0a8b105232077c0d5b88 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 8 Dec 2022 10:07:55 +0800 Subject: [PATCH 34/66] fix: mem leak --- source/client/src/clientTmq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index ade0c95227..766a94caf1 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -875,6 +875,7 @@ void tmqFreeImpl(void* handle) { tmq_t* tmq = (tmq_t*)handle; // TODO stop timer + tmqClearUnhandleMsg(tmq); if (tmq->mqueue) taosCloseQueue(tmq->mqueue); if (tmq->delayedTask) taosCloseQueue(tmq->delayedTask); if (tmq->qall) taosFreeQall(tmq->qall); @@ -884,8 +885,7 @@ void tmqFreeImpl(void* handle) { int32_t sz = taosArrayGetSize(tmq->clientTopics); for (int32_t i = 0; i < sz; i++) { SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); - if (pTopic->schema.nCols) taosMemoryFreeClear(pTopic->schema.pSchema); - int32_t vgSz = taosArrayGetSize(pTopic->vgs); + taosMemoryFreeClear(pTopic->schema.pSchema); taosArrayDestroy(pTopic->vgs); } taosArrayDestroy(tmq->clientTopics); @@ -1304,7 +1304,6 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) { for (int32_t i = 0; i < sz; i++) { SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); if (pTopic->schema.nCols) taosMemoryFreeClear(pTopic->schema.pSchema); - int32_t vgSz = taosArrayGetSize(pTopic->vgs); taosArrayDestroy(pTopic->vgs); } taosArrayDestroy(tmq->clientTopics); @@ -1410,7 +1409,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool async) { return -1; } void* pReq = taosMemoryCalloc(1, tlen); - if (tlen < 0) { + if (pReq == NULL) { tscError("failed to malloc askEpReq msg, size:%d", tlen); return -1; } @@ -1738,7 +1737,7 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) { taosFreeQitem(pollRspWrapper); return pRsp; } else { - tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d\n", + tscDebug("msg discard since epoch mismatch: msg epoch %d, consumer epoch %d", pollRspWrapper->taosxRsp.head.epoch, consumerEpoch); taosFreeQitem(pollRspWrapper); } From 1d34b7edf8d22d07f9e50762ca936ee599dc975b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 10:50:24 +0800 Subject: [PATCH 35/66] enh: print dnode startup parameters --- include/os/osDir.h | 1 + include/os/osSystem.h | 8 ++++++-- source/dnode/mgmt/exe/dmMain.c | 15 +++++++++++++++ source/os/src/osDir.c | 8 ++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/os/osDir.h b/include/os/osDir.h index 40012f8141..73871602c5 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -62,6 +62,7 @@ int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen); bool taosIsDir(const char *dirname); char *taosDirName(char *dirname); char *taosDirEntryBaseName(char *dirname); +void taosGetCwd(char *buf, int32_t len); TdDirPtr taosOpenDir(const char *dirname); TdDirEntryPtr taosReadDir(TdDirPtr pDir); diff --git a/include/os/osSystem.h b/include/os/osSystem.h index 31ec513fca..ed5213ce34 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -62,8 +62,12 @@ void taosResetTerminalMode(); taosMemoryFree(strings); \ } #else -#define taosPrintTrace(flags, level, dflag) \ - {} +#define taosPrintTrace(flags, level, dflag) \ + { \ + taosPrintLog(flags, level, dflag, \ + "backtrace not implemented on windows, so detailed stack information cannot be printed"); \ + \ \ + } #endif #ifdef __cplusplus diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 6963803df0..b4e2379736 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -105,6 +105,19 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) { return 0; } +static void dmPrintArgs(int32_t argc, char const *argv[]) { + char path[1024] = {0}; + taosGetCwd(path, sizeof(path)); + + char args[1024] = {0}; + int32_t arglen = snprintf(args, sizeof(args), "%s", argv[0]); + for (int32_t i = 1; i < argc; ++i) { + arglen = arglen + snprintf(args + arglen, sizeof(args) - arglen, " %s", argv[i]); + } + + dInfo("startup path:%s args:%s", path, args); +} + static void dmGenerateGrant() { mndGenerateMachineCode(); } static void dmPrintVersion() { @@ -194,6 +207,8 @@ int mainWindows(int argc, char **argv) { return -1; } + dmPrintArgs(argc, argv); + if (taosInitCfg(configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0) != 0) { dError("failed to start since read config error"); taosCloseLog(); diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index d219873b5a..9175067568 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -497,3 +497,11 @@ int32_t taosCloseDir(TdDirPtr *ppDir) { return 0; #endif } + +void taosGetCwd(char *buf, int32_t len) { +#if !defined(WINDOWS) + (void)getcwd(buf, len - 1); +#else + strncpy(buf, "not implemented on windows", len -1); +#endif +} From 4aaa29bd4f5a17509e02895ff59d29b47da0a350 Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Thu, 8 Dec 2022 10:50:35 +0800 Subject: [PATCH 36/66] fix:TD-20141 mac os type empty --- source/os/src/osSysinfo.c | 41 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 7ec1da0530..8b5e6c0e97 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -97,6 +97,7 @@ LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception); #include #include +#include #else @@ -275,34 +276,34 @@ int32_t taosGetEmail(char *email, int32_t maxLen) { #endif } + + int32_t taosGetOsReleaseName(char *releaseName, int32_t maxLen) { #ifdef WINDOWS snprintf(releaseName, maxLen, "Windows"); return 0; #elif defined(_TD_DARWIN_64) - char line[1024]; - size_t size = 0; - int32_t code = -1; + char osversion[32]; + size_t osversion_len = sizeof(osversion) - 1; + int osversion_name[] = { CTL_KERN, KERN_OSRELEASE }; - TdFilePtr pFile = taosOpenFile("/etc/os-release", TD_FILE_READ | TD_FILE_STREAM); - if (pFile == NULL) return false; - - while ((size = taosGetsFile(pFile, sizeof(line), line)) != -1) { - line[size - 1] = '\0'; - if (strncmp(line, "PRETTY_NAME", 11) == 0) { - const char *p = strchr(line, '=') + 1; - if (*p == '"') { - p++; - line[size - 2] = 0; - } - tstrncpy(releaseName, p, maxLen); - code = 0; - break; - } + if (sysctl(osversion_name, 2, osversion, &osversion_len, NULL, 0) == -1) { + return -1; } - taosCloseFile(&pFile); - return code; + uint32_t major, minor; + if (sscanf(osversion, "%u.%u", &major, &minor) != 2) { + return -1; + } + if (major >= 20) { + major -= 9; // macOS 11 and newer + sprintf(releaseName, "%u.%u", major, minor); + } else { + major -= 4; // macOS 10.1.1 and newer + sprintf(releaseName, "10.%d.%d", major, minor); + } + + return 0; #else char line[1024]; size_t size = 0; From 1a066d19f7390b15f37cc7d60f31902fa39304ab Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 8 Dec 2022 10:55:08 +0800 Subject: [PATCH 37/66] fix: dismiss coverity issues --- source/dnode/vnode/src/meta/metaTable.c | 4 ++++ source/dnode/vnode/src/tsdb/tsdbCache.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 0b00f036de..632675ee1d 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -1353,6 +1353,10 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) { goto end; } + if (stbEntry.stbEntry.schemaTag.pSchema == NULL) { + goto end; + } + pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0]; STagVal tagVal = {.cid = pTagColumn->colId}; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 7309ea3407..37fae4f709 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -952,7 +952,10 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs SArray *pDelIdxArray = taosArrayInit(32, sizeof(SDelIdx)); code = tsdbReadDelIdx(pDelFReader, pDelIdxArray); - if (code) goto _err; + if (code) { + tsdbDelFReaderClose(&pDelFReader); + goto _err; + } SDelIdx *delIdx = taosArraySearch(pDelIdxArray, &(SDelIdx){.suid = suid, .uid = uid}, tCmprDelIdx, TD_EQ); From ad69067a012a2336d591bdc6abcb84129e711c9d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 8 Dec 2022 10:57:21 +0800 Subject: [PATCH 38/66] fix asan stack-scope-after-use errror --- source/libs/function/src/tpercentile.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index 56f55bde32..cf8e239190 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -367,16 +367,18 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) { pSlot->info.data = NULL; } - SArray **pPageIdList = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); - if (pPageIdList == NULL) { - SArray *pList = taosArrayInit(4, sizeof(int32_t)); - taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pList, POINTER_BYTES); - pPageIdList = &pList; + SArray *pPageIdList; + void *p = taosHashGet(pBucket->groupPagesMap, &groupId, sizeof(groupId)); + if (p == NULL) { + pPageIdList = taosArrayInit(4, sizeof(int32_t)); + taosHashPut(pBucket->groupPagesMap, &groupId, sizeof(groupId), &pPageIdList, POINTER_BYTES); + } else { + pPageIdList = *(SArray **)p; } pSlot->info.data = getNewBufPage(pBucket->pBuffer, &pageId); pSlot->info.pageId = pageId; - taosArrayPush(*pPageIdList, &pageId); + taosArrayPush(pPageIdList, &pageId); } memcpy(pSlot->info.data->data + pSlot->info.data->num * pBucket->bytes, d, pBucket->bytes); From fcfff59f86c4256065d2130be34bb85e18ce822f Mon Sep 17 00:00:00 2001 From: facetosea <25808407@qq.com> Date: Thu, 8 Dec 2022 11:13:57 +0800 Subject: [PATCH 39/66] fix:maxOS type --- source/os/src/osSysinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 8b5e6c0e97..5366c80405 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -297,10 +297,10 @@ int32_t taosGetOsReleaseName(char *releaseName, int32_t maxLen) { } if (major >= 20) { major -= 9; // macOS 11 and newer - sprintf(releaseName, "%u.%u", major, minor); + sprintf(releaseName, "macOS %u.%u", major, minor); } else { major -= 4; // macOS 10.1.1 and newer - sprintf(releaseName, "10.%d.%d", major, minor); + sprintf(releaseName, "macOS 10.%d.%d", major, minor); } return 0; From 942152947b3e489f298eb61fc54dbf0e69864a4f Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Thu, 8 Dec 2022 11:36:34 +0800 Subject: [PATCH 40/66] fix:stream update data --- source/libs/executor/src/timewindowoperator.c | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index d9a011a892..6f1ab8ca65 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -863,19 +863,20 @@ static void removeResults(SArray* pWins, SHashObj* pUpdatedMap) { int32_t compareWinRes(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; - SWinKey* pos = taosArrayGet(res, index); - SResKeyPos* pData = (SResKeyPos*)pKey; - if (*(int64_t*)pData->key == pos->ts) { - if (pData->groupId > pos->groupId) { - return 1; - } else if (pData->groupId < pos->groupId) { - return -1; - } - return 0; - } else if (*(int64_t*)pData->key > pos->ts) { + SWinKey* pDataPos = taosArrayGet(res, index); + SResKeyPos* pRKey = (SResKeyPos*)pKey; + if (pRKey->groupId > pDataPos->groupId) { return 1; + } else if (pRKey->groupId < pDataPos->groupId) { + return -1; } - return -1; + + if (*(int64_t*)pRKey->key > pDataPos->ts) { + return 1; + } else if (*(int64_t*)pRKey->key < pDataPos->ts){ + return -1; + } + return 0; } static void removeDeleteResults(SHashObj* pUpdatedMap, SArray* pDelWins) { @@ -1400,19 +1401,21 @@ static int32_t getAllIntervalWindow(SSHashObj* pHashMap, SHashObj* resWins) { int32_t compareWinKey(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; - SWinKey* pos = taosArrayGet(res, index); - SWinKey* pData = (SWinKey*)pKey; - if (pData->ts == pos->ts) { - if (pData->groupId > pos->groupId) { - return 1; - } else if (pData->groupId < pos->groupId) { - return -1; - } - return 0; - } else if (pData->ts > pos->ts) { + SWinKey* pDataPos = taosArrayGet(res, index); + SWinKey* pWKey = (SWinKey*)pKey; + + if (pWKey->groupId > pDataPos->groupId) { return 1; + } else if (pWKey->groupId < pDataPos->groupId) { + return -1; } - return -1; + + if (pWKey->ts > pDataPos->ts) { + return 1; + } else if (pWKey->ts < pDataPos->ts) { + return -1; + } + return 0; } static int32_t closeStreamIntervalWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SInterval* pInterval, From 4a6f41f7f1612fa02be3dfaf0d45baae0fb4f309 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 8 Dec 2022 11:56:29 +0800 Subject: [PATCH 41/66] fix: keep option of database with precision ns --- include/util/tdef.h | 1 + source/libs/parser/src/parTranslater.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 58c8c1b51a..0ebc78bedb 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -309,6 +309,7 @@ typedef enum ELogicConditionType { #define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440) #define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute #define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_MAX_KEEP_NS (29200 * 1440) // data in db to be reserved. #define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years #define TSDB_MIN_MINROWS_FBLOCK 10 #define TSDB_MAX_MINROWS_FBLOCK 1000 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2afca5e35c..10e45901e5 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3881,10 +3881,7 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt int64_t tsdbMaxKeep = TSDB_MAX_KEEP; if (pOptions->precision == TSDB_TIME_PRECISION_NANO) { - int64_t now = taosGetTimestampSec(); - if (now < 0) now = 0; - tsdbMaxKeep = now / 60 + 292 * 365 * 1440; - tsdbMaxKeep = TMIN(tsdbMaxKeep, TSDB_MAX_KEEP); + tsdbMaxKeep = TSDB_MAX_KEEP_NS; } if (pOptions->keep[0] < TSDB_MIN_KEEP || pOptions->keep[1] < TSDB_MIN_KEEP || pOptions->keep[2] < TSDB_MIN_KEEP || From 399dace80f2942d5fa1d01d4da2e16a002e4768a Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 8 Dec 2022 12:00:04 +0800 Subject: [PATCH 42/66] chore: code format optimization --- source/dnode/vnode/src/tsdb/tsdbFS.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index 1942634d89..7dc839773f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -963,7 +963,6 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) { } pDFileSet->diskId = pSet->diskId; - goto _exit; } } From a3c1d3e1bac3519931d0236e9506e146480a5510 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 12:26:10 +0800 Subject: [PATCH 43/66] fix: compile error in windows --- include/os/osSystem.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/os/osSystem.h b/include/os/osSystem.h index ed5213ce34..8f1f5c58d5 100644 --- a/include/os/osSystem.h +++ b/include/os/osSystem.h @@ -66,8 +66,7 @@ void taosResetTerminalMode(); { \ taosPrintLog(flags, level, dflag, \ "backtrace not implemented on windows, so detailed stack information cannot be printed"); \ - \ \ - } + } #endif #ifdef __cplusplus From 45528081d53825353188a08ac09d99646683c675 Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 8 Dec 2022 12:30:40 +0800 Subject: [PATCH 44/66] chore: keep option of ns database --- include/util/tdef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 0ebc78bedb..e0089014aa 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -307,9 +307,9 @@ typedef enum ELogicConditionType { #define TSDB_MIN_DURATION_PER_FILE 60 // unit minute #define TSDB_MAX_DURATION_PER_FILE (3650 * 1440) #define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440) -#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute -#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. -#define TSDB_MAX_KEEP_NS (29200 * 1440) // data in db to be reserved. +#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute +#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_MAX_KEEP_NS (365 * 292 * 1440) // data in db to be reserved. #define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years #define TSDB_MIN_MINROWS_FBLOCK 10 #define TSDB_MAX_MINROWS_FBLOCK 1000 From 509ba087d2a2d807a16965d64ee544c00a56ecb0 Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Thu, 8 Dec 2022 13:51:31 +0800 Subject: [PATCH 45/66] fix:taos.dll export taosDatatype --- include/client/taos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/client/taos.h b/include/client/taos.h index 69774b750f..379363c51d 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -149,7 +149,7 @@ DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char DLL_EXPORT TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port); DLL_EXPORT void taos_close(TAOS *taos); -const char *taos_data_type(int type); +DLL_EXPORT const char *taos_data_type(int type); DLL_EXPORT TAOS_STMT *taos_stmt_init(TAOS *taos); DLL_EXPORT TAOS_STMT *taos_stmt_init_with_reqid(TAOS *taos, int64_t reqid); From da31f5e588f5e9202ceec97b4fec3a94b2090c2c Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Thu, 8 Dec 2022 13:54:41 +0800 Subject: [PATCH 46/66] fix: dismiss coverity issues --- source/dnode/vnode/src/meta/metaTable.c | 4 ++-- source/libs/tdb/inc/tdb.h | 2 ++ source/libs/tdb/src/db/tdbBtree.c | 4 ++++ source/libs/tdb/src/db/tdbPager.c | 9 ++++----- source/libs/tdb/src/db/tdbTxn.c | 5 +++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 632675ee1d..722a93137c 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -549,8 +549,8 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) { } static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME) { - int64_t ttlDays; - int64_t ctime; + int64_t ttlDays = 0; + int64_t ctime = 0; if (pME->type == TSDB_CHILD_TABLE) { ctime = pME->ctbEntry.ctime; ttlDays = pME->ctbEntry.ttlDays; diff --git a/source/libs/tdb/inc/tdb.h b/source/libs/tdb/inc/tdb.h index c728e29641..10a99bb1fa 100644 --- a/source/libs/tdb/inc/tdb.h +++ b/source/libs/tdb/inc/tdb.h @@ -81,6 +81,8 @@ void tdbFree(void *); typedef struct hashset_st *hashset_t; +void hashset_destroy(hashset_t set); + struct STxn { int flags; int64_t txnId; diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 8c62f89b64..5c1f264460 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -110,6 +110,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbBegin(pEnv, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); if (ret < 0) { + tdbOsFree(pBt); return -1; } @@ -119,6 +120,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbPagerFetchPage(pPager, &pgno, &pPage, tdbBtreeInitPage, &zArg, txn); if (ret < 0) { tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } @@ -126,6 +128,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg if (ret < 0) { tdbError("failed to write page since %s", terrstr()); tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } @@ -138,6 +141,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, char const *tbname, SPg ret = tdbTbInsert(pPager->pEnv->pMainDb, tbname, strlen(tbname) + 1, &pBt->info, sizeof(pBt->info), txn); if (ret < 0) { tdbAbort(pEnv, txn); + tdbOsFree(pBt); return -1; } } diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index f638ec25a3..e3d886b046 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -379,9 +379,6 @@ int tdbPagerPostCommit(SPager *pPager, TXN *pTxn) { return -1; } - if (pTxn->jPageSet) { - hashset_destroy(pTxn->jPageSet); - } // pPager->inTran = 0; return 0; @@ -549,8 +546,6 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) { return -1; } - hashset_destroy(pTxn->jPageSet); - // pPager->inTran = 0; return 0; @@ -922,6 +917,8 @@ int tdbPagerRestoreJournals(SPager *pPager, SBTree *pBt) { char *name = tdbDirEntryBaseName(tdbGetDirEntryName(pDirEntry)); if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { if (tdbPagerRestore(pPager, pBt, name) < 0) { + tdbCloseDir(&pDir); + tdbError("failed to restore file due to %s. jFileName:%s", strerror(errno), name); return -1; } @@ -946,6 +943,8 @@ int tdbPagerRollback(SPager *pPager) { if (strncmp(TDB_MAINDB_NAME "-journal", name, 16) == 0) { if (tdbOsRemove(name) < 0 && errno != ENOENT) { + tdbCloseDir(&pDir); + tdbError("failed to remove file due to %s. jFileName:%s", strerror(errno), name); terrno = TAOS_SYSTEM_ERROR(errno); return -1; diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index 77c87d18f2..055d9c7f98 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -30,6 +30,11 @@ int tdbTxnOpen(TXN *pTxn, int64_t txnid, void *(*xMalloc)(void *, size_t), void int tdbTxnClose(TXN *pTxn) { if (pTxn) { + if (pTxn->jPageSet) { + hashset_destroy(pTxn->jPageSet); + pTxn->jPageSet = NULL; + } + tdbOsFree(pTxn); } From abd5c696f0465e087023875e5c30b795f96c4b55 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 8 Dec 2022 15:21:41 +0800 Subject: [PATCH 47/66] fix(sync): checkout NULL pointer --- source/libs/sync/src/syncMain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 2aaa13f95d..157829986e 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1640,7 +1640,8 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { #endif // close receiver - if (snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) { + if (pSyncNode != NULL && pSyncNode->pNewNodeReceiver != NULL && + snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) { snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver); } From b2b1eb748ac9358a4cf2531b657eee280a85081e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 8 Dec 2022 15:31:20 +0800 Subject: [PATCH 48/66] update epset --- source/libs/transport/src/transCli.c | 29 ++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 50594f1a5a..6d6a6b6625 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1493,18 +1493,35 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) { bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) { bool noDelay = true; if (hasEpSet == false) { - // assert(pResp->contLen == 0); if (pResp->contLen == 0) { if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { noDelay = false; } else { EPSET_FORWARD_INUSE(&pCtx->epSet); } - } else { - if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { - noDelay = false; + } else if (pResp->contLen != 0) { + SEpSet epSet; + int32_t valid = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epSet); + if (valid < 0) { + tDebug("get invalid epset, epset equal, continue"); + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { + noDelay = false; + } else { + EPSET_FORWARD_INUSE(&pCtx->epSet); + } } else { - EPSET_FORWARD_INUSE(&pCtx->epSet); + if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) { + tDebug("epset not equal, retry new epset"); + pCtx->epSet = epSet; + noDelay = false; + } else { + if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) { + noDelay = false; + } else { + tDebug("epset equal, continue"); + EPSET_FORWARD_INUSE(&pCtx->epSet); + } + } } } } else { @@ -1584,7 +1601,7 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { addConnToPool(pThrd->pool, pConn); } else if (code == TSDB_CODE_SYN_RESTORING) { tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen); - noDelay = cliResetEpset(pCtx, pResp, false); + noDelay = cliResetEpset(pCtx, pResp, true); addConnToPool(pThrd->pool, pConn); transFreeMsg(pResp->pCont); } else { From 6c9d6e2aa8d1ef6d64c001743085c4fdb7575b1d Mon Sep 17 00:00:00 2001 From: 54liuyao <54liuyao@163.com> Date: Wed, 7 Dec 2022 13:46:41 +0800 Subject: [PATCH 49/66] fix:read the deleted data --- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 3ec4f63c30..58fa24ad41 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -3129,7 +3129,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, TSDBKEY* pKey, int32 return false; } else if (pKey->ts == last->ts) { TSDBKEY* prev = taosArrayGet(pDelList, num - 2); - return (prev->version >= pKey->version); + return (prev->version >= pKey->version && prev->version <= pVerRange->maxVer && prev->version >= pVerRange->minVer); } } else { TSDBKEY* pCurrent = taosArrayGet(pDelList, *index); From a70cb83c6517bec2718415c0b6ef09204ae9fd70 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 15:48:16 +0800 Subject: [PATCH 50/66] fix: taosbenchmark fully use rest interface --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 4abd9e86a6..5ca2cacf57 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG ac69142 + GIT_TAG c86dda8 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From d19ffd8fca04f659aa3730f57516c143a3850b67 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 16:05:38 +0800 Subject: [PATCH 51/66] fix: update taos-tools 7bb2495 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 5ca2cacf57..1d96e69d53 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG c86dda8 + GIT_TAG 7bb2495 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 7e23e0b750e24c603eccb05f83cd0f8e0c8702ac Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 16:31:39 +0800 Subject: [PATCH 52/66] fix: update taos-tools 3bb9bf9 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 1d96e69d53..22fbdc35e8 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 7bb2495 + GIT_TAG 3bb9bf9 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 46889e2dc10d53cf9f912d6dbb094eedbf576f22 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 17:14:06 +0800 Subject: [PATCH 53/66] fix: avoid sync restore repeat called --- source/dnode/mnode/impl/src/mndSync.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 7cba69ed50..4966fb7749 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -149,9 +149,13 @@ void mndRestoreFinish(const SSyncFSM *pFsm) { SMnode *pMnode = pFsm->data; if (!pMnode->deploy) { - mInfo("vgId:1, sync restore finished, and will handle outstanding transactions"); - mndTransPullup(pMnode); - mndSetRestored(pMnode, true); + if (pMnode->restored) { + mInfo("vgId:1, sync restore finished, and will handle outstanding transactions"); + mndTransPullup(pMnode); + mndSetRestored(pMnode, true); + } else { + mInfo("vgId:1, sync restore finished, repeat call"); + } } else { mInfo("vgId:1, sync restore finished"); } From c0c98320f323b0c186e0cd3ea4ed50464f16b0f1 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 8 Dec 2022 17:14:17 +0800 Subject: [PATCH 54/66] enh: check topic privilege --- source/dnode/mnode/impl/src/mndConsumer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 76bff9a70f..373a653b51 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -555,6 +555,12 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { } if (mndCheckDbPrivilegeByName(pMnode, pMsg->info.conn.user, MND_OPER_READ_DB, pTopic->db) != 0) { + mndReleaseTopic(pMnode, pTopic); + goto SUBSCRIBE_OVER; + } + + if (mndCheckTopicPrivilege(pMnode, pMsg->info.conn.user, MND_OPER_SUBSCRIBE, pTopic) != 0) { + mndReleaseTopic(pMnode, pTopic); goto SUBSCRIBE_OVER; } From 60d6a21a199c12173c2ad595e91d37702ef722bf Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 17:30:00 +0800 Subject: [PATCH 55/66] fix: update taos-tools c86dda8 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 22fbdc35e8..5ca2cacf57 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 3bb9bf9 + GIT_TAG c86dda8 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 1b433cac0ca54bd079e223666406d5c441d3e967 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 8 Dec 2022 17:44:47 +0800 Subject: [PATCH 56/66] fix tsdb snapshot problem --- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index f4bdeeb387..3dcbe261ba 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -179,16 +179,14 @@ _err: return code; } -static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) { return pReader->pIter ? &pReader->pIter->rInfo : NULL; } - static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { int32_t code = 0; if (pReader->pIter) { - SFDataIter* pIter = pReader->pIter; - + SFDataIter* pIter = NULL; while (true) { _find_row: + pIter = pReader->pIter; for (pIter->iRow++; pIter->iRow < pIter->bData.nRow; pIter->iRow++) { int64_t rowVer = pIter->bData.aVersion[pIter->iRow]; @@ -224,6 +222,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { } pReader->pIter = NULL; + break; } else if (pIter->type == SNAP_STT_FILE_ITER) { for (pIter->iSttBlk++; pIter->iSttBlk < taosArrayGetSize(pIter->aSttBlk); pIter->iSttBlk++) { SSttBlk* pSttBlk = (SSttBlk*)taosArrayGet(pIter->aSttBlk, pIter->iSttBlk); @@ -238,6 +237,7 @@ static int32_t tsdbSnapNextRow(STsdbSnapReader* pReader) { } pReader->pIter = NULL; + break; } else { ASSERT(0); } @@ -269,6 +269,20 @@ _err: return code; } +static SRowInfo* tsdbSnapGetRow(STsdbSnapReader* pReader) { + if (pReader->pIter) { + return &pReader->pIter->rInfo; + } else { + tsdbSnapNextRow(pReader); + + if (pReader->pIter) { + return &pReader->pIter->rInfo; + } else { + return NULL; + } + } +} + static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; @@ -1356,7 +1370,7 @@ _exit: taosMemoryFree(pWriter); } } else { - tsdbDebug("vgId:%d, tsdb snapshot writer open for %s succeed", TD_VID(pTsdb->pVnode), pTsdb->path); + tsdbInfo("vgId:%d %s done", TD_VID(pTsdb->pVnode), __func__); *ppWriter = pWriter; } return code; @@ -1421,7 +1435,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) { for (int32_t iBuf = 0; iBuf < sizeof(pWriter->aBuf) / sizeof(uint8_t*); iBuf++) { tFree(pWriter->aBuf[iBuf]); } - tsdbInfo("vgId:%d, vnode snapshot tsdb writer close for %s", TD_VID(pWriter->pTsdb->pVnode), pWriter->pTsdb->path); + tsdbInfo("vgId:%d %s done", TD_VID(pWriter->pTsdb->pVnode), __func__); taosMemoryFree(pWriter); *ppWriter = NULL; return code; From fa8fb1e5b6060a2cc8a8930b36408edab5db4022 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 17:50:29 +0800 Subject: [PATCH 57/66] fix: update taos-tools fe6566b --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 5ca2cacf57..60a5a48b0b 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG c86dda8 + GIT_TAG fe6566b SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From e0215d60ade47508c3dcaa1a17ad8609bb366bb2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 8 Dec 2022 17:53:39 +0800 Subject: [PATCH 58/66] fix: set restored --- source/dnode/mnode/impl/src/mndSync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndSync.c b/source/dnode/mnode/impl/src/mndSync.c index 4966fb7749..10b1e36496 100644 --- a/source/dnode/mnode/impl/src/mndSync.c +++ b/source/dnode/mnode/impl/src/mndSync.c @@ -149,7 +149,7 @@ void mndRestoreFinish(const SSyncFSM *pFsm) { SMnode *pMnode = pFsm->data; if (!pMnode->deploy) { - if (pMnode->restored) { + if (!pMnode->restored) { mInfo("vgId:1, sync restore finished, and will handle outstanding transactions"); mndTransPullup(pMnode); mndSetRestored(pMnode, true); From 2dfbed6b6cb2b690d73c585f26ac7de8ebbfa5ea Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 18:33:40 +0800 Subject: [PATCH 59/66] fix: update taos-tools 1b2cbd0 --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 60a5a48b0b..8561e0ff42 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG fe6566b + GIT_TAG 1b2cbd0 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 68ff496113bd652b59ee1883e9f1d7ba36cbdbe3 Mon Sep 17 00:00:00 2001 From: xleili Date: Thu, 8 Dec 2022 19:01:30 +0800 Subject: [PATCH 60/66] fix(build):centos7 x64 makeinstall cannt write taod service to systemctl --- packaging/tools/make_install.sh | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 9034fd85f5..6a82322a12 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -497,27 +497,27 @@ function install_service_on_systemd() { taosd_service_config="${service_config_dir}/${serverName}.service" - ${csudo}bash -c "echo '[Unit]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Description=${productName} server service' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'After=network-online.target' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Wants=network-online.target' >> ${taosd_service_config}" + ${csudo}bash -c "echo [Unit] >> ${taosd_service_config}" + ${csudo}bash -c "echo Description=${productName} server service >> ${taosd_service_config}" + ${csudo}bash -c "echo After=network-online.target >> ${taosd_service_config}" + ${csudo}bash -c "echo Wants=network-online.target >> ${taosd_service_config}" ${csudo}bash -c "echo >> ${taosd_service_config}" - ${csudo}bash -c "echo '[Service]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Type=simple' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'ExecStart=/usr/bin/${serverName}' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'ExecStartPre=${installDir}/bin/startPre.sh' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'Restart=always' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}" + ${csudo}bash -c "echo [Service] >> ${taosd_service_config}" + ${csudo}bash -c "echo Type=simple >> ${taosd_service_config}" + ${csudo}bash -c "echo ExecStart=/usr/bin/${serverName} >> ${taosd_service_config}" + ${csudo}bash -c "echo ExecStartPre=${installDir}/bin/startPre.sh >> ${taosd_service_config}" + ${csudo}bash -c "echo TimeoutStopSec=1000000s >> ${taosd_service_config}" + ${csudo}bash -c "echo LimitNOFILE=infinity >> ${taosd_service_config}" + ${csudo}bash -c "echo LimitNPROC=infinity >> ${taosd_service_config}" + ${csudo}bash -c "echo LimitCORE=infinity >> ${taosd_service_config}" + ${csudo}bash -c "echo TimeoutStartSec=0 >> ${taosd_service_config}" + ${csudo}bash -c "echo StandardOutput=null >> ${taosd_service_config}" + ${csudo}bash -c "echo Restart=always >> ${taosd_service_config}" + ${csudo}bash -c "echo StartLimitBurst=3 >> ${taosd_service_config}" + ${csudo}bash -c "echo StartLimitInterval=60s >> ${taosd_service_config}" ${csudo}bash -c "echo >> ${taosd_service_config}" - ${csudo}bash -c "echo '[Install]' >> ${taosd_service_config}" - ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}" + ${csudo}bash -c "echo [Install] >> ${taosd_service_config}" + ${csudo}bash -c "echo WantedBy=multi-user.target >> ${taosd_service_config}" ${csudo}systemctl enable ${serverName} } From bd047f8f393e734895a9045116646e85bbcf26b9 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 19:51:38 +0800 Subject: [PATCH 61/66] fix: update taos-tools 4a4027c --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 8561e0ff42..7247200fe7 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 1b2cbd0 + GIT_TAG 4a4027c SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 8fbe4b64a84baa5a0da597aee0be5efd0337c477 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 8 Dec 2022 20:26:06 +0800 Subject: [PATCH 62/66] fix: taos shell prompt for websocket (#18826) --- tools/shell/src/shellWebsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellWebsocket.c b/tools/shell/src/shellWebsocket.c index 94bb909e29..add3ccc51f 100644 --- a/tools/shell/src/shellWebsocket.c +++ b/tools/shell/src/shellWebsocket.c @@ -223,7 +223,7 @@ void shellRunSingleCommandWebsocketImp(char *command) { if (code == TSDB_CODE_WS_SEND_TIMEOUT || code == TSDB_CODE_WS_RECV_TIMEOUT) { fprintf(stderr, "Hint: use -t to increase the timeout in seconds\n"); } else if (code == TSDB_CODE_WS_INTERNAL_ERRO || code == TSDB_CODE_WS_CLOSED) { - fprintf(stderr, "TDengine server is down, will try to reconnect\n"); + fprintf(stderr, "TDengine server is disconnected, will try to reconnect\n"); shell.ws_conn = NULL; } ws_free_result(res); From ed6f542a3eefa757e53077f88d8f5a097a88b1c5 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 8 Dec 2022 21:18:36 +0800 Subject: [PATCH 63/66] TD-20975 --- source/dnode/mgmt/mgmt_dnode/src/dmHandle.c | 10 ++++++++-- source/libs/transport/src/transCli.c | 3 --- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index a7ad983b0c..39eeeb32ea 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -103,7 +103,12 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { tSerializeSStatusReq(pHead, contLen, &req); tFreeSStatusReq(&req); - SRpcMsg rpcMsg = {.pCont = pHead, .contLen = contLen, .msgType = TDMT_MND_STATUS, .info.ahandle = (void *)0x9527}; + SRpcMsg rpcMsg = {.pCont = pHead, + .contLen = contLen, + .msgType = TDMT_MND_STATUS, + .info.ahandle = (void *)0x9527, + .info.refId = 0, + .info.noResp = 0}; SRpcMsg rpcRsp = {0}; dTrace("send status req to mnode, dnodeVer:%" PRId64 " statusSeq:%d", req.dnodeVer, req.statusSeq); @@ -150,7 +155,8 @@ static void dmGetServerRunStatus(SDnodeMgmt *pMgmt, SServerStatusRsp *pStatus) { SServerStatusRsp statusRsp = {0}; SMonMloadInfo minfo = {0}; (*pMgmt->getMnodeLoadsFp)(&minfo); - if (minfo.isMnode && (minfo.load.syncState == TAOS_SYNC_STATE_ERROR || minfo.load.syncState == TAOS_SYNC_STATE_OFFLINE)) { + if (minfo.isMnode && + (minfo.load.syncState == TAOS_SYNC_STATE_ERROR || minfo.load.syncState == TAOS_SYNC_STATE_OFFLINE)) { pStatus->statusCode = TSDB_SRV_STATUS_SERVICE_DEGRADED; snprintf(pStatus->details, sizeof(pStatus->details), "mnode sync state is %s", syncStr(minfo.load.syncState)); return; diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 6d6a6b6625..060d1d3a98 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1052,9 +1052,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { cliMayCvtFqdnToIp(&pCtx->epSet, &pThrd->cvtAddr); - char tbuf[256] = {0}; - EPSET_DEBUG_STR(&pCtx->epSet, tbuf); - if (!EPSET_IS_VALID(&pCtx->epSet)) { tError("invalid epset"); destroyCmsg(pMsg); From 24ee499670941c065b6aca12d778fbbd9c81a493 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 8 Dec 2022 21:38:08 +0800 Subject: [PATCH 64/66] fix: coredump --- source/dnode/vnode/src/tsdb/tsdbSnapshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c index 3dcbe261ba..8be4904349 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSnapshot.c +++ b/source/dnode/vnode/src/tsdb/tsdbSnapshot.c @@ -155,7 +155,7 @@ static int32_t tsdbSnapReadOpenFile(STsdbSnapReader* pReader) { if (rowVer >= pReader->sver && rowVer <= pReader->ever) { pIter->rInfo.suid = pIter->bData.suid; - pIter->rInfo.uid = pIter->bData.uid; + pIter->rInfo.uid = pIter->bData.uid ? pIter->bData.uid : pIter->bData.aUid[pIter->iRow]; pIter->rInfo.row = tsdbRowFromBlockData(&pIter->bData, pIter->iRow); goto _add_iter; } From bf48419dff643f26013a2216780fce08b79187a8 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 8 Dec 2022 22:18:08 +0800 Subject: [PATCH 65/66] change trim cron --- source/dnode/mgmt/mgmt_dnode/src/dmWorker.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 30ef7b9542..80c040a5e8 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -20,7 +20,9 @@ static void *dmStatusThreadFp(void *param) { SDnodeMgmt *pMgmt = param; int64_t lastTime = taosGetTimestampMs(); setThreadName("dnode-status"); - + + const static int16_t TRIM_FREQ = 30; + int32_t trimCount = 0; while (1) { taosMsleep(200); if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; @@ -28,9 +30,13 @@ static void *dmStatusThreadFp(void *param) { int64_t curTime = taosGetTimestampMs(); float interval = (curTime - lastTime) / 1000.0f; if (interval >= tsStatusInterval) { - taosMemoryTrim(0); dmSendStatusReq(pMgmt); lastTime = curTime; + + trimCount = (trimCount + 1) % TRIM_FREQ; + if (trimCount == 0) { + taosMemoryTrim(0); + } } } From 291750b9c34502235f0524429b1dd58782af7803 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 8 Dec 2022 22:34:08 +0800 Subject: [PATCH 66/66] fix(sync): snapshot problem --- source/libs/sync/src/syncMain.c | 2 +- source/libs/sync/src/syncSnapshot.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 90afec8b95..6fabab18cb 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -151,7 +151,7 @@ int32_t syncReconfig(int64_t rid, SSyncCfg* pNewCfg) { } syncNodeStartHeartbeatTimer(pSyncNode); - syncNodeReplicate(pSyncNode); + //syncNodeReplicate(pSyncNode); } syncNodeRelease(pSyncNode); diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 42deb2c20a..540f40a4c0 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -345,6 +345,8 @@ bool snapshotReceiverIsStart(SSyncSnapshotReceiver *pReceiver) { return pReceive void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { // force close, abandon incomplete data if (pReceiver->pWriter != NULL) { + // event log + sRTrace(pReceiver, "snapshot receiver force stop"); int32_t ret = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, false, &(pReceiver->snapshot)); ASSERT(ret == 0); @@ -354,7 +356,7 @@ void snapshotReceiverForceStop(SSyncSnapshotReceiver *pReceiver) { pReceiver->start = false; // event log - sRTrace(pReceiver, "snapshot receiver force stop"); + // sRTrace(pReceiver, "snapshot receiver force stop"); } int32_t snapshotReceiverStartWriter(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pBeginMsg) { @@ -675,6 +677,7 @@ static int32_t syncNodeOnSnapshotEnd(SSyncNode *pSyncNode, SyncSnapshotSend *pMs sNTrace(pSyncNode, "snapshot receiver finish waitting for true time, now:%" PRId64 ", stime:%" PRId64, timeNow, pMsg->startTime); taosMsleep(10); + timeNow = taosGetTimestampMs(); } int32_t code = snapshotReceiverFinish(pReceiver, pMsg);