Merge branch '3.0' of https://github.com/taosdata/TDengine into feat/TS-4592

This commit is contained in:
wangmm0220 2024-07-30 01:19:06 +08:00
commit c72c3f3b1d
53 changed files with 625 additions and 615 deletions

View File

@ -201,7 +201,7 @@ void qStreamSetOpen(qTaskInfo_t tinfo);
void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded); void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded);
void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset); int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset);
SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo);

View File

@ -682,13 +682,13 @@ void streamTaskCleanupCheckInfo(STaskCheckInfo* pInfo);
// fill-history task // fill-history task
int32_t streamLaunchFillHistoryTask(SStreamTask* pTask); int32_t streamLaunchFillHistoryTask(SStreamTask* pTask);
int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated); int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated);
int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration); void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration);
bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t latestVer); bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t latestVer);
// checkpoint related // checkpoint related
void streamTaskGetActiveCheckpointInfo(const SStreamTask* pTask, int32_t* pTransId, int64_t* pCheckpointId); void streamTaskGetActiveCheckpointInfo(const SStreamTask* pTask, int32_t* pTransId, int64_t* pCheckpointId);
int32_t streamTaskSetActiveCheckpointInfo(SStreamTask* pTask, int64_t activeCheckpointId); int32_t streamTaskSetActiveCheckpointInfo(SStreamTask* pTask, int64_t activeCheckpointId);
int32_t streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId); void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId);
bool streamTaskAlreadySendTrigger(SStreamTask* pTask, int32_t downstreamNodeId); bool streamTaskAlreadySendTrigger(SStreamTask* pTask, int32_t downstreamNodeId);
void streamTaskGetTriggerRecvStatus(SStreamTask* pTask, int32_t* pRecved, int32_t* pTotal); void streamTaskGetTriggerRecvStatus(SStreamTask* pTask, int32_t* pRecved, int32_t* pTotal);
void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask); void streamTaskInitTriggerDispatchInfo(SStreamTask* pTask);

View File

@ -84,7 +84,7 @@ int32_t taosWTryLockLatch(SRWLatch *pLatch);
int32_t old_ = atomic_add_fetch_32((x), 0); \ int32_t old_ = atomic_add_fetch_32((x), 0); \
if (old_ & 0x00000001) { \ if (old_ & 0x00000001) { \
if (i_ % 1000 == 0) { \ if (i_ % 1000 == 0) { \
sched_yield(); \ (void)sched_yield(); \
} \ } \
continue; \ continue; \
} }
@ -99,7 +99,7 @@ int32_t taosWTryLockLatch(SRWLatch *pLatch);
taosCorBeginRead(x) if (atomic_val_compare_exchange_32((x), old_, old_ + 1) != old_) { continue; } taosCorBeginRead(x) if (atomic_val_compare_exchange_32((x), old_, old_ + 1) != old_) { continue; }
#define taosCorEndWrite(x) \ #define taosCorEndWrite(x) \
atomic_add_fetch_32((x), 1); \ (void)atomic_add_fetch_32((x), 1); \
break; \ break; \
} }

View File

@ -706,7 +706,10 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart,
if (code) goto _exit; if (code) goto _exit;
taosArrayRemoveBatch(aRowP, iStart, nRow, (FDelete)tRowPDestroy); taosArrayRemoveBatch(aRowP, iStart, nRow, (FDelete)tRowPDestroy);
taosArrayInsert(aRowP, iStart, &pRow); if (taosArrayInsert(aRowP, iStart, &pRow) == NULL) {
code = terrno;
goto _exit;
}
_exit: _exit:
if (aIter) { if (aIter) {
@ -1708,7 +1711,7 @@ bool tTagGet(const STag *pTag, STagVal *pTagVal) {
offset = pTag->idx[midx]; offset = pTag->idx[midx];
} }
tGetTagVal(p + offset, &tv, isJson); (void)tGetTagVal(p + offset, &tv, isJson);
if (isJson) { if (isJson) {
c = tTagValJsonCmprFn(pTagVal, &tv); c = tTagValJsonCmprFn(pTagVal, &tv);
} else { } else {
@ -1758,7 +1761,7 @@ int32_t tTagToValArray(const STag *pTag, SArray **ppArray) {
} else { } else {
offset = pTag->idx[iTag]; offset = pTag->idx[iTag];
} }
tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON); (void)tGetTagVal(p + offset, &tv, pTag->flags & TD_TAG_JSON);
if (taosArrayPush(*ppArray, &tv) == NULL) { if (taosArrayPush(*ppArray, &tv) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto _err; goto _err;
@ -1788,7 +1791,7 @@ void tTagSetCid(const STag *pTag, int16_t iTag, int16_t cid) {
offset = pTag->idx[iTag]; offset = pTag->idx[iTag];
} }
tPutI16v(p + offset, cid); (void)tPutI16v(p + offset, cid);
} }
// STSchema ======================================== // STSchema ========================================
@ -3152,16 +3155,16 @@ static int32_t tColDataCopyRowSingleCol(SColData *pFromColData, int32_t iFromRow
SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow)); SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow));
} break; } break;
case HAS_VALUE: { case HAS_VALUE: {
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); (void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
} break; } break;
case (HAS_VALUE | HAS_NONE): case (HAS_VALUE | HAS_NONE):
case (HAS_VALUE | HAS_NULL): { case (HAS_VALUE | HAS_NULL): {
SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow)); SET_BIT1(pToColData->pBitMap, iToRow, GET_BIT1(pFromColData->pBitMap, iFromRow));
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); (void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
} break; } break;
case (HAS_VALUE | HAS_NULL | HAS_NONE): { case (HAS_VALUE | HAS_NULL | HAS_NONE): {
SET_BIT2(pToColData->pBitMap, iToRow, GET_BIT2(pFromColData->pBitMap, iFromRow)); SET_BIT2(pToColData->pBitMap, iToRow, GET_BIT2(pFromColData->pBitMap, iFromRow));
tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow); (void)tColDataCopyRowCell(pFromColData, iFromRow, pToColData, iToRow);
} break; } break;
default: default:
return -1; return -1;
@ -3235,24 +3238,24 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t
tColDataArrGetRowKey(aColData, nColData, j, &keyj); tColDataArrGetRowKey(aColData, nColData, j, &keyj);
while (i <= mid && j <= end) { while (i <= mid && j <= end) {
if (tRowKeyCompare(&keyi, &keyj) <= 0) { if (tRowKeyCompare(&keyi, &keyj) <= 0) {
tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); (void)tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
tColDataArrGetRowKey(aColData, nColData, i, &keyi); tColDataArrGetRowKey(aColData, nColData, i, &keyi);
} else { } else {
tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); (void)tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
tColDataArrGetRowKey(aColData, nColData, j, &keyj); tColDataArrGetRowKey(aColData, nColData, j, &keyj);
} }
} }
while (i <= mid) { while (i <= mid) {
tColDataCopyRowAppend(aColData, i++, aDstColData, nColData); (void)tColDataCopyRowAppend(aColData, i++, aDstColData, nColData);
} }
while (j <= end) { while (j <= end) {
tColDataCopyRowAppend(aColData, j++, aDstColData, nColData); (void)tColDataCopyRowAppend(aColData, j++, aDstColData, nColData);
} }
for (i = start, k = 0; i <= end; ++i, ++k) { for (i = start, k = 0; i <= end; ++i, ++k) {
tColDataCopyRow(aDstColData, k, aColData, i, nColData); (void)tColDataCopyRow(aDstColData, k, aColData, i, nColData);
} }
if (aDstColData) { if (aDstColData) {
@ -3551,7 +3554,7 @@ void tColDataSortMerge(SArray *colDataArr) {
// sort ------- // sort -------
if (doSort) { if (doSort) {
tColDataSort(aColData, nColData); (void)tColDataSort(aColData, nColData);
} }
if (doMerge != 1) { if (doMerge != 1) {
@ -4209,17 +4212,17 @@ int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value) {
int32_t offset, nextOffset; int32_t offset, nextOffset;
SBufferReader reader = BUFFER_READER_INITIALIZER(idx * sizeof(offset), &valCol->offsets); SBufferReader reader = BUFFER_READER_INITIALIZER(idx * sizeof(offset), &valCol->offsets);
tBufferGetI32(&reader, &offset); (void)tBufferGetI32(&reader, &offset);
if (idx == valCol->numOfValues - 1) { if (idx == valCol->numOfValues - 1) {
nextOffset = tBufferGetSize(&valCol->data); nextOffset = tBufferGetSize(&valCol->data);
} else { } else {
tBufferGetI32(&reader, &nextOffset); (void)tBufferGetI32(&reader, &nextOffset);
} }
value->nData = nextOffset - offset; value->nData = nextOffset - offset;
value->pData = (uint8_t *)tBufferGetDataAt(&valCol->data, offset); value->pData = (uint8_t *)tBufferGetDataAt(&valCol->data, offset);
} else { } else {
SBufferReader reader = BUFFER_READER_INITIALIZER(idx * tDataTypes[value->type].bytes, &valCol->data); SBufferReader reader = BUFFER_READER_INITIALIZER(idx * tDataTypes[value->type].bytes, &valCol->data);
tBufferGet(&reader, tDataTypes[value->type].bytes, &value->val); (void)tBufferGet(&reader, tDataTypes[value->type].bytes, &value->val);
} }
return 0; return 0;
} }
@ -4269,7 +4272,7 @@ int32_t tValueColumnDecompress(void *input, const SValueColumnCompressInfo *info
SBuffer *assist) { SBuffer *assist) {
int32_t code; int32_t code;
tValueColumnClear(valCol); (void)tValueColumnClear(valCol);
valCol->type = info->type; valCol->type = info->type;
// offset // offset
if (IS_VAR_DATA_TYPE(valCol->type)) { if (IS_VAR_DATA_TYPE(valCol->type)) {

View File

@ -522,7 +522,7 @@ int32_t tDeserializeSClientHbBatchReq(void *buf, int32_t bufLen, SClientHbBatchR
} }
if (!tDecodeIsEnd(&decoder)) { if (!tDecodeIsEnd(&decoder)) {
tDecodeI64(&decoder, &pBatchReq->ipWhiteList); if (tDecodeI64(&decoder, &pBatchReq->ipWhiteList) < 0) return -1;
} }
tEndDecode(&decoder); tEndDecode(&decoder);
@ -2163,21 +2163,21 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
char db[TSDB_DB_FNAME_LEN] = {0}; char db[TSDB_DB_FNAME_LEN] = {0};
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err; if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
int32_t len = strlen(db); int32_t len = strlen(db);
taosHashPut(pRsp->createdDbs, db, len + 1, db, len + 1); if (taosHashPut(pRsp->createdDbs, db, len + 1, db, len + 1) < 0) goto _err;
} }
for (int32_t i = 0; i < numOfReadDbs; ++i) { for (int32_t i = 0; i < numOfReadDbs; ++i) {
char db[TSDB_DB_FNAME_LEN] = {0}; char db[TSDB_DB_FNAME_LEN] = {0};
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err; if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
int32_t len = strlen(db); int32_t len = strlen(db);
taosHashPut(pRsp->readDbs, db, len + 1, db, len + 1); if (taosHashPut(pRsp->readDbs, db, len + 1, db, len + 1) < 0) goto _err;
} }
for (int32_t i = 0; i < numOfWriteDbs; ++i) { for (int32_t i = 0; i < numOfWriteDbs; ++i) {
char db[TSDB_DB_FNAME_LEN] = {0}; char db[TSDB_DB_FNAME_LEN] = {0};
if (tDecodeCStrTo(pDecoder, db) < 0) goto _err; if (tDecodeCStrTo(pDecoder, db) < 0) goto _err;
int32_t len = strlen(db); int32_t len = strlen(db);
taosHashPut(pRsp->writeDbs, db, len + 1, db, len + 1); if (taosHashPut(pRsp->writeDbs, db, len + 1, db, len + 1) < 0) goto _err;
} }
if (!tDecodeIsEnd(pDecoder)) { if (!tDecodeIsEnd(pDecoder)) {
@ -2209,7 +2209,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err; if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err; if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen + 1); if (taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen + 1) < 0) goto _err;
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
taosMemoryFreeClear(value); taosMemoryFreeClear(value);
@ -2247,7 +2247,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err; if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err; if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
taosHashPut(pRsp->alterTbs, key, keyLen, value, valuelen + 1); if (taosHashPut(pRsp->alterTbs, key, keyLen, value, valuelen + 1) < 0) goto _err;
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
taosMemoryFreeClear(value); taosMemoryFreeClear(value);
@ -2266,7 +2266,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err; if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err; if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
taosHashPut(pRsp->readViews, key, keyLen, value, valuelen + 1); if (taosHashPut(pRsp->readViews, key, keyLen, value, valuelen + 1) < 0) goto _err;
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
taosMemoryFreeClear(value); taosMemoryFreeClear(value);
@ -2304,7 +2304,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err; if ((value = taosMemoryCalloc(valuelen + 1, sizeof(char))) == NULL) goto _err;
if (tDecodeCStrTo(pDecoder, value) < 0) goto _err; if (tDecodeCStrTo(pDecoder, value) < 0) goto _err;
taosHashPut(pRsp->alterViews, key, keyLen, value, valuelen + 1); if (taosHashPut(pRsp->alterViews, key, keyLen, value, valuelen + 1) < 0) goto _err;
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
taosMemoryFreeClear(value); taosMemoryFreeClear(value);
@ -2320,7 +2320,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
int32_t ref = 0; int32_t ref = 0;
if (tDecodeI32(pDecoder, &ref) < 0) goto _err; if (tDecodeI32(pDecoder, &ref) < 0) goto _err;
taosHashPut(pRsp->useDbs, key, keyLen, &ref, sizeof(ref)); if (taosHashPut(pRsp->useDbs, key, keyLen, &ref, sizeof(ref)) < 0) goto _err;
taosMemoryFreeClear(key); taosMemoryFreeClear(key);
} }
// since 3.0.7.0 // since 3.0.7.0
@ -4240,7 +4240,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
tEncoderInit(&encoder, buf, bufLen); tEncoderInit(&encoder, buf, bufLen);
if (tStartEncode(&encoder) < 0) return -1; if (tStartEncode(&encoder) < 0) return -1;
tSerializeSDbCfgRspImpl(&encoder, pRsp); if (tSerializeSDbCfgRspImpl(&encoder, pRsp) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
tEncoderClear(&encoder); tEncoderClear(&encoder);
@ -7819,8 +7819,8 @@ int32_t tEncodeTSma(SEncoder *pCoder, const STSma *pSma) {
if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1; if (tEncodeCStr(pCoder, pSma->tagsFilter) < 0) return -1;
} }
tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow); if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaRow) < 0) return -1;
tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag); if (tEncodeSSchemaWrapper(pCoder, &pSma->schemaTag) < 0) return -1;
return 0; return 0;
} }
@ -7865,8 +7865,8 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma, bool deepCopy) {
pSma->tagsFilter = NULL; pSma->tagsFilter = NULL;
} }
// only needed in dstVgroup // only needed in dstVgroup
tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow); if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaRow) < 0) return -1;
tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag); if (tDecodeSSchemaWrapperEx(pCoder, &pSma->schemaTag) < 0) return -1;
return 0; return 0;
} }
@ -7874,7 +7874,7 @@ int32_t tDecodeTSma(SDecoder *pCoder, STSma *pSma, bool deepCopy) {
int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) { int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) {
if (tStartEncode(pCoder) < 0) return -1; if (tStartEncode(pCoder) < 0) return -1;
tEncodeTSma(pCoder, pReq); if (tEncodeTSma(pCoder, pReq) < 0) return -1;
tEndEncode(pCoder); tEndEncode(pCoder);
return 0; return 0;
@ -7883,7 +7883,7 @@ int32_t tEncodeSVCreateTSmaReq(SEncoder *pCoder, const SVCreateTSmaReq *pReq) {
int32_t tDecodeSVCreateTSmaReq(SDecoder *pCoder, SVCreateTSmaReq *pReq) { int32_t tDecodeSVCreateTSmaReq(SDecoder *pCoder, SVCreateTSmaReq *pReq) {
if (tStartDecode(pCoder) < 0) return -1; if (tStartDecode(pCoder) < 0) return -1;
tDecodeTSma(pCoder, pReq, false); if (tDecodeTSma(pCoder, pReq, false) < 0) return -1;
tEndDecode(pCoder); tEndDecode(pCoder);
return 0; return 0;
@ -10745,7 +10745,7 @@ void tFreeSMDropTbReqOnSingleVg(void *p) {
int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pReq) { int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pReq) {
SEncoder encoder = {0}; SEncoder encoder = {0};
tEncoderInit(&encoder, buf, bufLen); tEncoderInit(&encoder, buf, bufLen);
tStartEncode(&encoder); if (tStartEncode(&encoder) < 0) return -1;
int32_t size = pReq->pVgReqs ? pReq->pVgReqs->size : 0; int32_t size = pReq->pVgReqs ? pReq->pVgReqs->size : 0;
if (tEncodeI32(&encoder, size) < 0) return -1; if (tEncodeI32(&encoder, size) < 0) return -1;
for (int32_t i = 0; i < size; ++i) { for (int32_t i = 0; i < size; ++i) {
@ -10761,7 +10761,7 @@ int32_t tSerializeSMDropTbsReq(void *buf, int32_t bufLen, const SMDropTbsReq *pR
int32_t tDeserializeSMDropTbsReq(void *buf, int32_t bufLen, SMDropTbsReq *pReq) { int32_t tDeserializeSMDropTbsReq(void *buf, int32_t bufLen, SMDropTbsReq *pReq) {
SDecoder decoder = {0}; SDecoder decoder = {0};
tDecoderInit(&decoder, buf, bufLen); tDecoderInit(&decoder, buf, bufLen);
tStartDecode(&decoder); if (tStartDecode(&decoder) < 0) return -1;
int32_t size = 0; int32_t size = 0;
if (tDecodeI32(&decoder, &size) < 0) return -1; if (tDecodeI32(&decoder, &size) < 0) return -1;
pReq->pVgReqs = taosArrayInit(size, sizeof(SMDropTbReqsOnSingleVg)); pReq->pVgReqs = taosArrayInit(size, sizeof(SMDropTbReqsOnSingleVg));

View File

@ -39,9 +39,9 @@ typedef struct SMetaCache SMetaCache;
// clang-format on // clang-format on
// metaOpen ================== // metaOpen ==================
int32_t metaRLock(SMeta* pMeta); void metaRLock(SMeta* pMeta);
int32_t metaWLock(SMeta* pMeta); void metaWLock(SMeta* pMeta);
int32_t metaULock(SMeta* pMeta); void metaULock(SMeta* pMeta);
// metaEntry ================== // metaEntry ==================
int metaEncodeEntry(SEncoder* pCoder, const SMetaEntry* pME); int metaEncodeEntry(SEncoder* pCoder, const SMetaEntry* pME);

View File

@ -156,7 +156,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
} }
taosHashSetFreeFp(pMeta->pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp); taosHashSetFreeFp(pMeta->pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp);
taosThreadMutexInit(&pMeta->pCache->sTagFilterResCache.lock, NULL); (void)taosThreadMutexInit(&pMeta->pCache->sTagFilterResCache.lock, NULL);
pMeta->pCache->STbGroupResCache.pResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5); pMeta->pCache->STbGroupResCache.pResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
if (pMeta->pCache->STbGroupResCache.pResCache == NULL) { if (pMeta->pCache->STbGroupResCache.pResCache == NULL) {
@ -171,7 +171,7 @@ int32_t metaCacheOpen(SMeta* pMeta) {
} }
taosHashSetFreeFp(pMeta->pCache->STbGroupResCache.pTableEntry, freeCacheEntryFp); taosHashSetFreeFp(pMeta->pCache->STbGroupResCache.pTableEntry, freeCacheEntryFp);
taosThreadMutexInit(&pMeta->pCache->STbGroupResCache.lock, NULL); (void)taosThreadMutexInit(&pMeta->pCache->STbGroupResCache.lock, NULL);
pMeta->pCache->STbFilterCache.pStb = pMeta->pCache->STbFilterCache.pStb =
taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
@ -201,11 +201,11 @@ void metaCacheClose(SMeta* pMeta) {
statsCacheClose(pMeta); statsCacheClose(pMeta);
taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache); taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache);
taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock); (void)taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock);
taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry); taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry);
taosLRUCacheCleanup(pMeta->pCache->STbGroupResCache.pResCache); taosLRUCacheCleanup(pMeta->pCache->STbGroupResCache.pResCache);
taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock); (void)taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock);
taosHashCleanup(pMeta->pCache->STbGroupResCache.pTableEntry); taosHashCleanup(pMeta->pCache->STbGroupResCache.pTableEntry);
taosHashCleanup(pMeta->pCache->STbFilterCache.pStb); taosHashCleanup(pMeta->pCache->STbFilterCache.pStb);
@ -495,7 +495,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
} else { } else {
taosLRUCacheRelease(pCache, pRes, false); (void)taosLRUCacheRelease(pCache, pRes, false);
} }
} }
@ -552,7 +552,9 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
int32_t size = *(int32_t*)p; int32_t size = *(int32_t*)p;
// set the result into the buffer // set the result into the buffer
taosArrayAddBatch(pList1, p + sizeof(int32_t), size); if (taosArrayAddBatch(pList1, p + sizeof(int32_t), size) == NULL) {
return terrno;
}
(*pEntry)->hitTimes += 1; (*pEntry)->hitTimes += 1;
@ -562,7 +564,7 @@ int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pK
((double)(*pEntry)->hitTimes) / acc); ((double)(*pEntry)->hitTimes) / acc);
} }
taosLRUCacheRelease(pCache, pHandle, false); (void)taosLRUCacheRelease(pCache, pHandle, false);
// unlock meta // unlock meta
(void)taosThreadMutexUnlock(pLock); (void)taosThreadMutexUnlock(pLock);
@ -618,7 +620,7 @@ static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyL
p->hitTimes = 0; p->hitTimes = 0;
tdListInit(&p->list, keyLen); tdListInit(&p->list, keyLen);
TAOS_CHECK_RETURN(taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES)); TAOS_CHECK_RETURN(taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES));
tdListAppend(&p->list, pKey); (void)tdListAppend(&p->list, pKey);
return 0; return 0;
} }
@ -662,7 +664,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
} else { // check if it exists or not } else { // check if it exists or not
size_t size = listNEles(&(*pEntry)->list); size_t size = listNEles(&(*pEntry)->list);
if (size == 0) { if (size == 0) {
tdListAppend(&(*pEntry)->list, pKey); (void)tdListAppend(&(*pEntry)->list, pKey);
} else { } else {
SListNode* pNode = listHead(&(*pEntry)->list); SListNode* pNode = listHead(&(*pEntry)->list);
uint64_t* p = (uint64_t*)pNode->data; uint64_t* p = (uint64_t*)pNode->data;
@ -671,7 +673,7 @@ int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int
(void)taosThreadMutexUnlock(pLock); (void)taosThreadMutexUnlock(pLock);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { // not equal, append it } else { // not equal, append it
tdListAppend(&(*pEntry)->list, pKey); (void)tdListAppend(&(*pEntry)->list, pKey);
} }
} }
} }
@ -761,7 +763,7 @@ int32_t metaGetCachedTbGroup(void* pVnode, tb_uid_t suid, const uint8_t* pKey, i
((double)(*pEntry)->hitTimes) / acc); ((double)(*pEntry)->hitTimes) / acc);
} }
taosLRUCacheRelease(pCache, pHandle, false); (void)taosLRUCacheRelease(pCache, pHandle, false);
// unlock meta // unlock meta
(void)taosThreadMutexUnlock(pLock); (void)taosThreadMutexUnlock(pLock);
@ -839,7 +841,7 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
} else { // check if it exists or not } else { // check if it exists or not
size_t size = listNEles(&(*pEntry)->list); size_t size = listNEles(&(*pEntry)->list);
if (size == 0) { if (size == 0) {
tdListAppend(&(*pEntry)->list, pKey); (void)tdListAppend(&(*pEntry)->list, pKey);
} else { } else {
SListNode* pNode = listHead(&(*pEntry)->list); SListNode* pNode = listHead(&(*pEntry)->list);
uint64_t* p = (uint64_t*)pNode->data; uint64_t* p = (uint64_t*)pNode->data;
@ -848,13 +850,13 @@ int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int
(void)taosThreadMutexUnlock(pLock); (void)taosThreadMutexUnlock(pLock);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { // not equal, append it } else { // not equal, append it
tdListAppend(&(*pEntry)->list, pKey); (void)tdListAppend(&(*pEntry)->list, pKey);
} }
} }
} }
// add to cache. // add to cache.
taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL, (void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL,
TAOS_LRU_PRIORITY_LOW, NULL); TAOS_LRU_PRIORITY_LOW, NULL);
_end: _end:
(void)taosThreadMutexUnlock(pLock); (void)taosThreadMutexUnlock(pLock);

View File

