enh: clear some useless asserts
This commit is contained in:
parent
34f65ad158
commit
e20c36c022
|
@ -2653,7 +2653,6 @@ static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow, bool *pIgnoreEarli
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,6 @@ static int32_t tsdbCommitOpenReader(SCommitter2 *committer) {
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
ASSERT(TARRAY2_SIZE(committer->sttReaderArray) == 0);
|
||||
|
||||
if (committer->ctx->info->fset == NULL //
|
||||
|| committer->sttTrigger > 1 //
|
||||
|| TARRAY2_SIZE(committer->ctx->info->fset->lvlArr) == 0 //
|
||||
|
@ -264,11 +262,6 @@ static int32_t tsdbCommitOpenIter(SCommitter2 *committer) {
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
ASSERT(TARRAY2_SIZE(committer->dataIterArray) == 0);
|
||||
ASSERT(committer->dataIterMerger == NULL);
|
||||
ASSERT(TARRAY2_SIZE(committer->tombIterArray) == 0);
|
||||
ASSERT(committer->tombIterMerger == NULL);
|
||||
|
||||
STsdbIter *iter;
|
||||
STsdbIterConfig config = {0};
|
||||
|
||||
|
@ -342,10 +335,6 @@ static int32_t tsdbCommitFileSetBegin(SCommitter2 *committer) {
|
|||
committer->ctx->tbid->suid = 0;
|
||||
committer->ctx->tbid->uid = 0;
|
||||
|
||||
ASSERT(TARRAY2_SIZE(committer->dataIterArray) == 0);
|
||||
ASSERT(committer->dataIterMerger == NULL);
|
||||
ASSERT(committer->writer == NULL);
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbCommitOpenReader(committer), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(tsdbCommitOpenIter(committer), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(tsdbCommitOpenWriter(committer), &lino, _exit);
|
||||
|
@ -641,9 +630,6 @@ static int32_t tsdbCloseCommitter(SCommitter2 *committer, int32_t eno) {
|
|||
ASSERT(0);
|
||||
}
|
||||
|
||||
ASSERT(committer->writer == NULL);
|
||||
ASSERT(committer->dataIterMerger == NULL);
|
||||
ASSERT(committer->tombIterMerger == NULL);
|
||||
TARRAY2_DESTROY(committer->dataIterArray, NULL);
|
||||
TARRAY2_DESTROY(committer->tombIterArray, NULL);
|
||||
TARRAY2_DESTROY(committer->sttReaderArray, NULL);
|
||||
|
|
|
@ -283,7 +283,9 @@ int32_t tsdbDataFileReadBrinBlock(SDataFileReader *reader, const SBrinBlk *brinB
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(br.offset == br.buffer->size);
|
||||
if (br.offset != br.buffer->size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -313,7 +315,10 @@ int32_t tsdbDataFileReadBlockData(SDataFileReader *reader, const SBrinRecord *re
|
|||
// decompress
|
||||
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer);
|
||||
TAOS_CHECK_GOTO(tBlockDataDecompress(&br, bData, assist), &lino, _exit);
|
||||
ASSERT(br.offset == buffer->size);
|
||||
|
||||
if (br.offset != buffer->size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -345,7 +350,9 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe
|
|||
SBufferReader br = BUFFER_READER_INITIALIZER(0, buffer0);
|
||||
TAOS_CHECK_GOTO(tGetDiskDataHdr(&br, &hdr), &lino, _exit);
|
||||
|
||||
ASSERT(hdr.delimiter == TSDB_FILE_DLMT);
|
||||
if (hdr.delimiter != TSDB_FILE_DLMT) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
tBlockDataReset(bData);
|
||||
bData->suid = hdr.suid;
|
||||
|
@ -354,7 +361,9 @@ int32_t tsdbDataFileReadBlockDataByColumn(SDataFileReader *reader, const SBrinRe
|
|||
|
||||
// Key part
|
||||
TAOS_CHECK_GOTO(tBlockDataDecompressKeyPart(&hdr, &br, bData, assist), &lino, _exit);
|
||||
ASSERT(br.offset == buffer0->size);
|
||||
if (br.offset != buffer0->size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
int extraColIdx = -1;
|
||||
for (int i = 0; i < ncid; i++) {
|
||||
|
@ -526,7 +535,9 @@ int32_t tsdbDataFileReadBlockSma(SDataFileReader *reader, const SBrinRecord *rec
|
|||
TAOS_CHECK_GOTO(tGetColumnDataAgg(&br, sma), &lino, _exit);
|
||||
TAOS_CHECK_GOTO(TARRAY2_APPEND_PTR(columnDataAggArray, sma), &lino, _exit);
|
||||
}
|
||||
ASSERT(br.offset == record->smaSize);
|
||||
if (br.offset != record->smaSize) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -661,7 +672,8 @@ struct SDataFileWriter {
|
|||
};
|
||||
|
||||
static int32_t tsdbDataFileWriterCloseAbort(SDataFileWriter *writer) {
|
||||
ASSERT(0);
|
||||
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(writer->config->tsdb->pVnode), __func__, __FILE__, __LINE__,
|
||||
"not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -980,7 +992,9 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
|
|||
return 0;
|
||||
}
|
||||
|
||||
ASSERT(bData->uid);
|
||||
if (!bData->uid) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
@ -1234,7 +1248,6 @@ static int32_t tsdbDataFileWriteTableDataEnd(SDataFileWriter *writer) {
|
|||
|
||||
if (writer->ctx->tbHasOldData) {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileDoWriteTableOldData(writer, NULL /* as the largest key */), &lino, _exit);
|
||||
ASSERT(writer->ctx->tbHasOldData == false);
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(tsdbDataFileDoWriteBlockData(writer, writer->blockData), &lino, _exit);
|
||||
|
@ -1251,9 +1264,6 @@ static int32_t tsdbDataFileWriteTableDataBegin(SDataFileWriter *writer, const TA
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
ASSERT(writer->ctx->blockDataIdx == writer->ctx->blockData->nRow);
|
||||
ASSERT(writer->blockData->nRow == 0);
|
||||
|
||||
SMetaInfo info;
|
||||
bool drop = false;
|
||||
TABLEID tbid1[1];
|
||||
|
@ -1451,7 +1461,9 @@ int32_t tsdbFileWriteTombBlk(STsdbFD *fd, const TTombBlkArray *tombBlkArray, SFD
|
|||
}
|
||||
|
||||
static int32_t tsdbDataFileDoWriteTombBlk(SDataFileWriter *writer) {
|
||||
ASSERT(TARRAY2_SIZE(writer->tombBlkArray) > 0);
|
||||
if (TARRAY2_SIZE(writer->tombBlkArray) <= 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
@ -1523,7 +1535,9 @@ static int32_t tsdbDataFileDoWriteTombRecord(SDataFileWriter *writer, const STom
|
|||
TAOS_CHECK_GOTO(tsdbDataFileDoWriteTombBlock(writer), &lino, _exit);
|
||||
}
|
||||
} else {
|
||||
ASSERT(0);
|
||||
tsdbError("vgId:%d duplicate tomb record, cid:%" PRId64 ", suid:%" PRId64 ", uid:%" PRId64 ", version:%" PRId64,
|
||||
TD_VID(writer->config->tsdb->pVnode), writer->config->cid, record->suid, record->uid,
|
||||
record->version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1566,7 +1580,9 @@ _exit:
|
|||
|
||||
int32_t tsdbFileWriteBrinBlk(STsdbFD *fd, TBrinBlkArray *brinBlkArray, SFDataPtr *ptr, int64_t *fileSize,
|
||||
int32_t encryptAlgorithm, char *encryptKey) {
|
||||
ASSERT(TARRAY2_SIZE(brinBlkArray) > 0);
|
||||
if (TARRAY2_SIZE(brinBlkArray) <= 0) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
ptr->offset = *fileSize;
|
||||
ptr->size = TARRAY2_DATA_LEN(brinBlkArray);
|
||||
|
||||
|
@ -1852,7 +1868,9 @@ int32_t tsdbDataFileWriteBlockData(SDataFileWriter *writer, SBlockData *bData) {
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
ASSERT(bData->uid);
|
||||
if (!bData->uid) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
if (!writer->ctx->opened) {
|
||||
TAOS_CHECK_GOTO(tsdbDataFileWriterDoOpen(writer), &lino, _exit);
|
||||
|
@ -1895,7 +1913,9 @@ _exit:
|
|||
}
|
||||
|
||||
int32_t tsdbDataFileFlush(SDataFileWriter *writer) {
|
||||
ASSERT(writer->ctx->opened);
|
||||
if (!writer->ctx->opened) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
if (writer->blockData->nRow == 0) return 0;
|
||||
if (writer->ctx->tbHasOldData) return 0;
|
||||
|
@ -1910,8 +1930,6 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) {
|
|||
char fname[TSDB_FILENAME_LEN];
|
||||
int32_t ftype = TSDB_FTYPE_TOMB;
|
||||
|
||||
ASSERT(writer->files[ftype].size == 0);
|
||||
|
||||
int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
|
||||
|
||||
int32_t lcn = writer->files[ftype].lcn;
|
||||
|
|
|
@ -83,7 +83,10 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(n + sizeof(TSCKSUM) == nData);
|
||||
if (n + sizeof(TSCKSUM) != nData) {
|
||||
code = TSDB_CODE_FILE_CORRUPTED;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
_exit:
|
||||
return code;
|
||||
|
@ -450,8 +453,9 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
taosMemoryFree(pHeadF);
|
||||
}
|
||||
} else {
|
||||
ASSERT(pHeadF->offset == pSetNew->pHeadF->offset);
|
||||
ASSERT(pHeadF->size == pSetNew->pHeadF->size);
|
||||
if (pHeadF->offset != pSetNew->pHeadF->offset || pHeadF->size != pSetNew->pHeadF->size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
}
|
||||
|
||||
// data
|
||||
|
@ -499,7 +503,6 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
|||
// stt
|
||||
if (sameDisk) {
|
||||
if (pSetNew->nSttF > pSetOld->nSttF) {
|
||||
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;
|
||||
|
@ -509,7 +512,6 @@ 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);
|
||||
for (int32_t iStt = 0; iStt < pSetOld->nSttF; iStt++) {
|
||||
SSttFile *pSttFile = pSetOld->aSttF[iStt];
|
||||
nRef = atomic_sub_fetch_32(&pSttFile->nRef, 1);
|
||||
|
@ -548,8 +550,10 @@ 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);
|
||||
if (pSetOld->aSttF[iStt]->size != pSetOld->aSttF[iStt]->size ||
|
||||
pSetOld->aSttF[iStt]->offset == pSetOld->aSttF[iStt]->offset) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -777,8 +781,6 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) {
|
|||
// empty one
|
||||
code = tsdbSaveFSToFile(&pTsdb->fs, current);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
ASSERT(!rollback);
|
||||
}
|
||||
|
||||
// scan and fix FS
|
||||
|
@ -796,7 +798,6 @@ int32_t tsdbFSClose(STsdb *pTsdb) {
|
|||
int32_t code = 0;
|
||||
|
||||
if (pTsdb->fs.pDelFile) {
|
||||
ASSERT(pTsdb->fs.pDelFile->nRef == 1);
|
||||
taosMemoryFree(pTsdb->fs.pDelFile);
|
||||
}
|
||||
|
||||
|
@ -804,20 +805,16 @@ int32_t tsdbFSClose(STsdb *pTsdb) {
|
|||
SDFileSet *pSet = (SDFileSet *)taosArrayGet(pTsdb->fs.aDFileSet, iSet);
|
||||
|
||||
// head
|
||||
ASSERT(pSet->pHeadF->nRef == 1);
|
||||
taosMemoryFree(pSet->pHeadF);
|
||||
|
||||
// data
|
||||
ASSERT(pSet->pDataF->nRef == 1);
|
||||
taosMemoryFree(pSet->pDataF);
|
||||
|
||||
// sma
|
||||
ASSERT(pSet->pSmaF->nRef == 1);
|
||||
taosMemoryFree(pSet->pSmaF);
|
||||
|
||||
// stt
|
||||
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
||||
ASSERT(pSet->aSttF[iStt]->nRef == 1);
|
||||
taosMemoryFree(pSet->aSttF[iStt]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,7 +208,9 @@ static int32_t load_fs(STsdb *pTsdb, const char *fname, TFileSetArray *arr) {
|
|||
/* fmtv */
|
||||
item1 = cJSON_GetObjectItem(json, "fmtv");
|
||||
if (cJSON_IsNumber(item1)) {
|
||||
ASSERT(item1->valuedouble == 1);
|
||||
if (item1->valuedouble != 1) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
} else {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
@ -1193,7 +1195,6 @@ int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
|||
ASSERT(fset != NULL);
|
||||
|
||||
(*fset)->numWaitTask--;
|
||||
ASSERT((*fset)->numWaitTask >= 0);
|
||||
} else {
|
||||
(*fset)->taskRunning = true;
|
||||
break;
|
||||
|
|
|
@ -242,18 +242,18 @@ int32_t tsdbTFileObjInit(STsdb *pTsdb, const STFile *f, STFileObj **fobj) {
|
|||
|
||||
int32_t tsdbTFileObjRef(STFileObj *fobj) {
|
||||
int32_t nRef;
|
||||
(void)(void)taosThreadMutexLock(&fobj->mutex);
|
||||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
ASSERT(fobj->ref > 0 && fobj->state == TSDB_FSTATE_LIVE);
|
||||
nRef = ++fobj->ref;
|
||||
(void)(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
tsdbTrace("ref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
|
||||
(void)(void)taosThreadMutexLock(&fobj->mutex);
|
||||
(void)taosThreadMutexLock(&fobj->mutex);
|
||||
int32_t nRef = --fobj->ref;
|
||||
(void)(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
(void)taosThreadMutexUnlock(&fobj->mutex);
|
||||
ASSERT(nRef >= 0);
|
||||
tsdbTrace("unref file %s, fobj:%p ref %d", fobj->fname, fobj, nRef);
|
||||
if (nRef == 0) {
|
||||
|
|
|
@ -170,7 +170,6 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
|
|||
goto _err;
|
||||
}
|
||||
|
||||
ASSERT(pPool != NULL);
|
||||
// do delete
|
||||
SDelData *pDelData = (SDelData *)vnodeBufPoolMalloc(pPool, sizeof(*pDelData));
|
||||
if (pDelData == NULL) {
|
||||
|
@ -183,7 +182,6 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
|
|||
pDelData->pNext = NULL;
|
||||
taosWLockLatch(&pTbData->lock);
|
||||
if (pTbData->pHead == NULL) {
|
||||
ASSERT(pTbData->pTail == NULL);
|
||||
pTbData->pHead = pTbData->pTail = pDelData;
|
||||
} else {
|
||||
pTbData->pTail->pNext = pDelData;
|
||||
|
@ -263,8 +261,6 @@ void tsdbTbDataIterOpen(STbData *pTbData, STsdbRowKey *pFrom, int8_t backward, S
|
|||
bool tsdbTbDataIterNext(STbDataIter *pIter) {
|
||||
pIter->pRow = NULL;
|
||||
if (pIter->backward) {
|
||||
ASSERT(pIter->pNode != pIter->pTbData->sl.pTail);
|
||||
|
||||
if (pIter->pNode == pIter->pTbData->sl.pHead) {
|
||||
return false;
|
||||
}
|
||||
|
@ -274,8 +270,6 @@ bool tsdbTbDataIterNext(STbDataIter *pIter) {
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
ASSERT(pIter->pNode != pIter->pTbData->sl.pHead);
|
||||
|
||||
if (pIter->pNode == pIter->pTbData->sl.pTail) {
|
||||
return false;
|
||||
}
|
||||
|
@ -366,7 +360,6 @@ 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);
|
||||
pTbData = vnodeBufPoolMallocAligned(pPool, sizeof(*pTbData) + SL_NODE_SIZE(maxLevel) * 2);
|
||||
if (pTbData == NULL) {
|
||||
code = terrno;
|
||||
|
@ -516,8 +509,6 @@ static int32_t tbDataDoPut(SMemTable *pMemTable, STbData *pTbData, SMemSkipListN
|
|||
pNode = (SMemSkipListNode *)vnodeBufPoolMallocAligned(pPool, nSize + pRow->pTSRow->len);
|
||||
} else if (pRow->type == TSDBROW_COL_FMT) {
|
||||
pNode = (SMemSkipListNode *)vnodeBufPoolMallocAligned(pPool, nSize);
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
if (pNode == NULL) {
|
||||
code = terrno;
|
||||
|
@ -582,10 +573,6 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData,
|
|||
int32_t nColData = TARRAY_SIZE(pSubmitTbData->aCol);
|
||||
SColData *aColData = (SColData *)TARRAY_DATA(pSubmitTbData->aCol);
|
||||
|
||||
ASSERT(aColData[0].cid == PRIMARYKEY_TIMESTAMP_COL_ID);
|
||||
ASSERT(aColData[0].type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||
ASSERT(aColData[0].flag == HAS_VALUE);
|
||||
|
||||
// copy and construct block data
|
||||
SBlockData *pBlockData = vnodeBufPoolMalloc(pPool, sizeof(*pBlockData));
|
||||
if (pBlockData == NULL) {
|
||||
|
@ -740,7 +727,9 @@ int32_t tsdbRefMemTable(SMemTable *pMemTable, SQueryNode *pQNode) {
|
|||
int32_t code = 0;
|
||||
|
||||
int32_t nRef = atomic_fetch_add_32(&pMemTable->nRef, 1);
|
||||
ASSERT(nRef > 0);
|
||||
if (nRef <= 0) {
|
||||
tsdbError("vgId:%d, memtable ref count is invalid, ref:%d", TD_VID(pMemTable->pTsdb->pVnode), nRef);
|
||||
}
|
||||
|
||||
(void)vnodeBufPoolRegisterQuery(pMemTable->pPool, pQNode);
|
||||
|
||||
|
|
|
@ -69,13 +69,6 @@ static int32_t tsdbMergerClose(SMerger *merger) {
|
|||
int32_t lino = 0;
|
||||
SVnode *pVnode = merger->tsdb->pVnode;
|
||||
|
||||
ASSERT(merger->writer == NULL);
|
||||
ASSERT(merger->dataIterMerger == NULL);
|
||||
ASSERT(merger->tombIterMerger == NULL);
|
||||
ASSERT(TARRAY2_SIZE(merger->dataIterArr) == 0);
|
||||
ASSERT(TARRAY2_SIZE(merger->tombIterArr) == 0);
|
||||
ASSERT(TARRAY2_SIZE(merger->sttReaderArr) == 0);
|
||||
|
||||
// clear the merge
|
||||
TARRAY2_DESTROY(merger->tombIterArr, NULL);
|
||||
TARRAY2_DESTROY(merger->dataIterArr, NULL);
|
||||
|
@ -156,8 +149,6 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(merger->ctx->level > 0);
|
||||
|
||||
if (merger->ctx->level <= TSDB_MAX_LEVEL) {
|
||||
TARRAY2_FOREACH_REVERSE(merger->ctx->fset->lvlArr, lvl) {
|
||||
if (TARRAY2_SIZE(lvl->fobjArr) == 0) {
|
||||
|
@ -180,8 +171,6 @@ static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
|
|||
numFile = numFile - TARRAY2_SIZE(lvl->fobjArr) * pow(merger->sttTrigger, lvl->level);
|
||||
}
|
||||
|
||||
ASSERT(numFile >= 0);
|
||||
|
||||
// get file system operations
|
||||
TARRAY2_FOREACH(merger->ctx->fset->lvlArr, lvl) {
|
||||
if (lvl->level >= merger->ctx->level) {
|
||||
|
@ -323,11 +312,6 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
ASSERT(TARRAY2_SIZE(merger->sttReaderArr) == 0);
|
||||
ASSERT(TARRAY2_SIZE(merger->dataIterArr) == 0);
|
||||
ASSERT(merger->dataIterMerger == NULL);
|
||||
ASSERT(merger->writer == NULL);
|
||||
|
||||
TARRAY2_CLEAR(merger->fopArr, NULL);
|
||||
|
||||
merger->ctx->tbid->suid = 0;
|
||||
|
|
|
@ -77,7 +77,9 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) {
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(pFD->szFile % szPage == 0);
|
||||
if (pFD->szFile % szPage != 0) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_INVALID_PARA, lino, _exit);
|
||||
}
|
||||
pFD->szFile = pFD->szFile / szPage;
|
||||
|
||||
_exit:
|
||||
|
@ -202,7 +204,6 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno, int32_t encryptAlgor
|
|||
int32_t code = 0;
|
||||
int32_t lino;
|
||||
|
||||
// ASSERT(pgno <= pFD->szFile);
|
||||
if (!pFD->pFD) {
|
||||
code = tsdbOpenFileImpl(pFD);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
@ -317,8 +318,9 @@ static int32_t tsdbReadFileImp(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int6
|
|||
int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage);
|
||||
int64_t bOffset = fOffset % pFD->szPage;
|
||||
|
||||
// ASSERT(pgno && pgno <= pFD->szFile);
|
||||
ASSERT(bOffset < szPgCont);
|
||||
if (bOffset < szPgCont) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_INVALID_PARA, lino, _exit);
|
||||
}
|
||||
|
||||
while (n < size) {
|
||||
if (pFD->pgno != pgno) {
|
||||
|
@ -417,7 +419,9 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64
|
|||
int64_t pgno = OFFSET_PGNO(fOffset, pFD->szPage);
|
||||
int64_t bOffset = fOffset % pFD->szPage;
|
||||
|
||||
ASSERT(bOffset < szPgCont);
|
||||
if (bOffset >= szPgCont) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_INVALID_PARA, lino, _exit);
|
||||
}
|
||||
|
||||
// 1, find pgnoStart & pgnoEnd to fetch from s3, if all pgs are local, no need to fetch
|
||||
// 2, fetch pgnoStart ~ pgnoEnd from s3
|
||||
|
@ -690,7 +694,9 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
|
|||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
}
|
||||
}
|
||||
ASSERT(n == size);
|
||||
if (n != size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -731,7 +737,9 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) {
|
|||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
||||
}
|
||||
}
|
||||
ASSERT(n == size);
|
||||
if (n != size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -760,7 +768,9 @@ int32_t tsdbReadDataBlk(SDataFReader *pReader, SBlockIdx *pBlockIdx, SMapData *m
|
|||
int32_t n;
|
||||
code = tGetMapData(pReader->aBuf[0], mDataBlk, &n);
|
||||
if (code) goto _exit;
|
||||
ASSERT(n == size);
|
||||
if (n != size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -861,7 +871,9 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(n == size);
|
||||
if (n != size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
@ -901,7 +913,9 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) {
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT(n == size);
|
||||
if (n != size) {
|
||||
TSDB_CHECK_CODE(code = TSDB_CODE_FILE_CORRUPTED, lino, _exit);
|
||||
}
|
||||
|
||||
_exit:
|
||||
if (code) {
|
||||
|
|
|
@ -403,8 +403,6 @@ static int32_t tsdbS3FidLevel(int32_t fid, STsdbKeepCfg *pKeepCfg, int32_t s3Kee
|
|||
nowSec = nowSec * 1000000l;
|
||||
} else if (pKeepCfg->precision == TSDB_TIME_PRECISION_NANO) {
|
||||
nowSec = nowSec * 1000000000l;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
nowSec = nowSec - pKeepCfg->keepTimeOffset * tsTickPerHour[pKeepCfg->precision];
|
||||
|
|
|
@ -106,7 +106,6 @@ _exit:
|
|||
#endif
|
||||
|
||||
void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) {
|
||||
ASSERT(idx >= 0 && idx < pMapData->nItem);
|
||||
(void)tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem);
|
||||
}
|
||||
|
||||
|
@ -628,8 +627,6 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *
|
|||
*pColVal = COL_VAL_NONE(pTColumn->colId, pTColumn->type);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -697,8 +694,6 @@ int32_t tsdbRowIterOpen(STSDBRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema)
|
|||
if (code) return code;
|
||||
} else if (pRow->type == TSDBROW_COL_FMT) {
|
||||
pIter->iColData = 0;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -730,8 +725,8 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {
|
|||
return NULL;
|
||||
}
|
||||
} else {
|
||||
ASSERT(0);
|
||||
return NULL; // suppress error report by compiler
|
||||
tsdbError("invalid row type:%d", pIter->pRow->type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1745,8 +1740,6 @@ int32_t tBlockDataDecompressColData(const SDiskDataHdr *hdr, const SBlockCol *bl
|
|||
code = tBlockDataAddColData(blockData, blockCol->cid, blockCol->type, blockCol->cflag, &colData);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
// ASSERT(blockCol->flag != HAS_NONE);
|
||||
|
||||
SColDataCompressInfo info = {
|
||||
.cmprAlg = blockCol->alg,
|
||||
.columnFlag = blockCol->cflag,
|
||||
|
|
|
@ -276,7 +276,9 @@ int32_t tBrinBlockClear(SBrinBlock *brinBlock) {
|
|||
}
|
||||
|
||||
int32_t tBrinBlockPut(SBrinBlock *brinBlock, const SBrinRecord *record) {
|
||||
ASSERT(record->firstKey.key.numOfPKs == record->lastKey.key.numOfPKs);
|
||||
if (record->firstKey.key.numOfPKs != record->lastKey.key.numOfPKs) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
if (brinBlock->numOfRecords == 0) { // the first row
|
||||
brinBlock->numOfPKs = record->firstKey.key.numOfPKs;
|
||||
|
|
|
@ -103,17 +103,18 @@ int vnodeCloseBufPool(SVnode *pVnode) {
|
|||
}
|
||||
|
||||
void vnodeBufPoolReset(SVBufPool *pPool) {
|
||||
ASSERT(pPool->nQuery == 0);
|
||||
if (pPool->nQuery != 0) {
|
||||
vError("vgId:%d, buffer pool %p of id %d has %d queries, reset it may cause problem", TD_VID(pPool->pVnode), pPool,
|
||||
pPool->id, pPool->nQuery);
|
||||
}
|
||||
|
||||
for (SVBufPoolNode *pNode = pPool->pTail; pNode->prev; pNode = 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);
|
||||
}
|
||||
|
||||
ASSERT(pPool->size == pPool->ptr - pPool->node.data);
|
||||
|
||||
pPool->size = 0;
|
||||
pPool->ptr = pPool->node.data;
|
||||
}
|
||||
|
@ -123,7 +124,11 @@ void *vnodeBufPoolMallocAligned(SVBufPool *pPool, int size) {
|
|||
void *p = NULL;
|
||||
uint8_t *ptr = NULL;
|
||||
int paddingLen = 0;
|
||||
ASSERT(pPool != NULL);
|
||||
|
||||
if (pPool == NULL) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pPool->lock) taosThreadSpinLock(pPool->lock);
|
||||
|
||||
|
@ -162,7 +167,11 @@ void *vnodeBufPoolMallocAligned(SVBufPool *pPool, int size) {
|
|||
void *vnodeBufPoolMalloc(SVBufPool *pPool, int size) {
|
||||
SVBufPoolNode *pNode;
|
||||
void *p = NULL;
|
||||
ASSERT(pPool != NULL);
|
||||
|
||||
if (pPool == NULL) {
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pPool->lock) taosThreadSpinLock(pPool->lock);
|
||||
if (pPool->node.size >= pPool->ptr - pPool->node.data + size) {
|
||||
|
@ -207,7 +216,9 @@ void vnodeBufPoolFree(SVBufPool *pPool, void *p) {
|
|||
|
||||
void vnodeBufPoolRef(SVBufPool *pPool) {
|
||||
int32_t nRef = atomic_fetch_add_32(&pPool->nRef, 1);
|
||||
ASSERT(nRef > 0);
|
||||
if (nRef <= 0) {
|
||||
vError("vgId:%d, buffer pool %p of id %d is referenced by %d", TD_VID(pPool->pVnode), pPool, pPool->id, nRef);
|
||||
}
|
||||
}
|
||||
|
||||
void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
|
||||
|
|
Loading…
Reference in New Issue