diff --git a/source/dnode/vnode/src/meta/metaCache.c b/source/dnode/vnode/src/meta/metaCache.c index 16cf9335fe..91aa513aa6 100644 --- a/source/dnode/vnode/src/meta/metaCache.c +++ b/source/dnode/vnode/src/meta/metaCache.c @@ -216,7 +216,7 @@ void metaCacheClose(SMeta* pMeta) { } } -static int32_t metaRehashCache(SMetaCache* pCache, int8_t expand) { +static void metaRehashCache(SMetaCache* pCache, int8_t expand) { int32_t code = 0; int32_t nBucket; @@ -228,8 +228,7 @@ static int32_t metaRehashCache(SMetaCache* pCache, int8_t expand) { SMetaCacheEntry** aBucket = (SMetaCacheEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaCacheEntry*)); if (aBucket == NULL) { - code = terrno; - goto _exit; + return; } // rehash @@ -250,9 +249,7 @@ static int32_t metaRehashCache(SMetaCache* pCache, int8_t expand) { taosMemoryFree(pCache->sEntryCache.aBucket); pCache->sEntryCache.nBucket = nBucket; pCache->sEntryCache.aBucket = aBucket; - -_exit: - return code; + return; } int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { @@ -279,7 +276,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) { } } else { // insert if (pCache->sEntryCache.nEntry >= pCache->sEntryCache.nBucket) { - TAOS_UNUSED(metaRehashCache(pCache, 1)); + metaRehashCache(pCache, 1); iBucket = TABS(pInfo->uid) % pCache->sEntryCache.nBucket; } @@ -317,7 +314,7 @@ int32_t metaCacheDrop(SMeta* pMeta, int64_t uid) { pCache->sEntryCache.nEntry--; if (pCache->sEntryCache.nEntry < pCache->sEntryCache.nBucket / 4 && pCache->sEntryCache.nBucket > META_CACHE_BASE_BUCKET) { - TAOS_UNUSED(metaRehashCache(pCache, 0)); + metaRehashCache(pCache, 0); } } else { code = TSDB_CODE_NOT_FOUND; diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index d1ffe82e32..1da6ed584e 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -60,7 +60,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) { pMeta->path = (char *)&pMeta[1]; strcpy(pMeta->path, path); - (void)taosRealPath(pMeta->path, NULL, strlen(path) + 1); + int32_t ret = taosRealPath(pMeta->path, NULL, strlen(path) + 1); pMeta->pVnode = pVnode; @@ -98,7 +98,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) { TSDB_CHECK_CODE(code, lino, _exit); sprintf(indexFullPath, "%s/%s", pMeta->path, "invert"); - TAOS_UNUSED(taosMkDir(indexFullPath)); + ret = taosMkDir(indexFullPath); SIndexOpts opts = {.cacheSize = 8 * 1024 * 1024}; code = indexOpen(&opts, indexFullPath, (SIndex **)&pMeta->pTagIvtIdx); diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 1024803083..d489535c02 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -285,7 +285,9 @@ static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) { int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries; if (deltaTS > tsTimeSeriesThreshold) { if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) { - (void)tsem_post(&dmNotifyHdl.sem); + if (tsem_post(&dmNotifyHdl.sem) != 0) { + metaError("vgId:%d, failed to post semaphore, errno:%d", TD_VID(pMeta->pVnode), errno); + } } } #endif diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index cf0a9701d9..ee8ee962e9 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -89,7 +89,7 @@ void *tdFreeRSmaInfo(SSma *pSma, SRSmaInfo *pInfo) { if (pItem->tmrId) { smaDebug("vgId:%d, stop fetch timer %p for table %" PRIi64 " level %d", SMA_VID(pSma), pItem->tmrId, pInfo->suid, i + 1); - if(!taosTmrStopA(&pItem->tmrId)){ + if (!taosTmrStopA(&pItem->tmrId)) { smaError("vgId:%d, failed to stop fetch timer for table %" PRIi64 " level %d", SMA_VID(pSma), pInfo->suid, i + 1); } @@ -404,7 +404,7 @@ int32_t tdRSmaProcessCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con } STSchema *pTSchema; - code = metaGetTbTSchemaNotNull(SMA_META(pSma), suid, -1, 1, &pTSchema); + code = metaGetTbTSchemaNotNull(SMA_META(pSma), suid, -1, 1, &pTSchema); TAOS_CHECK_EXIT(code); pRSmaInfo->pSma = pSma; pRSmaInfo->pTSchema = pTSchema; @@ -820,7 +820,10 @@ static int32_t tdExecuteRSmaImplAsync(SSma *pSma, int64_t version, const void *p int64_t nItems = atomic_fetch_add_64(&pRSmaStat->nBufItems, 1); if (atomic_load_8(&pInfo->assigned) == 0) { - (void)tsem_post(&(pRSmaStat->notEmpty)); + if (tsem_post(&(pRSmaStat->notEmpty)) != 0) { + smaError("vgId:%d, failed to post notEmpty semaphore for rsma %" PRIi64 " since %s", SMA_VID(pSma), suid, + tstrerror(terrno)); + } } // smoothing consume @@ -1385,7 +1388,8 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { if (rsmaTriggerStat == TASK_TRIGGER_STAT_PAUSED) { bool ret = taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId); if (!ret) { - smaWarn("vgId:%d, rsma fetch task not reset for level %" PRIi8 " since tmr reset failed, rsetId:%d refId:%" PRIi64, + smaWarn("vgId:%d, rsma fetch task not reset for level %" PRIi8 + " since tmr reset failed, rsetId:%d refId:%" PRIi64, SMA_VID(pSma), pItem->level, smaMgmt.rsetId, pRSmaRef->refId); } } @@ -1407,7 +1411,10 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { atomic_store_8(&pItem->fetchLevel, 1); if (atomic_load_8(&pRSmaInfo->assigned) == 0) { - (void)tsem_post(&(pStat->notEmpty)); + if (tsem_post(&(pStat->notEmpty)) != 0) { + smaError("vgId:%d, rsma fetch task not start for level:%" PRIi8 " suid:%" PRIi64 " since sem post failed", + SMA_VID(pSma), pItem->level, pRSmaInfo->suid); + } } } break; case TASK_TRIGGER_STAT_INACTIVE: { @@ -1641,7 +1648,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { batchMax = 100 / batchMax; batchMax = TMAX(batchMax, 4); } - while (occupied || (++batchCnt < batchMax)) { // greedy mode + while (occupied || (++batchCnt < batchMax)) { // greedy mode TAOS_UNUSED(taosReadAllQitems(pInfo->queue, pInfo->qall)); // queue has mutex lock int32_t qallItemSize = taosQallItemSize(pInfo->qall); if (qallItemSize > 0) { diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit2.c b/source/dnode/vnode/src/tsdb/tsdbCommit2.c index 2ffc1d1648..57f6aa3592 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit2.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit2.c @@ -413,7 +413,7 @@ static void tsdbCommitInfoDestroy(STsdb *pTsdb) { if (pTsdb->commitInfo) { for (int32_t i = 0; i < taosArrayGetSize(pTsdb->commitInfo->arr); i++) { SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(pTsdb->commitInfo->arr, i); - TAOS_UNUSED(vHashDrop(pTsdb->commitInfo->ht, info)); + int32_t ret = vHashDrop(pTsdb->commitInfo->ht, info); tsdbTFileSetClear(&info->fset); taosMemoryFree(info); } @@ -514,7 +514,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) { SFileSetCommitInfo tinfo = { .fid = fid, }; - TAOS_UNUSED(vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info)); + int32_t ret = vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info); if (info == NULL) { TAOS_CHECK_GOTO(tsdbCommitInfoAdd(tsdb, fid), &lino, _exit); } @@ -538,7 +538,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) { }; // check if the file set already on the commit list - TAOS_UNUSED(vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info)); + int32_t ret = vHashGet(tsdb->commitInfo->ht, &tinfo, (void **)&info); if (info != NULL) { continue; } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 7afc61e5dc..d3b783847c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -63,7 +63,9 @@ static void destroy_fs(STFileSystem **fs) { TARRAY2_DESTROY(fs[0]->fSetArr, NULL); TARRAY2_DESTROY(fs[0]->fSetArrTmp, NULL); - (void)tsem_destroy(&fs[0]->canEdit); + if (tsem_destroy(&fs[0]->canEdit) != 0) { + tsdbError("failed to destroy semaphore"); + } taosMemoryFree(fs[0]); fs[0] = NULL; } @@ -808,7 +810,11 @@ void tsdbEnableBgTask(STsdb *pTsdb) { void tsdbCloseFS(STFileSystem **fs) { if (fs[0] == NULL) return; - TAOS_UNUSED(tsdbDisableAndCancelAllBgTask((*fs)->tsdb)); + int32_t code = tsdbDisableAndCancelAllBgTask((*fs)->tsdb); + if (code) { + tsdbError("vgId:%d %s failed at line %d since %s", TD_VID((*fs)->tsdb->pVnode), __func__, __LINE__, + tstrerror(code)); + } close_file_system(fs[0]); destroy_fs(fs); return; @@ -838,7 +844,9 @@ int32_t tsdbFSEditBegin(STFileSystem *fs, const TFileOpArray *opArray, EFEditT e current_fname(fs->tsdb, current_t, TSDB_FCURRENT_M); } - (void)tsem_wait(&fs->canEdit); + if (tsem_wait(&fs->canEdit) != 0) { + tsdbError("vgId:%d failed to wait semaphore", TD_VID(fs->tsdb->pVnode)); + } fs->etype = etype; // edit @@ -944,13 +952,17 @@ _exit: } else { tsdbInfo("vgId:%d %s done, etype:%d", TD_VID(fs->tsdb->pVnode), __func__, fs->etype); } - (void)tsem_post(&fs->canEdit); + if (tsem_post(&fs->canEdit) != 0) { + tsdbError("vgId:%d failed to post semaphore", TD_VID(fs->tsdb->pVnode)); + } return code; } int32_t tsdbFSEditAbort(STFileSystem *fs) { int32_t code = abort_edit(fs); - (void)tsem_post(&fs->canEdit); + if (tsem_post(&fs->canEdit) != 0) { + tsdbError("vgId:%d failed to post semaphore", TD_VID(fs->tsdb->pVnode)); + } return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 74b7ebc06b..c0d8f7f17d 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -436,7 +436,7 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64 code = tsdbCacheGetPageS3(pFD->pTsdb->pgCache, pFD, pgno, &handle); if (code != TSDB_CODE_SUCCESS) { if (handle) { - (void)tsdbCacheRelease(pFD->pTsdb->pgCache, handle); + tsdbCacheRelease(pFD->pTsdb->pgCache, handle); } TSDB_CHECK_CODE(code, lino, _exit); } @@ -447,7 +447,7 @@ static int32_t tsdbReadFileS3(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64 uint8_t *pPage = (uint8_t *)taosLRUCacheValue(pFD->pTsdb->pgCache, handle); memcpy(pFD->pBuf, pPage, pFD->szPage); - (void)tsdbCacheRelease(pFD->pTsdb->pgCache, handle); + tsdbCacheRelease(pFD->pTsdb->pgCache, handle); // check if (pgno > 1 && !taosCheckChecksumWhole(pFD->pBuf, pFD->szPage)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 34a07333ae..5b8a062361 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -609,7 +609,10 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal * SValue value; if (pRow->type == TSDBROW_ROW_FMT) { - (void)tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal); + int32_t ret = tRowGet(pRow->pTSRow, pTSchema, iCol, pColVal); + if (ret != 0) { + tsdbError("failed to get column value, code:%d", ret); + } } else if (pRow->type == TSDBROW_COL_FMT) { if (iCol == 0) { *pColVal = diff --git a/source/dnode/vnode/src/vnd/vnodeAsync.c b/source/dnode/vnode/src/vnd/vnodeAsync.c index 0953c2615d..9e4fbd84a9 100644 --- a/source/dnode/vnode/src/vnd/vnodeAsync.c +++ b/source/dnode/vnode/src/vnd/vnodeAsync.c @@ -432,7 +432,7 @@ static void vnodeAsyncLaunchWorker(SVAsync *async) { if (async->workers[i].state == EVA_WORKER_STATE_ACTIVE) { continue; } else if (async->workers[i].state == EVA_WORKER_STATE_STOP) { - TAOS_UNUSED(taosThreadJoin(async->workers[i].thread, NULL)); + int32_t ret = taosThreadJoin(async->workers[i].thread, NULL); async->workers[i].state = EVA_WORKER_STATE_UINIT; } diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 9fba8df90d..b857cdeb42 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -414,7 +414,10 @@ SVnode *vnodeOpen(const char *path, int32_t diskPrimary, STfs *pTfs, SMsgCb msgC pVnode->blocked = false; pVnode->disableWrite = false; - (void)tsem_init(&pVnode->syncSem, 0, 0); + if (tsem_init(&pVnode->syncSem, 0, 0) != 0) { + vError("vgId:%d, failed to init semaphore", TD_VID(pVnode)); + goto _err; + } (void)taosThreadMutexInit(&pVnode->mutex, NULL); (void)taosThreadCondInit(&pVnode->poolNotEmpty, NULL); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index c5699796c1..9dbf16cb48 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -1833,7 +1833,9 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in } if (info.suid) { - (void)metaGetInfo(pVnode->pMeta, info.suid, &info, NULL); + if (metaGetInfo(pVnode->pMeta, info.suid, &info, NULL) != 0) { + vWarn("vgId:%d, table uid:%" PRId64 " not exists", TD_VID(pVnode), info.suid); + } } if (pSubmitTbData->sver != info.skmVer) {