@ -29,10 +29,10 @@ static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen
static int32_t metaInitLock(SMeta *pMeta) { static int32_t metaInitLock(SMeta *pMeta) {
TdThreadRwlockAttr attr; TdThreadRwlockAttr attr;
taosThreadRwlockAttrInit(&attr); (void)taosThreadRwlockAttrInit(&attr);
taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); (void)taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
taosThreadRwlockInit(&pMeta->lock, &attr); (void)taosThreadRwlockInit(&pMeta->lock, &attr);
taosThreadRwlockAttrDestroy(&attr); (void)taosThreadRwlockAttrDestroy(&attr);
return 0; return 0;
} }
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); } static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
@ -48,7 +48,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
char indexFullPath[128] = {0}; char indexFullPath[128] = {0};
// create handle // create handle
vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN); (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
offset = strlen(path); offset = strlen(path);
snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR); snprintf(path + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s", TD_DIRSEP, VNODE_META_DIR);
@ -56,16 +56,16 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit); TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
} }
metaInitLock(pMeta); (void)metaInitLock(pMeta);
pMeta->path = (char *)&pMeta[1]; pMeta->path = (char *)&pMeta[1];
strcpy(pMeta->path, path); strcpy(pMeta->path, path);
taosRealPath(pMeta->path, NULL, strlen(path) + 1); (void)taosRealPath(pMeta->path, NULL, strlen(path) + 1);
pMeta->pVnode = pVnode; pMeta->pVnode = pVnode;
// create path if not created yet // create path if not created yet
taosMkDir(pMeta->path); (void)taosMkDir(pMeta->path);
// open env // open env
code = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv, rollback, code = tdbOpen(pMeta->path, pVnode->config.szPage, pVnode->config.szCache, &pMeta->pEnv, rollback,
@ -186,31 +186,19 @@ int metaAlterCache(SMeta *pMeta, int32_t nPage) {
return code; return code;
} }
int32_t metaRLock(SMeta *pMeta) { void metaRLock(SMeta *pMeta) {
metaTrace("meta rlock %p", &pMeta->lock); metaTrace("meta rlock %p", &pMeta->lock);
int32_t code = taosThreadRwlockRdlock(&pMeta->lock); (void)taosThreadRwlockRdlock(&pMeta->lock);
if (code) {
return TAOS_SYSTEM_ERROR(code);
}
return 0;
} }
int32_t metaWLock(SMeta *pMeta) { void metaWLock(SMeta *pMeta) {
metaTrace("meta wlock %p", &pMeta->lock); metaTrace("meta wlock %p", &pMeta->lock);
int32_t code = taosThreadRwlockWrlock(&pMeta->lock); (void)taosThreadRwlockWrlock(&pMeta->lock);
if (code) {
return TAOS_SYSTEM_ERROR(code);
}
return 0;
} }
int32_t metaULock(SMeta *pMeta) { void metaULock(SMeta *pMeta) {
metaTrace("meta ulock %p", &pMeta->lock); metaTrace("meta ulock %p", &pMeta->lock);
int32_t code = taosThreadRwlockUnlock(&pMeta->lock); (void)taosThreadRwlockUnlock(&pMeta->lock);
if (code) {
return TAOS_SYSTEM_ERROR(code);
}
return 0;
} }
static void metaCleanup(SMeta **ppMeta) { static void metaCleanup(SMeta **ppMeta) {
@ -235,7 +223,7 @@ static void metaCleanup(SMeta **ppMeta) {
if (pMeta->pSkmDb) tdbTbClose(pMeta->pSkmDb); if (pMeta->pSkmDb) tdbTbClose(pMeta->pSkmDb);
if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb); if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb);
if (pMeta->pEnv) tdbClose(pMeta->pEnv); if (pMeta->pEnv) tdbClose(pMeta->pEnv);
metaDestroyLock(pMeta); (void)metaDestroyLock(pMeta);
taosMemoryFreeClear(*ppMeta); taosMemoryFreeClear(*ppMeta);
} }

View File

