Merge pull request #27474 from taosdata/enh/TD-31538-6
enh: clear more asserts
This commit is contained in:
commit
4039b4c1fa
|
@ -707,7 +707,9 @@ static FORCE_INLINE SColCmprWrapper* tCloneSColCmprWrapper(const SColCmprWrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
|
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* pCmpr, int32_t nCols) {
|
||||||
assert(!pCmpr->pColCmpr);
|
if (!(!pCmpr->pColCmpr)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(nCols, sizeof(SColCmpr));
|
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(nCols, sizeof(SColCmpr));
|
||||||
if (pCmpr->pColCmpr == NULL) {
|
if (pCmpr->pColCmpr == NULL) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -718,7 +720,9 @@ static FORCE_INLINE int32_t tInitDefaultSColCmprWrapperByCols(SColCmprWrapper* p
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
static FORCE_INLINE int32_t tInitDefaultSColCmprWrapper(SColCmprWrapper* pCmpr, SSchemaWrapper* pSchema) {
|
||||||
pCmpr->nCols = pSchema->nCols;
|
pCmpr->nCols = pSchema->nCols;
|
||||||
assert(!pCmpr->pColCmpr);
|
if (!(!pCmpr->pColCmpr)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
pCmpr->pColCmpr = (SColCmpr*)taosMemoryCalloc(pCmpr->nCols, sizeof(SColCmpr));
|
||||||
if (pCmpr->pColCmpr == NULL) {
|
if (pCmpr->pColCmpr == NULL) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -2813,8 +2817,8 @@ enum {
|
||||||
TOPIC_SUB_TYPE__COLUMN,
|
TOPIC_SUB_TYPE__COLUMN,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_MAX_POLL_INTERVAL 3000000
|
#define DEFAULT_MAX_POLL_INTERVAL 3000000
|
||||||
#define DEFAULT_SESSION_TIMEOUT 12000
|
#define DEFAULT_SESSION_TIMEOUT 12000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
||||||
|
|
|
@ -40,7 +40,7 @@ extern const int32_t TYPE_BYTES[21];
|
||||||
#define LONG_BYTES sizeof(int64_t)
|
#define LONG_BYTES sizeof(int64_t)
|
||||||
#define FLOAT_BYTES sizeof(float)
|
#define FLOAT_BYTES sizeof(float)
|
||||||
#define DOUBLE_BYTES sizeof(double)
|
#define DOUBLE_BYTES sizeof(double)
|
||||||
#define POINTER_BYTES sizeof(void *) // 8 by default assert(sizeof(ptrdiff_t) == sizseof(void*)
|
#define POINTER_BYTES sizeof(void *)
|
||||||
#define TSDB_KEYSIZE sizeof(TSKEY)
|
#define TSDB_KEYSIZE sizeof(TSKEY)
|
||||||
#define TSDB_NCHAR_SIZE sizeof(TdUcs4)
|
#define TSDB_NCHAR_SIZE sizeof(TdUcs4)
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,6 @@ int32_t vmOpenVnode(SVnodeMgmt *pMgmt, SWrapperCfg *pCfg, SVnode *pImpl) {
|
||||||
SVnodeObj *pOld = NULL;
|
SVnodeObj *pOld = NULL;
|
||||||
(void)taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
(void)taosHashGetDup(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), (void *)&pOld);
|
||||||
if (pOld) {
|
if (pOld) {
|
||||||
ASSERT(pOld->failed);
|
|
||||||
vmFreeVnodeObj(&pOld);
|
vmFreeVnodeObj(&pOld);
|
||||||
}
|
}
|
||||||
int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *));
|
int32_t code = taosHashPut(pMgmt->hash, &pVnode->vgId, sizeof(int32_t), &pVnode, sizeof(SVnodeObj *));
|
||||||
|
@ -190,7 +189,6 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
|
|
||||||
if (pVnode->failed) {
|
if (pVnode->failed) {
|
||||||
ASSERT(pVnode->pImpl == NULL);
|
|
||||||
goto _closed;
|
goto _closed;
|
||||||
}
|
}
|
||||||
dInfo("vgId:%d, pre close", pVnode->vgId);
|
dInfo("vgId:%d, pre close", pVnode->vgId);
|
||||||
|
@ -692,8 +690,6 @@ static void *vmRestoreVnodeInThread(void *param) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(pVnode->pImpl);
|
|
||||||
|
|
||||||
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
char stepDesc[TSDB_STEP_DESC_LEN] = {0};
|
||||||
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
|
snprintf(stepDesc, TSDB_STEP_DESC_LEN, "vgId:%d, start to restore, %d of %d have been restored", pVnode->vgId,
|
||||||
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
|
pMgmt->state.openVnodes, pMgmt->state.totalVnodes);
|
||||||
|
@ -764,7 +760,6 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) {
|
||||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||||
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
if (taosThreadCreate(&pThread->thread, &thAttr, vmRestoreVnodeInThread, pThread) != 0) {
|
||||||
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
dError("thread:%d, failed to create thread to restore vnode since %s", pThread->threadIndex, strerror(errno));
|
||||||
ASSERT(errno == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadAttrDestroy(&thAttr);
|
(void)taosThreadAttrDestroy(&thAttr);
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer) {
|
int32_t sndBuildStreamTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer) {
|
||||||
ASSERT(pTask->info.taskLevel == TASK_LEVEL__AGG && taosArrayGetSize(pTask->upstreamInfo.pList) != 0);
|
if (!(pTask->info.taskLevel == TASK_LEVEL__AGG && taosArrayGetSize(pTask->upstreamInfo.pList) != 0)) {
|
||||||
|
return TSDB_CODE_INVALID_PARA;
|
||||||
|
}
|
||||||
int32_t code = streamTaskInit(pTask, pSnode->pMeta, &pSnode->msgCb, nextProcessVer);
|
int32_t code = streamTaskInit(pTask, pSnode->pMeta, &pSnode->msgCb, nextProcessVer);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
return code;
|
return code;
|
||||||
|
@ -135,7 +137,7 @@ int32_t sndProcessStreamMsg(SSnode *pSnode, SRpcMsg *pMsg) {
|
||||||
return tqStreamTaskProcessRetrieveTriggerRsp(pSnode->pMeta, pMsg);
|
return tqStreamTaskProcessRetrieveTriggerRsp(pSnode->pMeta, pMsg);
|
||||||
default:
|
default:
|
||||||
sndError("invalid snode msg:%d", pMsg->msgType);
|
sndError("invalid snode msg:%d", pMsg->msgType);
|
||||||
ASSERT(0);
|
return TSDB_CODE_INVALID_MSG;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +166,7 @@ int32_t sndProcessWriteMsg(SSnode *pSnode, SRpcMsg *pMsg, SRpcMsg *pRsp) {
|
||||||
case TDMT_STREAM_CONSEN_CHKPT:
|
case TDMT_STREAM_CONSEN_CHKPT:
|
||||||
return tqStreamTaskProcessConsenChkptIdReq(pSnode->pMeta, pMsg);
|
return tqStreamTaskProcessConsenChkptIdReq(pSnode->pMeta, pMsg);
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
return TSDB_CODE_INVALID_MSG;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1126,8 +1126,8 @@ int32_t tMergeTreeNext(SMergeTree *pMTree, bool *pHasNext) {
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
(void)tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
(void)tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pMTree->pIter);
|
||||||
pMTree->pIter = NULL;
|
pMTree->pIter = NULL;
|
||||||
} else {
|
} else if (!c) {
|
||||||
ASSERT(c);
|
return TSDB_CODE_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1081,7 +1081,6 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo
|
||||||
int32_t step = asc ? 1 : -1;
|
int32_t step = asc ? 1 : -1;
|
||||||
|
|
||||||
// make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit
|
// make sure it is aligned to 8bit, the allocated memory address is aligned to 256bit
|
||||||
// ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0);
|
|
||||||
|
|
||||||
// 1. copy data in a batch model
|
// 1. copy data in a batch model
|
||||||
(void)memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes);
|
(void)memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes);
|
||||||
|
@ -3828,7 +3827,6 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ASSERT(key >= last->ts);
|
|
||||||
if (key > last->ts) {
|
if (key > last->ts) {
|
||||||
return false;
|
return false;
|
||||||
} else if (key == last->ts) {
|
} else if (key == last->ts) {
|
||||||
|
@ -3891,7 +3889,7 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
|
||||||
} else if (key == pFirst->ts) {
|
} else if (key == pFirst->ts) {
|
||||||
return pFirst->version >= ver;
|
return pFirst->version >= ver;
|
||||||
} else {
|
} else {
|
||||||
// ASSERT(0);
|
tsdbError("unexpected error, key:%" PRId64 ", first:%" PRId64, key, pFirst->ts);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TSDBKEY* pCurrent = taosArrayGet(pDelList, *index);
|
TSDBKEY* pCurrent = taosArrayGet(pDelList, *index);
|
||||||
|
|
|
@ -1319,7 +1319,9 @@ static bool doCheckDatablockOverlap(STableBlockScanInfo* pBlockScanInfo, const S
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else { // it must be the last point
|
} else { // it must be the last point
|
||||||
ASSERT(p->version == 0);
|
if (!(p->version == 0)) {
|
||||||
|
tsdbError("unexpected version:%" PRId64, p->version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // (p->ts > pBlock->maxKey.ts) {
|
} else { // (p->ts > pBlock->maxKey.ts) {
|
||||||
|
|
|
@ -33,8 +33,8 @@ int tsdbInsertData(STsdb *pTsdb, int64_t version, SSubmitReq2 *pMsg, SSubmitRsp2
|
||||||
int32_t affectedrows = 0;
|
int32_t affectedrows = 0;
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
|
|
||||||
if (ASSERTS(pTsdb->mem != NULL, "vgId:%d, mem is NULL", TD_VID(pTsdb->pVnode))) {
|
if (pTsdb->mem == NULL) {
|
||||||
TAOS_RETURN(TSDB_CODE_INVALID_PTR);
|
TAOS_RETURN(TSDB_CODE_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrSize = taosArrayGetSize(pMsg->aSubmitTbData);
|
arrSize = taosArrayGetSize(pMsg->aSubmitTbData);
|
||||||
|
|
|
@ -159,7 +159,7 @@ static void lockTimerList(timer_list_t* list) {
|
||||||
static void unlockTimerList(timer_list_t* list) {
|
static void unlockTimerList(timer_list_t* list) {
|
||||||
int64_t tid = taosGetSelfPthreadId();
|
int64_t tid = taosGetSelfPthreadId();
|
||||||
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
if (atomic_val_compare_exchange_64(&(list->lockedBy), tid, 0) != tid) {
|
||||||
ASSERTS(false, "%" PRId64 " trying to unlock a timer list not locked by current thread.", tid);
|
uError("%" PRId64 " trying to unlock a timer list not locked by current thread.", tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,9 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* han
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERTS(timer->refCount == 1, "timer refCount=%d not expected 1", timer->refCount);
|
if (timer->refCount == 1) {
|
||||||
|
uError("timer refCount=%d not expected 1", timer->refCount);
|
||||||
|
}
|
||||||
memset(timer, 0, sizeof(*timer));
|
memset(timer, 0, sizeof(*timer));
|
||||||
*pTmrId = (tmr_h)doStartTimer(timer, fp, mseconds, param, ctrl);
|
*pTmrId = (tmr_h)doStartTimer(timer, fp, mseconds, param, ctrl);
|
||||||
|
|
||||||
|
|
|
@ -494,7 +494,7 @@ int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg)
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
return TSDB_CODE_INVALID_PARA;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ void tSingleWorkerCleanup(SSingleWorker *pWorker) {
|
||||||
taosMemoryFree(pWorker->pool);
|
taosMemoryFree(pWorker->pool);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,6 @@ int32_t tQueryAutoQWorkerInit(SQueryAutoQWorkerPool *pool) {
|
||||||
if (!pool->exitedWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!pool->exitedWorkers) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
pool->maxInUse = pool->max * 2 + 2;
|
pool->maxInUse = pool->max * 2 + 2;
|
||||||
|
|
||||||
|
|
||||||
if (!pool->pCb) {
|
if (!pool->pCb) {
|
||||||
pool->pCb = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPoolCB));
|
pool->pCb = taosMemoryCalloc(1, sizeof(SQueryAutoQWorkerPoolCB));
|
||||||
if (!pool->pCb) return TSDB_CODE_OUT_OF_MEMORY;
|
if (!pool->pCb) return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
Loading…
Reference in New Issue