fix: remove assert
This commit is contained in:
parent
768855c26a
commit
044f7d6658
|
@ -852,34 +852,58 @@ typedef struct SCtgCacheItemInfo {
|
|||
#define CTG_LOCK(type, _lock) \
|
||||
do { \
|
||||
if (CTG_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before read lock"); \
|
||||
break; \
|
||||
} \
|
||||
CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRLockLatch(_lock); \
|
||||
CTG_LOCK_DEBUG("CTG RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value after read lock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before write lock"); \
|
||||
break; \
|
||||
} \
|
||||
CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWLockLatch(_lock); \
|
||||
CTG_LOCK_DEBUG("CTG WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value after write lock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CTG_UNLOCK(type, _lock) \
|
||||
do { \
|
||||
if (CTG_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value before read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRUnLockLatch(_lock); \
|
||||
CTG_LOCK_DEBUG("CTG RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value before write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWUnLockLatch(_lock); \
|
||||
CTG_LOCK_DEBUG("CTG WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -773,8 +773,6 @@ int32_t ctgGetTsma(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTsmaNa
|
|||
}
|
||||
|
||||
CTG_ERR_JRET(code);
|
||||
|
||||
ASSERT(tsmaRsp.pTsmas && tsmaRsp.pTsmas->size == 1);
|
||||
|
||||
*pTsma = taosArrayGetP(tsmaRsp.pTsmas, 0);
|
||||
taosArrayDestroy(tsmaRsp.pTsmas);
|
||||
|
|
|
@ -2448,30 +2448,33 @@ int32_t ctgHandleGetTSMARsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
|
|||
|
||||
STableTSMAInfoRsp* pOut = pMsgCtx->out;
|
||||
pRes->code = 0;
|
||||
if (pOut->pTsmas->size > 0) {
|
||||
ASSERT(pOut->pTsmas->size == 1);
|
||||
pRes->pRes = pOut;
|
||||
pMsgCtx->out = NULL;
|
||||
TSWAP(pTask->res, pCtx->pResList);
|
||||
if (1 != pOut->pTsmas->size) {
|
||||
ctgError("invalid tsma num:%d", (int32_t)pOut->pTsmas->size);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
STableTSMAInfo* pTsma = taosArrayGetP(pOut->pTsmas, 0);
|
||||
if (NULL == pTsma) {
|
||||
ctgError("fail to get the 0th STableTSMAInfo, totalNum:%d", (int32_t)taosArrayGetSize(pOut->pTsmas));
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
int32_t exists = false;
|
||||
CTG_ERR_JRET(ctgTbMetaExistInCache(pCtg, pTsma->targetDbFName, pTsma->targetTb, &exists));
|
||||
if (!exists) {
|
||||
TSWAP(pMsgCtx->lastOut, pMsgCtx->out);
|
||||
CTG_RET(ctgGetTbMetaFromMnodeImpl(pCtg, pConn, pTsma->targetDbFName, pTsma->targetTb, NULL, tReq));
|
||||
}
|
||||
pRes->pRes = pOut;
|
||||
pMsgCtx->out = NULL;
|
||||
TSWAP(pTask->res, pCtx->pResList);
|
||||
|
||||
STableTSMAInfo* pTsma = taosArrayGetP(pOut->pTsmas, 0);
|
||||
if (NULL == pTsma) {
|
||||
ctgError("fail to get the 0th STableTSMAInfo, totalNum:%d", (int32_t)taosArrayGetSize(pOut->pTsmas));
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
int32_t exists = false;
|
||||
CTG_ERR_JRET(ctgTbMetaExistInCache(pCtg, pTsma->targetDbFName, pTsma->targetTb, &exists));
|
||||
if (!exists) {
|
||||
TSWAP(pMsgCtx->lastOut, pMsgCtx->out);
|
||||
CTG_RET(ctgGetTbMetaFromMnodeImpl(pCtg, pConn, pTsma->targetDbFName, pTsma->targetTb, NULL, tReq));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT(0);
|
||||
ctgError("invalid reqType:%d while getting tsma rsp", reqType);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
_return:
|
||||
|
@ -2635,14 +2638,14 @@ int32_t ctgHandleGetTbTSMARsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT(0);
|
||||
ctgError("invalid fetchType:%d while getting tb tsma rsp", pFetch->fetchType);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TDMT_VND_TABLE_META: {
|
||||
// handle source tb meta
|
||||
ASSERT(pFetch->fetchType == FETCH_TSMA_SOURCE_TB_META);
|
||||
STableMetaOutput* pOut = (STableMetaOutput*)pMsgCtx->out;
|
||||
pFetch->fetchType = FETCH_TB_TSMA;
|
||||
pFetch->tsmaSourceTbName = *pTbName;
|
||||
|
@ -2663,7 +2666,8 @@ int32_t ctgHandleGetTbTSMARsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT(0);
|
||||
ctgError("invalid reqType:%d while getting tsma rsp", reqType);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
_return:
|
||||
|
@ -3628,7 +3632,8 @@ int32_t ctgLaunchGetTbTSMATask(SCtgTask* pTask) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT(0);
|
||||
ctgError("invalid fetchType:%d in getting tb tsma task", pFetch->fetchType);
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3644,14 +3649,12 @@ int32_t ctgLaunchGetTSMATask(SCtgTask* pTask) {
|
|||
SCtgJob* pJob = pTask->pJob;
|
||||
|
||||
// currently, only support fetching one tsma
|
||||
ASSERT(pCtx->pNames->size == 1);
|
||||
STablesReq* pReq = taosArrayGet(pCtx->pNames, 0);
|
||||
if (NULL == pReq) {
|
||||
ctgError("fail to get the 0th STablesReq, totalNum:%d", (int32_t)taosArrayGetSize(pCtx->pNames));
|
||||
CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
ASSERT(pReq->pTables->size == 1);
|
||||
SName* pTsmaName = taosArrayGet(pReq->pTables, 0);
|
||||
if (NULL == pReq) {
|
||||
ctgError("fail to get the 0th SName, totalNum:%d", (int32_t)taosArrayGetSize(pReq->pTables));
|
||||
|
@ -3686,7 +3689,6 @@ int32_t ctgLaunchGetTSMATask(SCtgTask* pTask) {
|
|||
}
|
||||
|
||||
STableTSMAInfoRsp* pRsp = (STableTSMAInfoRsp*)pRes->pRes;
|
||||
ASSERT(pRsp->pTsmas->size == 1);
|
||||
|
||||
const STSMACache* pTsma = taosArrayGetP(pRsp->pTsmas, 0);
|
||||
if (NULL == pTsma) {
|
||||
|
|
|
@ -42,7 +42,8 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
|
|||
msgNum = taosArrayGetSize(batchRsp.pRsps);
|
||||
}
|
||||
|
||||
if (ASSERTS(taskNum == msgNum || 0 == msgNum, "taskNum %d mis-match msgNum %d", taskNum, msgNum)) {
|
||||
if (taskNum != msgNum && 0 != msgNum) {
|
||||
ctgError("taskNum %d mis-match msgNum %d", taskNum, msgNum);
|
||||
msgNum = 0;
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,9 @@ int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBu
|
|||
if (msgNum > 0) {
|
||||
pRsp = taosArrayGet(batchRsp.pRsps, i);
|
||||
|
||||
if (ASSERTS(pRsp->msgIdx == *msgIdx, "rsp msgIdx %d mis-match msgIdx %d", pRsp->msgIdx, *msgIdx)) {
|
||||
if (pRsp->msgIdx != *msgIdx) {
|
||||
ctgError("rsp msgIdx %d mis-match msgIdx %d", pRsp->msgIdx, *msgIdx);
|
||||
|
||||
pRsp = &rsp;
|
||||
pRsp->msgIdx = *msgIdx;
|
||||
pRsp->reqType = -1;
|
||||
|
|
|
@ -2631,7 +2631,7 @@ bool hasOutOfDateTSMACache(SArray* pTsmas) {
|
|||
for (int32_t i = 0; i < pTsmas->size; ++i) {
|
||||
STSMACache* pTsmaInfo = taosArrayGetP(pTsmas, i);
|
||||
if (NULL == pTsmaInfo) {
|
||||
ASSERT(0);
|
||||
continue;
|
||||
}
|
||||
if (isCtgTSMACacheOutOfDate(pTsmaInfo)) {
|
||||
return true;
|
||||
|
|
|
@ -87,7 +87,10 @@ static int32_t toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* p
|
|||
if (pRes->affectedRows) {
|
||||
pRes->skey = *(int64_t*)pColSKey->pData;
|
||||
pRes->ekey = *(int64_t*)pColEKey->pData;
|
||||
ASSERT(pRes->skey <= pRes->ekey);
|
||||
if (pRes->skey > pRes->ekey) {
|
||||
qError("data delter skey:%" PRId64 " is bigger than ekey:%" PRId64, pRes->skey, pRes->ekey);
|
||||
QRY_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
}
|
||||
} else {
|
||||
pRes->skey = pHandle->pDeleter->deleteTimeRange.skey;
|
||||
pRes->ekey = pHandle->pDeleter->deleteTimeRange.ekey;
|
||||
|
@ -205,7 +208,10 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, int64_t* pRaw
|
|||
static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
|
||||
SDataDeleterHandle* pDeleter = (SDataDeleterHandle*)pHandle;
|
||||
if (NULL == pDeleter->nextOutput.pData) {
|
||||
ASSERT(pDeleter->queryEnd);
|
||||
if (!pDeleter->queryEnd) {
|
||||
qError("empty res while query not end in data deleter");
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
pOutput->useconds = pDeleter->useconds;
|
||||
pOutput->precision = pDeleter->pSchema->precision;
|
||||
pOutput->bufStatus = DS_BUF_EMPTY;
|
||||
|
|
|
@ -242,7 +242,11 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, int64_t* pRow
|
|||
static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
|
||||
SDataDispatchHandle* pDispatcher = (SDataDispatchHandle*)pHandle;
|
||||
if (NULL == pDispatcher->nextOutput.pData) {
|
||||
ASSERT(pDispatcher->queryEnd);
|
||||
if (!pDispatcher->queryEnd) {
|
||||
qError("empty res while query not end in data dispatcher");
|
||||
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
pOutput->useconds = pDispatcher->useconds;
|
||||
pOutput->precision = pDispatcher->pSchema->precision;
|
||||
pOutput->bufStatus = DS_BUF_EMPTY;
|
||||
|
|
|
@ -234,7 +234,11 @@ int32_t buildSubmitReqFromBlock(SDataInserterHandle* pInserter, SSubmitReq2** pp
|
|||
case TSDB_DATA_TYPE_NCHAR:
|
||||
case TSDB_DATA_TYPE_VARBINARY:
|
||||
case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY
|
||||
ASSERT(pColInfoData->info.type == pCol->type);
|
||||
if (pColInfoData->info.type != pCol->type) {
|
||||
qError("column:%d type:%d in block dismatch with schema col:%d type:%d", colIdx, pColInfoData->info.type, k, pCol->type);
|
||||
terrno = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
|
||||
goto _end;
|
||||
}
|
||||
if (colDataIsNull_s(pColInfoData, j)) {
|
||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||
if (NULL == taosArrayPush(pVals, &cv)) {
|
||||
|
|
|
@ -823,12 +823,14 @@ static void postProcessStbJoinTableHash(SOperatorInfo* pOperator) {
|
|||
pStbJoin->execInfo.leftCacheNum = tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache);
|
||||
qDebug("more than 1 ref build table num %" PRId64, (int64_t)tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache));
|
||||
|
||||
/*
|
||||
// debug only
|
||||
iter = 0;
|
||||
uint32_t* num = NULL;
|
||||
while (NULL != (num = tSimpleHashIterate(pStbJoin->ctx.prev.leftCache, num, &iter))) {
|
||||
ASSERT(*num > 1);
|
||||
A S S E R T(*num > 1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void buildStbJoinTableList(SOperatorInfo* pOperator) {
|
||||
|
|
|
@ -60,7 +60,7 @@ int32_t hInnerJoinDo(struct SOperatorInfo* pOperator) {
|
|||
/*
|
||||
size_t keySize = 0;
|
||||
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
|
||||
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
A S S E R T(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
|
||||
pJoin->execInfo.expectRows += rows;
|
||||
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
|
||||
|
@ -145,7 +145,7 @@ int32_t hLeftJoinHandleSeqProbeRows(struct SOperatorInfo* pOperator, SHJoinOpera
|
|||
/*
|
||||
size_t keySize = 0;
|
||||
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
|
||||
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
A S S E R T(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
|
||||
pJoin->execInfo.expectRows += rows;
|
||||
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
|
||||
|
@ -248,7 +248,7 @@ int32_t hLeftJoinHandleProbeRows(struct SOperatorInfo* pOperator, SHJoinOperator
|
|||
/*
|
||||
size_t keySize = 0;
|
||||
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
|
||||
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
A S S E R T(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
|
||||
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
|
||||
pJoin->execInfo.expectRows += rows;
|
||||
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
|
||||
|
|
|
@ -38,8 +38,6 @@ bool hJoinBlkReachThreshold(SHJoinOperatorInfo* pInfo, int64_t blkRows) {
|
|||
}
|
||||
|
||||
int32_t hJoinHandleMidRemains(SHJoinOperatorInfo* pJoin, SHJoinCtx* pCtx) {
|
||||
ASSERT(0 < pJoin->midBlk->info.rows);
|
||||
|
||||
TSWAP(pJoin->midBlk, pJoin->finBlk);
|
||||
|
||||
pCtx->midRemains = false;
|
||||
|
@ -1153,7 +1151,6 @@ int32_t hJoinInitResBlocks(SHJoinOperatorInfo* pJoin, SHashJoinPhysiNode* pJoinN
|
|||
if (NULL == pJoin->finBlk) {
|
||||
QRY_ERR_RET(terrno);
|
||||
}
|
||||
ASSERT(pJoinNode->node.pOutputDataBlockDesc->totalRowSize > 0);
|
||||
|
||||
int32_t code = blockDataEnsureCapacity(pJoin->finBlk, hJoinGetFinBlkCapacity(pJoin, pJoinNode));
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
|
|
|
@ -321,7 +321,7 @@ static int32_t mOuterJoinMergeSeqCart(SMJoinMergeCtx* pCtx) {
|
|||
|
||||
int32_t buildEndIdx = buildGrp->endIdx;
|
||||
buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1;
|
||||
ASSERT(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
//A S S E R T(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp));
|
||||
buildGrp->readIdx += rowsLeft;
|
||||
buildGrp->endIdx = buildEndIdx;
|
||||
|
@ -1383,9 +1383,9 @@ static int32_t mSemiJoinHashGrpCartFilter(SMJoinMergeCtx* pCtx, SMJoinGrpRows* p
|
|||
continue;
|
||||
}
|
||||
|
||||
ASSERT(1 == pCtx->midBlk->info.rows);
|
||||
//A S S E R T(1 == pCtx->midBlk->info.rows);
|
||||
MJ_ERR_RET(mJoinCopyMergeMidBlk(pCtx, &pCtx->midBlk, &pCtx->finBlk));
|
||||
ASSERT(false == pCtx->midRemains);
|
||||
//A S S E R T(false == pCtx->midRemains);
|
||||
|
||||
break;
|
||||
} while (true);
|
||||
|
@ -1449,10 +1449,10 @@ static int32_t mSemiJoinHashFullCart(SMJoinMergeCtx* pCtx) {
|
|||
}
|
||||
|
||||
build->pHashCurGrp = *(SArray**)pGrp;
|
||||
ASSERT(1 == taosArrayGetSize(build->pHashCurGrp));
|
||||
//A S S E R T(1 == taosArrayGetSize(build->pHashCurGrp));
|
||||
build->grpRowIdx = 0;
|
||||
MJ_ERR_RET(mJoinHashGrpCart(pCtx->finBlk, probeGrp, true, probe, build, NULL));
|
||||
ASSERT(build->grpRowIdx < 0);
|
||||
//A S S E R T(build->grpRowIdx < 0);
|
||||
}
|
||||
|
||||
pCtx->grpRemains = probeGrp->readIdx <= probeGrp->endIdx;
|
||||
|
@ -1497,7 +1497,7 @@ static int32_t mSemiJoinMergeSeqCart(SMJoinMergeCtx* pCtx) {
|
|||
|
||||
int32_t buildEndIdx = buildGrp->endIdx;
|
||||
buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1;
|
||||
ASSERT(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
//A S S E R T(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp));
|
||||
buildGrp->readIdx += rowsLeft;
|
||||
buildGrp->endIdx = buildEndIdx;
|
||||
|
@ -1513,9 +1513,9 @@ static int32_t mSemiJoinMergeSeqCart(SMJoinMergeCtx* pCtx) {
|
|||
continue;
|
||||
}
|
||||
} else {
|
||||
ASSERT(1 == pCtx->midBlk->info.rows);
|
||||
//A S S E R T(1 == pCtx->midBlk->info.rows);
|
||||
MJ_ERR_RET(mJoinCopyMergeMidBlk(pCtx, &pCtx->midBlk, &pCtx->finBlk));
|
||||
ASSERT(false == pCtx->midRemains);
|
||||
//A S S E R T(false == pCtx->midRemains);
|
||||
|
||||
if (build->grpIdx == buildGrpNum) {
|
||||
continue;
|
||||
|
@ -1555,8 +1555,8 @@ static int32_t mSemiJoinMergeFullCart(SMJoinMergeCtx* pCtx) {
|
|||
int32_t probeRows = GRP_REMAIN_ROWS(probeGrp);
|
||||
int32_t probeEndIdx = probeGrp->endIdx;
|
||||
|
||||
ASSERT(1 == taosArrayGetSize(build->eqGrps));
|
||||
ASSERT(buildGrp->beginIdx == buildGrp->endIdx);
|
||||
//A S S E R T(1 == taosArrayGetSize(build->eqGrps));
|
||||
//A S S E R T(buildGrp->beginIdx == buildGrp->endIdx);
|
||||
|
||||
if (probeRows <= rowsLeft) {
|
||||
MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->finBlk, true, probeGrp, buildGrp));
|
||||
|
@ -1826,7 +1826,7 @@ static int32_t mAntiJoinMergeSeqCart(SMJoinMergeCtx* pCtx) {
|
|||
|
||||
int32_t buildEndIdx = buildGrp->endIdx;
|
||||
buildGrp->endIdx = buildGrp->readIdx + rowsLeft - 1;
|
||||
ASSERT(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
//A S S E R T(buildGrp->endIdx >= buildGrp->readIdx);
|
||||
MJ_ERR_RET(mJoinMergeGrpCart(pCtx->pJoin, pCtx->midBlk, true, probeGrp, buildGrp));
|
||||
buildGrp->readIdx += rowsLeft;
|
||||
buildGrp->endIdx = buildEndIdx;
|
||||
|
@ -2381,7 +2381,7 @@ int32_t mAsofForwardTrimCacheBlk(SMJoinWindowCtx* pCtx) {
|
|||
if (pGrp->blk == pCtx->cache.outBlk && pCtx->pJoin->build->blkRowIdx > 0) {
|
||||
MJ_ERR_RET(blockDataTrimFirstRows(pGrp->blk, pCtx->pJoin->build->blkRowIdx));
|
||||
pCtx->pJoin->build->blkRowIdx = 0;
|
||||
ASSERT(pCtx->pJoin->build->blk == pGrp->blk);
|
||||
//A S S E R T(pCtx->pJoin->build->blk == pGrp->blk);
|
||||
MJOIN_SAVE_TB_BLK(&pCtx->cache, pCtx->pJoin->build);
|
||||
}
|
||||
|
||||
|
@ -2419,16 +2419,16 @@ int32_t mAsofForwardChkFillGrpCache(SMJoinWindowCtx* pCtx) {
|
|||
MJ_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
}
|
||||
|
||||
ASSERT(pGrp->blk == pCache->outBlk);
|
||||
//A S S E R T(pGrp->blk == pCache->outBlk);
|
||||
//pGrp->endIdx = pGrp->blk->info.rows - pGrp->beginIdx;
|
||||
}
|
||||
|
||||
//ASSERT((pGrp->endIdx - pGrp->beginIdx + 1) == pCtx->cache.rowNum);
|
||||
//A S S E R T((pGrp->endIdx - pGrp->beginIdx + 1) == pCtx->cache.rowNum);
|
||||
}
|
||||
|
||||
|
||||
ASSERT(taosArrayGetSize(pCache->grps) == 1);
|
||||
ASSERT(pGrp->blk->info.rows - pGrp->beginIdx == pCtx->cache.rowNum);
|
||||
//A S S E R T(taosArrayGetSize(pCache->grps) == 1);
|
||||
//A S S E R T(pGrp->blk->info.rows - pGrp->beginIdx == pCtx->cache.rowNum);
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -2473,7 +2473,7 @@ int32_t mAsofForwardUpdateBuildGrpEndIdx(SMJoinWindowCtx* pCtx) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
ASSERT(pCtx->jLimit > (pGrp->blk->info.rows - pGrp->beginIdx));
|
||||
//A S S E R T(pCtx->jLimit > (pGrp->blk->info.rows - pGrp->beginIdx));
|
||||
pGrp->endIdx = pGrp->blk->info.rows - 1;
|
||||
|
||||
int64_t remainRows = pCtx->jLimit - (pGrp->endIdx - pGrp->beginIdx + 1);
|
||||
|
@ -2550,8 +2550,8 @@ int32_t mAsofForwardSkipAllEqRows(SMJoinWindowCtx* pCtx, int64_t timestamp) {
|
|||
MJOIN_RESTORE_TB_BLK(cache, pTable);
|
||||
} while (!MJOIN_BUILD_TB_ROWS_DONE(pTable));
|
||||
|
||||
ASSERT(pCtx->cache.rowNum == 0);
|
||||
ASSERT(taosArrayGetSize(pCtx->cache.grps) == 0);
|
||||
//A S S E R T(pCtx->cache.rowNum == 0);
|
||||
//A S S E R T(taosArrayGetSize(pCtx->cache.grps) == 0);
|
||||
|
||||
if (pTable->dsFetchDone) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -2648,7 +2648,7 @@ static int32_t mAsofForwardRetrieve(SOperatorInfo* pOperator, SMJoinOperatorInfo
|
|||
if ((probeGot || MJOIN_DS_NEED_INIT(pOperator, pJoin->build)) && pCtx->cache.rowNum < pCtx->jLimit) {
|
||||
pJoin->build->newBlk = false;
|
||||
MJOIN_SAVE_TB_BLK(&pCtx->cache, pCtx->pJoin->build);
|
||||
ASSERT(taosArrayGetSize(pCtx->cache.grps) <= 1);
|
||||
//A S S E R T(taosArrayGetSize(pCtx->cache.grps) <= 1);
|
||||
buildGot = mJoinRetrieveBlk(pJoin, &pJoin->build->blkRowIdx, &pJoin->build->blk, pJoin->build);
|
||||
}
|
||||
|
||||
|
@ -3375,7 +3375,7 @@ int32_t mWinJoinMoveAscWinEnd(SMJoinWindowCtx* pCtx) {
|
|||
continue;
|
||||
}
|
||||
|
||||
ASSERT(pGrp->endIdx > startIdx);
|
||||
//A S S E R T(pGrp->endIdx > startIdx);
|
||||
|
||||
pGrp->endIdx--;
|
||||
break;
|
||||
|
@ -3419,7 +3419,7 @@ int32_t mWinJoinMoveDescWinEnd(SMJoinWindowCtx* pCtx) {
|
|||
continue;
|
||||
}
|
||||
|
||||
ASSERT(pGrp->endIdx > startIdx);
|
||||
//A S S E R T(pGrp->endIdx > startIdx);
|
||||
|
||||
pGrp->endIdx--;
|
||||
break;
|
||||
|
@ -3676,7 +3676,7 @@ int32_t mJoinInitMergeCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJ
|
|||
MJ_ERR_RET(terrno);
|
||||
}
|
||||
|
||||
ASSERT(pJoinNode->node.pOutputDataBlockDesc->totalRowSize > 0);
|
||||
//A S S E R T(pJoinNode->node.pOutputDataBlockDesc->totalRowSize > 0);
|
||||
|
||||
MJ_ERR_RET(blockDataEnsureCapacity(pCtx->finBlk, mJoinGetFinBlkCapacity(pJoin, pJoinNode)));
|
||||
|
||||
|
|
|
@ -490,8 +490,6 @@ int32_t mJoinCopyMergeMidBlk(SMJoinMergeCtx* pCtx, SSDataBlock** ppMid, SSDataBl
|
|||
|
||||
|
||||
int32_t mJoinHandleMidRemains(SMJoinMergeCtx* pCtx) {
|
||||
ASSERT(0 < pCtx->midBlk->info.rows);
|
||||
|
||||
TSWAP(pCtx->midBlk, pCtx->finBlk);
|
||||
|
||||
pCtx->midRemains = false;
|
||||
|
@ -567,7 +565,6 @@ int32_t mJoinMergeGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool app
|
|||
int32_t currRows = append ? pRes->info.rows : 0;
|
||||
int32_t firstRows = GRP_REMAIN_ROWS(pFirst);
|
||||
int32_t secondRows = GRP_REMAIN_ROWS(pSecond);
|
||||
ASSERT(secondRows > 0);
|
||||
|
||||
for (int32_t c = 0; c < probe->finNum; ++c) {
|
||||
SMJoinColMap* pFirstCol = probe->finCols + c;
|
||||
|
@ -581,9 +578,15 @@ int32_t mJoinMergeGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool app
|
|||
if (colDataIsNull_s(pInCol, pFirst->readIdx + r)) {
|
||||
colDataSetNItemsNull(pOutCol, currRows + r * secondRows, secondRows);
|
||||
} else {
|
||||
ASSERT(pRes->info.capacity >= (pRes->info.rows + firstRows * secondRows));
|
||||
if (pRes->info.capacity < (pRes->info.rows + firstRows * secondRows)) {
|
||||
qError("capacity:%d not enough, rows:%" PRId64 ", firstRows:%d, secondRows:%d", pRes->info.capacity, pRes->info.rows, firstRows, secondRows);
|
||||
MJ_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
}
|
||||
uint32_t startOffset = (IS_VAR_DATA_TYPE(pOutCol->info.type)) ? pOutCol->varmeta.length : ((currRows + r * secondRows) * pOutCol->info.bytes);
|
||||
ASSERT((startOffset + 1 * pOutCol->info.bytes) <= pRes->info.capacity * pOutCol->info.bytes);
|
||||
if ((startOffset + 1 * pOutCol->info.bytes) > pRes->info.capacity * pOutCol->info.bytes) {
|
||||
qError("col buff not enough, startOffset:%d, bytes:%d, capacity:%d", startOffset, pOutCol->info.bytes, pRes->info.capacity);
|
||||
MJ_ERR_RET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
|
||||
}
|
||||
MJ_ERR_RET(colDataSetNItems(pOutCol, currRows + r * secondRows, colDataGetData(pInCol, pFirst->readIdx + r), secondRows, true));
|
||||
}
|
||||
}
|
||||
|
@ -1097,7 +1100,6 @@ SSDataBlock* mJoinGrpRetrieveImpl(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTa
|
|||
}
|
||||
|
||||
SMJoinTableCtx* pProbe = pJoin->probe;
|
||||
ASSERT(pProbe->lastInGid);
|
||||
|
||||
while (true) {
|
||||
if (pTable->remainInBlk) {
|
||||
|
|
|
@ -338,38 +338,62 @@ typedef struct SQWorkerMgmt {
|
|||
|
||||
#define TD_RWLATCH_WRITE_FLAG_COPY 0x40000000
|
||||
|
||||
#define QW_LOCK(type, _lock) \
|
||||
do { \
|
||||
if (QW_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \
|
||||
QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \
|
||||
QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
|
||||
} \
|
||||
#define QW_LOCK(type, _lock) \
|
||||
do { \
|
||||
if (QW_READ == (type)) { \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before read lock"); \
|
||||
break; \
|
||||
} \
|
||||
QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value after read lock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before write lock"); \
|
||||
break; \
|
||||
} \
|
||||
QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value after write lock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define QW_UNLOCK(type, _lock) \
|
||||
do { \
|
||||
if (QW_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
|
||||
QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRUnLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
|
||||
QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWUnLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
|
||||
} \
|
||||
#define QW_UNLOCK(type, _lock) \
|
||||
do { \
|
||||
if (QW_READ == (type)) { \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value before read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRUnLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value before write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWUnLockLatch(_lock); \
|
||||
QW_LOCK_DEBUG("QW WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
extern SQWorkerMgmt gQwMgmt;
|
||||
|
|
|
@ -501,34 +501,58 @@ extern SSchedulerMgmt schMgmt;
|
|||
#define SCH_LOCK(type, _lock) \
|
||||
do { \
|
||||
if (SCH_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32(_lock) >= 0, "invalid lock value before read lock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before read lock"); \
|
||||
break; \
|
||||
} \
|
||||
SCH_LOCK_DEBUG("SCH RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRLockLatch(_lock); \
|
||||
SCH_LOCK_DEBUG("SCH RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32(_lock) > 0, "invalid lock value after read lock"); \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value after read lock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32(_lock) >= 0, "invalid lock value before write lock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value before write lock"); \
|
||||
break; \
|
||||
} \
|
||||
SCH_LOCK_DEBUG("SCH WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWLockLatch(_lock); \
|
||||
SCH_LOCK_DEBUG("SCH WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32(_lock) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value after write lock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SCH_UNLOCK(type, _lock) \
|
||||
do { \
|
||||
if (SCH_READ == (type)) { \
|
||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
|
||||
if (atomic_load_32((_lock)) <= 0) { \
|
||||
qError("invalid lock value before read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
SCH_LOCK_DEBUG("SCH RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosRUnLockLatch(_lock); \
|
||||
SCH_LOCK_DEBUG("SCH RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after read unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
ASSERTS(atomic_load_32((_lock)) & TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
|
||||
if (atomic_load_32((_lock)) != TD_RWLATCH_WRITE_FLAG_COPY) { \
|
||||
qError("invalid lock value before write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
SCH_LOCK_DEBUG("SCH WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
taosWUnLockLatch(_lock); \
|
||||
SCH_LOCK_DEBUG("SCH WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
|
||||
if (atomic_load_32((_lock)) < 0) { \
|
||||
qError("invalid lock value after write unlock"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -454,7 +454,6 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
|
|||
#if FILE_WITH_LOCK
|
||||
taosThreadRwlockWrlock(&(pFile->rwlock));
|
||||
#endif
|
||||
ASSERT(pFile->hFile != NULL); // Please check if you have closed the file.
|
||||
if (pFile->hFile == NULL) {
|
||||
#if FILE_WITH_LOCK
|
||||
taosThreadRwlockUnlock(&(pFile->rwlock));
|
||||
|
@ -867,7 +866,6 @@ int64_t taosLSeekFile(TdFilePtr pFile, int64_t offset, int32_t whence) {
|
|||
#endif
|
||||
|
||||
int32_t code = 0;
|
||||
ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
|
||||
|
||||
#ifdef WINDOWS
|
||||
int64_t ret = _lseeki64(pFile->fd, offset, whence);
|
||||
|
@ -1479,7 +1477,6 @@ int32_t taosEOFFile(TdFilePtr pFile) {
|
|||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return -1;
|
||||
}
|
||||
ASSERT(pFile->fp != NULL);
|
||||
if (pFile->fp == NULL) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return -1;
|
||||
|
|
|
@ -326,10 +326,8 @@ void *taosMemoryRealloc(void *ptr, int64_t size) {
|
|||
if (ptr == NULL) return taosMemoryMalloc(size);
|
||||
|
||||
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char *)ptr - sizeof(TdMemoryInfo));
|
||||
ASSERT(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
|
||||
if (tpTdMemoryInfo->symbol != TD_MEMORY_SYMBOL) {
|
||||
+return NULL;
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TdMemoryInfo tdMemoryInfo;
|
||||
|
@ -366,7 +364,6 @@ char *taosStrdup(const char *ptr) {
|
|||
if (ptr == NULL) return NULL;
|
||||
|
||||
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char *)ptr - sizeof(TdMemoryInfo));
|
||||
ASSERT(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
|
||||
if (pTdMemoryInfo->symbol != TD_MEMORY_SYMBOL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -413,7 +410,6 @@ int64_t taosMemorySize(void *ptr) {
|
|||
|
||||
#ifdef USE_TD_MEMORY
|
||||
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char *)ptr - sizeof(TdMemoryInfo));
|
||||
ASSERT(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
|
||||
if (pTdMemoryInfo->symbol != TD_MEMORY_SYMBOL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -441,7 +437,7 @@ void taosMemoryTrim(int32_t size) {
|
|||
|
||||
void *taosMemoryMallocAlign(uint32_t alignment, int64_t size) {
|
||||
#ifdef USE_TD_MEMORY
|
||||
ASSERT(0);
|
||||
return NULL;
|
||||
#else
|
||||
#if defined(LINUX)
|
||||
#ifdef BUILD_WITH_RAND_ERR
|
||||
|
|
|
@ -312,8 +312,7 @@ int32_t taosGetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void
|
|||
return -1;
|
||||
}
|
||||
#ifdef WINDOWS
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
return -1;
|
||||
#else
|
||||
return getsockopt(pSocket->fd, level, optname, optval, (int *)optlen);
|
||||
#endif
|
||||
|
@ -681,8 +680,7 @@ int32_t taosKeepTcpAlive(TdSocketPtr pSocket) {
|
|||
int taosGetLocalIp(const char *eth, char *ip) {
|
||||
#if defined(WINDOWS)
|
||||
// DO NOTHAING
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
return -1;
|
||||
#else
|
||||
int fd;
|
||||
struct ifreq ifr;
|
||||
|
@ -708,8 +706,7 @@ int taosGetLocalIp(const char *eth, char *ip) {
|
|||
int taosValidIp(uint32_t ip) {
|
||||
#if defined(WINDOWS)
|
||||
// DO NOTHAING
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
return -1;
|
||||
#else
|
||||
int ret = -1;
|
||||
int fd;
|
||||
|
@ -1111,7 +1108,7 @@ int32_t taosIgnSIGPIPE() {
|
|||
|
||||
int32_t taosSetMaskSIGPIPE() {
|
||||
#ifdef WINDOWS
|
||||
// ASSERT(0);
|
||||
return -1;
|
||||
#else
|
||||
sigset_t signal_mask;
|
||||
(void)sigemptyset(&signal_mask);
|
||||
|
|
|
@ -425,10 +425,6 @@ int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix) {
|
|||
int64_t tmp = strtoll(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
@ -437,10 +433,6 @@ uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix) {
|
|||
uint64_t tmp = strtoull(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
@ -449,10 +441,6 @@ int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix) {
|
|||
int32_t tmp = strtol(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
@ -461,10 +449,6 @@ uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix) {
|
|||
uint32_t tmp = strtol(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
@ -473,12 +457,6 @@ int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix) {
|
|||
int32_t tmp = strtol(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp >= SHRT_MIN);
|
||||
ASSERT(tmp <= SHRT_MAX);
|
||||
#endif
|
||||
return (int16_t)tmp;
|
||||
}
|
||||
|
@ -487,23 +465,12 @@ uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix) {
|
|||
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp <= USHRT_MAX);
|
||||
#endif
|
||||
return (uint16_t)tmp;
|
||||
}
|
||||
|
||||
int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix) {
|
||||
int32_t tmp = strtol(str, pEnd, radix);
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp >= SCHAR_MIN);
|
||||
ASSERT(tmp <= SCHAR_MAX);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
@ -511,33 +478,17 @@ uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix) {
|
|||
uint32_t tmp = strtoul(str, pEnd, radix);
|
||||
#if defined(DARWIN) || defined(_ALPINE)
|
||||
if (errno == EINVAL) errno = 0;
|
||||
#endif
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp <= UCHAR_MAX);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
double taosStr2Double(const char *str, char **pEnd) {
|
||||
double tmp = strtod(str, pEnd);
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp != HUGE_VAL);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
float taosStr2Float(const char *str, char **pEnd) {
|
||||
float tmp = strtof(str, pEnd);
|
||||
#ifdef TD_CHECK_STR_TO_INT_ERROR
|
||||
ASSERT(errno != ERANGE);
|
||||
ASSERT(errno != EINVAL);
|
||||
ASSERT(tmp != HUGE_VALF);
|
||||
ASSERT(tmp != NAN);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ void taosGetSystemInfo() {
|
|||
|
||||
int32_t taosGetEmail(char *email, int32_t maxLen) {
|
||||
#ifdef WINDOWS
|
||||
// ASSERT(0);
|
||||
return 0;
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
#ifdef CUS_PROMPT
|
||||
const char *filepath = "/usr/local/"CUS_PROMPT"/email";
|
||||
|
@ -1040,7 +1040,6 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen) {
|
|||
|
||||
char *taosGetCmdlineByPID(int pid) {
|
||||
#ifdef WINDOWS
|
||||
ASSERT(0);
|
||||
return "";
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
static char cmdline[1024];
|
||||
|
|
|
@ -91,7 +91,6 @@ typedef struct FILE TdCmd;
|
|||
#ifdef BUILD_NO_CALL
|
||||
void* taosLoadDll(const char* filename) {
|
||||
#if defined(WINDOWS)
|
||||
ASSERT(0);
|
||||
return NULL;
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
return NULL;
|
||||
|
@ -110,7 +109,6 @@ void* taosLoadDll(const char* filename) {
|
|||
|
||||
void* taosLoadSym(void* handle, char* name) {
|
||||
#if defined(WINDOWS)
|
||||
ASSERT(0);
|
||||
return NULL;
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
return NULL;
|
||||
|
@ -131,7 +129,6 @@ void* taosLoadSym(void* handle, char* name) {
|
|||
|
||||
void taosCloseDll(void* handle) {
|
||||
#if defined(WINDOWS)
|
||||
ASSERT(0);
|
||||
return;
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
return;
|
||||
|
|
|
@ -784,8 +784,7 @@ int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock) {
|
|||
|
||||
int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int32_t pshared) {
|
||||
#ifdef TD_USE_SPINLOCK_AS_MUTEX
|
||||
ASSERT(pshared == 0);
|
||||
if (pshared != 0) return -1;
|
||||
if (pshared != 0) return TSDB_CODE_INVALID_PARA;
|
||||
return pthread_mutex_init((pthread_mutex_t *)lock, NULL);
|
||||
#else
|
||||
int32_t code = pthread_spin_init((pthread_spinlock_t *)lock, pshared);
|
||||
|
|
Loading…
Reference in New Issue