@ -252,7 +252,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
if (!pTbCur->paused) { if (!pTbCur->paused) {
metaReaderClear(&pTbCur->mr); metaReaderClear(&pTbCur->mr);
if (pTbCur->pDbc) { if (pTbCur->pDbc) {
tdbTbcClose((TBC *)pTbCur->pDbc); (void)tdbTbcClose((TBC *)pTbCur->pDbc);
} }
} }
taosMemoryFree(pTbCur); taosMemoryFree(pTbCur);
@ -262,7 +262,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
void metaPauseTbCursor(SMTbCursor *pTbCur) { void metaPauseTbCursor(SMTbCursor *pTbCur) {
if (!pTbCur->paused) { if (!pTbCur->paused) {
metaReaderClear(&pTbCur->mr); metaReaderClear(&pTbCur->mr);
tdbTbcClose((TBC *)pTbCur->pDbc); (void)tdbTbcClose((TBC *)pTbCur->pDbc);
pTbCur->paused = 1; pTbCur->paused = 1;
} }
} }
@ -270,10 +270,10 @@ void metaResumeTbCursor(SMTbCursor *pTbCur, int8_t first, int8_t move) {
if (pTbCur->paused) { if (pTbCur->paused) {
metaReaderDoInit(&pTbCur->mr, pTbCur->pMeta, META_READER_LOCK); metaReaderDoInit(&pTbCur->mr, pTbCur->pMeta, META_READER_LOCK);
tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL); (void)tdbTbcOpen(((SMeta *)pTbCur->pMeta)->pUidIdx, (TBC **)&pTbCur->pDbc, NULL);
if (first) { if (first) {
tdbTbcMoveToFirst((TBC *)pTbCur->pDbc); (void)tdbTbcMoveToFirst((TBC *)pTbCur->pDbc);
} else { } else {
int c = 1; int c = 1;
tdbTbcMoveTo(pTbCur->pDbc, pTbCur->pKey, pTbCur->kLen, &c); tdbTbcMoveTo(pTbCur->pDbc, pTbCur->pKey, pTbCur->kLen, &c);
@ -433,7 +433,7 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) {
if (!pCtbCur->paused) { if (!pCtbCur->paused) {
if (pCtbCur->pMeta && pCtbCur->lock) metaULock(pCtbCur->pMeta); if (pCtbCur->pMeta && pCtbCur->lock) metaULock(pCtbCur->pMeta);
if (pCtbCur->pCur) { if (pCtbCur->pCur) {
tdbTbcClose(pCtbCur->pCur); (void)tdbTbcClose(pCtbCur->pCur);
} }
} }
tdbFree(pCtbCur->pKey); tdbFree(pCtbCur->pKey);
@ -444,7 +444,7 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) {
void metaPauseCtbCursor(SMCtbCursor *pCtbCur) { void metaPauseCtbCursor(SMCtbCursor *pCtbCur) {
if (!pCtbCur->paused) { if (!pCtbCur->paused) {
tdbTbcClose((TBC *)pCtbCur->pCur); (void)tdbTbcClose((TBC *)pCtbCur->pCur);
if (pCtbCur->lock) { if (pCtbCur->lock) {
metaULock(pCtbCur->pMeta); metaULock(pCtbCur->pMeta);
} }
@ -552,7 +552,7 @@ void metaCloseStbCursor(SMStbCursor *pStbCur) {
if (pStbCur) { if (pStbCur) {
if (pStbCur->pMeta) metaULock(pStbCur->pMeta); if (pStbCur->pMeta) metaULock(pStbCur->pMeta);
if (pStbCur->pCur) { if (pStbCur->pCur) {
tdbTbcClose(pStbCur->pCur); (void)tdbTbcClose(pStbCur->pCur);
tdbFree(pStbCur->pKey); tdbFree(pStbCur->pKey);
tdbFree(pStbCur->pVal); tdbFree(pStbCur->pVal);
@ -603,19 +603,19 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
skmDbKey.uid = suid ? suid : uid; skmDbKey.uid = suid ? suid : uid;
skmDbKey.sver = INT32_MAX; skmDbKey.sver = INT32_MAX;
tdbTbcOpen(pMeta->pSkmDb, &pSkmDbC, NULL); (void)tdbTbcOpen(pMeta->pSkmDb, &pSkmDbC, NULL);
metaRLock(pMeta); metaRLock(pMeta);
if (tdbTbcMoveTo(pSkmDbC, &skmDbKey, sizeof(skmDbKey), &c) < 0) { if (tdbTbcMoveTo(pSkmDbC, &skmDbKey, sizeof(skmDbKey), &c) < 0) {
metaULock(pMeta); metaULock(pMeta);
tdbTbcClose(pSkmDbC); (void)tdbTbcClose(pSkmDbC);
code = TSDB_CODE_NOT_FOUND; code = TSDB_CODE_NOT_FOUND;
goto _exit; goto _exit;
} }
if (c == 0) { if (c == 0) {
metaULock(pMeta); metaULock(pMeta);
tdbTbcClose(pSkmDbC); (void)tdbTbcClose(pSkmDbC);
code = TSDB_CODE_FAILED; code = TSDB_CODE_FAILED;
metaError("meta/query: incorrect c: %" PRId32 ".", c); metaError("meta/query: incorrect c: %" PRId32 ".", c);
goto _exit; goto _exit;
@ -631,7 +631,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
if (((SSkmDbKey *)pKey)->uid != skmDbKey.uid) { if (((SSkmDbKey *)pKey)->uid != skmDbKey.uid) {
metaULock(pMeta); metaULock(pMeta);
tdbTbcClose(pSkmDbC); (void)tdbTbcClose(pSkmDbC);
code = TSDB_CODE_NOT_FOUND; code = TSDB_CODE_NOT_FOUND;
goto _exit; goto _exit;
} }
@ -639,7 +639,7 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
sver = ((SSkmDbKey *)pKey)->sver; sver = ((SSkmDbKey *)pKey)->sver;
metaULock(pMeta); metaULock(pMeta);
tdbTbcClose(pSkmDbC); (void)tdbTbcClose(pSkmDbC);
} }
} }
@ -765,7 +765,7 @@ void metaCloseSmaCursor(SMSmaCursor *pSmaCur) {
if (pSmaCur) { if (pSmaCur) {
if (pSmaCur->pMeta) metaULock(pSmaCur->pMeta); if (pSmaCur->pMeta) metaULock(pSmaCur->pMeta);
if (pSmaCur->pCur) { if (pSmaCur->pCur) {
tdbTbcClose(pSmaCur->pCur); (void)tdbTbcClose(pSmaCur->pCur);
tdbFree(pSmaCur->pKey); tdbFree(pSmaCur->pKey);
tdbFree(pSmaCur->pVal); tdbFree(pSmaCur->pVal);
@ -1086,7 +1086,7 @@ int32_t metaFilterCreateTime(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
END: END:
if (pCursor->pMeta) metaULock(pCursor->pMeta); if (pCursor->pMeta) metaULock(pCursor->pMeta);
if (pCursor->pCur) tdbTbcClose(pCursor->pCur); if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
taosMemoryFree(pCursor); taosMemoryFree(pCursor);
return ret; return ret;
} }
@ -1153,7 +1153,7 @@ int32_t metaFilterTableName(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
END: END:
if (pCursor->pMeta) metaULock(pCursor->pMeta); if (pCursor->pMeta) metaULock(pCursor->pMeta);
if (pCursor->pCur) tdbTbcClose(pCursor->pCur); if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
taosMemoryFree(buf); taosMemoryFree(buf);
taosMemoryFree(pKey); taosMemoryFree(pKey);
@ -1182,7 +1182,7 @@ int32_t metaFilterTtl(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
END: END:
if (pCursor->pMeta) metaULock(pCursor->pMeta); if (pCursor->pMeta) metaULock(pCursor->pMeta);
if (pCursor->pCur) tdbTbcClose(pCursor->pCur); if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
taosMemoryFree(buf); taosMemoryFree(buf);
taosMemoryFree(pKey); taosMemoryFree(pKey);
@ -1353,7 +1353,7 @@ int32_t metaFilterTableIds(void *pVnode, SMetaFltParam *arg, SArray *pUids) {
END: END:
if (pCursor->pMeta) metaULock(pCursor->pMeta); if (pCursor->pMeta) metaULock(pCursor->pMeta);
if (pCursor->pCur) tdbTbcClose(pCursor->pCur); if (pCursor->pCur) (void)tdbTbcClose(pCursor->pCur);
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
tDecoderClear(&dc); tDecoderClear(&dc);
tdbFree(pData); tdbFree(pData);

View File

@ -59,7 +59,7 @@ _exit:
void metaSnapReaderClose(SMetaSnapReader** ppReader) { void metaSnapReaderClose(SMetaSnapReader** ppReader) {
if (ppReader && *ppReader) { if (ppReader && *ppReader) {
tdbTbcClose((*ppReader)->pTbc); (void)tdbTbcClose((*ppReader)->pTbc);
taosMemoryFree(*ppReader); taosMemoryFree(*ppReader);
*ppReader = NULL; *ppReader = NULL;
} }
@ -87,7 +87,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
if (key.version < pReader->sver // if (key.version < pReader->sver //
|| metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) { || metaGetInfo(pReader->pMeta, key.uid, &info, NULL) == TSDB_CODE_NOT_FOUND) {
tdbTbcMoveToNext(pReader->pTbc); (void)tdbTbcMoveToNext(pReader->pTbc);
continue; continue;
} }
@ -110,7 +110,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d", metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d",
TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData); TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData);
tdbTbcMoveToNext(pReader->pTbc); (void)tdbTbcMoveToNext(pReader->pTbc);
break; break;
} }
@ -223,17 +223,17 @@ static int32_t MoveToSnapShotVersion(SSnapContext* ctx) {
int32_t code = 0; int32_t code = 0;
(void)tdbTbcClose((TBC*)ctx->pCur); (void)tdbTbcClose((TBC*)ctx->pCur);
code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL); code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
STbDbKey key = {.version = ctx->snapVersion, .uid = INT64_MAX}; STbDbKey key = {.version = ctx->snapVersion, .uid = INT64_MAX};
int c = 0; int c = 0;
code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c); code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
if (c < 0) { if (c < 0) {
tdbTbcMoveToPrev((TBC*)ctx->pCur); (void)tdbTbcMoveToPrev((TBC*)ctx->pCur);
} }
return 0; return 0;
} }
@ -241,13 +241,13 @@ static int32_t MoveToSnapShotVersion(SSnapContext* ctx) {
static int32_t MoveToPosition(SSnapContext* ctx, int64_t ver, int64_t uid) { static int32_t MoveToPosition(SSnapContext* ctx, int64_t ver, int64_t uid) {
(void)tdbTbcClose((TBC*)ctx->pCur); (void)tdbTbcClose((TBC*)ctx->pCur);
int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL); int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
STbDbKey key = {.version = ver, .uid = uid}; STbDbKey key = {.version = ver, .uid = uid};
int c = 0; int c = 0;
code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c); code = tdbTbcMoveTo((TBC*)ctx->pCur, &key, sizeof(key), &c);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
return c; return c;
@ -256,11 +256,11 @@ static int32_t MoveToPosition(SSnapContext* ctx, int64_t ver, int64_t uid) {
static int32_t MoveToFirst(SSnapContext* ctx) { static int32_t MoveToFirst(SSnapContext* ctx) {
(void)tdbTbcClose((TBC*)ctx->pCur); (void)tdbTbcClose((TBC*)ctx->pCur);
int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL); int32_t code = tdbTbcOpen(ctx->pMeta->pTbDb, (TBC**)&ctx->pCur, NULL);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
code = tdbTbcMoveToFirst((TBC*)ctx->pCur); code = tdbTbcMoveToFirst((TBC*)ctx->pCur);
if (code != 0){ if (code != 0) {
return TAOS_GET_TERRNO(code); return TAOS_GET_TERRNO(code);
} }
return 0; return 0;
@ -274,35 +274,36 @@ static int32_t saveSuperTableInfoForChildTable(SMetaEntry* me, SHashObj* suidInf
int32_t code = 0; int32_t code = 0;
STableInfoForChildTable dataTmp = {0}; STableInfoForChildTable dataTmp = {0};
dataTmp.tableName = taosStrdup(me->name); dataTmp.tableName = taosStrdup(me->name);
if (dataTmp.tableName == NULL){ if (dataTmp.tableName == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto END; goto END;
} }
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow); dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
if (dataTmp.schemaRow == NULL){ if (dataTmp.schemaRow == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto END; goto END;
} }
dataTmp.tagRow = tCloneSSchemaWrapper(&me->stbEntry.schemaTag); dataTmp.tagRow = tCloneSSchemaWrapper(&me->stbEntry.schemaTag);
if (dataTmp.tagRow == NULL){ if (dataTmp.tagRow == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto END; goto END;
} }
code = taosHashPut(suidInfo, &me->uid, sizeof(tb_uid_t), &dataTmp, sizeof(STableInfoForChildTable)); code = taosHashPut(suidInfo, &me->uid, sizeof(tb_uid_t), &dataTmp, sizeof(STableInfoForChildTable));
if (code != 0){ if (code != 0) {
goto END; goto END;
} }
return 0; return 0;
END: END:
destroySTableInfoForChildTable(&dataTmp); destroySTableInfoForChildTable(&dataTmp);
return TAOS_GET_TERRNO(code);; return TAOS_GET_TERRNO(code);
;
} }
int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8_t subType, int8_t withMeta, int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8_t subType, int8_t withMeta,
SSnapContext** ctxRet) { SSnapContext** ctxRet) {
SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext)); SSnapContext* ctx = taosMemoryCalloc(1, sizeof(SSnapContext));
if (ctx == NULL){ if (ctx == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
} }
*ctxRet = ctx; *ctxRet = ctx;
@ -319,14 +320,16 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
ctx->suidInfo = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); ctx->suidInfo = taosHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
if (ctx->suidInfo == NULL) { if (ctx->suidInfo == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);; return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
;
} }
taosHashSetFreeFp(ctx->suidInfo, destroySTableInfoForChildTable); taosHashSetFreeFp(ctx->suidInfo, destroySTableInfoForChildTable);
ctx->index = 0; ctx->index = 0;
ctx->idList = taosArrayInit(100, sizeof(int64_t)); ctx->idList = taosArrayInit(100, sizeof(int64_t));
if (ctx->idList == NULL){ if (ctx->idList == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);; return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
;
} }
void* pKey = NULL; void* pKey = NULL;
void* pVal = NULL; void* pVal = NULL;
@ -334,7 +337,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
metaDebug("tmqsnap init snapVersion:%" PRIi64, ctx->snapVersion); metaDebug("tmqsnap init snapVersion:%" PRIi64, ctx->snapVersion);
int32_t code = MoveToFirst(ctx); int32_t code = MoveToFirst(ctx);
if (code != 0){ if (code != 0) {
return code; return code;
} }
while (1) { while (1) {
@ -348,7 +351,8 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
continue; continue;
} }
if (tdbTbGet(ctx->pMeta->pUidIdx, &tmp->uid, sizeof(tb_uid_t), NULL, NULL) < 0) { // check if table exist for now, need optimize later if (tdbTbGet(ctx->pMeta->pUidIdx, &tmp->uid, sizeof(tb_uid_t), NULL, NULL) <
0) { // check if table exist for now, need optimize later
continue; continue;
} }
@ -356,7 +360,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
SMetaEntry me = {0}; SMetaEntry me = {0};
tDecoderInit(&dc, pVal, vLen); tDecoderInit(&dc, pVal, vLen);
ret = metaDecodeEntry(&dc, &me); ret = metaDecodeEntry(&dc, &me);
if (ret < 0){ if (ret < 0) {
tDecoderClear(&dc); tDecoderClear(&dc);
return TAOS_GET_TERRNO(ret); return TAOS_GET_TERRNO(ret);
} }
@ -368,7 +372,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
} }
} }
if (taosArrayPush(ctx->idList, &tmp->uid) == NULL){ if (taosArrayPush(ctx->idList, &tmp->uid) == NULL) {
tDecoderClear(&dc); tDecoderClear(&dc);
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
} }
@ -383,7 +387,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
taosHashClear(ctx->idVersion); taosHashClear(ctx->idVersion);
code = MoveToSnapShotVersion(ctx); code = MoveToSnapShotVersion(ctx);
if (code != 0){ if (code != 0) {
return code; return code;
} }
while (1) { while (1) {
@ -405,7 +409,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
SMetaEntry me = {0}; SMetaEntry me = {0};
tDecoderInit(&dc, pVal, vLen); tDecoderInit(&dc, pVal, vLen);
ret = metaDecodeEntry(&dc, &me); ret = metaDecodeEntry(&dc, &me);
if (ret < 0){ if (ret < 0) {
tDecoderClear(&dc); tDecoderClear(&dc);
return TAOS_GET_TERRNO(ret); return TAOS_GET_TERRNO(ret);
} }
@ -421,7 +425,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_SUPER_TABLE) || if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_SUPER_TABLE) ||
(ctx->subType == TOPIC_SUB_TYPE__TABLE && me.uid == ctx->suid)) { (ctx->subType == TOPIC_SUB_TYPE__TABLE && me.uid == ctx->suid)) {
ret = saveSuperTableInfoForChildTable(&me, ctx->suidInfo); ret = saveSuperTableInfoForChildTable(&me, ctx->suidInfo);
if (ret != 0){ if (ret != 0) {
tDecoderClear(&dc); tDecoderClear(&dc);
return ret; return ret;
} }
@ -431,7 +435,7 @@ int32_t buildSnapContext(SVnode* pVnode, int64_t snapVersion, int64_t suid, int8
for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) { for (int i = 0; i < taosArrayGetSize(ctx->idList); i++) {
int64_t* uid = taosArrayGet(ctx->idList, i); int64_t* uid = taosArrayGet(ctx->idList, i);
if (uid == NULL){ if (uid == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
} }
SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t)); SIdInfo* idData = (SIdInfo*)taosHashGet(ctx->idVersion, uid, sizeof(int64_t));
@ -467,7 +471,7 @@ static int32_t buildNormalChildTableInfo(SVCreateTbReq* req, void** pBuf, int32_
ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
goto end; goto end;
} }
if (taosArrayPush(reqs.pArray, req) == NULL){ if (taosArrayPush(reqs.pArray, req) == NULL) {
ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); ret = TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
goto end; goto end;
} }
@ -540,10 +544,10 @@ int32_t setForSnapShot(SSnapContext* ctx, int64_t uid) {
return 0; return 0;
} }
void taosXSetTablePrimaryKey(SSnapContext* ctx, int64_t uid){ void taosXSetTablePrimaryKey(SSnapContext* ctx, int64_t uid) {
bool ret = false; bool ret = false;
SSchemaWrapper *schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1); SSchemaWrapper* schema = metaGetTableSchema(ctx->pMeta, uid, -1, 1);
if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY){ if (schema && schema->nCols >= 2 && schema->pSchema[1].flags & COL_IS_KEY) {
ret = true; ret = true;
} }
tDeleteSchemaWrapper(schema); tDeleteSchemaWrapper(schema);
@ -711,7 +715,7 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
return 0; return 0;
} }
int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index); int64_t* uidTmp = taosArrayGet(ctx->idList, ctx->index);
if (uidTmp == NULL){ if (uidTmp == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
} }
ctx->index++; ctx->index++;
@ -728,21 +732,21 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
continue; continue;
} }
ret = tdbTbcGet((TBC*)ctx->pCur, (const void**)&pKey, &kLen, (const void**)&pVal, &vLen); ret = tdbTbcGet((TBC*)ctx->pCur, (const void**)&pKey, &kLen, (const void**)&pVal, &vLen);
if (ret != 0){ if (ret != 0) {
return TAOS_GET_TERRNO(ret); return TAOS_GET_TERRNO(ret);
} }
SDecoder dc = {0}; SDecoder dc = {0};
SMetaEntry me = {0}; SMetaEntry me = {0};
tDecoderInit(&dc, pVal, vLen); tDecoderInit(&dc, pVal, vLen);
ret = metaDecodeEntry(&dc, &me); ret = metaDecodeEntry(&dc, &me);
if (ret != 0){ if (ret != 0) {
tDecoderClear(&dc); tDecoderClear(&dc);
return TAOS_GET_TERRNO(ret); return TAOS_GET_TERRNO(ret);
} }
metaDebug("tmqsnap get uid info uid:%" PRIi64 " name:%s index:%d", me.uid, me.name, ctx->index - 1); metaDebug("tmqsnap get uid info uid:%" PRIi64 " name:%s index:%d", me.uid, me.name, ctx->index - 1);
if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_CHILD_TABLE) || if ((ctx->subType == TOPIC_SUB_TYPE__DB && me.type == TSDB_CHILD_TABLE) ||
(ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)){ (ctx->subType == TOPIC_SUB_TYPE__TABLE && me.type == TSDB_CHILD_TABLE && me.ctbEntry.suid == ctx->suid)) {
STableInfoForChildTable* data = STableInfoForChildTable* data =
(STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t)); (STableInfoForChildTable*)taosHashGet(ctx->suidInfo, &me.ctbEntry.suid, sizeof(tb_uid_t));
if (data == NULL) { if (data == NULL) {
@ -763,7 +767,7 @@ int32_t getMetaTableInfoFromSnapshot(SSnapContext* ctx, SMetaTableInfo* result)
result->uid = me.uid; result->uid = me.uid;
tstrncpy(result->tbName, me.name, TSDB_TABLE_NAME_LEN); tstrncpy(result->tbName, me.name, TSDB_TABLE_NAME_LEN);
tDecoderClear(&dc); tDecoderClear(&dc);
if(result->schema == NULL){ if (result->schema == NULL) {
return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY); return TAOS_GET_TERRNO(TSDB_CODE_OUT_OF_MEMORY);
} }
break; break;

View File

@ -161,10 +161,10 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len); term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
} }
if (term != NULL) { if (term != NULL) {
indexMultiTermAdd(terms, term); (void)indexMultiTermAdd(terms, term);
} }
} }
indexJsonPut(pMeta->pTagIvtIdx, terms, tuid); (void)indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
indexMultiTermDestroy(terms); indexMultiTermDestroy(terms);
taosArrayDestroy(pTagVals); taosArrayDestroy(pTagVals);
@ -223,7 +223,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len); term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
} }
if (term != NULL) { if (term != NULL) {
indexMultiTermAdd(terms, term); (void)indexMultiTermAdd(terms, term);
} }
} }
indexJsonPut(pMeta->pTagIvtIdx, terms, tuid); indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
@ -239,7 +239,7 @@ static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) {
int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries; int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries;
if (deltaTS > tsTimeSeriesThreshold) { if (deltaTS > tsTimeSeriesThreshold) {
if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) { if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) {
tsem_post(&dmNotifyHdl.sem); (void)tsem_post(&dmNotifyHdl.sem);
} }
} }
#endif #endif
@ -323,10 +323,10 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
// drop all child tables // drop all child tables
TBC *pCtbIdxc = NULL; TBC *pCtbIdxc = NULL;
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); (void)(void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = pReq->suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
if (rc < 0) { if (rc < 0) {
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
metaWLock(pMeta); metaWLock(pMeta);
goto _drop_super_table; goto _drop_super_table;
} }
@ -344,7 +344,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
(void)taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid)); (void)taosArrayPush(tbUidList, &(((SCtbIdxKey *)pKey)->uid));
} }
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
(void)tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid); (void)tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid);
@ -352,19 +352,19 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) { for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) {
tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild); tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild);
metaDropTableByUid(pMeta, uid, NULL, NULL, NULL); (void)metaDropTableByUid(pMeta, uid, NULL, NULL, NULL);
} }
// drop super table // drop super table
_drop_super_table: _drop_super_table:
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData); tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid}, (void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
sizeof(STbDbKey), pMeta->txn); sizeof(STbDbKey), pMeta->txn);
tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn); (void)tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn); (void)tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn); (void)tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
metaStatsCacheDrop(pMeta, pReq->suid); (void)metaStatsCacheDrop(pMeta, pReq->suid);
metaULock(pMeta); metaULock(pMeta);
@ -387,10 +387,10 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
int nKey = 0; int nKey = 0;
TBC *pCtbIdxc = NULL; TBC *pCtbIdxc = NULL;
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); (void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
if (rc < 0) { if (rc < 0) {
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
metaWLock(pMeta); metaWLock(pMeta);
return; return;
} }
@ -410,7 +410,7 @@ static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
tdbFree(pKey); tdbFree(pKey);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
} }
int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
@ -425,28 +425,28 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
int32_t ret; int32_t ret;
int32_t c = -2; int32_t c = -2;
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); (void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c); ret = tdbTbcMoveTo(pUidIdxc, &pReq->suid, sizeof(tb_uid_t), &c);
if (ret < 0 || c) { if (ret < 0 || c) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST; return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
} }
ret = tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData); ret = tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
if (ret < 0) { if (ret < 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST; return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
} }
oversion = ((SUidIdxVal *)pData)[0].version; oversion = ((SUidIdxVal *)pData)[0].version;
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); (void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c); ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = pReq->suid, .version = oversion}), sizeof(STbDbKey), &c);
if (!(ret == 0 && c == 0)) { if (!(ret == 0 && c == 0)) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
metaError("meta/table: invalide ret: %" PRId32 " or c: %" PRId32 "alter stb failed.", ret, c); metaError("meta/table: invalide ret: %" PRId32 " or c: %" PRId32 "alter stb failed.", ret, c);
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST; return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
@ -454,8 +454,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData); ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
if (ret < 0) { if (ret < 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
return terrno = TSDB_CODE_TDB_STB_NOT_EXIST; return terrno = TSDB_CODE_TDB_STB_NOT_EXIST;
} }
@ -512,19 +512,19 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
metaWLock(pMeta); metaWLock(pMeta);
// compare two entry // compare two entry
if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) { if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) {
metaSaveToSkmDb(pMeta, &nStbEntry); (void)metaSaveToSkmDb(pMeta, &nStbEntry);
} }
// update table.db // update table.db
metaSaveToTbDb(pMeta, &nStbEntry); (void)metaSaveToTbDb(pMeta, &nStbEntry);
// update uid index // update uid index
metaUpdateUidIdx(pMeta, &nStbEntry); (void)metaUpdateUidIdx(pMeta, &nStbEntry);
// metaStatsCacheDrop(pMeta, nStbEntry.uid); // metaStatsCacheDrop(pMeta, nStbEntry.uid);
if (updStat) { if (updStat) {
metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol); (void)metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol);
} }
metaULock(pMeta); metaULock(pMeta);
@ -540,8 +540,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
_exit: _exit:
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
tDecoderClear(&dc); tDecoderClear(&dc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
return 0; return 0;
} }
int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
@ -619,10 +619,10 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
* iterator all pTdDbc by uid and version * iterator all pTdDbc by uid and version
*/ */
TBC *pCtbIdxc = NULL; TBC *pCtbIdxc = NULL;
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); (void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
if (rc < 0) { if (rc < 0) {
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
for (;;) { for (;;) {
@ -632,7 +632,7 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
if (rc < 0) { if (rc < 0) {
tdbFree(pKey); tdbFree(pKey);
tdbFree(pVal); tdbFree(pVal);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
pCtbIdxc = NULL; pCtbIdxc = NULL;
break; break;
} }
@ -667,7 +667,7 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
tdbFree(pVal); tdbFree(pVal);
if (rc < 0) { if (rc < 0) {
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
@ -688,16 +688,16 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
metaWLock(pMeta); metaWLock(pMeta);
// update table.db // update table.db
metaSaveToTbDb(pMeta, &nStbEntry); (void)metaSaveToTbDb(pMeta, &nStbEntry);
// update uid index // update uid index
metaUpdateUidIdx(pMeta, &nStbEntry); (void)metaUpdateUidIdx(pMeta, &nStbEntry);
metaULock(pMeta); metaULock(pMeta);
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
tDecoderClear(&dc); tDecoderClear(&dc);
tdbFree(pData); tdbFree(pData);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
_err: _err:
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
@ -756,10 +756,10 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
* iterator all pTdDbc by uid and version * iterator all pTdDbc by uid and version
*/ */
TBC *pCtbIdxc = NULL; TBC *pCtbIdxc = NULL;
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); (void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
if (rc < 0) { if (rc < 0) {
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
for (;;) { for (;;) {
@ -769,7 +769,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
if (rc < 0) { if (rc < 0) {
tdbFree(pKey); tdbFree(pKey);
tdbFree(pVal); tdbFree(pVal);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
pCtbIdxc = NULL; pCtbIdxc = NULL;
break; break;
} }
@ -804,12 +804,12 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
tdbFree(pVal); tdbFree(pVal);
if (rc < 0) { if (rc < 0) {
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
metaWLock(pMeta); metaWLock(pMeta);
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn); (void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
metaULock(pMeta); metaULock(pMeta);
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
pTagIdxKey = NULL; pTagIdxKey = NULL;
@ -836,9 +836,9 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
metaWLock(pMeta); metaWLock(pMeta);
// update table.db // update table.db
metaSaveToTbDb(pMeta, &nStbEntry); (void)metaSaveToTbDb(pMeta, &nStbEntry);
// update uid index // update uid index
metaUpdateUidIdx(pMeta, &nStbEntry); (void)metaUpdateUidIdx(pMeta, &nStbEntry);
metaULock(pMeta); metaULock(pMeta);
tDeleteSchemaWrapper(tag); tDeleteSchemaWrapper(tag);
@ -849,7 +849,7 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
tDecoderClear(&dc); tDecoderClear(&dc);
tdbFree(pData); tdbFree(pData);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
_err: _err:
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
@ -942,9 +942,9 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
} }
metaWLock(pMeta); metaWLock(pMeta);
metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0); (void)metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0);
metaUidCacheClear(pMeta, me.ctbEntry.suid); (void)metaUidCacheClear(pMeta, me.ctbEntry.suid);
metaTbGroupCacheClear(pMeta, me.ctbEntry.suid); (void)metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
metaULock(pMeta); metaULock(pMeta);
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
@ -982,7 +982,7 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
(*pMetaRsp)->suid = pReq->ctb.suid; (*pMetaRsp)->suid = pReq->ctb.suid;
strcpy((*pMetaRsp)->tbName, pReq->name); strcpy((*pMetaRsp)->tbName, pReq->name);
} else { } else {
metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp); (void)metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
for (int32_t i = 0; i < pReq->colCmpr.nCols; i++) { for (int32_t i = 0; i < pReq->colCmpr.nCols; i++) {
SColCmpr *p = &pReq->colCmpr.pColCmpr[i]; SColCmpr *p = &pReq->colCmpr.pColCmpr[i];
(*pMetaRsp)->pSchemaExt[i].colId = p->id; (*pMetaRsp)->pSchemaExt[i].colId = p->id;
@ -1062,7 +1062,7 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
tb_uid_t suid = 0; tb_uid_t suid = 0;
int8_t sysTbl = 0; int8_t sysTbl = 0;
int type; int type;
metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl); (void)metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) { if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) {
int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t)); int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t));
if (pVal) { if (pVal) {
@ -1111,7 +1111,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
code = tdbTbcMoveToFirst(pCur); code = tdbTbcMoveToFirst(pCur);
if (code) { if (code) {
tdbTbcClose(pCur); (void)tdbTbcClose(pCur);
return code; return code;
} }
@ -1142,7 +1142,7 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
} }
tdbFree(pData); tdbFree(pData);
tdbFree(pKey); tdbFree(pKey);
tdbTbcClose(pCur); (void)tdbTbcClose(pCur);
return 0; return 0;
} }
@ -1296,7 +1296,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid, if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
&pTagIdxKey, &nTagIdxKey) == 0) { &pTagIdxKey, &nTagIdxKey) == 0) {
tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn); (void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
} }
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
pTagIdxKey = NULL; pTagIdxKey = NULL;
@ -1308,9 +1308,9 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
} }
} }
tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn); (void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn); (void)tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn); (void)tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e); if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e);
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e); if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
@ -1318,12 +1318,13 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e); if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e);
if (e.type == TSDB_CHILD_TABLE) { if (e.type == TSDB_CHILD_TABLE) {
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn); (void)tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey),
pMeta->txn);
--pMeta->pVnode->config.vndStats.numOfCTables; --pMeta->pVnode->config.vndStats.numOfCTables;
metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0); (void)metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
metaUidCacheClear(pMeta, e.ctbEntry.suid); (void)metaUidCacheClear(pMeta, e.ctbEntry.suid);
metaTbGroupCacheClear(pMeta, e.ctbEntry.suid); (void)metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
/* /*
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) { if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL); tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
@ -1341,10 +1342,10 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
} }
*/ */
} else if (e.type == TSDB_SUPER_TABLE) { } else if (e.type == TSDB_SUPER_TABLE) {
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn); (void)tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
// drop schema.db (todo) // drop schema.db (todo)
metaStatsCacheDrop(pMeta, uid); (void)metaStatsCacheDrop(pMeta, uid);
metaUidCacheClear(pMeta, uid); metaUidCacheClear(pMeta, uid);
metaTbGroupCacheClear(pMeta, uid); metaTbGroupCacheClear(pMeta, uid);
--pMeta->pVnode->config.vndStats.numOfSTables; --pMeta->pVnode->config.vndStats.numOfSTables;
@ -1423,10 +1424,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
// search uid index // search uid index
TBC *pUidIdxc = NULL; TBC *pUidIdxc = NULL;
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); (void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c); metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
@ -1437,11 +1438,11 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
// search table.db // search table.db
TBC *pTbDbc = NULL; TBC *pTbDbc = NULL;
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); (void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c); metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
@ -1455,8 +1456,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
tDecoderInit(&dc, entry.pBuf, nData); tDecoderInit(&dc, entry.pBuf, nData);
ret = metaDecodeEntry(&dc, &entry); ret = metaDecodeEntry(&dc, &entry);
if (ret != 0) { if (ret != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tDecoderClear(&dc); tDecoderClear(&dc);
metaError("meta/table: invalide ret: %" PRId32 " alt tb column failed.", ret); metaError("meta/table: invalide ret: %" PRId32 " alt tb column failed.", ret);
return ret; return ret;
@ -1620,20 +1621,20 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
// do actual write // do actual write
metaWLock(pMeta); metaWLock(pMeta);
metaDeleteNcolIdx(pMeta, &oldEntry); (void)metaDeleteNcolIdx(pMeta, &oldEntry);
metaUpdateNcolIdx(pMeta, &entry); (void)metaUpdateNcolIdx(pMeta, &entry);
// save to table db // save to table db
metaSaveToTbDb(pMeta, &entry); (void)metaSaveToTbDb(pMeta, &entry);
metaUpdateUidIdx(pMeta, &entry); (void)metaUpdateUidIdx(pMeta, &entry);
metaSaveToSkmDb(pMeta, &entry); (void)metaSaveToSkmDb(pMeta, &entry);
metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); (void)metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
metaULock(pMeta); metaULock(pMeta);
metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp); (void)metaUpdateMetaRsp(uid, pAlterTbReq->tbName, pSchema, pMetaRsp);
for (int32_t i = 0; i < entry.colCmpr.nCols; i++) { for (int32_t i = 0; i < entry.colCmpr.nCols; i++) {
SColCmpr *p = &entry.colCmpr.pColCmpr[i]; SColCmpr *p = &entry.colCmpr.pColCmpr[i];
pMetaRsp->pSchemaExt[i].colId = p->id; pMetaRsp->pSchemaExt[i].colId = p->id;
@ -1644,16 +1645,16 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
if (pNewSchema) taosMemoryFree(pNewSchema); if (pNewSchema) taosMemoryFree(pNewSchema);
if (freeColCmpr) taosMemoryFree(entry.colCmpr.pColCmpr); if (freeColCmpr) taosMemoryFree(entry.colCmpr.pColCmpr);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tDecoderClear(&dc); tDecoderClear(&dc);
return 0; return 0;
_err: _err:
if (entry.pBuf) taosMemoryFree(entry.pBuf); if (entry.pBuf) taosMemoryFree(entry.pBuf);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tDecoderClear(&dc); tDecoderClear(&dc);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
@ -1688,10 +1689,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
// search uid index // search uid index
TBC *pUidIdxc = NULL; TBC *pUidIdxc = NULL;
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); (void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c); metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c);
return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST; return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
} }
@ -1705,11 +1706,11 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
SDecoder dc2 = {0}; SDecoder dc2 = {0};
/* get ctbEntry */ /* get ctbEntry */
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); (void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c); metaError("meta/table: invalide c: %" PRId32 " update tb tag val failed.", c);
return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST; return terrno = TSDB_CODE_TDB_TABLE_NOT_EXIST;
} }
@ -1802,12 +1803,12 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
metaWLock(pMeta); metaWLock(pMeta);
// save to table.db // save to table.db
metaSaveToTbDb(pMeta, &ctbEntry); (void)metaSaveToTbDb(pMeta, &ctbEntry);
// save to uid.idx // save to uid.idx
metaUpdateUidIdx(pMeta, &ctbEntry); (void)metaUpdateUidIdx(pMeta, &ctbEntry);
metaUpdateTagIdx(pMeta, &ctbEntry); (void)metaUpdateTagIdx(pMeta, &ctbEntry);
if (NULL == ctbEntry.ctbEntry.pTags) { if (NULL == ctbEntry.ctbEntry.pTags) {
metaError("meta/table: null tags, update tag val failed."); metaError("meta/table: null tags, update tag val failed.");
@ -1818,10 +1819,10 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags, tdbTbUpsert(pMeta->pCtbIdx, &ctbIdxKey, sizeof(ctbIdxKey), ctbEntry.ctbEntry.pTags,
((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn); ((STag *)(ctbEntry.ctbEntry.pTags))->len, pMeta->txn);
metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid); (void)metaUidCacheClear(pMeta, ctbEntry.ctbEntry.suid);
metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid); (void)metaTbGroupCacheClear(pMeta, ctbEntry.ctbEntry.suid);
metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs); (void)metaUpdateChangeTime(pMeta, ctbEntry.uid, pAlterTbReq->ctimeMs);
metaULock(pMeta); metaULock(pMeta);
@ -1830,8 +1831,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
taosMemoryFree((void *)ctbEntry.ctbEntry.pTags); taosMemoryFree((void *)ctbEntry.ctbEntry.pTags);
if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf); if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf);
if (stbEntry.pBuf) tdbFree(stbEntry.pBuf); if (stbEntry.pBuf) tdbFree(stbEntry.pBuf);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
return 0; return 0;
_err: _err:
@ -1839,8 +1840,8 @@ _err:
tDecoderClear(&dc2); tDecoderClear(&dc2);
if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf); if (ctbEntry.pBuf) taosMemoryFree(ctbEntry.pBuf);
if (stbEntry.pBuf) tdbFree(stbEntry.pBuf); if (stbEntry.pBuf) tdbFree(stbEntry.pBuf);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
return -1; return -1;
} }
@ -1868,10 +1869,10 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
// search uid index // search uid index
TBC *pUidIdxc = NULL; TBC *pUidIdxc = NULL;
tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL); (void)tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL);
tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c); tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c); metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
@ -1882,11 +1883,11 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
// search table.db // search table.db
TBC *pTbDbc = NULL; TBC *pTbDbc = NULL;
tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL); (void)tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL);
tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c); tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
if (c != 0) { if (c != 0) {
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c); metaError("meta/table: invalide c: %" PRId32 " update tb options failed.", c);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
@ -1901,8 +1902,8 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
ret = metaDecodeEntry(&dc, &entry); ret = metaDecodeEntry(&dc, &entry);
if (ret != 0) { if (ret != 0) {
tDecoderClear(&dc); tDecoderClear(&dc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
metaError("meta/table: invalide ret: %" PRId32 " alt tb options failed.", ret); metaError("meta/table: invalide ret: %" PRId32 " alt tb options failed.", ret);
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
@ -1912,9 +1913,9 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
// build SMetaEntry // build SMetaEntry
if (entry.type == TSDB_CHILD_TABLE) { if (entry.type == TSDB_CHILD_TABLE) {
if (pAlterTbReq->updateTTL) { if (pAlterTbReq->updateTTL) {
metaDeleteTtl(pMeta, &entry); (void)metaDeleteTtl(pMeta, &entry);
entry.ctbEntry.ttlDays = pAlterTbReq->newTTL; entry.ctbEntry.ttlDays = pAlterTbReq->newTTL;
metaUpdateTtl(pMeta, &entry); (void)metaUpdateTtl(pMeta, &entry);
} }
if (pAlterTbReq->newCommentLen >= 0) { if (pAlterTbReq->newCommentLen >= 0) {
entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen; entry.ctbEntry.commentLen = pAlterTbReq->newCommentLen;
@ -1922,9 +1923,9 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
} }
} else { } else {
if (pAlterTbReq->updateTTL) { if (pAlterTbReq->updateTTL) {
metaDeleteTtl(pMeta, &entry); (void)metaDeleteTtl(pMeta, &entry);
entry.ntbEntry.ttlDays = pAlterTbReq->newTTL; entry.ntbEntry.ttlDays = pAlterTbReq->newTTL;
metaUpdateTtl(pMeta, &entry); (void)metaUpdateTtl(pMeta, &entry);
} }
if (pAlterTbReq->newCommentLen >= 0) { if (pAlterTbReq->newCommentLen >= 0) {
entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen; entry.ntbEntry.commentLen = pAlterTbReq->newCommentLen;
@ -1933,14 +1934,14 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
} }
// save to table db // save to table db
metaSaveToTbDb(pMeta, &entry); (void)metaSaveToTbDb(pMeta, &entry);
metaUpdateUidIdx(pMeta, &entry); (void)metaUpdateUidIdx(pMeta, &entry);
metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs); (void)metaUpdateChangeTime(pMeta, entry.uid, pAlterTbReq->ctimeMs);
metaULock(pMeta); metaULock(pMeta);
tdbTbcClose(pTbDbc); (void)tdbTbcClose(pTbDbc);
tdbTbcClose(pUidIdxc); (void)tdbTbcClose(pUidIdxc);
tDecoderClear(&dc); tDecoderClear(&dc);
if (entry.pBuf) taosMemoryFree(entry.pBuf); if (entry.pBuf) taosMemoryFree(entry.pBuf);
return 0; return 0;
@ -2017,10 +2018,10 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb
* iterator all pTdDbc by uid and version * iterator all pTdDbc by uid and version
*/ */
TBC *pCtbIdxc = NULL; TBC *pCtbIdxc = NULL;
tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL); (void)tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c); int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
if (rc < 0) { if (rc < 0) {
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
for (;;) { for (;;) {
@ -2057,14 +2058,14 @@ static int metaAddTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterTb
tdbFree(pKey); tdbFree(pKey);
tdbFree(pVal); tdbFree(pVal);
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
goto _err; goto _err;
} }
tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn); tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
metaDestroyTagIdxKey(pTagIdxKey); metaDestroyTagIdxKey(pTagIdxKey);
pTagIdxKey = NULL; pTagIdxKey = NULL;
} }
tdbTbcClose(pCtbIdxc); (void)tdbTbcClose(pCtbIdxc);
return 0; return 0;
_err: _err:
@ -2156,7 +2157,7 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
SArray *tagIdxList = taosArrayInit(512, sizeof(SMetaPair)); SArray *tagIdxList = taosArrayInit(512, sizeof(SMetaPair));
TBC *pTagIdxc = NULL; TBC *pTagIdxc = NULL;
tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL); (void)tdbTbcOpen(pMeta->pTagIdx, &pTagIdxc, NULL);
int rc = int rc =
tdbTbcMoveTo(pTagIdxc, &(STagIdxKey){.suid = suid, .cid = INT32_MIN, .type = pCol->type}, sizeof(STagIdxKey), &c); tdbTbcMoveTo(pTagIdxc, &(STagIdxKey){.suid = suid, .cid = INT32_MIN, .type = pCol->type}, sizeof(STagIdxKey), &c);
for (;;) { for (;;) {
@ -2173,12 +2174,12 @@ static int metaDropTagIndex(SMeta *pMeta, int64_t version, SVAlterTbReq *pAlterT
SMetaPair pair = {.key = pKey, nKey = nKey}; SMetaPair pair = {.key = pKey, nKey = nKey};
(void)taosArrayPush(tagIdxList, &pair); (void)taosArrayPush(tagIdxList, &pair);
} }
tdbTbcClose(pTagIdxc); (void)tdbTbcClose(pTagIdxc);
metaWLock(pMeta); metaWLock(pMeta);
for (int i = 0; i < taosArrayGetSize(tagIdxList); i++) { for (int i = 0; i < taosArrayGetSize(tagIdxList); i++) {
SMetaPair *pair = taosArrayGet(tagIdxList, i); SMetaPair *pair = taosArrayGet(tagIdxList, i);
tdbTbDelete(pMeta->pTagIdx, pair->key, pair->nkey, pMeta->txn); (void)tdbTbDelete(pMeta->pTagIdx, pair->key, pair->nkey, pMeta->txn);
} }
metaULock(pMeta); metaULock(pMeta);
@ -2265,9 +2266,9 @@ int32_t metaUpdateTableColCompress(SMeta *pMeta, int64_t version, SVAlterTbReq *
tbEntry.version = version; tbEntry.version = version;
metaWLock(pMeta); metaWLock(pMeta);
metaSaveToTbDb(pMeta, &tbEntry); (void)metaSaveToTbDb(pMeta, &tbEntry);
metaUpdateUidIdx(pMeta, &tbEntry); (void)metaUpdateUidIdx(pMeta, &tbEntry);
metaUpdateChangeTime(pMeta, suid, pReq->ctimeMs); (void)metaUpdateChangeTime(pMeta, suid, pReq->ctimeMs);
metaULock(pMeta); metaULock(pMeta);

View File

@ -169,7 +169,7 @@ void tqPushEmptyDataRsp(STqHandle* pHandle, int32_t vgId) {
} }
dataRsp.common.blockNum = 0; dataRsp.common.blockNum = 0;
char buf[TSDB_OFFSET_LEN] = {0}; char buf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset); (void) tFormatOffset(buf, TSDB_OFFSET_LEN, &dataRsp.common.reqOffset);
tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, reqId:0x%" PRIx64, req.consumerId, vgId, buf, tqInfo("tqPushEmptyDataRsp to consumer:0x%" PRIx64 " vgId:%d, offset:%s, reqId:0x%" PRIx64, req.consumerId, vgId, buf,
req.reqId); req.reqId);
@ -187,8 +187,8 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq*
char buf1[TSDB_OFFSET_LEN] = {0}; char buf1[TSDB_OFFSET_LEN] = {0};
char buf2[TSDB_OFFSET_LEN] = {0}; char buf2[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset); (void) tFormatOffset(buf1, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->reqOffset);
tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset); (void) tFormatOffset(buf2, TSDB_OFFSET_LEN, &((SMqDataRspCommon*)pRsp)->rspOffset);
tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%" PRIx64, tqDebug("tmq poll vgId:%d consumer:0x%" PRIx64 " (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%" PRIx64,
vgId, pReq->consumerId, pReq->epoch, ((SMqDataRspCommon*)pRsp)->blockNum, buf1, buf2, pReq->reqId); vgId, pReq->consumerId, pReq->epoch, ((SMqDataRspCommon*)pRsp)->blockNum, buf1, buf2, pReq->reqId);
@ -412,7 +412,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
} }
char buf[TSDB_OFFSET_LEN] = {0}; char buf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset); (void) tFormatOffset(buf, TSDB_OFFSET_LEN, &reqOffset);
tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%" PRIx64, tqDebug("tmq poll: consumer:0x%" PRIx64 " (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%" PRIx64,
consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId); consumerId, req.epoch, pHandle->subKey, vgId, buf, req.reqId);
@ -745,7 +745,7 @@ int32_t tqBuildStreamTask(void* pTqObj, SStreamTask* pTask, int64_t nextProcessV
} }
streamTaskResetUpstreamStageInfo(pTask); streamTaskResetUpstreamStageInfo(pTask);
streamSetupScheduleTrigger(pTask); (void) streamSetupScheduleTrigger(pTask);
SCheckpointInfo* pChkInfo = &pTask->chkInfo; SCheckpointInfo* pChkInfo = &pTask->chkInfo;
tqSetRestoreVersionInfo(pTask); tqSetRestoreVersionInfo(pTask);
@ -801,8 +801,11 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
if (done) { if (done) {
qDebug("s-task:%s scan wal(step 2) verRange:%" PRId64 "-%" PRId64 " ended, elapsed time:%.2fs", id, pStep2Range->minVer, qDebug("s-task:%s scan wal(step 2) verRange:%" PRId64 "-%" PRId64 " ended, elapsed time:%.2fs", id, pStep2Range->minVer,
pStep2Range->maxVer, 0.0); pStep2Range->maxVer, 0.0);
streamTaskPutTranstateIntoInputQ(pTask); int32_t code = streamTaskPutTranstateIntoInputQ(pTask); // todo: msg lost.
streamExecTask(pTask); // exec directly if (code) {
qError("s-task:%s failed put trans-state into inputQ, code:%s", id, tstrerror(code));
}
(void) streamExecTask(pTask); // exec directly
} else { } else {
STimeWindow* pWindow = &pTask->dataRange.window; STimeWindow* pWindow = &pTask->dataRange.window;
tqDebug("s-task:%s level:%d verRange:%" PRId64 "-%" PRId64 " window:%" PRId64 "-%" PRId64 tqDebug("s-task:%s level:%d verRange:%" PRId64 "-%" PRId64 " window:%" PRId64 "-%" PRId64
@ -811,7 +814,10 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
pStreamTask->id.idStr); pStreamTask->id.idStr);
ASSERT(pTask->status.schedStatus == TASK_SCHED_STATUS__WAITING); ASSERT(pTask->status.schedStatus == TASK_SCHED_STATUS__WAITING);
streamSetParamForStreamScannerStep2(pTask, pStep2Range, pWindow); int32_t code = streamSetParamForStreamScannerStep2(pTask, pStep2Range, pWindow);
if (code) {
tqError("s-task:%s level:%d failed to set step2 param", id, pTask->info.taskLevel);
}
int64_t dstVer = pStep2Range->minVer; int64_t dstVer = pStep2Range->minVer;
pTask->chkInfo.nextProcessVer = dstVer; pTask->chkInfo.nextProcessVer = dstVer;
@ -820,12 +826,12 @@ static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask
tqDebug("s-task:%s wal reader start scan WAL verRange:%" PRId64 "-%" PRId64 ", set sched-status:%d", id, dstVer, tqDebug("s-task:%s wal reader start scan WAL verRange:%" PRId64 "-%" PRId64 ", set sched-status:%d", id, dstVer,
pStep2Range->maxVer, TASK_SCHED_STATUS__INACTIVE); pStep2Range->maxVer, TASK_SCHED_STATUS__INACTIVE);
/*int8_t status = */ streamTaskSetSchedStatusInactive(pTask); (void) streamTaskSetSchedStatusInactive(pTask);
// now the fill-history task starts to scan data from wal files. // now the fill-history task starts to scan data from wal files.
int32_t code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE); code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE);
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
tqScanWalAsync(pTq, false); (void) tqScanWalAsync(pTq, false);
} }
} }
} }
@ -949,11 +955,11 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
pTask->streamTaskId.taskId, pTask->id.idStr); pTask->streamTaskId.taskId, pTask->id.idStr);
tqDebug("s-task:%s fill-history task set status to be dropping", id); tqDebug("s-task:%s fill-history task set status to be dropping", id);
streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0); code = streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
atomic_store_32(&pTask->status.inScanHistorySentinel, 0); atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
return -1; return code; // todo: handle failure
} }
ASSERT(pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE); ASSERT(pStreamTask->info.taskLevel == TASK_LEVEL__SOURCE);
@ -971,15 +977,14 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
// extracted submit data from wal files for all tasks // extracted submit data from wal files for all tasks
if (pReq->reqType == STREAM_EXEC_T_EXTRACT_WAL_DATA) { if (pReq->reqType == STREAM_EXEC_T_EXTRACT_WAL_DATA) {
tqScanWal(pTq); return tqScanWal(pTq);
return 0;
} }
int32_t code = tqStreamTaskProcessRunReq(pTq->pStreamMeta, pMsg, vnodeIsRoleLeader(pTq->pVnode)); int32_t code = tqStreamTaskProcessRunReq(pTq->pStreamMeta, pMsg, vnodeIsRoleLeader(pTq->pVnode));
// let's continue scan data in the wal files // let's continue scan data in the wal files
if (code == 0 && (pReq->reqType >= 0 || pReq->reqType == STREAM_EXEC_T_RESUME_TASK)) { if (code == 0 && (pReq->reqType >= 0 || pReq->reqType == STREAM_EXEC_T_RESUME_TASK)) {
tqScanWalAsync(pTq, false); (void) tqScanWalAsync(pTq, false); // it's ok to failed
} }
return code; return code;
@ -1044,7 +1049,11 @@ int32_t tqStreamProgressRetrieveReq(STQ *pTq, SRpcMsg *pMsg) {
pRsp->subFetchIdx = req.subFetchIdx; pRsp->subFetchIdx = req.subFetchIdx;
pRsp->vgId = req.vgId; pRsp->vgId = req.vgId;
pRsp->streamId = req.streamId; pRsp->streamId = req.streamId;
tSerializeStreamProgressRsp(pRsp, sizeof(SStreamProgressRsp) + sizeof(SMsgHead), pRsp); code = tSerializeStreamProgressRsp(pRsp, sizeof(SStreamProgressRsp) + sizeof(SMsgHead), pRsp);
if (code) {
goto _OVER;
}
SRpcMsg rsp = {.info = pMsg->info, .code = 0}; SRpcMsg rsp = {.info = pMsg->info, .code = 0};
rsp.pCont = pRspBuf; rsp.pCont = pRspBuf;
pRspBuf = NULL; pRspBuf = NULL;
@ -1079,18 +1088,18 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
tqError("vgId:%d failed to decode checkpoint-source msg, code:%s", vgId, tstrerror(code)); tqError("vgId:%d failed to decode checkpoint-source msg, code:%s", vgId, tstrerror(code));
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return code; return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
} }
tDecoderClear(&decoder); tDecoderClear(&decoder);
if (!vnodeIsRoleLeader(pTq->pVnode)) { if (!vnodeIsRoleLeader(pTq->pVnode)) {
tqDebug("vgId:%d not leader, ignore checkpoint-source msg, s-task:0x%x", vgId, req.taskId); tqDebug("vgId:%d not leader, ignore checkpoint-source msg, s-task:0x%x", vgId, req.taskId);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS; // always return success to mnode, todo: handle failure of build and send msg to mnode
} }
if (!pTq->pVnode->restored) { if (!pTq->pVnode->restored) {
@ -1098,9 +1107,9 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
", transId:%d s-task:0x%x ignore it", ", transId:%d s-task:0x%x ignore it",
vgId, req.checkpointId, req.transId, req.taskId); vgId, req.checkpointId, req.transId, req.taskId);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS; // always return success to mnode, , todo: handle failure of build and send msg to mnode
} }
SStreamTask* pTask = NULL; SStreamTask* pTask = NULL;
@ -1110,7 +1119,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
" transId:%d it may have been destroyed", " transId:%d it may have been destroyed",
vgId, req.taskId, req.checkpointId, req.transId); vgId, req.taskId, req.checkpointId, req.transId);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1123,13 +1132,13 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS; // todo retry handle error
} }
// todo save the checkpoint failed info // todo save the checkpoint failed info
taosThreadMutexLock(&pTask->lock); streamMutexLock(&pTask->lock);
ETaskStatus status = streamTaskGetStatus(pTask).state; ETaskStatus status = streamTaskGetStatus(pTask).state;
if (req.mndTrigger == 1) { if (req.mndTrigger == 1) {
@ -1137,13 +1146,12 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
tqError("s-task:%s not ready for checkpoint, since it is halt, ignore checkpointId:%" PRId64 ", set it failure", tqError("s-task:%s not ready for checkpoint, since it is halt, ignore checkpointId:%" PRId64 ", set it failure",
pTask->id.idStr, req.checkpointId); pTask->id.idStr, req.checkpointId);
taosThreadMutexUnlock(&pTask->lock); streamMutexUnlock(&pTask->lock);
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
} else { } else {
@ -1162,7 +1170,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
" transId:%d already handled, ignore msg and continue process checkpoint", " transId:%d already handled, ignore msg and continue process checkpoint",
pTask->id.idStr, checkpointId, req.transId); pTask->id.idStr, checkpointId, req.transId);
taosThreadMutexUnlock(&pTask->lock); streamMutexUnlock(&pTask->lock);
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -1171,19 +1179,24 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
tqWarn("s-task:%s repeatly recv checkpoint-source msg checkpointId:%" PRId64 tqWarn("s-task:%s repeatly recv checkpoint-source msg checkpointId:%" PRId64
" transId:%d already handled, return success", pTask->id.idStr, req.checkpointId, req.transId); " transId:%d already handled, return success", pTask->id.idStr, req.checkpointId, req.transId);
taosThreadMutexUnlock(&pTask->lock); streamMutexUnlock(&pTask->lock);
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
} }
streamProcessCheckpointSourceReq(pTask, &req); code = streamProcessCheckpointSourceReq(pTask, &req);
taosThreadMutexUnlock(&pTask->lock); streamMutexUnlock(&pTask->lock);
if (code) {
qError("s-task:%s (vgId:%d) failed to process checkpoint-source req, code:%s", pTask->id.idStr, vgId, tstrerror(code));
return code;
}
if (req.mndTrigger) { if (req.mndTrigger) {
qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d, ", pTask->id.idStr, qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d, ", pTask->id.idStr,
@ -1198,13 +1211,13 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask); code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
SRpcMsg rsp = {0}; SRpcMsg rsp = {0};
streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS); (void) streamTaskBuildCheckpointSourceRsp(&req, &pMsg->info, &rsp, TSDB_CODE_SUCCESS);
tmsgSendRsp(&rsp); // error occurs tmsgSendRsp(&rsp); // error occurs
return code; return TSDB_CODE_SUCCESS;
} }
streamMetaReleaseTask(pMeta, pTask); streamMetaReleaseTask(pMeta, pTask);
return code; return TSDB_CODE_SUCCESS;
} }
// downstream task has complete the stream task checkpoint procedure, let's start the handle the rsp by execute task // downstream task has complete the stream task checkpoint procedure, let's start the handle the rsp by execute task

View File

@ -115,14 +115,15 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
if (pDataBlock == NULL) { if (pDataBlock == NULL) {
break; break;
} }
STqOffsetVal offset = {0}; STqOffsetVal offset = {0};
qStreamExtractOffset(task, &offset); code = qStreamExtractOffset(task, &offset);
TSDB_CHECK_CODE(code, line, END);
pHandle->block = NULL; pHandle->block = NULL;
code = createOneDataBlock(pDataBlock, true, &pHandle->block); code = createOneDataBlock(pDataBlock, true, &pHandle->block);
if (code) { TSDB_CHECK_CODE(code, line, END);
return code;
}
pHandle->blockTime = offset.ts; pHandle->blockTime = offset.ts;
tOffsetDestroy(&offset); tOffsetDestroy(&offset);
@ -140,8 +141,11 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
} else { } else {
code = copyDataBlock(pHandle->block, pDataBlock); code = copyDataBlock(pHandle->block, pDataBlock);
TSDB_CHECK_CODE(code, line, END); TSDB_CHECK_CODE(code, line, END);
STqOffsetVal offset = {0}; STqOffsetVal offset = {0};
qStreamExtractOffset(task, &offset); code = qStreamExtractOffset(task, &offset);
TSDB_CHECK_CODE(code, line, END);
pRsp->sleepTime = offset.ts - pHandle->blockTime; pRsp->sleepTime = offset.ts - pHandle->blockTime;
pHandle->blockTime = offset.ts; pHandle->blockTime = offset.ts;
tOffsetDestroy(&offset); tOffsetDestroy(&offset);
@ -164,10 +168,11 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
tqDebug("consumer:0x%" PRIx64 " vgId:%d tmq task executed finished, total blocks:%d, totalRows:%d", tqDebug("consumer:0x%" PRIx64 " vgId:%d tmq task executed finished, total blocks:%d, totalRows:%d",
pHandle->consumerId, vgId, pRsp->common.blockNum, totalRows); pHandle->consumerId, vgId, pRsp->common.blockNum, totalRows);
qStreamExtractOffset(task, &pRsp->common.rspOffset); code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
END: END:
if ( code!= 0){ if (code != 0) {
tqError("consumer:0x%" PRIx64 " vgId:%d tmq task executed error, line:%d code:%d", pHandle->consumerId, vgId, line, code); tqError("consumer:0x%" PRIx64 " vgId:%d tmq task executed error, line:%d code:%d", pHandle->consumerId, vgId, line,
code);
} }
return code; return code;
} }
@ -241,31 +246,40 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqBatc
// get meta // get meta
SMqBatchMetaRsp* tmp = qStreamExtractMetaMsg(task); SMqBatchMetaRsp* tmp = qStreamExtractMetaMsg(task);
if (taosArrayGetSize(tmp->batchMetaReq) > 0) { if (taosArrayGetSize(tmp->batchMetaReq) > 0) {
qStreamExtractOffset(task, &tmp->rspOffset); code = qStreamExtractOffset(task, &tmp->rspOffset);
if (code) {
return code;
}
*pBatchMetaRsp = *tmp; *pBatchMetaRsp = *tmp;
tqDebug("tmqsnap task get meta"); tqDebug("tmqsnap task get meta");
break; break;
} }
if (pDataBlock == NULL) { if (pDataBlock == NULL) {
qStreamExtractOffset(task, pOffset); code = qStreamExtractOffset(task, pOffset);
if (code) {
break;
}
if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) {
continue; continue;
} }
tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode), tqDebug("tmqsnap vgId: %d, tsdb consume over, switch to wal, ver %" PRId64, TD_VID(pTq->pVnode),
pHandle->snapshotVer + 1); pHandle->snapshotVer + 1);
qStreamExtractOffset(task, &pRsp->common.rspOffset); code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
break; break;
} }
if (pRsp->common.blockNum > 0) { if (pRsp->common.blockNum > 0) {
tqDebug("tmqsnap task exec exited, get data"); tqDebug("tmqsnap task exec exited, get data");
qStreamExtractOffset(task, &pRsp->common.rspOffset); code = qStreamExtractOffset(task, &pRsp->common.rspOffset);
break; break;
} }
} }
return 0; return code;
} }

View File

@ -3274,7 +3274,7 @@ _err:
TAOS_RETURN(code); TAOS_RETURN(code);
} }
void tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h) { taosLRUCacheRelease(pCache, h, false); } void tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h) { (void)taosLRUCacheRelease(pCache, h, false); }
void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity) { void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity) {
taosLRUCacheSetCapacity(pVnode->pTsdb->lruCache, capacity); taosLRUCacheSetCapacity(pVnode->pTsdb->lruCache, capacity);

View File

@ -135,7 +135,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig
for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) { for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) {
if (config->files[i].exist) { if (config->files[i].exist) {
char fname1[TSDB_FILENAME_LEN]; char fname1[TSDB_FILENAME_LEN];
tsdbTFileName(config->tsdb, &config->files[i].file, fname1); (void)tsdbTFileName(config->tsdb, &config->files[i].file, fname1);
int32_t lcn = config->files[i].file.lcn; int32_t lcn = config->files[i].file.lcn;
TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd[i], lcn), &lino, _exit); TAOS_CHECK_GOTO(tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd[i], lcn), &lino, _exit);
} }
@ -667,7 +667,7 @@ static int32_t tsdbDataFileWriterCloseAbort(SDataFileWriter *writer) {
static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) { static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
if (writer->ctx->reader) { if (writer->ctx->reader) {
tsdbDataFileReaderClose(&writer->ctx->reader); (void)tsdbDataFileReaderClose(&writer->ctx->reader);
} }
tTombBlockDestroy(writer->tombBlock); tTombBlockDestroy(writer->tombBlock);
@ -857,7 +857,7 @@ int32_t tsdbFileWriteBrinBlock(STsdbFD *fd, SBrinBlock *brinBlock, uint32_t cmpr
} }
} }
tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer); (void)tsdbWriterUpdVerRange(range, brinBlk.minVer, brinBlk.maxVer);
// write to file // write to file
for (int32_t i = 0; i < 10; ++i) { for (int32_t i = 0; i < 10; ++i) {
@ -1018,7 +1018,7 @@ static int32_t tsdbDataFileDoWriteBlockData(SDataFileWriter *writer, SBlockData
} }
} }
tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer); (void)tsdbWriterUpdVerRange(&writer->ctx->range, record->minVer, record->maxVer);
code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, bData->suid != 0 ? bData->suid : bData->uid, code = metaGetColCmpr(writer->config->tsdb->pVnode->pMeta, bData->suid != 0 ? bData->suid : bData->uid,
&cmprInfo.pColCmpr); &cmprInfo.pColCmpr);
@ -1371,7 +1371,7 @@ int32_t tsdbFileWriteTombBlock(STsdbFD *fd, STombBlock *tombBlock, int8_t cmprAl
} }
} }
tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer); (void)tsdbWriterUpdVerRange(range, tombBlk.minVer, tombBlk.maxVer);
for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); i++) { for (int32_t i = 0; i < ARRAY_SIZE(tombBlock->buffers); i++) {
tBufferClear(buffer0); tBufferClear(buffer0);
@ -1640,8 +1640,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid, .fid = writer->config->fid,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, ofRange); (void)tsdbTFileUpdVerRange(&op.nf, ofRange);
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
// .data // .data
@ -1652,7 +1652,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid, .fid = writer->config->fid,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) { } else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
op = (STFileOp){ op = (STFileOp){
@ -1661,7 +1661,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.of = writer->config->files[ftype].file, .of = writer->config->files[ftype].file,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} }
@ -1673,7 +1673,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid, .fid = writer->config->fid,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} else if (writer->config->files[ftype].file.size != writer->files[ftype].size) { } else if (writer->config->files[ftype].file.size != writer->files[ftype].size) {
op = (STFileOp){ op = (STFileOp){
@ -1682,7 +1682,7 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.of = writer->config->files[ftype].file, .of = writer->config->files[ftype].file,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, writer->ctx->range); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->range);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} }
} }
@ -1716,8 +1716,8 @@ static int32_t tsdbDataFileWriterCloseCommit(SDataFileWriter *writer, TFileOpArr
.fid = writer->config->fid, .fid = writer->config->fid,
.nf = writer->files[ftype], .nf = writer->files[ftype],
}; };
tsdbTFileUpdVerRange(&op.nf, ofRange); (void)tsdbTFileUpdVerRange(&op.nf, ofRange);
tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange); (void)tsdbTFileUpdVerRange(&op.nf, writer->ctx->tombRange);
TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(opArr, op), &lino, _exit);
} }
int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm; int32_t encryptAlgorithm = writer->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
@ -1754,7 +1754,7 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) {
} }
int32_t lcn = writer->files[ftype].lcn; int32_t lcn = writer->files[ftype].lcn;
tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname); (void)tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit); TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);
if (writer->files[ftype].size == 0) { if (writer->files[ftype].size == 0) {
@ -1804,7 +1804,7 @@ int32_t tsdbDataFileWriterClose(SDataFileWriter **writer, bool abort, TFileOpArr
} else { } else {
TAOS_CHECK_GOTO(tsdbDataFileWriterCloseCommit(writer[0], opArr), &lino, _exit); TAOS_CHECK_GOTO(tsdbDataFileWriterCloseCommit(writer[0], opArr), &lino, _exit);
} }
tsdbDataFileWriterDoClose(writer[0]); (void)tsdbDataFileWriterDoClose(writer[0]);
} }
taosMemoryFree(writer[0]); taosMemoryFree(writer[0]);
writer[0] = NULL; writer[0] = NULL;
@ -1915,7 +1915,7 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) {
int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
int32_t lcn = writer->files[ftype].lcn; int32_t lcn = writer->files[ftype].lcn;
tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname); (void)tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname);
TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit); TAOS_CHECK_GOTO(tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype], lcn), &lino, _exit);

View File

@ -777,7 +777,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
} }
fset->channel = (SVAChannelID){0}; fset->channel = (SVAChannelID){0};
fset->mergeScheduled = false; fset->mergeScheduled = false;
tsdbFSSetBlockCommit(fset, false); (void)tsdbFSSetBlockCommit(fset, false);
fset->channelOpened = false; fset->channelOpened = false;
} }
} }
@ -877,7 +877,7 @@ int32_t tsdbFSCheckCommit(STsdb *tsdb, int32_t fid) {
if (fset) { if (fset) {
while (fset->blockCommit) { while (fset->blockCommit) {
fset->numWaitCommit++; fset->numWaitCommit++;
taosThreadCondWait(&fset->canCommit, &tsdb->mutex); (void)taosThreadCondWait(&fset->canCommit, &tsdb->mutex);
fset->numWaitCommit--; fset->numWaitCommit--;
} }
} }
@ -1163,7 +1163,7 @@ int32_t tsdbFSCreateRefRangedSnapshot(STFileSystem *fs, int64_t sver, int64_t ev
(void)taosThreadMutexUnlock(&fs->tsdb->mutex); (void)taosThreadMutexUnlock(&fs->tsdb->mutex);
if (code) { if (code) {
tsdbTFileSetRangeClear(&fsr1); (void)tsdbTFileSetRangeClear(&fsr1);
TARRAY2_DESTROY(fsrArr[0], tsdbTFileSetRangeClear); TARRAY2_DESTROY(fsrArr[0], tsdbTFileSetRangeClear);
fsrArr[0] = NULL; fsrArr[0] = NULL;
} }
@ -1187,7 +1187,7 @@ int32_t tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
if ((*fset)->taskRunning) { if ((*fset)->taskRunning) {
(*fset)->numWaitTask++; (*fset)->numWaitTask++;
taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex); (void)taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex);
(void)tsdbFSGetFSet(tsdb->pFS, fid, fset); (void)tsdbFSGetFSet(tsdb->pFS, fid, fset);
ASSERT(fset != NULL); ASSERT(fset != NULL);

View File

@ -45,7 +45,7 @@ static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl
STFileObj *fobj; STFileObj *fobj;
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj); code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
if (code) { if (code) {
tsdbSttLvlClear(lvl); (void)tsdbSttLvlClear(lvl);
return code; return code;
} }
@ -79,7 +79,7 @@ static int32_t tsdbSttLvlFilteredInitEx(STsdb *pTsdb, const SSttLvl *lvl1, int64
STFileObj *fobj; STFileObj *fobj;
code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj); code = tsdbTFileObjInit(pTsdb, fobj1->f, &fobj);
if (code) { if (code) {
tsdbSttLvlClear(lvl); (void)tsdbSttLvlClear(lvl);
return code; return code;
} }
@ -522,7 +522,8 @@ int32_t tsdbTFileSetFilteredInitDup(STsdb *pTsdb, const STFileSet *fset1, int64_
.fid = fobj->f->fid, .fid = fobj->f->fid,
.of = fobj->f[0], .of = fobj->f[0],
}; };
TARRAY2_APPEND(fopArr, op); code = TARRAY2_APPEND(fopArr, op);
if (code) return code;
} }
} }

View File

@ -57,7 +57,7 @@ int32_t tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *
snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir); snprintf(pTsdb->path, TD_PATH_MAX, "%s%s%s", pVnode->path, TD_DIRSEP, dir);
// taosRealPath(pTsdb->path, NULL, slen); // taosRealPath(pTsdb->path, NULL, slen);
pTsdb->pVnode = pVnode; pTsdb->pVnode = pVnode;
taosThreadMutexInit(&pTsdb->mutex, NULL); (void)taosThreadMutexInit(&pTsdb->mutex, NULL);
if (!pKeepCfg) { if (!pKeepCfg) {
(void)tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg); (void)tsdbSetKeepCfg(pTsdb, &pVnode->config.tsdbCfg);
} else { } else {

View File

@ -48,7 +48,7 @@ typedef struct {
static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo); static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo);
static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity,
STsdbReader* pReader); STsdbReader* pReader);
static int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes); static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes);
static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey, static int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pScanInfo, SRowKey* pKey,
STsdbReader* pReader); STsdbReader* pReader);
static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, static int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo,
@ -3866,11 +3866,11 @@ bool hasBeenDropped(const SArray* pDelList, int32_t* index, int64_t key, int64_t
return false; return false;
} }
FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes) { FORCE_INLINE void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes) {
*pRes = NULL; *pRes = NULL;
if (!pIter->hasVal) { if (!pIter->hasVal) {
return TSDB_CODE_SUCCESS; return;
} }
int32_t order = pReader->info.order; int32_t order = pReader->info.order;
@ -3880,20 +3880,20 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
TSDBROW_INIT_KEY(pRow, key); TSDBROW_INIT_KEY(pRow, key);
if (outOfTimeWindow(key.ts, &pReader->info.window)) { if (outOfTimeWindow(key.ts, &pReader->info.window)) {
pIter->hasVal = false; pIter->hasVal = false;
return TSDB_CODE_SUCCESS; return;
} }
// it is a valid data version // it is a valid data version
if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) { if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) {
if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) { if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) {
*pRes = pRow; *pRes = pRow;
return TSDB_CODE_SUCCESS; return;
} else { } else {
bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange,
pReader->suppInfo.numOfPks > 0); pReader->suppInfo.numOfPks > 0);
if (!dropped) { if (!dropped) {
*pRes = pRow; *pRes = pRow;
return TSDB_CODE_SUCCESS; return;
} }
} }
} }
@ -3901,7 +3901,7 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
while (1) { while (1) {
pIter->hasVal = tsdbTbDataIterNext(pIter->iter); pIter->hasVal = tsdbTbDataIterNext(pIter->iter);
if (!pIter->hasVal) { if (!pIter->hasVal) {
return TSDB_CODE_SUCCESS; return;
} }
pRow = tsdbTbDataIterGet(pIter->iter); pRow = tsdbTbDataIterGet(pIter->iter);
@ -3909,19 +3909,19 @@ FORCE_INLINE int32_t getValidMemRow(SIterInfo* pIter, const SArray* pDelList, ST
TSDBROW_INIT_KEY(pRow, key); TSDBROW_INIT_KEY(pRow, key);
if (outOfTimeWindow(key.ts, &pReader->info.window)) { if (outOfTimeWindow(key.ts, &pReader->info.window)) {
pIter->hasVal = false; pIter->hasVal = false;
return TSDB_CODE_SUCCESS; return;
} }
if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) { if (key.version <= pReader->info.verRange.maxVer && key.version >= pReader->info.verRange.minVer) {
if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) { if (pDelList == NULL || TARRAY_SIZE(pDelList) == 0) {
*pRes = pRow; *pRes = pRow;
return TSDB_CODE_SUCCESS; return;
} else { } else {
bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange, bool dropped = hasBeenDropped(pDelList, &pIter->index, key.ts, key.version, order, &pReader->info.verRange,
pReader->suppInfo.numOfPks > 0); pReader->suppInfo.numOfPks > 0);
if (!dropped) { if (!dropped) {
*pRes = pRow; *pRes = pRow;
return TSDB_CODE_SUCCESS; return;
} }
} }
} }

View File

@ -507,7 +507,7 @@ static int32_t tsdbFileDoWriteSttBlockData(STsdbFD *fd, SBlockData *blockData, S
if (sttBlk->maxVer < blockData->aVersion[iRow]) sttBlk->maxVer = blockData->aVersion[iRow]; if (sttBlk->maxVer < blockData->aVersion[iRow]) sttBlk->maxVer = blockData->aVersion[iRow];
} }
tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer); (void)tsdbWriterUpdVerRange(range, sttBlk->minVer, sttBlk->maxVer);
TAOS_CHECK_RETURN(tBlockDataCompress(blockData, info, buffers, buffers + 4)); TAOS_CHECK_RETURN(tBlockDataCompress(blockData, info, buffers, buffers + 4));
sttBlk->bInfo.offset = *fileSize; sttBlk->bInfo.offset = *fileSize;

View File

@ -358,7 +358,7 @@ static int32_t tsdbUpgradeFileSet(STsdb *tsdb, SDFileSet *pDFileSet, TFileSetArr
TAOS_CHECK_GOTO(tsdbUpgradeStt(tsdb, pDFileSet, reader, fset), &lino, _exit); TAOS_CHECK_GOTO(tsdbUpgradeStt(tsdb, pDFileSet, reader, fset), &lino, _exit);
} }
tsdbDataFReaderClose(&reader); (void)tsdbDataFReaderClose(&reader);
TAOS_CHECK_GOTO(TARRAY2_APPEND(fileSetArray, fset), &lino, _exit); TAOS_CHECK_GOTO(TARRAY2_APPEND(fileSetArray, fset), &lino, _exit);
@ -570,7 +570,7 @@ _exit:
if (code) { if (code) {
tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code)); tsdbError("vgId:%d %s failed at %s:%d since %s", TD_VID(tsdb->pVnode), __func__, __FILE__, lino, tstrerror(code));
} }
tsdbDelFReaderClose(&reader); (void)tsdbDelFReaderClose(&reader);
taosArrayDestroy(aDelIdx); taosArrayDestroy(aDelIdx);
return code; return code;
} }
@ -612,7 +612,7 @@ static int32_t tsdbUpgradeFileSystem(STsdb *tsdb, int8_t rollback) {
// save new file system // save new file system
char fname[TSDB_FILENAME_LEN]; char fname[TSDB_FILENAME_LEN];
current_fname(tsdb, fname, TSDB_FCURRENT); (void)current_fname(tsdb, fname, TSDB_FCURRENT);
TAOS_CHECK_GOTO(save_fs(fileSetArray, fname), &lino, _exit); TAOS_CHECK_GOTO(save_fs(fileSetArray, fname), &lino, _exit);
_exit: _exit:

View File

@ -107,7 +107,7 @@ _exit:
void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) { void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) {
ASSERT(idx >= 0 && idx < pMapData->nItem); ASSERT(idx >= 0 && idx < pMapData->nItem);
tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem); (void)tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem);
} }
#ifdef BUILD_NO_CALL #ifdef BUILD_NO_CALL
@ -613,7 +613,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *
SValue value; SValue value;
if (pRow->type == TSDBROW_ROW_FMT) { if (pRow->type == TSDBROW_ROW_FMT) {
tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal); (void)tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal);
} else if (pRow->type == TSDBROW_COL_FMT) { } else if (pRow->type == TSDBROW_COL_FMT) {
if (iCol == 0) { if (iCol == 0) {
*pColVal = *pColVal =

View File

@ -389,7 +389,7 @@ static int32_t vnodeAsyncDestroy(SVAsync **async) {
// set stop and broadcast // set stop and broadcast
(void)taosThreadMutexLock(&(*async)->mutex); (void)taosThreadMutexLock(&(*async)->mutex);
(*async)->stop = true; (*async)->stop = true;
taosThreadCondBroadcast(&(*async)->hasTask); (void)taosThreadCondBroadcast(&(*async)->hasTask);
(void)taosThreadMutexUnlock(&(*async)->mutex); (void)taosThreadMutexUnlock(&(*async)->mutex);
// join all workers // join all workers
@ -666,7 +666,7 @@ int32_t vnodeAsyncSetWorkers(int64_t asyncID, int32_t numWorkers) {
(void)taosThreadMutexLock(&async->mutex); (void)taosThreadMutexLock(&async->mutex);
async->numWorkers = numWorkers; async->numWorkers = numWorkers;
if (async->numIdleWorkers > 0) { if (async->numIdleWorkers > 0) {
taosThreadCondBroadcast(&async->hasTask); (void)taosThreadCondBroadcast(&async->hasTask);
} }
(void)taosThreadMutexUnlock(&async->mutex); (void)taosThreadMutexUnlock(&async->mutex);

View File

@ -291,7 +291,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
code = vnodeSaveInfo(dir, &pInfo->info); code = vnodeSaveInfo(dir, &pInfo->info);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);
tsdbPreCommit(pVnode->pTsdb); (void)tsdbPreCommit(pVnode->pTsdb);
code = metaPrepareAsyncCommit(pVnode->pMeta); code = metaPrepareAsyncCommit(pVnode->pMeta);
TSDB_CHECK_CODE(code, lino, _exit); TSDB_CHECK_CODE(code, lino, _exit);

View File

@ -404,7 +404,7 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC
(void)taosThreadMutexInit(&pVnode->lock, NULL); (void)taosThreadMutexInit(&pVnode->lock, NULL);
pVnode->blocked = false; pVnode->blocked = false;
tsem_init(&pVnode->syncSem, 0, 0); (void)tsem_init(&pVnode->syncSem, 0, 0);
(void)taosThreadMutexInit(&pVnode->mutex, NULL); (void)taosThreadMutexInit(&pVnode->mutex, NULL);
(void)taosThreadCondInit(&pVnode->poolNotEmpty, NULL); (void)taosThreadCondInit(&pVnode->poolNotEmpty, NULL);
@ -546,8 +546,8 @@ void vnodeClose(SVnode *pVnode) {
(void)vnodeCloseBufPool(pVnode); (void)vnodeCloseBufPool(pVnode);
// destroy handle // destroy handle
tsem_destroy(&pVnode->syncSem); (void)tsem_destroy(&pVnode->syncSem);
taosThreadCondDestroy(&pVnode->poolNotEmpty); (void)taosThreadCondDestroy(&pVnode->poolNotEmpty);
(void)taosThreadMutexDestroy(&pVnode->mutex); (void)taosThreadMutexDestroy(&pVnode->mutex);
(void)taosThreadMutexDestroy(&pVnode->lock); (void)taosThreadMutexDestroy(&pVnode->lock);
taosMemoryFree(pVnode); taosMemoryFree(pVnode);

View File

@ -610,7 +610,7 @@ int32_t vnodeSnapWriterOpen(SVnode *pVnode, SSnapshotParam *pParam, SVSnapWriter
int64_t ever = pParam->end; int64_t ever = pParam->end;
// cancel and disable all bg task // cancel and disable all bg task
vnodeCancelAndDisableAllBgTask(pVnode); (void)vnodeCancelAndDisableAllBgTask(pVnode);
// alloc // alloc
pWriter = (SVSnapWriter *)taosMemoryCalloc(1, sizeof(*pWriter)); pWriter = (SVSnapWriter *)taosMemoryCalloc(1, sizeof(*pWriter));
@ -749,7 +749,7 @@ _exit:
vInfo("vgId:%d, vnode snapshot writer closed, rollback:%d", TD_VID(pVnode), rollback); vInfo("vgId:%d, vnode snapshot writer closed, rollback:%d", TD_VID(pVnode), rollback);
taosMemoryFree(pWriter); taosMemoryFree(pWriter);
} }
vnodeEnableBgTask(pVnode); (void)vnodeEnableBgTask(pVnode);
return code; return code;
} }

View File

@ -699,7 +699,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg
vTrace("vgId:%d, process %s request, code:0x%x index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), pRsp->code, vTrace("vgId:%d, process %s request, code:0x%x index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), pRsp->code,
ver); ver);
walApplyVer(pVnode->pWal, ver); (void)walApplyVer(pVnode->pWal, ver);
code = tqPushMsg(pVnode->pTq, pMsg->msgType); code = tqPushMsg(pVnode->pTq, pMsg->msgType);
if (code) { if (code) {
@ -1405,7 +1405,7 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in
} }
(void)tqUpdateTbUidList(pVnode->pTq, tbUids, false); (void)tqUpdateTbUidList(pVnode->pTq, tbUids, false);
tdUpdateTbUidList(pVnode->pSma, pStore, false); (void)tdUpdateTbUidList(pVnode->pSma, pStore, false);
if (tsEnableAuditCreateTable) { if (tsEnableAuditCreateTable) {
int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId;
@ -1440,7 +1440,7 @@ _exit:
tEncodeSize(tEncodeSVDropTbBatchRsp, &rsp, pRsp->contLen, ret); tEncodeSize(tEncodeSVDropTbBatchRsp, &rsp, pRsp->contLen, ret);
pRsp->pCont = rpcMallocCont(pRsp->contLen); pRsp->pCont = rpcMallocCont(pRsp->contLen);
tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen); tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen);
tEncodeSVDropTbBatchRsp(&encoder, &rsp); (void)tEncodeSVDropTbBatchRsp(&encoder, &rsp);
tEncoderClear(&encoder); tEncoderClear(&encoder);
taosArrayDestroy(rsp.pArray); taosArrayDestroy(rsp.pArray);
taosArrayDestroy(tbNames); taosArrayDestroy(tbNames);
@ -2158,7 +2158,7 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t ver, void *pRe
SBatchDeleteReq deleteReq; SBatchDeleteReq deleteReq;
SDecoder decoder; SDecoder decoder;
tDecoderInit(&decoder, pReq, len); tDecoderInit(&decoder, pReq, len);
tDecodeSBatchDeleteReq(&decoder, &deleteReq); (void)tDecodeSBatchDeleteReq(&decoder, &deleteReq);
SMetaReader mr = {0}; SMetaReader mr = {0};
metaReaderDoInit(&mr, pVnode->pMeta, META_READER_NOLOCK); metaReaderDoInit(&mr, pVnode->pMeta, META_READER_NOLOCK);

View File

@ -583,7 +583,7 @@ static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx)
streamMetaWUnLock(pMeta); streamMetaWUnLock(pMeta);
tqInfo("vgId:%d stream task already loaded, start them", vgId); tqInfo("vgId:%d stream task already loaded, start them", vgId);
streamTaskSchedTask(&pVnode->msgCb, TD_VID(pVnode), 0, 0, STREAM_EXEC_T_START_ALL_TASKS); (void)streamTaskSchedTask(&pVnode->msgCb, TD_VID(pVnode), 0, 0, STREAM_EXEC_T_START_ALL_TASKS);
return; return;
} }
} }

View File

@ -1158,14 +1158,15 @@ SMqBatchMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo) {
return &pTaskInfo->streamInfo.btMetaRsp; return &pTaskInfo->streamInfo.btMetaRsp;
} }
void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) { int32_t qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
int32_t code = tOffsetCopy(pOffset, &pTaskInfo->streamInfo.currentOffset); tOffsetCopy(pOffset, &pTaskInfo->streamInfo.currentOffset);
if (code != TSDB_CODE_SUCCESS) { return 0;
/*if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
pTaskInfo->code = code; pTaskInfo->code = code;
T_LONG_JMP(pTaskInfo->env, code); T_LONG_JMP(pTaskInfo->env, code);
} }*/
} }
int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* sContext, SMetaTableInfo* pMtInfo) { int32_t initQueryTableDataCondForTmq(SQueryTableDataCond* pCond, SSnapContext* sContext, SMetaTableInfo* pMtInfo) {
@ -1436,8 +1437,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
} }
end: end:
tOffsetCopy(&pTaskInfo->streamInfo.currentOffset, pOffset); (void) tOffsetCopy(&pTaskInfo->streamInfo.currentOffset, pOffset);
return 0; return 0;
} }

View File

@ -309,14 +309,8 @@ int32_t mJoinFilterAndMarkHashRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo
} }
code = extractQualifiedTupleByFilterResult(pBlock, p, status); code = extractQualifiedTupleByFilterResult(pBlock, p, status);
if (code != TSDB_CODE_SUCCESS) {
goto _err;
}
code = TSDB_CODE_SUCCESS;
_err: _err:
colDataDestroy(p); colDataDestroy(p);
taosMemoryFree(p); taosMemoryFree(p);
@ -379,14 +373,8 @@ int32_t mJoinFilterAndMarkRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SM
} }
code = extractQualifiedTupleByFilterResult(pBlock, p, status); code = extractQualifiedTupleByFilterResult(pBlock, p, status);
if (code != TSDB_CODE_SUCCESS) {
goto _return;
}
code = TSDB_CODE_SUCCESS;
_return: _return:
colDataDestroy(p); colDataDestroy(p);
taosMemoryFree(p); taosMemoryFree(p);

View File

@ -897,7 +897,7 @@ int32_t convertDataBlockToUdfDataBlock(SSDataBlock *block, SUdfDataBlock *udfBlo
int32_t convertUdfColumnToDataBlock(SUdfColumn *udfCol, SSDataBlock *block) { int32_t convertUdfColumnToDataBlock(SUdfColumn *udfCol, SSDataBlock *block) {
int32_t code = 0, lino = 0; int32_t code = 0, lino = 0;
SUdfColumnMeta* meta = &udfCol->colMeta; SUdfColumnMeta *meta = &udfCol->colMeta;
SColumnInfoData colInfoData = createColumnInfoData(meta->type, meta->bytes, 1); SColumnInfoData colInfoData = createColumnInfoData(meta->type, meta->bytes, 1);
code = blockDataAppendColInfo(block, &colInfoData); code = blockDataAppendColInfo(block, &colInfoData);

View File

@ -80,7 +80,7 @@ int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated) {
return tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &rpcMsg); return tmsgPutToQueue(pTask->pMsgCb, STREAM_QUEUE, &rpcMsg);
} }
int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) { void streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration) {
int32_t numOfTicks = idleDuration / SCANHISTORY_IDLE_TIME_SLICE; int32_t numOfTicks = idleDuration / SCANHISTORY_IDLE_TIME_SLICE;
if (numOfTicks <= 0) { if (numOfTicks <= 0) {
numOfTicks = 1; numOfTicks = 1;
@ -91,10 +91,10 @@ int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration)
// add ref for task // add ref for task
SStreamTask* p = NULL; SStreamTask* p = NULL;
int32_t code = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, &p); int32_t code = streamMetaAcquireTask(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, &p);
if (p == NULL) { if (p == NULL || code != 0) {
stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId, stError("s-task:0x%x failed to acquire task, status:%s, not exec scan-history data", pTask->id.taskId,
streamTaskGetStatus(pTask).name); streamTaskGetStatus(pTask).name);
return TSDB_CODE_SUCCESS; return;
} }
pTask->schedHistoryInfo.numOfTicks = numOfTicks; pTask->schedHistoryInfo.numOfTicks = numOfTicks;
@ -109,8 +109,6 @@ int32_t streamExecScanHistoryInFuture(SStreamTask* pTask, int32_t idleDuration)
streamTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, streamTmrReset(doExecScanhistoryInFuture, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer,
&pTask->schedHistoryInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr"); &pTask->schedHistoryInfo.pTimer, pTask->pMeta->vgId, " start-history-task-tmr");
} }
return TSDB_CODE_SUCCESS;
} }
int32_t streamTaskStartScanHistory(SStreamTask* pTask) { int32_t streamTaskStartScanHistory(SStreamTask* pTask) {

View File

@ -766,8 +766,7 @@ int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt) {
int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId, int64_t resetRelHalt) { int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId, int64_t resetRelHalt) {
SVDropStreamTaskReq* pReq = rpcMallocCont(sizeof(SVDropStreamTaskReq)); SVDropStreamTaskReq* pReq = rpcMallocCont(sizeof(SVDropStreamTaskReq));
if (pReq == NULL) { if (pReq == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno;
return -1;
} }
pReq->head.vgId = vgId; pReq->head.vgId = vgId;
@ -1089,11 +1088,10 @@ int32_t streamTaskSetActiveCheckpointInfo(SStreamTask* pTask, int64_t activeChec
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId) { void streamTaskSetFailedChkptInfo(SStreamTask* pTask, int32_t transId, int64_t checkpointId) {
pTask->chkInfo.pActiveInfo->transId = transId; pTask->chkInfo.pActiveInfo->transId = transId;
pTask->chkInfo.pActiveInfo->activeId = checkpointId; pTask->chkInfo.pActiveInfo->activeId = checkpointId;
pTask->chkInfo.pActiveInfo->failedId = checkpointId; pTask->chkInfo.pActiveInfo->failedId = checkpointId;
return TSDB_CODE_SUCCESS;
} }
int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes) { int32_t streamTaskCreateActiveChkptInfo(SActiveCheckpointInfo** pRes) {

View File

@ -270,7 +270,7 @@ int32_t streamTaskRestoreStatus(SStreamTask* pTask) {
code = TSDB_CODE_FAILED; // failed to restore the status, since it is not in pause status code = TSDB_CODE_FAILED; // failed to restore the status, since it is not in pause status
} }
(void)taosThreadMutexUnlock(&pTask->lock); streamMutexUnlock(&pTask->lock);
return code; return code;
} }

View File

@ -235,7 +235,7 @@ int tdbBtreeDelete(SBTree *pBt, const void *pKey, int kLen, TXN *pTxn) {
int c; int c;
int ret; int ret;
tdbBtcOpen(&btc, pBt, pTxn); (void)tdbBtcOpen(&btc, pBt, pTxn);
/* /*
btc.coder.ofps = taosArrayInit(8, sizeof(SPage *)); btc.coder.ofps = taosArrayInit(8, sizeof(SPage *));
// btc.coder.ofps = taosArrayInit(8, sizeof(SPgno)); // btc.coder.ofps = taosArrayInit(8, sizeof(SPgno));
@ -337,7 +337,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL
void *pTVal = NULL; void *pTVal = NULL;
SCellDecoder cd = {0}; SCellDecoder cd = {0};
tdbBtcOpen(&btc, pBt, NULL); (void)tdbBtcOpen(&btc, pBt, NULL);
tdbTrace("tdb pget, btc: %p", &btc); tdbTrace("tdb pget, btc: %p", &btc);
@ -799,7 +799,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
iNew = 0; iNew = 0;
nNewCells = 0; nNewCells = 0;
tdbBtreeInitPage(pNews[iNew], &iarg, 0); (void)tdbBtreeInitPage(pNews[iNew], &iarg, 0);
for (int iOld = 0; iOld < nOlds; iOld++) { for (int iOld = 0; iOld < nOlds; iOld++) {
SPage *pPage; SPage *pPage;
@ -828,7 +828,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
if (iNew == nNews - 1 && pIntHdr->pgno == 0) { if (iNew == nNews - 1 && pIntHdr->pgno == 0) {
pIntHdr->pgno = TDB_PAGE_PGNO(pNews[iNew]); pIntHdr->pgno = TDB_PAGE_PGNO(pNews[iNew]);
} else { } else {
tdbBtreeDecodeCell(pPage, pCell, &cd, pTxn, pBt); (void)tdbBtreeDecodeCell(pPage, pCell, &cd, pTxn, pBt);
// TODO: pCell here may be inserted as an overflow cell, handle it // TODO: pCell here may be inserted as an overflow cell, handle it
SCell *pNewCell = tdbOsMalloc(cd.kLen + 9); SCell *pNewCell = tdbOsMalloc(cd.kLen + 9);
@ -850,7 +850,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
iNew++; iNew++;
nNewCells = 0; nNewCells = 0;
if (iNew < nNews) { if (iNew < nNews) {
tdbBtreeInitPage(pNews[iNew], &iarg, 0); (void)tdbBtreeInitPage(pNews[iNew], &iarg, 0);
} }
} }
} else { } else {
@ -875,7 +875,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
iNew++; iNew++;
nNewCells = 0; nNewCells = 0;
if (iNew < nNews) { if (iNew < nNews) {
tdbBtreeInitPage(pNews[iNew], &iarg, 0); (void)tdbBtreeInitPage(pNews[iNew], &iarg, 0);
} }
} }
} }
@ -904,7 +904,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx, TXN *pTx
if (TDB_BTREE_PAGE_IS_ROOT(pParent) && TDB_PAGE_TOTAL_CELLS(pParent) == 0) { if (TDB_BTREE_PAGE_IS_ROOT(pParent) && TDB_PAGE_TOTAL_CELLS(pParent) == 0) {
i8 flags = TDB_BTREE_ROOT | TDB_BTREE_PAGE_IS_LEAF(pNews[0]); i8 flags = TDB_BTREE_ROOT | TDB_BTREE_PAGE_IS_LEAF(pNews[0]);
// copy content to the parent page // copy content to the parent page
tdbBtreeInitPage(pParent, &(SBtreeInitPageArg){.flags = flags, .pBt = pBt}, 0); (void)tdbBtreeInitPage(pParent, &(SBtreeInitPageArg){.flags = flags, .pBt = pBt}, 0);
(void)tdbPageCopy(pNews[0], pParent, 1); (void)tdbPageCopy(pNews[0], pParent, 1);
if (!TDB_BTREE_PAGE_IS_LEAF(pNews[0])) { if (!TDB_BTREE_PAGE_IS_LEAF(pNews[0])) {

View File

@ -968,7 +968,7 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage
if (TDB_PAGE_INITIALIZED(pPage)) break; if (TDB_PAGE_INITIALIZED(pPage)) break;
nLoops++; nLoops++;
if (nLoops > 1000) { if (nLoops > 1000) {
sched_yield(); (void)sched_yield();
nLoops = 0; nLoops = 0;
} }
} }

View File

@ -293,7 +293,7 @@ void taosArrayRemove(SArray* pArray, size_t index) {
ASSERT(index < pArray->size); ASSERT(index < pArray->size);
if (index == pArray->size - 1) { if (index == pArray->size - 1) {
taosArrayPop(pArray); (void)taosArrayPop(pArray);
return; return;
} }

View File

@ -110,7 +110,7 @@ typedef struct SCacheObjTravSup {
static FORCE_INLINE void __trashcan_wr_lock(SCacheObj *pCacheObj) { static FORCE_INLINE void __trashcan_wr_lock(SCacheObj *pCacheObj) {
#if defined(LINUX) #if defined(LINUX)
taosThreadRwlockWrlock(&pCacheObj->lock); (void)taosThreadRwlockWrlock(&pCacheObj->lock);
#else #else
(void)taosThreadMutexLock(&pCacheObj->lock); (void)taosThreadMutexLock(&pCacheObj->lock);
#endif #endif
@ -118,7 +118,7 @@ static FORCE_INLINE void __trashcan_wr_lock(SCacheObj *pCacheObj) {
static FORCE_INLINE void __trashcan_unlock(SCacheObj *pCacheObj) { static FORCE_INLINE void __trashcan_unlock(SCacheObj *pCacheObj) {
#if defined(LINUX) #if defined(LINUX)
taosThreadRwlockUnlock(&pCacheObj->lock); (void)taosThreadRwlockUnlock(&pCacheObj->lock);
#else #else
(void)taosThreadMutexUnlock(&pCacheObj->lock); (void)taosThreadMutexUnlock(&pCacheObj->lock);
#endif #endif
@ -134,9 +134,9 @@ static FORCE_INLINE int32_t __trashcan_lock_init(SCacheObj *pCacheObj) {
static FORCE_INLINE void __trashcan_lock_destroy(SCacheObj *pCacheObj) { static FORCE_INLINE void __trashcan_lock_destroy(SCacheObj *pCacheObj) {
#if defined(LINUX) #if defined(LINUX)
taosThreadRwlockDestroy(&pCacheObj->lock); (void)taosThreadRwlockDestroy(&pCacheObj->lock);
#else #else
taosThreadMutexDestroy(&pCacheObj->lock); (void)taosThreadMutexDestroy(&pCacheObj->lock);
#endif #endif
} }
@ -155,18 +155,18 @@ static void *taosCacheTimedRefresh(void *handle);
static void doInitRefreshThread(void) { static void doInitRefreshThread(void) {
pCacheArrayList = taosArrayInit(4, POINTER_BYTES); pCacheArrayList = taosArrayInit(4, POINTER_BYTES);
taosThreadMutexInit(&guard, NULL); (void)taosThreadMutexInit(&guard, NULL);
TdThreadAttr thattr; TdThreadAttr thattr;
taosThreadAttrInit(&thattr); (void)taosThreadAttrInit(&thattr);
taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE);
taosThreadCreate(&cacheRefreshWorker, &thattr, taosCacheTimedRefresh, NULL); (void)taosThreadCreate(&cacheRefreshWorker, &thattr, taosCacheTimedRefresh, NULL);
taosThreadAttrDestroy(&thattr); (void)taosThreadAttrDestroy(&thattr);
} }
TdThread doRegisterCacheObj(SCacheObj *pCacheObj) { TdThread doRegisterCacheObj(SCacheObj *pCacheObj) {
taosThreadOnce(&cacheThreadInit, doInitRefreshThread); (void)taosThreadOnce(&cacheThreadInit, doInitRefreshThread);
(void)taosThreadMutexLock(&guard); (void)taosThreadMutexLock(&guard);
(void)taosArrayPush(pCacheArrayList, &pCacheObj); (void)taosArrayPush(pCacheArrayList, &pCacheObj);
@ -215,7 +215,7 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheNode *
return; return;
} }
atomic_sub_fetch_64(&pCacheObj->sizeInBytes, pNode->size); (void)atomic_sub_fetch_64(&pCacheObj->sizeInBytes, pNode->size);
uDebug("cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, total num:%d size:%" PRId64 "bytes", uDebug("cache:%s, key:%p, %p is destroyed from cache, size:%dbytes, total num:%d size:%" PRId64 "bytes",
pCacheObj->name, pNode->key, pNode->data, pNode->size, (int)pCacheObj->numOfElems - 1, pCacheObj->sizeInBytes); pCacheObj->name, pNode->key, pNode->data, pNode->size, (int)pCacheObj->numOfElems - 1, pCacheObj->sizeInBytes);
@ -416,8 +416,8 @@ void *taosCachePut(SCacheObj *pCacheObj, const void *key, size_t keyLen, const v
if (pNode == NULL) { if (pNode == NULL) {
pushfrontNodeInEntryList(pe, pNode1); pushfrontNodeInEntryList(pe, pNode1);
atomic_add_fetch_ptr(&pCacheObj->numOfElems, 1); (void)atomic_add_fetch_ptr(&pCacheObj->numOfElems, 1);
atomic_add_fetch_ptr(&pCacheObj->sizeInBytes, pNode1->size); (void)atomic_add_fetch_ptr(&pCacheObj->sizeInBytes, pNode1->size);
uDebug("cache:%s, key:%p, %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 uDebug("cache:%s, key:%p, %p added into cache, added:%" PRIu64 ", expire:%" PRIu64
", totalNum:%d sizeInBytes:%" PRId64 "bytes size:%" PRId64 "bytes", ", totalNum:%d sizeInBytes:%" PRId64 "bytes size:%" PRId64 "bytes",
pCacheObj->name, key, pNode1->data, pNode1->addedTime, pNode1->expireTime, (int32_t)pCacheObj->numOfElems, pCacheObj->name, key, pNode1->data, pNode1->addedTime, pNode1->expireTime, (int32_t)pCacheObj->numOfElems,
@ -431,7 +431,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const void *key, size_t keyLen, const v
pCacheObj->freeFp(pNode->data); pCacheObj->freeFp(pNode->data);
} }
atomic_sub_fetch_64(&pCacheObj->sizeInBytes, pNode->size); (void)atomic_sub_fetch_64(&pCacheObj->sizeInBytes, pNode->size);
taosMemoryFreeClear(pNode); taosMemoryFreeClear(pNode);
} else { } else {
taosAddToTrashcan(pCacheObj, pNode); taosAddToTrashcan(pCacheObj, pNode);
@ -439,7 +439,7 @@ void *taosCachePut(SCacheObj *pCacheObj, const void *key, size_t keyLen, const v
} }
pushfrontNodeInEntryList(pe, pNode1); pushfrontNodeInEntryList(pe, pNode1);
atomic_add_fetch_64(&pCacheObj->sizeInBytes, pNode1->size); (void)atomic_add_fetch_64(&pCacheObj->sizeInBytes, pNode1->size);
uDebug("cache:%s, key:%p, %p added into cache, added:%" PRIu64 ", expire:%" PRIu64 uDebug("cache:%s, key:%p, %p added into cache, added:%" PRIu64 ", expire:%" PRIu64
", totalNum:%d sizeInBytes:%" PRId64 "bytes size:%" PRId64 "bytes", ", totalNum:%d sizeInBytes:%" PRId64 "bytes size:%" PRId64 "bytes",
pCacheObj->name, key, pNode1->data, pNode1->addedTime, pNode1->expireTime, (int32_t)pCacheObj->numOfElems, pCacheObj->name, key, pNode1->data, pNode1->addedTime, pNode1->expireTime, (int32_t)pCacheObj->numOfElems,
@ -456,7 +456,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen
} }
if (pCacheObj->numOfElems == 0) { if (pCacheObj->numOfElems == 0) {
atomic_add_fetch_64(&pCacheObj->statistics.missCount, 1); (void)atomic_add_fetch_64(&pCacheObj->statistics.missCount, 1);
return NULL; return NULL;
} }
@ -474,15 +474,15 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen
void *pData = (pNode != NULL) ? pNode->data : NULL; void *pData = (pNode != NULL) ? pNode->data : NULL;
if (pData != NULL) { if (pData != NULL) {
atomic_add_fetch_64(&pCacheObj->statistics.hitCount, 1); (void)atomic_add_fetch_64(&pCacheObj->statistics.hitCount, 1);
uDebug("cache:%s, key:%p, %p is retrieved from cache, refcnt:%d", pCacheObj->name, key, pData, uDebug("cache:%s, key:%p, %p is retrieved from cache, refcnt:%d", pCacheObj->name, key, pData,
T_REF_VAL_GET(pNode)); T_REF_VAL_GET(pNode));
} else { } else {
atomic_add_fetch_64(&pCacheObj->statistics.missCount, 1); (void)atomic_add_fetch_64(&pCacheObj->statistics.missCount, 1);
uDebug("cache:%s, key:%p, not in cache, retrieved failed", pCacheObj->name, key); uDebug("cache:%s, key:%p, not in cache, retrieved failed", pCacheObj->name, key);
} }
atomic_add_fetch_64(&pCacheObj->statistics.totalAccess, 1); (void)atomic_add_fetch_64(&pCacheObj->statistics.totalAccess, 1);
return pData; return pData;
} }
@ -577,7 +577,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
ASSERT(pNode->pTNodeHeader->pData == pNode); ASSERT(pNode->pTNodeHeader->pData == pNode);
__trashcan_wr_lock(pCacheObj); __trashcan_wr_lock(pCacheObj);
doRemoveElemInTrashcan(pCacheObj, pNode->pTNodeHeader); (void)doRemoveElemInTrashcan(pCacheObj, pNode->pTNodeHeader);
__trashcan_unlock(pCacheObj); __trashcan_unlock(pCacheObj);
ref = T_REF_DEC(pNode); ref = T_REF_DEC(pNode);
@ -786,7 +786,7 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) {
uDebug("cache:%s, key:%p, %p removed from trashcan. numOfElem in trashcan:%d", pCacheObj->name, pElem->pData->key, uDebug("cache:%s, key:%p, %p removed from trashcan. numOfElem in trashcan:%d", pCacheObj->name, pElem->pData->key,
pElem->pData->data, pCacheObj->numOfElemsInTrash - 1); pElem->pData->data, pCacheObj->numOfElemsInTrash - 1);
doRemoveElemInTrashcan(pCacheObj, pElem); (void)doRemoveElemInTrashcan(pCacheObj, pElem);
doDestroyTrashcanElem(pCacheObj, pElem); doDestroyTrashcanElem(pCacheObj, pElem);
pElem = pCacheObj->pTrash; pElem = pCacheObj->pTrash;
} else { } else {
@ -896,7 +896,7 @@ _end:
taosArrayDestroy(pCacheArrayList); taosArrayDestroy(pCacheArrayList);
pCacheArrayList = NULL; pCacheArrayList = NULL;
taosThreadMutexDestroy(&guard); (void)taosThreadMutexDestroy(&guard);
refreshWorkerNormalStopped = true; refreshWorkerNormalStopped = true;
uDebug("cache refresh thread quits"); uDebug("cache refresh thread quits");
@ -915,7 +915,7 @@ void taosCacheRefresh(SCacheObj *pCacheObj, __cache_trav_fn_t fp, void *param1)
void taosStopCacheRefreshWorker(void) { void taosStopCacheRefreshWorker(void) {
stopRefreshWorker = true; stopRefreshWorker = true;
TdThreadOnce tmp = PTHREAD_ONCE_INIT; TdThreadOnce tmp = PTHREAD_ONCE_INIT;
if (memcmp(&cacheThreadInit, &tmp, sizeof(TdThreadOnce)) != 0) taosThreadJoin(cacheRefreshWorker, NULL); if (memcmp(&cacheThreadInit, &tmp, sizeof(TdThreadOnce)) != 0) (void)taosThreadJoin(cacheRefreshWorker, NULL);
taosArrayDestroy(pCacheArrayList); taosArrayDestroy(pCacheArrayList);
} }

View File

@ -256,7 +256,7 @@ double tdigestQuantile(TDigest *t, double q) {
int64_t weight_so_far; int64_t weight_so_far;
SCentroid *a, *b, tmp; SCentroid *a, *b, tmp;
tdigestCompress(t); (void)tdigestCompress(t);
if (t->num_centroids == 0) return NAN; if (t->num_centroids == 0) return NAN;
if (t->num_centroids == 1) return t->centroids[0].mean; if (t->num_centroids == 1) return t->centroids[0].mean;
if (FLOAT_EQ(q, 0.0)) return t->min; if (FLOAT_EQ(q, 0.0)) return t->min;

View File

@ -834,7 +834,7 @@ static void tsSortError(void) {
} }
const char* tstrerror(int32_t err) { const char* tstrerror(int32_t err) {
taosThreadOnce(&tsErrorInit, tsSortError); (void)taosThreadOnce(&tsErrorInit, tsSortError);
// this is a system errno // this is a system errno
if ((err & 0x00ff0000) == 0x00ff0000) { if ((err & 0x00ff0000) == 0x00ff0000) {

View File

@ -52,7 +52,7 @@ static void cleanupWrapper_void_ptr(SCleanupAction* ca) {
static void cleanupWrapper_int_int(SCleanupAction* ca) { static void cleanupWrapper_int_int(SCleanupAction* ca) {
int32_t (*func)(int32_t) = ca->func; int32_t (*func)(int32_t) = ca->func;
func(ca->arg1.Int); (void)func(ca->arg1.Int);
} }
static void cleanupWrapper_void(SCleanupAction* ca) { static void cleanupWrapper_void(SCleanupAction* ca) {
@ -62,7 +62,7 @@ static void cleanupWrapper_void(SCleanupAction* ca) {
static void cleanupWrapper_int_ptr(SCleanupAction* ca) { static void cleanupWrapper_int_ptr(SCleanupAction* ca) {
int32_t (*func)(void*) = ca->func; int32_t (*func)(void*) = ca->func;
func(ca->arg1.Ptr); (void)func(ca->arg1.Ptr);
} }
typedef void (*wrapper)(SCleanupAction*); typedef void (*wrapper)(SCleanupAction*);

View File

@ -188,7 +188,7 @@ static SHashNode *doCreateHashNode(const void *key, size_t keyLen, const void *p
*/ */
static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SHashNode *prev, SHashNode *pNode, static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SHashNode *prev, SHashNode *pNode,
SHashNode *pNewNode) { SHashNode *pNewNode) {
atomic_sub_fetch_16(&pNode->refCount, 1); (void)atomic_sub_fetch_16(&pNode->refCount, 1);
if (prev != NULL) { if (prev != NULL) {
prev->next = pNewNode; prev->next = pNewNode;
ASSERT(prev->next != prev); ASSERT(prev->next != prev);
@ -204,7 +204,7 @@ static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry *pe, SH
} else { } else {
pNewNode->next = pNode; pNewNode->next = pNode;
pe->num++; pe->num++;
atomic_add_fetch_64(&pHashObj->size, 1); (void)atomic_add_fetch_64(&pHashObj->size, 1);
} }
} }
@ -359,7 +359,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
} }
pushfrontNodeInEntryList(pe, pNewNode); pushfrontNodeInEntryList(pe, pNewNode);
atomic_add_fetch_64(&pHashObj->size, 1); (void)atomic_add_fetch_64(&pHashObj->size, 1);
} else { } else {
// not support the update operation, return error // not support the update operation, return error
if (pHashObj->enableUpdate) { if (pHashObj->enableUpdate) {
@ -392,7 +392,7 @@ void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) {
int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void *destBuf) { int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void *destBuf) {
terrno = 0; terrno = 0;
/*char* p = */ taosHashGetImpl(pHashObj, key, keyLen, &destBuf, 0, false); (void)taosHashGetImpl(pHashObj, key, keyLen, &destBuf, 0, false);
return terrno; return terrno;
} }
@ -454,7 +454,7 @@ void *taosHashGetImpl(SHashObj *pHashObj, const void *key, size_t keyLen, void *
} }
if (addRef) { if (addRef) {
atomic_add_fetch_16(&pNode->refCount, 1); (void)atomic_add_fetch_16(&pNode->refCount, 1);
} }
if (*d != NULL) { if (*d != NULL) {
@ -501,7 +501,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
pNode->removed == 0) { pNode->removed == 0) {
code = 0; // it is found code = 0; // it is found
atomic_sub_fetch_16(&pNode->refCount, 1); (void)atomic_sub_fetch_16(&pNode->refCount, 1);
pNode->removed = 1; pNode->removed = 1;
if (pNode->refCount <= 0) { if (pNode->refCount <= 0) {
if (prevNode == NULL) { if (prevNode == NULL) {
@ -512,7 +512,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
} }
pe->num--; pe->num--;
atomic_sub_fetch_64(&pHashObj->size, 1); (void)atomic_sub_fetch_64(&pHashObj->size, 1);
FREE_HASH_NODE(pHashObj->freeFp, pNode); FREE_HASH_NODE(pHashObj->freeFp, pNode);
} }
} else { } else {
@ -752,7 +752,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
pNode = pNode->next; pNode = pNode->next;
} }
atomic_sub_fetch_16(&pOld->refCount, 1); (void)atomic_sub_fetch_16(&pOld->refCount, 1);
if (pOld->refCount <= 0) { if (pOld->refCount <= 0) {
if (prevNode) { if (prevNode) {
prevNode->next = pOld->next; prevNode->next = pOld->next;
@ -766,7 +766,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
} }
pe->num--; pe->num--;
atomic_sub_fetch_64(&pHashObj->size, 1); (void)atomic_sub_fetch_64(&pHashObj->size, 1);
FREE_HASH_NODE(pHashObj->freeFp, pOld); FREE_HASH_NODE(pHashObj->freeFp, pOld);
} }
} else { } else {
@ -840,7 +840,7 @@ void taosHashCancelIterate(SHashObj *pHashObj, void *p) {
taosHashRLock(pHashObj); taosHashRLock(pHashObj);
int slot; int slot;
taosHashReleaseNode(pHashObj, p, &slot); (void)taosHashReleaseNode(pHashObj, p, &slot);
SHashEntry *pe = pHashObj->hashList[slot]; SHashEntry *pe = pHashObj->hashList[slot];

View File

@ -258,9 +258,9 @@ static PriorityQueueNode* pqHeapify(PriorityQueue* pq, size_t from, size_t last)
static void pqBuildHeap(PriorityQueue* pq) { static void pqBuildHeap(PriorityQueue* pq) {
if (pqContainerSize(pq) > 1) { if (pqContainerSize(pq) > 1) {
for (size_t i = pqContainerSize(pq) - 1; i > 0; --i) { for (size_t i = pqContainerSize(pq) - 1; i > 0; --i) {
pqHeapify(pq, i, pqContainerSize(pq)); (void)pqHeapify(pq, i, pqContainerSize(pq));
} }
pqHeapify(pq, 0, pqContainerSize(pq)); (void)pqHeapify(pq, 0, pqContainerSize(pq));
} }
} }
@ -276,21 +276,21 @@ static PriorityQueueNode* pqReverseHeapify(PriorityQueue* pq, size_t i) {
static void pqUpdate(PriorityQueue* pq, size_t i) { static void pqUpdate(PriorityQueue* pq, size_t i) {
if (i == 0 || pq->fn(pqContainerGetEle(pq, i)->data, pqContainerGetEle(pq, pqParent(i))->data, pq->param)) { if (i == 0 || pq->fn(pqContainerGetEle(pq, i)->data, pqContainerGetEle(pq, pqParent(i))->data, pq->param)) {
// if value in pos i is smaller than parent, heapify down from i to the end // if value in pos i is smaller than parent, heapify down from i to the end
pqHeapify(pq, i, pqContainerSize(pq)); (void)pqHeapify(pq, i, pqContainerSize(pq));
} else { } else {
// if value in pos i is big than parent, heapify up from i // if value in pos i is big than parent, heapify up from i
pqReverseHeapify(pq, i); (void)pqReverseHeapify(pq, i);
} }
} }
static void pqRemove(PriorityQueue* pq, size_t i) { static void pqRemove(PriorityQueue* pq, size_t i) {
if (i == pqContainerSize(pq) - 1) { if (i == pqContainerSize(pq) - 1) {
taosArrayPop(pq->container); (void)taosArrayPop(pq->container);
return; return;
} }
taosArraySet(pq->container, i, taosArrayGet(pq->container, pqContainerSize(pq) - 1)); taosArraySet(pq->container, i, taosArrayGet(pq->container, pqContainerSize(pq) - 1));
taosArrayPop(pq->container); (void)taosArrayPop(pq->container);
pqUpdate(pq, i); pqUpdate(pq, i);
} }

View File

@ -33,7 +33,7 @@ void *taosInitIdPool(int32_t maxId) {
pIdPool->numOfFree = maxId; pIdPool->numOfFree = maxId;
pIdPool->freeSlot = 0; pIdPool->freeSlot = 0;
taosThreadMutexInit(&pIdPool->mutex, NULL); (void)taosThreadMutexInit(&pIdPool->mutex, NULL);
uDebug("pool:%p is setup, maxId:%d", pIdPool, pIdPool->maxId); uDebug("pool:%p is setup, maxId:%d", pIdPool, pIdPool->maxId);
@ -83,7 +83,7 @@ void taosIdPoolCleanUp(id_pool_t *pIdPool) {
if (pIdPool->freeList) taosMemoryFree(pIdPool->freeList); if (pIdPool->freeList) taosMemoryFree(pIdPool->freeList);
taosThreadMutexDestroy(&pIdPool->mutex); (void)taosThreadMutexDestroy(&pIdPool->mutex);
memset(pIdPool, 0, sizeof(id_pool_t)); memset(pIdPool, 0, sizeof(id_pool_t));

View File

@ -30,7 +30,7 @@ void taosWLockLatch(SRWLatch *pLatch) {
if (oLatch & TD_RWLATCH_WRITE_FLAG) { if (oLatch & TD_RWLATCH_WRITE_FLAG) {
nLoops++; nLoops++;
if (nLoops > 1000) { if (nLoops > 1000) {
sched_yield(); (void)sched_yield();
nLoops = 0; nLoops = 0;
} }
continue; continue;
@ -47,7 +47,7 @@ void taosWLockLatch(SRWLatch *pLatch) {
if (oLatch == TD_RWLATCH_WRITE_FLAG) break; if (oLatch == TD_RWLATCH_WRITE_FLAG) break;
nLoops++; nLoops++;
if (nLoops > 1000) { if (nLoops > 1000) {
sched_yield(); (void)sched_yield();
nLoops = 0; nLoops = 0;
} }
} }
@ -80,7 +80,7 @@ void taosRLockLatch(SRWLatch *pLatch) {
if (oLatch & TD_RWLATCH_WRITE_FLAG) { if (oLatch & TD_RWLATCH_WRITE_FLAG) {
nLoops++; nLoops++;
if (nLoops > 1000) { if (nLoops > 1000) {
sched_yield(); (void)sched_yield();
nLoops = 0; nLoops = 0;
} }
continue; continue;
@ -91,4 +91,4 @@ void taosRLockLatch(SRWLatch *pLatch) {
} }
} }
void taosRUnLockLatch(SRWLatch *pLatch) { atomic_fetch_sub_32(pLatch, 1); } void taosRUnLockLatch(SRWLatch *pLatch) { (void)atomic_fetch_sub_32(pLatch, 1); }

View File

@ -136,7 +136,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxFileNum);
static FORCE_INLINE void taosUpdateDaylight() { static FORCE_INLINE void taosUpdateDaylight() {
struct tm Tm, *ptm; struct tm Tm, *ptm;
struct timeval timeSecs; struct timeval timeSecs;
taosGetTimeOfDay(&timeSecs); (void)taosGetTimeOfDay(&timeSecs);
time_t curTime = timeSecs.tv_sec; time_t curTime = timeSecs.tv_sec;
ptm = taosLocalTime(&curTime, &Tm, NULL); ptm = taosLocalTime(&curTime, &Tm, NULL);
tsDaylightActive = ptm->tm_isdst; tsDaylightActive = ptm->tm_isdst;
@ -145,11 +145,11 @@ static FORCE_INLINE int32_t taosGetDaylight() { return tsDaylightActive; }
static int32_t taosStartLog() { static int32_t taosStartLog() {
TdThreadAttr threadAttr; TdThreadAttr threadAttr;
taosThreadAttrInit(&threadAttr); (void)taosThreadAttrInit(&threadAttr);
if (taosThreadCreate(&(tsLogObj.logHandle->asyncThread), &threadAttr, taosAsyncOutputLog, tsLogObj.logHandle) != 0) { if (taosThreadCreate(&(tsLogObj.logHandle->asyncThread), &threadAttr, taosAsyncOutputLog, tsLogObj.logHandle) != 0) {
return terrno; return terrno;
} }
taosThreadAttrDestroy(&threadAttr); (void)taosThreadAttrDestroy(&threadAttr);
return 0; return 0;
} }
@ -179,7 +179,7 @@ int32_t taosInitSlowLog() {
tsLogObj.slowHandle = taosLogBuffNew(LOG_SLOW_BUF_SIZE); tsLogObj.slowHandle = taosLogBuffNew(LOG_SLOW_BUF_SIZE);
if (tsLogObj.slowHandle == NULL) return terrno; if (tsLogObj.slowHandle == NULL) return terrno;
taosUmaskFile(0); (void)taosUmaskFile(0);
tsLogObj.slowHandle->pFile = taosOpenFile(fullName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); tsLogObj.slowHandle->pFile = taosOpenFile(fullName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND);
if (tsLogObj.slowHandle->pFile == NULL) { if (tsLogObj.slowHandle->pFile == NULL) {
printf("\nfailed to open slow log file:%s, reason:%s\n", fullName, strerror(errno)); printf("\nfailed to open slow log file:%s, reason:%s\n", fullName, strerror(errno));
@ -231,13 +231,13 @@ void taosCloseLog() {
taosStopLog(); taosStopLog();
if (tsLogObj.logHandle != NULL && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { if (tsLogObj.logHandle != NULL && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL); (void)taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL);
taosThreadClear(&tsLogObj.logHandle->asyncThread); taosThreadClear(&tsLogObj.logHandle->asyncThread);
} }
if (tsLogObj.slowHandle != NULL) { if (tsLogObj.slowHandle != NULL) {
taosThreadMutexDestroy(&tsLogObj.slowHandle->buffMutex); (void)taosThreadMutexDestroy(&tsLogObj.slowHandle->buffMutex);
taosCloseFile(&tsLogObj.slowHandle->pFile); (void)taosCloseFile(&tsLogObj.slowHandle->pFile);
taosMemoryFreeClear(tsLogObj.slowHandle->buffer); taosMemoryFreeClear(tsLogObj.slowHandle->buffer);
taosMemoryFreeClear(tsLogObj.slowHandle); taosMemoryFreeClear(tsLogObj.slowHandle);
} }
@ -245,10 +245,10 @@ void taosCloseLog() {
if (tsLogObj.logHandle != NULL) { if (tsLogObj.logHandle != NULL) {
tsLogInited = 0; tsLogInited = 0;
taosThreadMutexDestroy(&tsLogObj.logHandle->buffMutex); (void)taosThreadMutexDestroy(&tsLogObj.logHandle->buffMutex);
taosCloseFile(&tsLogObj.logHandle->pFile); (void)taosCloseFile(&tsLogObj.logHandle->pFile);
taosMemoryFreeClear(tsLogObj.logHandle->buffer); taosMemoryFreeClear(tsLogObj.logHandle->buffer);
taosThreadMutexDestroy(&tsLogObj.logMutex); (void)taosThreadMutexDestroy(&tsLogObj.logMutex);
taosMemoryFreeClear(tsLogObj.logHandle); taosMemoryFreeClear(tsLogObj.logHandle);
tsLogObj.logHandle = NULL; tsLogObj.logHandle = NULL;
} }
@ -321,7 +321,7 @@ static OldFileKeeper *taosOpenNewFile() {
char name[LOG_FILE_NAME_LEN + 20]; char name[LOG_FILE_NAME_LEN + 20];
sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag); sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag);
taosUmaskFile(0); (void)taosUmaskFile(0);
TdFilePtr pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); TdFilePtr pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
if (pFile == NULL) { if (pFile == NULL) {
@ -331,7 +331,7 @@ static OldFileKeeper *taosOpenNewFile() {
return NULL; return NULL;
} }
taosLockLogFile(pFile); (void)taosLockLogFile(pFile);
(void)taosLSeekFile(pFile, 0, SEEK_SET); (void)taosLSeekFile(pFile, 0, SEEK_SET);
TdFilePtr pOldFile = tsLogObj.logHandle->pFile; TdFilePtr pOldFile = tsLogObj.logHandle->pFile;
@ -370,12 +370,12 @@ static int32_t taosOpenNewLogFile() {
uInfo("open new log file ......"); uInfo("open new log file ......");
TdThread thread; TdThread thread;
TdThreadAttr attr; TdThreadAttr attr;
taosThreadAttrInit(&attr); (void)taosThreadAttrInit(&attr);
taosThreadAttrSetDetachState(&attr, PTHREAD_CREATE_DETACHED); (void)taosThreadAttrSetDetachState(&attr, PTHREAD_CREATE_DETACHED);
OldFileKeeper *oldFileKeeper = taosOpenNewFile(); OldFileKeeper *oldFileKeeper = taosOpenNewFile();
taosThreadCreate(&thread, &attr, taosThreadToCloseOldFile, oldFileKeeper); (void)taosThreadCreate(&thread, &attr, taosThreadToCloseOldFile, oldFileKeeper);
taosThreadAttrDestroy(&attr); (void)taosThreadAttrDestroy(&attr);
} }
(void)taosThreadMutexUnlock(&tsLogObj.logMutex); (void)taosThreadMutexUnlock(&tsLogObj.logMutex);
@ -388,7 +388,7 @@ void taosResetLog() {
tsLogObj.lines = tsNumOfLogLines + 10; tsLogObj.lines = tsNumOfLogLines + 10;
if (tsLogObj.logHandle) { if (tsLogObj.logHandle) {
taosOpenNewLogFile(); (void)taosOpenNewLogFile();
uInfo("=================================="); uInfo("==================================");
uInfo(" reset log file "); uInfo(" reset log file ");
} }
@ -407,10 +407,10 @@ static bool taosCheckFileIsOpen(char *logFileName) {
if (taosLockLogFile(pFile)) { if (taosLockLogFile(pFile)) {
taosUnLockLogFile(pFile); taosUnLockLogFile(pFile);
taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
return false; return false;
} else { } else {
taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
return true; return true;
} }
} }
@ -480,14 +480,14 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxFileNum) {
sprintf(fileName, "%s.%d", tsLogObj.logName, tsLogObj.flag); sprintf(fileName, "%s.%d", tsLogObj.logName, tsLogObj.flag);
taosThreadMutexInit(&tsLogObj.logMutex, NULL); taosThreadMutexInit(&tsLogObj.logMutex, NULL);
taosUmaskFile(0); (void)taosUmaskFile(0);
tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CREATE | TD_FILE_WRITE); tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CREATE | TD_FILE_WRITE);
if (tsLogObj.logHandle->pFile == NULL) { if (tsLogObj.logHandle->pFile == NULL) {
printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno));
return TAOS_SYSTEM_ERROR(errno); return TAOS_SYSTEM_ERROR(errno);
} }
taosLockLogFile(tsLogObj.logHandle->pFile); (void)taosLockLogFile(tsLogObj.logHandle->pFile);
// only an estimate for number of lines // only an estimate for number of lines
int64_t filesize = 0; int64_t filesize = 0;
@ -497,14 +497,14 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxFileNum) {
} }
tsLogObj.lines = (int32_t)(filesize / 60); tsLogObj.lines = (int32_t)(filesize / 60);
taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END); (void)taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END);
sprintf(name, "==================================================\n"); sprintf(name, "==================================================\n");
taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name));
sprintf(name, " new log file \n"); sprintf(name, " new log file \n");
taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name));
sprintf(name, "==================================================\n"); sprintf(name, "==================================================\n");
taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name));
return 0; return 0;
} }
@ -512,17 +512,17 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxFileNum) {
static void taosUpdateLogNums(ELogLevel level) { static void taosUpdateLogNums(ELogLevel level) {
switch (level) { switch (level) {
case DEBUG_ERROR: case DEBUG_ERROR:
atomic_add_fetch_64(&tsNumOfErrorLogs, 1); (void)atomic_add_fetch_64(&tsNumOfErrorLogs, 1);
break; break;
case DEBUG_INFO: case DEBUG_INFO:
atomic_add_fetch_64(&tsNumOfInfoLogs, 1); (void)atomic_add_fetch_64(&tsNumOfInfoLogs, 1);
break; break;
case DEBUG_DEBUG: case DEBUG_DEBUG:
atomic_add_fetch_64(&tsNumOfDebugLogs, 1); (void)atomic_add_fetch_64(&tsNumOfDebugLogs, 1);
break; break;
case DEBUG_DUMP: case DEBUG_DUMP:
case DEBUG_TRACE: case DEBUG_TRACE:
atomic_add_fetch_64(&tsNumOfTraceLogs, 1); (void)atomic_add_fetch_64(&tsNumOfTraceLogs, 1);
break; break;
default: default:
break; break;
@ -533,7 +533,7 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) {
struct tm Tm, *ptm; struct tm Tm, *ptm;
struct timeval timeSecs; struct timeval timeSecs;
taosGetTimeOfDay(&timeSecs); (void)taosGetTimeOfDay(&timeSecs);
time_t curTime = timeSecs.tv_sec; time_t curTime = timeSecs.tv_sec;
ptm = taosLocalTime(&curTime, &Tm, NULL); ptm = taosLocalTime(&curTime, &Tm, NULL);
@ -546,15 +546,15 @@ static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *b
if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL && osLogSpaceAvailable()) { if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL && osLogSpaceAvailable()) {
taosUpdateLogNums(level); taosUpdateLogNums(level);
if (tsAsyncLog) { if (tsAsyncLog) {
taosPushLogBuffer(tsLogObj.logHandle, buffer, len); (void)taosPushLogBuffer(tsLogObj.logHandle, buffer, len);
} else { } else {
taosWriteFile(tsLogObj.logHandle->pFile, buffer, len); (void)taosWriteFile(tsLogObj.logHandle->pFile, buffer, len);
} }
if (tsNumOfLogLines > 0) { if (tsNumOfLogLines > 0) {
atomic_add_fetch_32(&tsLogObj.lines, 1); (void)atomic_add_fetch_32(&tsLogObj.lines, 1);
if ((tsLogObj.lines > tsNumOfLogLines) && (tsLogObj.openInProgress == 0)) { if ((tsLogObj.lines > tsNumOfLogLines) && (tsLogObj.openInProgress == 0)) {
taosOpenNewLogFile(); (void)taosOpenNewLogFile();
} }
} }
} }
@ -627,12 +627,12 @@ void taosPrintSlowLog(const char *format, ...) {
buffer[len++] = '\n'; buffer[len++] = '\n';
buffer[len] = 0; buffer[len] = 0;
atomic_add_fetch_64(&tsNumOfSlowLogs, 1); (void)atomic_add_fetch_64(&tsNumOfSlowLogs, 1);
if (tsAsyncLog) { if (tsAsyncLog) {
taosPushLogBuffer(tsLogObj.slowHandle, buffer, len); (void)taosPushLogBuffer(tsLogObj.slowHandle, buffer, len);
} else { } else {
taosWriteFile(tsLogObj.slowHandle->pFile, buffer, len); (void)taosWriteFile(tsLogObj.slowHandle->pFile, buffer, len);
} }
taosMemoryFree(buffer); taosMemoryFree(buffer);
@ -651,7 +651,7 @@ void taosDumpData(unsigned char *msg, int32_t len) {
pos += 3; pos += 3;
if (c >= 16) { if (c >= 16) {
temp[pos++] = '\n'; temp[pos++] = '\n';
taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); (void)taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos);
c = 0; c = 0;
pos = 0; pos = 0;
} }
@ -659,13 +659,13 @@ void taosDumpData(unsigned char *msg, int32_t len) {
temp[pos++] = '\n'; temp[pos++] = '\n';
taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); (void)taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos);
} }
static void taosCloseLogByFd(TdFilePtr pFile) { static void taosCloseLogByFd(TdFilePtr pFile) {
if (pFile != NULL) { if (pFile != NULL) {
taosUnLockLogFile(pFile); taosUnLockLogFile(pFile);
taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
} }
} }
@ -786,12 +786,12 @@ static void taosWriteLog(SLogBuff *pLogBuf) {
pLogBuf->lastDuration = 0; pLogBuf->lastDuration = 0;
if (start < end) { if (start < end) {
taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf) + start, pollSize); (void)taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf) + start, pollSize);
} else { } else {
int32_t tsize = LOG_BUF_SIZE(pLogBuf) - start; int32_t tsize = LOG_BUF_SIZE(pLogBuf) - start;
taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf) + start, tsize); (void)taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf) + start, tsize);
taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf), end); (void)taosWriteFile(pLogBuf->pFile, LOG_BUF_BUFFER(pLogBuf), end);
} }
dbgWN++; dbgWN++;
@ -937,7 +937,7 @@ void taosLogCrashInfo(char *nodeType, char *pMsg, int64_t msgLen, int signum, vo
_return: _return:
if (pFile) taosCloseFile(&pFile); if (pFile) (void)taosCloseFile(&pFile);
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
taosPrintLog(flags, level, dflag, "crash signal is %d", signum); taosPrintLog(flags, level, dflag, "crash signal is %d", signum);
@ -1029,10 +1029,10 @@ void taosReadCrashInfo(char *filepath, char **pMsg, int64_t *pMsgLen, TdFilePtr
_return: _return:
if (truncateFile) { if (truncateFile) {
taosFtruncateFile(pFile, 0); (void)taosFtruncateFile(pFile, 0);
} }
taosUnLockFile(pFile); taosUnLockFile(pFile);
taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
taosMemoryFree(buf); taosMemoryFree(buf);
*pMsg = NULL; *pMsg = NULL;
@ -1042,11 +1042,11 @@ _return:
void taosReleaseCrashLogFile(TdFilePtr pFile, bool truncateFile) { void taosReleaseCrashLogFile(TdFilePtr pFile, bool truncateFile) {
if (truncateFile) { if (truncateFile) {
taosFtruncateFile(pFile, 0); (void)taosFtruncateFile(pFile, 0);
} }
taosUnLockFile(pFile); taosUnLockFile(pFile);
taosCloseFile(&pFile); (void)taosCloseFile(&pFile);
} }
#ifdef NDEBUG #ifdef NDEBUG

View File

@ -102,7 +102,7 @@ void taosCloseQueue(STaosQueue *queue) {
taosMemoryFree(pTemp); taosMemoryFree(pTemp);
} }
taosThreadMutexDestroy(&queue->mutex); (void)taosThreadMutexDestroy(&queue->mutex);
taosMemoryFree(queue); taosMemoryFree(queue);
uDebug("queue:%p is closed", queue); uDebug("queue:%p is closed", queue);
@ -165,7 +165,7 @@ int32_t taosAllocateQitem(int32_t size, EQItype itype, int64_t dataSize, void **
if (alloced > tsRpcQueueMemoryAllowed) { if (alloced > tsRpcQueueMemoryAllowed) {
uError("failed to alloc qitem, size:%" PRId64 " alloc:%" PRId64 " allowed:%" PRId64, size + dataSize, alloced, uError("failed to alloc qitem, size:%" PRId64 " alloc:%" PRId64 " allowed:%" PRId64, size + dataSize, alloced,
tsRpcQueueMemoryAllowed); tsRpcQueueMemoryAllowed);
atomic_sub_fetch_64(&tsRpcQueueMemoryUsed, size + dataSize); (void)atomic_sub_fetch_64(&tsRpcQueueMemoryUsed, size + dataSize);
taosMemoryFree(pNode); taosMemoryFree(pNode);
return (terrno = TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE); return (terrno = TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE);
} }
@ -224,7 +224,7 @@ int32_t taosWriteQitem(STaosQueue *queue, void *pItem) {
queue->numOfItems++; queue->numOfItems++;
queue->memOfItems += (pNode->size + pNode->dataSize); queue->memOfItems += (pNode->size + pNode->dataSize);
if (queue->qset) { if (queue->qset) {
atomic_add_fetch_32(&queue->qset->numOfItems, 1); (void)atomic_add_fetch_32(&queue->qset->numOfItems, 1);
} }
uTrace("item:%p is put into queue:%p, items:%d mem:%" PRId64, pItem, queue, queue->numOfItems, queue->memOfItems); uTrace("item:%p is put into queue:%p, items:%d mem:%" PRId64, pItem, queue, queue->numOfItems, queue->memOfItems);
@ -253,7 +253,7 @@ int32_t taosReadQitem(STaosQueue *queue, void **ppItem) {
queue->numOfItems--; queue->numOfItems--;
queue->memOfItems -= (pNode->size + pNode->dataSize); queue->memOfItems -= (pNode->size + pNode->dataSize);
if (queue->qset) { if (queue->qset) {
atomic_sub_fetch_32(&queue->qset->numOfItems, 1); (void)atomic_sub_fetch_32(&queue->qset->numOfItems, 1);
} }
code = 1; code = 1;
uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems, uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems,
@ -301,7 +301,7 @@ int32_t taosReadAllQitems(STaosQueue *queue, STaosQall *qall) {
uTrace("read %d items from queue:%p, items:%d mem:%" PRId64, numOfItems, queue, queue->numOfItems, uTrace("read %d items from queue:%p, items:%d mem:%" PRId64, numOfItems, queue, queue->numOfItems,
queue->memOfItems); queue->memOfItems);
if (queue->qset) { if (queue->qset) {
atomic_sub_fetch_32(&queue->qset->numOfItems, qall->numOfItems); (void)atomic_sub_fetch_32(&queue->qset->numOfItems, qall->numOfItems);
} }
} }
@ -344,8 +344,8 @@ int32_t taosOpenQset(STaosQset **qset) {
return terrno = TSDB_CODE_OUT_OF_MEMORY; return terrno = TSDB_CODE_OUT_OF_MEMORY;
} }
taosThreadMutexInit(&(*qset)->mutex, NULL); (void)taosThreadMutexInit(&(*qset)->mutex, NULL);
tsem_init(&(*qset)->sem, 0, 0); (void)tsem_init(&(*qset)->sem, 0, 0);
uDebug("qset:%p is opened", qset); uDebug("qset:%p is opened", qset);
return 0; return 0;
@ -365,8 +365,8 @@ void taosCloseQset(STaosQset *qset) {
} }
(void)taosThreadMutexUnlock(&qset->mutex); (void)taosThreadMutexUnlock(&qset->mutex);
taosThreadMutexDestroy(&qset->mutex); (void)taosThreadMutexDestroy(&qset->mutex);
tsem_destroy(&qset->sem); (void)tsem_destroy(&qset->sem);
taosMemoryFree(qset); taosMemoryFree(qset);
uDebug("qset:%p is closed", qset); uDebug("qset:%p is closed", qset);
} }
@ -376,7 +376,7 @@ void taosCloseQset(STaosQset *qset) {
// thread to exit. // thread to exit.
void taosQsetThreadResume(STaosQset *qset) { void taosQsetThreadResume(STaosQset *qset) {
uDebug("qset:%p, it will exit", qset); uDebug("qset:%p, it will exit", qset);
tsem_post(&qset->sem); (void)tsem_post(&qset->sem);
} }
int32_t taosAddIntoQset(STaosQset *qset, STaosQueue *queue, void *ahandle) { int32_t taosAddIntoQset(STaosQset *qset, STaosQueue *queue, void *ahandle) {
@ -390,7 +390,7 @@ int32_t taosAddIntoQset(STaosQset *qset, STaosQueue *queue, void *ahandle) {
qset->numOfQueues++; qset->numOfQueues++;
(void)taosThreadMutexLock(&queue->mutex); (void)taosThreadMutexLock(&queue->mutex);
atomic_add_fetch_32(&qset->numOfItems, queue->numOfItems); (void)atomic_add_fetch_32(&qset->numOfItems, queue->numOfItems);
queue->qset = qset; queue->qset = qset;
(void)taosThreadMutexUnlock(&queue->mutex); (void)taosThreadMutexUnlock(&queue->mutex);
@ -428,7 +428,7 @@ void taosRemoveFromQset(STaosQset *qset, STaosQueue *queue) {
qset->numOfQueues--; qset->numOfQueues--;
(void)taosThreadMutexLock(&queue->mutex); (void)taosThreadMutexLock(&queue->mutex);
atomic_sub_fetch_32(&qset->numOfItems, queue->numOfItems); (void)atomic_sub_fetch_32(&qset->numOfItems, queue->numOfItems);
queue->qset = NULL; queue->qset = NULL;
queue->next = NULL; queue->next = NULL;
(void)taosThreadMutexUnlock(&queue->mutex); (void)taosThreadMutexUnlock(&queue->mutex);
@ -444,7 +444,7 @@ int32_t taosReadQitemFromQset(STaosQset *qset, void **ppItem, SQueueInfo *qinfo)
STaosQnode *pNode = NULL; STaosQnode *pNode = NULL;
int32_t code = 0; int32_t code = 0;
tsem_wait(&qset->sem); (void)tsem_wait(&qset->sem);
(void)taosThreadMutexLock(&qset->mutex); (void)taosThreadMutexLock(&qset->mutex);
@ -469,7 +469,7 @@ int32_t taosReadQitemFromQset(STaosQset *qset, void **ppItem, SQueueInfo *qinfo)
if (queue->head == NULL) queue->tail = NULL; if (queue->head == NULL) queue->tail = NULL;
// queue->numOfItems--; // queue->numOfItems--;
queue->memOfItems -= (pNode->size + pNode->dataSize); queue->memOfItems -= (pNode->size + pNode->dataSize);
atomic_sub_fetch_32(&qset->numOfItems, 1); (void)atomic_sub_fetch_32(&qset->numOfItems, 1);
code = 1; code = 1;
uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems - 1, uTrace("item:%p is read out from queue:%p, items:%d mem:%" PRId64, *ppItem, queue, queue->numOfItems - 1,
queue->memOfItems); queue->memOfItems);
@ -488,7 +488,7 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *
STaosQueue *queue; STaosQueue *queue;
int32_t code = 0; int32_t code = 0;
tsem_wait(&qset->sem); (void)tsem_wait(&qset->sem);
(void)taosThreadMutexLock(&qset->mutex); (void)taosThreadMutexLock(&qset->mutex);
for (int32_t i = 0; i < qset->numOfQueues; ++i) { for (int32_t i = 0; i < qset->numOfQueues; ++i) {
@ -520,9 +520,9 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *
queue->memOfItems = 0; queue->memOfItems = 0;
uTrace("read %d items from queue:%p, items:0 mem:%" PRId64, code, queue, queue->memOfItems); uTrace("read %d items from queue:%p, items:0 mem:%" PRId64, code, queue, queue->memOfItems);
atomic_sub_fetch_32(&qset->numOfItems, qall->numOfItems); (void)atomic_sub_fetch_32(&qset->numOfItems, qall->numOfItems);
for (int32_t j = 1; j < qall->numOfItems; ++j) { for (int32_t j = 1; j < qall->numOfItems; ++j) {
tsem_wait(&qset->sem); (void)tsem_wait(&qset->sem);
} }
} }

View File

@ -412,7 +412,7 @@ void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
pTree->max = tRBTreePredecessor(pTree, pTree->max); pTree->max = tRBTreePredecessor(pTree, pTree->max);
} }
rbtree_delete(pTree, z); (void)rbtree_delete(pTree, z);
pTree->n--; pTree->n--;
} }

View File

@ -63,7 +63,7 @@ int32_t taosOpenRef(int32_t max, RefFp fp) {
int64_t *lockedBy; int64_t *lockedBy;
int32_t i, rsetId; int32_t i, rsetId;
taosThreadOnce(&tsRefModuleInit, taosInitRefModule); (void)taosThreadOnce(&tsRefModuleInit, taosInitRefModule);
nodeList = taosMemoryCalloc(sizeof(SRefNode *), (size_t)max); nodeList = taosMemoryCalloc(sizeof(SRefNode *), (size_t)max);
if (nodeList == NULL) { if (nodeList == NULL) {
@ -450,7 +450,7 @@ static void taosLockList(int64_t *lockedBy) {
int32_t i = 0; int32_t i = 0;
while (atomic_val_compare_exchange_64(lockedBy, 0, tid) != 0) { while (atomic_val_compare_exchange_64(lockedBy, 0, tid) != 0) {
if (++i % 100 == 0) { if (++i % 100 == 0) {
sched_yield(); (void)sched_yield();
} }
} }
} }
@ -462,10 +462,10 @@ static void taosUnlockList(int64_t *lockedBy) {
} }
} }
static void taosInitRefModule(void) { taosThreadMutexInit(&tsRefMutex, NULL); } static void taosInitRefModule(void) { (void)taosThreadMutexInit(&tsRefMutex, NULL); }
static void taosIncRsetCount(SRefSet *pSet) { static void taosIncRsetCount(SRefSet *pSet) {
atomic_add_fetch_32(&pSet->count, 1); (void)atomic_add_fetch_32(&pSet->count, 1);
// uTrace("rsetId:%d inc count:%d", pSet->rsetId, count); // uTrace("rsetId:%d inc count:%d", pSet->rsetId, count);
} }

View File

@ -103,7 +103,7 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, _
void tSkipListDestroy(SSkipList *pSkipList) { void tSkipListDestroy(SSkipList *pSkipList) {
if (pSkipList == NULL) return; if (pSkipList == NULL) return;
tSkipListWLock(pSkipList); (void)tSkipListWLock(pSkipList);
SSkipListNode *pNode = SL_NODE_GET_FORWARD_POINTER(pSkipList->pHead, 0); SSkipListNode *pNode = SL_NODE_GET_FORWARD_POINTER(pSkipList->pHead, 0);
@ -113,7 +113,7 @@ void tSkipListDestroy(SSkipList *pSkipList) {
tSkipListFreeNode(pTemp); tSkipListFreeNode(pTemp);
} }
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
if (pSkipList->lock != NULL) { if (pSkipList->lock != NULL) {
taosThreadRwlockDestroy(pSkipList->lock); taosThreadRwlockDestroy(pSkipList->lock);
taosMemoryFreeClear(pSkipList->lock); taosMemoryFreeClear(pSkipList->lock);
@ -130,12 +130,12 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, void *pData) {
SSkipListNode *backward[MAX_SKIP_LIST_LEVEL] = {0}; SSkipListNode *backward[MAX_SKIP_LIST_LEVEL] = {0};
SSkipListNode *pNode = NULL; SSkipListNode *pNode = NULL;
tSkipListWLock(pSkipList); (void)tSkipListWLock(pSkipList);
bool hasDup = tSkipListGetPosToPut(pSkipList, backward, pData); bool hasDup = tSkipListGetPosToPut(pSkipList, backward, pData);
pNode = tSkipListPutImpl(pSkipList, pData, backward, false, hasDup); pNode = tSkipListPutImpl(pSkipList, pData, backward, false, hasDup);
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
return pNode; return pNode;
} }
@ -293,11 +293,11 @@ SSkipListIterator *tSkipListCreateIterFromVal(SSkipList *pSkipList, const char *
return iter; return iter;
} }
tSkipListRLock(pSkipList); (void)tSkipListRLock(pSkipList);
iter->cur = getPriorNode(pSkipList, val, order, &(iter->next)); iter->cur = getPriorNode(pSkipList, val, order, &(iter->next));
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
return iter; return iter;
} }
@ -307,13 +307,13 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
SSkipList *pSkipList = iter->pSkipList; SSkipList *pSkipList = iter->pSkipList;
tSkipListRLock(pSkipList); (void)tSkipListRLock(pSkipList);
if (iter->order == TSDB_ORDER_ASC) { if (iter->order == TSDB_ORDER_ASC) {
// no data in the skip list // no data in the skip list
if (iter->cur == pSkipList->pTail || iter->next == NULL) { if (iter->cur == pSkipList->pTail || iter->next == NULL) {
iter->cur = pSkipList->pTail; iter->cur = pSkipList->pTail;
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
return false; return false;
} }
@ -329,7 +329,7 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
} else { } else {
if (iter->cur == pSkipList->pHead) { if (iter->cur == pSkipList->pHead) {
iter->cur = pSkipList->pHead; iter->cur = pSkipList->pHead;
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
return false; return false;
} }
@ -344,7 +344,7 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
iter->step++; iter->step++;
} }
tSkipListUnlock(pSkipList); (void)tSkipListUnlock(pSkipList);
return (iter->order == TSDB_ORDER_ASC) ? (iter->cur != pSkipList->pTail) : (iter->cur != pSkipList->pHead); return (iter->order == TSDB_ORDER_ASC) ? (iter->cur != pSkipList->pTail) : (iter->cur != pSkipList->pHead);
} }

View File

@ -24,10 +24,10 @@ TdThread* taosCreateThread(void* (*__start_routine)(void*), void* param) {
} }
TdThreadAttr thattr; TdThreadAttr thattr;
taosThreadAttrInit(&thattr); (void)taosThreadAttrInit(&thattr);
taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE);
int32_t ret = taosThreadCreate(pthread, &thattr, __start_routine, param); int32_t ret = taosThreadCreate(pthread, &thattr, __start_routine, param);
taosThreadAttrDestroy(&thattr); (void)taosThreadAttrDestroy(&thattr);
if (ret != 0) { if (ret != 0) {
taosMemoryFree(pthread); taosMemoryFree(pthread);
@ -40,8 +40,8 @@ TdThread* taosCreateThread(void* (*__start_routine)(void*), void* param) {
bool taosDestroyThread(TdThread* pthread) { bool taosDestroyThread(TdThread* pthread) {
if (pthread == NULL) return false; if (pthread == NULL) return false;
if (taosThreadRunning(pthread)) { if (taosThreadRunning(pthread)) {
taosThreadCancel(*pthread); (void)taosThreadCancel(*pthread);
taosThreadJoin(*pthread, NULL); (void)taosThreadJoin(*pthread, NULL);
} }
taosMemoryFree(pthread); taosMemoryFree(pthread);

View File

@ -138,7 +138,7 @@ static uintptr_t getNextTimerId() {
return id; return id;
} }
static void timerAddRef(tmr_obj_t* timer) { atomic_add_fetch_8(&timer->refCount, 1); } static void timerAddRef(tmr_obj_t* timer) { (void)atomic_add_fetch_8(&timer->refCount, 1); }
static void timerDecRef(tmr_obj_t* timer) { static void timerDecRef(tmr_obj_t* timer) {
if (atomic_sub_fetch_8(&timer->refCount, 1) == 0) { if (atomic_sub_fetch_8(&timer->refCount, 1) == 0) {
@ -151,7 +151,7 @@ static void lockTimerList(timer_list_t* list) {
int32_t i = 0; int32_t i = 0;
while (atomic_val_compare_exchange_64(&(list->lockedBy), 0, tid) != 0) { while (atomic_val_compare_exchange_64(&(list->lockedBy), 0, tid) != 0) {
if (++i % 1000 == 0) { if (++i % 1000 == 0) {
sched_yield(); (void)sched_yield();
} }
} }
} }
@ -314,7 +314,7 @@ static void addToExpired(tmr_obj_t* head) {
schedMsg.msg = NULL; schedMsg.msg = NULL;
schedMsg.ahandle = head; schedMsg.ahandle = head;
schedMsg.thandle = NULL; schedMsg.thandle = NULL;
taosScheduleTask(tmrQhandle, &schedMsg); (void)taosScheduleTask(tmrQhandle, &schedMsg);
tmrDebug("timer[id=%" PRIuPTR "] has been added to queue.", id); tmrDebug("timer[id=%" PRIuPTR "] has been added to queue.", id);
head = next; head = next;
@ -458,7 +458,7 @@ bool taosTmrStop(tmr_h timerId) {
} }
uint8_t state = atomic_val_compare_exchange_8(&timer->state, TIMER_STATE_WAITING, TIMER_STATE_CANCELED); uint8_t state = atomic_val_compare_exchange_8(&timer->state, TIMER_STATE_WAITING, TIMER_STATE_CANCELED);
doStopTimer(timer, state); (void)doStopTimer(timer, state);
timerDecRef(timer); timerDecRef(timer);
return state == TIMER_STATE_WAITING; return state == TIMER_STATE_WAITING;
@ -501,7 +501,7 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* han
// so that we can reuse this timer safely. // so that we can reuse this timer safely.
for (int32_t i = 1; atomic_load_8(&timer->refCount) > 1; ++i) { for (int32_t i = 1; atomic_load_8(&timer->refCount) > 1; ++i) {
if (i % 1000 == 0) { if (i % 1000 == 0) {
sched_yield(); (void)sched_yield();
} }
} }
@ -528,7 +528,7 @@ static int32_t taosTmrModuleInit(void) {
(tmrCtrls + tsMaxTmrCtrl - 1)->next = NULL; (tmrCtrls + tsMaxTmrCtrl - 1)->next = NULL;
unusedTmrCtrl = tmrCtrls; unusedTmrCtrl = tmrCtrls;
taosThreadMutexInit(&tmrCtrlMutex, NULL); (void)taosThreadMutexInit(&tmrCtrlMutex, NULL);
int64_t now = taosGetMonotonicMs(); int64_t now = taosGetMonotonicMs();
for (int32_t i = 0; i < tListLen(wheels); i++) { for (int32_t i = 0; i < tListLen(wheels); i++) {
@ -555,7 +555,7 @@ static int32_t taosTmrModuleInit(void) {
} }
tmrQhandle = taosInitScheduler(10000, taosTmrThreads, "tmr", NULL); tmrQhandle = taosInitScheduler(10000, taosTmrThreads, "tmr", NULL);
taosInitTimer(taosTimerLoopFunc, MSECONDS_PER_TICK); (void)taosInitTimer(taosTimerLoopFunc, MSECONDS_PER_TICK);
tmrDebug("timer module is initialized, number of threads: %d", taosTmrThreads); tmrDebug("timer module is initialized, number of threads: %d", taosTmrThreads);
@ -638,11 +638,11 @@ void taosTmrCleanUp(void* handle) {
for (int32_t i = 0; i < tListLen(wheels); i++) { for (int32_t i = 0; i < tListLen(wheels); i++) {
time_wheel_t* wheel = wheels + i; time_wheel_t* wheel = wheels + i;
taosThreadMutexDestroy(&wheel->mutex); (void)taosThreadMutexDestroy(&wheel->mutex);
taosMemoryFree(wheel->slots); taosMemoryFree(wheel->slots);
} }
taosThreadMutexDestroy(&tmrCtrlMutex); (void)taosThreadMutexDestroy(&tmrCtrlMutex);
for (size_t i = 0; i < timerMap.size; i++) { for (size_t i = 0; i < timerMap.size; i++) {
timer_list_t* list = timerMap.slots + i; timer_list_t* list = timerMap.slots + i;

View File

@ -58,15 +58,15 @@ void tQWorkerCleanup(SQWorkerPool *pool) {
SQueueWorker *worker = pool->workers + i; SQueueWorker *worker = pool->workers + i;
if (taosCheckPthreadValid(worker->thread)) { if (taosCheckPthreadValid(worker->thread)) {
uInfo("worker:%s:%d is stopping", pool->name, worker->id); uInfo("worker:%s:%d is stopping", pool->name, worker->id);
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
uInfo("worker:%s:%d is stopped", pool->name, worker->id); uInfo("worker:%s:%d is stopped", pool->name, worker->id);
} }
} }
taosMemoryFreeClear(pool->workers); taosMemoryFreeClear(pool->workers);
taosCloseQset(pool->qset); taosCloseQset(pool->qset);
taosThreadMutexDestroy(&pool->mutex); (void)taosThreadMutexDestroy(&pool->mutex);
uInfo("worker:%s is closed", pool->name); uInfo("worker:%s is closed", pool->name);
} }
@ -77,7 +77,7 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) {
void *msg = NULL; void *msg = NULL;
int32_t code = 0; int32_t code = 0;
taosBlockSIGPIPE(); (void)taosBlockSIGPIPE();
setThreadName(pool->name); setThreadName(pool->name);
worker->pid = taosGetSelfPthreadId(); worker->pid = taosGetSelfPthreadId();
uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid); uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid);
@ -122,7 +122,7 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
(void)taosThreadMutexLock(&pool->mutex); (void)taosThreadMutexLock(&pool->mutex);
taosSetQueueFp(queue, fp, NULL); taosSetQueueFp(queue, fp, NULL);
taosAddIntoQset(pool->qset, queue, ahandle); (void)taosAddIntoQset(pool->qset, queue, ahandle);
// spawn a thread to process queue // spawn a thread to process queue
if (pool->num < pool->max) { if (pool->num < pool->max) {
@ -130,8 +130,8 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
SQueueWorker *worker = pool->workers + pool->num; SQueueWorker *worker = pool->workers + pool->num;
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tQWorkerThreadFp, worker) != 0) { if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tQWorkerThreadFp, worker) != 0) {
taosCloseQueue(queue); taosCloseQueue(queue);
@ -140,7 +140,7 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
break; break;
} }
taosThreadAttrDestroy(&thAttr); (void)taosThreadAttrDestroy(&thAttr);
pool->num++; pool->num++;
uInfo("worker:%s:%d is launched, total:%d", pool->name, worker->id, pool->num); uInfo("worker:%s:%d is launched, total:%d", pool->name, worker->id, pool->num);
} while (pool->num < pool->min); } while (pool->num < pool->min);
@ -190,8 +190,8 @@ void tAutoQWorkerCleanup(SAutoQWorkerPool *pool) {
SQueueWorker *worker = taosArrayGetP(pool->workers, i); SQueueWorker *worker = taosArrayGetP(pool->workers, i);
if (taosCheckPthreadValid(worker->thread)) { if (taosCheckPthreadValid(worker->thread)) {
uInfo("worker:%s:%d is stopping", pool->name, worker->id); uInfo("worker:%s:%d is stopping", pool->name, worker->id);
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
uInfo("worker:%s:%d is stopped", pool->name, worker->id); uInfo("worker:%s:%d is stopped", pool->name, worker->id);
} }
taosMemoryFree(worker); taosMemoryFree(worker);
@ -199,7 +199,7 @@ void tAutoQWorkerCleanup(SAutoQWorkerPool *pool) {
taosArrayDestroy(pool->workers); taosArrayDestroy(pool->workers);
taosCloseQset(pool->qset); taosCloseQset(pool->qset);
taosThreadMutexDestroy(&pool->mutex); (void)taosThreadMutexDestroy(&pool->mutex);
uInfo("worker:%s is closed", pool->name); uInfo("worker:%s is closed", pool->name);
} }
@ -210,7 +210,7 @@ static void *tAutoQWorkerThreadFp(SQueueWorker *worker) {
void *msg = NULL; void *msg = NULL;
int32_t code = 0; int32_t code = 0;
taosBlockSIGPIPE(); (void)taosBlockSIGPIPE();
setThreadName(pool->name); setThreadName(pool->name);
worker->pid = taosGetSelfPthreadId(); worker->pid = taosGetSelfPthreadId();
uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid); uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid);
@ -253,7 +253,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
(void)taosThreadMutexLock(&pool->mutex); (void)taosThreadMutexLock(&pool->mutex);
taosSetQueueFp(queue, fp, NULL); taosSetQueueFp(queue, fp, NULL);
taosAddIntoQset(pool->qset, queue, ahandle); (void)taosAddIntoQset(pool->qset, queue, ahandle);
int32_t queueNum = taosGetQueueNumber(pool->qset); int32_t queueNum = taosGetQueueNumber(pool->qset);
int32_t curWorkerNum = taosArrayGetSize(pool->workers); int32_t curWorkerNum = taosArrayGetSize(pool->workers);
@ -275,8 +275,8 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
worker->pool = pool; worker->pool = pool;
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tAutoQWorkerThreadFp, worker) != 0) { if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tAutoQWorkerThreadFp, worker) != 0) {
uError("worker:%s:%d failed to create thread, total:%d", pool->name, worker->id, curWorkerNum); uError("worker:%s:%d failed to create thread, total:%d", pool->name, worker->id, curWorkerNum);
@ -287,7 +287,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem
return NULL; return NULL;
} }
taosThreadAttrDestroy(&thAttr); (void)taosThreadAttrDestroy(&thAttr);
int32_t numOfThreads = taosArrayGetSize(pool->workers); int32_t numOfThreads = taosArrayGetSize(pool->workers);
uInfo("worker:%s:%d is launched, total:%d, expect:%d", pool->name, worker->id, numOfThreads, dstWorkerNum); uInfo("worker:%s:%d is launched, total:%d, expect:%d", pool->name, worker->id, numOfThreads, dstWorkerNum);
@ -340,8 +340,8 @@ void tWWorkerCleanup(SWWorkerPool *pool) {
SWWorker *worker = pool->workers + i; SWWorker *worker = pool->workers + i;
if (taosCheckPthreadValid(worker->thread)) { if (taosCheckPthreadValid(worker->thread)) {
uInfo("worker:%s:%d is stopping", pool->name, worker->id); uInfo("worker:%s:%d is stopping", pool->name, worker->id);
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
taosFreeQall(worker->qall); taosFreeQall(worker->qall);
taosCloseQset(worker->qset); taosCloseQset(worker->qset);
uInfo("worker:%s:%d is stopped", pool->name, worker->id); uInfo("worker:%s:%d is stopped", pool->name, worker->id);
@ -349,7 +349,7 @@ void tWWorkerCleanup(SWWorkerPool *pool) {
} }
taosMemoryFreeClear(pool->workers); taosMemoryFreeClear(pool->workers);
taosThreadMutexDestroy(&pool->mutex); (void)taosThreadMutexDestroy(&pool->mutex);
uInfo("worker:%s is closed", pool->name); uInfo("worker:%s is closed", pool->name);
} }
@ -361,7 +361,7 @@ static void *tWWorkerThreadFp(SWWorker *worker) {
int32_t code = 0; int32_t code = 0;
int32_t numOfMsgs = 0; int32_t numOfMsgs = 0;
taosBlockSIGPIPE(); (void)taosBlockSIGPIPE();
setThreadName(pool->name); setThreadName(pool->name);
worker->pid = taosGetSelfPthreadId(); worker->pid = taosGetSelfPthreadId();
uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid); uInfo("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid);
@ -406,23 +406,23 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
code = taosOpenQset(&worker->qset); code = taosOpenQset(&worker->qset);
if (code) goto _OVER; if (code) goto _OVER;
taosAddIntoQset(worker->qset, queue, ahandle); (void)taosAddIntoQset(worker->qset, queue, ahandle);
code = taosAllocateQall(&worker->qall); code = taosAllocateQall(&worker->qall);
if (code) goto _OVER; if (code) goto _OVER;
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tWWorkerThreadFp, worker) != 0) goto _OVER; if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tWWorkerThreadFp, worker) != 0) goto _OVER;
uInfo("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max); uInfo("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max);
pool->nextId = (pool->nextId + 1) % pool->max; pool->nextId = (pool->nextId + 1) % pool->max;
taosThreadAttrDestroy(&thAttr); (void)taosThreadAttrDestroy(&thAttr);
pool->num++; pool->num++;
if (pool->num > pool->max) pool->num = pool->max; if (pool->num > pool->max) pool->num = pool->max;
} else { } else {
taosAddIntoQset(worker->qset, queue, ahandle); (void)taosAddIntoQset(worker->qset, queue, ahandle);
pool->nextId = (pool->nextId + 1) % pool->max; pool->nextId = (pool->nextId + 1) % pool->max;
} }
@ -628,7 +628,7 @@ static void *tQueryAutoQWorkerThreadFp(SQueryAutoQWorker *worker) {
void *msg = NULL; void *msg = NULL;
int32_t code = 0; int32_t code = 0;
taosBlockSIGPIPE(); (void)taosBlockSIGPIPE();
setThreadName(pool->name); setThreadName(pool->name);
worker->pid = taosGetSelfPthreadId(); worker->pid = taosGetSelfPthreadId();
uDebug("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid); uDebug("worker:%s:%d is running, thread:%08" PRId64, pool->name, worker->id, worker->pid);
@ -647,7 +647,7 @@ static void *tQueryAutoQWorkerThreadFp(SQueryAutoQWorker *worker) {
} }
} }
tQueryAutoQWorkerWaitingCheck(pool); (void)tQueryAutoQWorkerWaitingCheck(pool);
if (qinfo.fp != NULL) { if (qinfo.fp != NULL) {
qinfo.workerId = worker->id; qinfo.workerId = worker->id;
@ -676,7 +676,7 @@ static bool tQueryAutoQWorkerTrySignalWaitingAfterBlock(void *p) {
int32_t waitingNew = atomic_val_compare_exchange_32(&pPool->waitingAfterBlockN, waiting, waiting - 1); int32_t waitingNew = atomic_val_compare_exchange_32(&pPool->waitingAfterBlockN, waiting, waiting - 1);
if (waitingNew == waiting) { if (waitingNew == waiting) {
(void)taosThreadMutexLock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexLock(&pPool->waitingAfterBlockLock);
taosThreadCondSignal(&pPool->waitingAfterBlockCond); (void)taosThreadCondSignal(&pPool->waitingAfterBlockCond);
(void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock);
ret = true; ret = true;
break; break;
@ -694,7 +694,7 @@ static bool tQueryAutoQWorkerTrySignalWaitingBeforeProcess(void *p) {
int32_t waitingNew = atomic_val_compare_exchange_32(&pPool->waitingBeforeProcessMsgN, waiting, waiting - 1); int32_t waitingNew = atomic_val_compare_exchange_32(&pPool->waitingBeforeProcessMsgN, waiting, waiting - 1);
if (waitingNew == waiting) { if (waitingNew == waiting) {
(void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock);
taosThreadCondSignal(&pPool->waitingBeforeProcessMsgCond); (void)taosThreadCondSignal(&pPool->waitingBeforeProcessMsgCond);
(void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock);
ret = true; ret = true;
break; break;
@ -733,7 +733,7 @@ static int32_t tQueryAutoQWorkerWaitingCheck(SQueryAutoQWorkerPool *pPool) {
// to wait for process // to wait for process
(void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock);
atomic_fetch_add_32(&pPool->waitingBeforeProcessMsgN, 1); atomic_fetch_add_32(&pPool->waitingBeforeProcessMsgN, 1);
if (!pPool->exit) taosThreadCondWait(&pPool->waitingBeforeProcessMsgCond, &pPool->waitingBeforeProcessMsgLock); if (!pPool->exit) (void)taosThreadCondWait(&pPool->waitingBeforeProcessMsgCond, &pPool->waitingBeforeProcessMsgLock);
// recovered from waiting // recovered from waiting
(void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -751,8 +751,8 @@ bool tQueryAutoQWorkerTryRecycleWorker(SQueryAutoQWorkerPool *pPool, SQueryAutoQ
SListNode *head = tdListPopHead(pPool->exitedWorkers); SListNode *head = tdListPopHead(pPool->exitedWorkers);
SQueryAutoQWorker *pWorker = (SQueryAutoQWorker *)head->data; SQueryAutoQWorker *pWorker = (SQueryAutoQWorker *)head->data;
if (pWorker && taosCheckPthreadValid(pWorker->thread)) { if (pWorker && taosCheckPthreadValid(pWorker->thread)) {
taosThreadJoin(pWorker->thread, NULL); (void)taosThreadJoin(pWorker->thread, NULL);
taosThreadClear(&pWorker->thread); (void)taosThreadClear(&pWorker->thread);
} }
taosMemoryFree(head); taosMemoryFree(head);
} }
@ -768,7 +768,7 @@ bool tQueryAutoQWorkerTryRecycleWorker(SQueryAutoQWorkerPool *pPool, SQueryAutoQ
// start to wait at backup cond // start to wait at backup cond
(void)taosThreadMutexLock(&pPool->backupLock); (void)taosThreadMutexLock(&pPool->backupLock);
atomic_fetch_add_32(&pPool->backupNum, 1); atomic_fetch_add_32(&pPool->backupNum, 1);
if (!pPool->exit) taosThreadCondWait(&pPool->backupCond, &pPool->backupLock); if (!pPool->exit) (void)taosThreadCondWait(&pPool->backupCond, &pPool->backupLock);
(void)taosThreadMutexUnlock(&pPool->backupLock); (void)taosThreadMutexUnlock(&pPool->backupLock);
// recovered from backup // recovered from backup
@ -832,15 +832,15 @@ void tQueryAutoQWorkerCleanup(SQueryAutoQWorkerPool *pPool) {
(void)taosThreadMutexUnlock(&pPool->poolLock); (void)taosThreadMutexUnlock(&pPool->poolLock);
(void)taosThreadMutexLock(&pPool->backupLock); (void)taosThreadMutexLock(&pPool->backupLock);
taosThreadCondBroadcast(&pPool->backupCond); (void)taosThreadCondBroadcast(&pPool->backupCond);
(void)taosThreadMutexUnlock(&pPool->backupLock); (void)taosThreadMutexUnlock(&pPool->backupLock);
(void)taosThreadMutexLock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexLock(&pPool->waitingAfterBlockLock);
taosThreadCondBroadcast(&pPool->waitingAfterBlockCond); (void)taosThreadCondBroadcast(&pPool->waitingAfterBlockCond);
(void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock);
(void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexLock(&pPool->waitingBeforeProcessMsgLock);
taosThreadCondBroadcast(&pPool->waitingBeforeProcessMsgCond); (void)taosThreadCondBroadcast(&pPool->waitingBeforeProcessMsgCond);
(void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexUnlock(&pPool->waitingBeforeProcessMsgLock);
int32_t idx = 0; int32_t idx = 0;
@ -855,8 +855,8 @@ void tQueryAutoQWorkerCleanup(SQueryAutoQWorkerPool *pPool) {
worker = (SQueryAutoQWorker *)pNode->data; worker = (SQueryAutoQWorker *)pNode->data;
(void)taosThreadMutexUnlock(&pPool->poolLock); (void)taosThreadMutexUnlock(&pPool->poolLock);
if (worker && taosCheckPthreadValid(worker->thread)) { if (worker && taosCheckPthreadValid(worker->thread)) {
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
} }
taosMemoryFree(pNode); taosMemoryFree(pNode);
} }
@ -865,8 +865,8 @@ void tQueryAutoQWorkerCleanup(SQueryAutoQWorkerPool *pPool) {
SListNode *pNode = tdListPopHead(pPool->backupWorkers); SListNode *pNode = tdListPopHead(pPool->backupWorkers);
worker = (SQueryAutoQWorker *)pNode->data; worker = (SQueryAutoQWorker *)pNode->data;
if (worker && taosCheckPthreadValid(worker->thread)) { if (worker && taosCheckPthreadValid(worker->thread)) {
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
} }
taosMemoryFree(pNode); taosMemoryFree(pNode);
} }
@ -875,8 +875,8 @@ void tQueryAutoQWorkerCleanup(SQueryAutoQWorkerPool *pPool) {
SListNode *pNode = tdListPopHead(pPool->exitedWorkers); SListNode *pNode = tdListPopHead(pPool->exitedWorkers);
worker = (SQueryAutoQWorker *)pNode->data; worker = (SQueryAutoQWorker *)pNode->data;
if (worker && taosCheckPthreadValid(worker->thread)) { if (worker && taosCheckPthreadValid(worker->thread)) {
taosThreadJoin(worker->thread, NULL); (void)taosThreadJoin(worker->thread, NULL);
taosThreadClear(&worker->thread); (void)taosThreadClear(&worker->thread);
} }
taosMemoryFree(pNode); taosMemoryFree(pNode);
} }
@ -886,14 +886,14 @@ void tQueryAutoQWorkerCleanup(SQueryAutoQWorkerPool *pPool) {
tdListFree(pPool->exitedWorkers); tdListFree(pPool->exitedWorkers);
taosMemoryFree(pPool->pCb); taosMemoryFree(pPool->pCb);
taosThreadMutexDestroy(&pPool->poolLock); (void)taosThreadMutexDestroy(&pPool->poolLock);
taosThreadMutexDestroy(&pPool->backupLock); (void)taosThreadMutexDestroy(&pPool->backupLock);
taosThreadMutexDestroy(&pPool->waitingAfterBlockLock); (void)taosThreadMutexDestroy(&pPool->waitingAfterBlockLock);
taosThreadMutexDestroy(&pPool->waitingBeforeProcessMsgLock); (void)taosThreadMutexDestroy(&pPool->waitingBeforeProcessMsgLock);
taosThreadCondDestroy(&pPool->backupCond); (void)taosThreadCondDestroy(&pPool->backupCond);
taosThreadCondDestroy(&pPool->waitingAfterBlockCond); (void)taosThreadCondDestroy(&pPool->waitingAfterBlockCond);
taosThreadCondDestroy(&pPool->waitingBeforeProcessMsgCond); (void)taosThreadCondDestroy(&pPool->waitingBeforeProcessMsgCond);
taosCloseQset(pPool->qset); taosCloseQset(pPool->qset);
} }
@ -907,7 +907,7 @@ STaosQueue *tQueryAutoQWorkerAllocQueue(SQueryAutoQWorkerPool *pool, void *ahand
(void)taosThreadMutexLock(&pool->poolLock); (void)taosThreadMutexLock(&pool->poolLock);
taosSetQueueFp(queue, fp, NULL); taosSetQueueFp(queue, fp, NULL);
taosAddIntoQset(pool->qset, queue, ahandle); (void)taosAddIntoQset(pool->qset, queue, ahandle);
SQueryAutoQWorker worker = {0}; SQueryAutoQWorker worker = {0};
SQueryAutoQWorker *pWorker = NULL; SQueryAutoQWorker *pWorker = NULL;
@ -927,8 +927,8 @@ STaosQueue *tQueryAutoQWorkerAllocQueue(SQueryAutoQWorkerPool *pool, void *ahand
pWorker = (SQueryAutoQWorker *)pNode->data; pWorker = (SQueryAutoQWorker *)pNode->data;
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&pWorker->thread, &thAttr, (ThreadFp)tQueryAutoQWorkerThreadFp, pWorker) != 0) { if (taosThreadCreate(&pWorker->thread, &thAttr, (ThreadFp)tQueryAutoQWorkerThreadFp, pWorker) != 0) {
taosCloseQueue(queue); taosCloseQueue(queue);
@ -937,7 +937,7 @@ STaosQueue *tQueryAutoQWorkerAllocQueue(SQueryAutoQWorkerPool *pool, void *ahand
break; break;
} }
taosThreadAttrDestroy(&thAttr); (void)taosThreadAttrDestroy(&thAttr);
pool->num++; pool->num++;
atomicFetchAddActive(&pool->activeRunningN, 1); atomicFetchAddActive(&pool->activeRunningN, 1);
uInfo("worker:%s:%d is launched, total:%d", pool->name, pWorker->id, pool->num); uInfo("worker:%s:%d is launched, total:%d", pool->name, pWorker->id, pool->num);
@ -958,7 +958,7 @@ static int32_t tQueryAutoQWorkerAddWorker(SQueryAutoQWorkerPool *pool) {
while (backup > 0) { while (backup > 0) {
int32_t backupNew = atomic_val_compare_exchange_32(&pool->backupNum, backup, backup - 1); int32_t backupNew = atomic_val_compare_exchange_32(&pool->backupNum, backup, backup - 1);
if (backupNew == backup) { if (backupNew == backup) {
taosThreadCondSignal(&pool->backupCond); (void)taosThreadCondSignal(&pool->backupCond);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
backup = backupNew; backup = backupNew;
@ -980,14 +980,14 @@ static int32_t tQueryAutoQWorkerAddWorker(SQueryAutoQWorkerPool *pool) {
pWorker = (SQueryAutoQWorker *)pNode->data; pWorker = (SQueryAutoQWorker *)pNode->data;
TdThreadAttr thAttr; TdThreadAttr thAttr;
taosThreadAttrInit(&thAttr); (void)taosThreadAttrInit(&thAttr);
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
if (taosThreadCreate(&pWorker->thread, &thAttr, (ThreadFp)tQueryAutoQWorkerThreadFp, pWorker) != 0) { if (taosThreadCreate(&pWorker->thread, &thAttr, (ThreadFp)tQueryAutoQWorkerThreadFp, pWorker) != 0) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno; return terrno;
} }
taosThreadAttrDestroy(&thAttr); (void)taosThreadAttrDestroy(&thAttr);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1017,7 +1017,7 @@ static int32_t tQueryAutoQWorkerRecoverFromBlocking(void *p) {
} }
(void)taosThreadMutexLock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexLock(&pPool->waitingAfterBlockLock);
atomic_fetch_add_32(&pPool->waitingAfterBlockN, 1); atomic_fetch_add_32(&pPool->waitingAfterBlockN, 1);
if (!pPool->exit) taosThreadCondWait(&pPool->waitingAfterBlockCond, &pPool->waitingAfterBlockLock); if (!pPool->exit) (void)taosThreadCondWait(&pPool->waitingAfterBlockCond, &pPool->waitingAfterBlockLock);
(void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock); (void)taosThreadMutexUnlock(&pPool->waitingAfterBlockLock);
if (pPool->exit) return TSDB_CODE_QRY_QWORKER_QUIT; if (pPool->exit) return TSDB_CODE_QRY_QWORKER_QUIT;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;