From 87e3c17adadb9d9eab5295865c8793bfd74e2f6d Mon Sep 17 00:00:00 2001 From: kailixu Date: Thu, 25 Jul 2024 23:55:35 +0800 Subject: [PATCH] enh: refactor return code --- source/common/src/trow.c | 44 +++---- source/dnode/mnode/impl/src/mndUser.c | 140 +++++++++++----------- source/dnode/vnode/src/sma/smaEnv.c | 22 ++-- source/dnode/vnode/src/sma/smaOpen.c | 6 +- source/dnode/vnode/src/sma/smaRollup.c | 34 +++--- source/dnode/vnode/src/sma/smaSnapshot.c | 4 +- source/dnode/vnode/src/sma/smaTimeRange.c | 5 +- source/dnode/vnode/src/sma/smaUtil.c | 8 +- source/libs/sync/src/syncPipeline.c | 96 +++++++-------- source/libs/sync/src/syncRaftCfg.c | 2 +- source/libs/sync/src/syncRespMgr.c | 36 +++--- source/libs/sync/src/syncSnapshot.c | 46 +++---- source/libs/sync/src/syncUtil.c | 4 +- source/libs/sync/src/syncVoteMgr.c | 4 +- source/libs/tfs/src/tfs.c | 48 ++++---- source/libs/tfs/src/tfsTier.c | 14 +-- source/util/src/tbase58.c | 4 +- 17 files changed, 260 insertions(+), 257 deletions(-) diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 7234e5c5f6..1dc4a6f9ba 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -138,7 +138,7 @@ int32_t tdGetBitmapValTypeII(const void *pBitmap, int16_t colIdx, TDRowValT *pVa int32_t tdGetBitmapValType(const void *pBitmap, int16_t colIdx, TDRowValT *pValType, int8_t bitmapMode) { switch (bitmapMode) { case 0: - tdGetBitmapValTypeII(pBitmap, colIdx, pValType); + (void)tdGetBitmapValTypeII(pBitmap, colIdx, pValType); break; #if 0 case -1: @@ -354,8 +354,8 @@ bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, col_id_t colIdx, SCellVal *pVa } void *pBitmap = tdGetBitmapAddrKv(pRow, tdRowGetNCols(pRow)); - tdGetKvRowValOfCol(pVal, pRow, pBitmap, pColIdx->offset, - POINTER_DISTANCE(pColIdx, TD_ROW_COL_IDX(pRow)) / sizeof(SKvRowIdx)); + (void)tdGetKvRowValOfCol(pVal, pRow, pBitmap, pColIdx->offset, + POINTER_DISTANCE(pColIdx, TD_ROW_COL_IDX(pRow)) / sizeof(SKvRowIdx)); return true; } @@ -366,7 +366,7 @@ bool tdSTpRowGetVal(STSRow *pRow, col_id_t colId, col_type_t colType, int32_t fl return true; } void *pBitmap = tdGetBitmapAddrTp(pRow, flen); - tdGetTpRowValOfCol(pVal, pRow, pBitmap, colType, offset, colIdx); + (void)tdGetTpRowValOfCol(pVal, pRow, pBitmap, colType, offset, colIdx); return true; } @@ -385,9 +385,9 @@ bool tdSTSRowIterNext(STSRowIter *pIter, SCellVal *pVal) { } if (TD_IS_TP_ROW(pIter->pRow)) { - tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal); + (void)tdSTSRowIterGetTpVal(pIter, pCol->type, pCol->offset, pVal); } else if (TD_IS_KV_ROW(pIter->pRow)) { - tdSTSRowIterGetKvVal(pIter, pCol->colId, &pIter->kvIdx, pVal); + (void)tdSTSRowIterGetKvVal(pIter, pCol->colId, &pIter->kvIdx, pVal); } else { ASSERT(0); } @@ -486,8 +486,8 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r SRowBuilder rb = {.rowType = rowType}; tdSRowInit(&rb, pTSchema->version); - tdSRowSetInfo(&rb, pTSchema->numOfCols, nBound, pTSchema->flen); - tdSRowResetBuf(&rb, *ppRow); + (void)tdSRowSetInfo(&rb, pTSchema->numOfCols, nBound, pTSchema->flen); + (void)tdSRowResetBuf(&rb, *ppRow); int32_t iBound = 0; iColVal = 0; @@ -506,7 +506,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r } else if (IS_VAR_DATA_TYPE(pTColumn->type)) { varDataSetLen(varBuf, pColVal->value.nData); if (pColVal->value.nData != 0) { - memcpy(varDataVal(varBuf), pColVal->value.pData, pColVal->value.nData); + (void)memcpy(varDataVal(varBuf), pColVal->value.pData, pColVal->value.nData); } val = varBuf; ++iBound; @@ -578,7 +578,7 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell #ifdef TD_SUPPORT_BITMAP colIdx = POINTER_DISTANCE(pCol, pSchema->columns) / sizeof(STColumn); #endif - tdGetTpRowValOfCol(pVal, pRow, pIter->pBitmap, pCol->type, pCol->offset, colIdx - 1); + (void)tdGetTpRowValOfCol(pVal, pRow, pIter->pBitmap, pCol->type, pCol->offset, colIdx - 1); } else if (TD_IS_KV_ROW(pRow)) { SKvRowIdx *pIdx = (SKvRowIdx *)taosbsearch(&colId, TD_ROW_COL_IDX(pRow), tdRowGetNCols(pRow), sizeof(SKvRowIdx), compareKvRowColId, TD_EQ); @@ -587,7 +587,7 @@ bool tdSTSRowGetVal(STSRowIter *pIter, col_id_t colId, col_type_t colType, SCell colIdx = POINTER_DISTANCE(pIdx, TD_ROW_COL_IDX(pRow)) / sizeof(SKvRowIdx); } #endif - tdGetKvRowValOfCol(pVal, pRow, pIter->pBitmap, pIdx ? pIdx->offset : -1, colIdx); + (void)tdGetKvRowValOfCol(pVal, pRow, pIter->pBitmap, pIdx ? pIdx->offset : -1, colIdx); } else { if (COL_REACH_END(colId, pIter->maxColId)) return false; pVal->valType = TD_VTYPE_NONE; @@ -689,9 +689,9 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp } if (TD_IS_TP_ROW(pRow)) { - tdAppendColValToTpRow(pBuilder, valType, val, isCopyVarData, colType, colIdx, offset); + (void)tdAppendColValToTpRow(pBuilder, valType, val, isCopyVarData, colType, colIdx, offset); } else { - tdAppendColValToKvRow(pBuilder, valType, val, isCopyVarData, colType, colIdx, offset, colId); + (void)tdAppendColValToKvRow(pBuilder, valType, val, isCopyVarData, colType, colIdx, offset, colId); } TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -718,11 +718,11 @@ int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowValT valType, const vo char *ptr = (char *)POINTER_SHIFT(row, TD_ROW_LEN(row)); if (IS_VAR_DATA_TYPE(colType)) { if (isCopyVarData) { - memcpy(ptr, val, varDataTLen(val)); + (void)memcpy(ptr, val, varDataTLen(val)); } TD_ROW_LEN(row) += varDataTLen(val); } else { - memcpy(ptr, val, TYPE_BYTES[colType]); + (void)memcpy(ptr, val, TYPE_BYTES[colType]); TD_ROW_LEN(row) += TYPE_BYTES[colType]; } } @@ -752,11 +752,11 @@ int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowValT valType, const vo // ts key stored in STSRow.ts *(VarDataOffsetT *)POINTER_SHIFT(TD_ROW_DATA(row), offset) = TD_ROW_LEN(row); if (isCopyVarData) { - memcpy(POINTER_SHIFT(row, TD_ROW_LEN(row)), val, varDataTLen(val)); + (void)memcpy(POINTER_SHIFT(row, TD_ROW_LEN(row)), val, varDataTLen(val)); } TD_ROW_LEN(row) += varDataTLen(val); } else { - memcpy(POINTER_SHIFT(TD_ROW_DATA(row), offset), val, TYPE_BYTES[colType]); + (void)memcpy(POINTER_SHIFT(TD_ROW_DATA(row), offset), val, TYPE_BYTES[colType]); } } @@ -782,7 +782,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { case TD_ROW_TP: #ifdef TD_SUPPORT_BITMAP pBuilder->pBitmap = tdGetBitmapAddrTp(pBuilder->pBuf, pBuilder->flen); - memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBitmaps); + (void)memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBitmaps); #endif // the primary TS key is stored separatedly len = TD_ROW_HEAD_LEN + pBuilder->flen + pBuilder->nBitmaps; @@ -792,7 +792,7 @@ int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { case TD_ROW_KV: #ifdef TD_SUPPORT_BITMAP pBuilder->pBitmap = tdGetBitmapAddrKv(pBuilder->pBuf, pBuilder->nBoundCols); - memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBoundBitmaps); + (void)memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBoundBitmaps); #endif len = TD_ROW_HEAD_LEN + TD_ROW_NCOLS_LEN + (pBuilder->nBoundCols - 1) * sizeof(SKvRowIdx) + pBuilder->nBoundBitmaps; // add @@ -937,9 +937,9 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV ASSERT((pTColumn->colId == PRIMARYKEY_TIMESTAMP_COL_ID) || (iCol > 0)); if (TD_IS_TP_ROW(pRow)) { - tdSTpRowGetVal(pRow, pTColumn->colId, pTColumn->type, pTSchema->flen, pTColumn->offset, iCol - 1, &cv); + (void)tdSTpRowGetVal(pRow, pTColumn->colId, pTColumn->type, pTSchema->flen, pTColumn->offset, iCol - 1, &cv); } else if (TD_IS_KV_ROW(pRow)) { - tdSKvRowGetVal(pRow, pTColumn->colId, iCol - 1, &cv); + (void)tdSKvRowGetVal(pRow, pTColumn->colId, iCol - 1, &cv); } else { ASSERT(0); } @@ -957,7 +957,7 @@ void tTSRowGetVal(STSRow *pRow, STSchema *pTSchema, int16_t iCol, SColVal *pColV pColVal->value.nData = varDataLen(cv.val); pColVal->value.pData = varDataVal(cv.val); } else { - memcpy(&pColVal->value.val, cv.val, tDataTypes[pTColumn->type].bytes); + (void)memcpy(&pColVal->value.val, cv.val, tDataTypes[pTColumn->type].bytes); } } } \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 9f37885d6d..f005cf4812 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -142,12 +142,12 @@ static int32_t ipWhiteMgtInit() { TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } ipWhiteMgt.ver = 0; - taosThreadRwlockInit(&ipWhiteMgt.rw, NULL); + (void)taosThreadRwlockInit(&ipWhiteMgt.rw, NULL); TAOS_RETURN(0); } void ipWhiteMgtCleanup() { destroyIpWhiteTab(ipWhiteMgt.pIpWhiteTab); - taosThreadRwlockDestroy(&ipWhiteMgt.rw); + (void)taosThreadRwlockDestroy(&ipWhiteMgt.rw); } int32_t ipWhiteMgtUpdate(SMnode *pMnode, char *user, SIpWhiteList *pNew) { @@ -155,7 +155,7 @@ int32_t ipWhiteMgtUpdate(SMnode *pMnode, char *user, SIpWhiteList *pNew) { int32_t lino = 0; bool update = true; SArray *fqdns = NULL; - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); SIpWhiteList **ppList = taosHashGet(ipWhiteMgt.pIpWhiteTab, user, strlen(user)); if (ppList == NULL || *ppList == NULL) { @@ -212,7 +212,7 @@ int32_t ipWhiteMgtUpdate(SMnode *pMnode, char *user, SIpWhiteList *pNew) { if (update) ipWhiteMgt.ver++; _OVER: - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); taosArrayDestroyP(fqdns, (FDelete)taosMemoryFree); if (code < 0) { mError("failed to update ip white list for user: %s at line %d since %s", user, lino, tstrerror(code)); @@ -221,17 +221,17 @@ _OVER: } int32_t ipWhiteMgtRemove(char *user) { bool update = true; - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); SIpWhiteList **ppList = taosHashGet(ipWhiteMgt.pIpWhiteTab, user, strlen(user)); if (ppList == NULL || *ppList == NULL) { update = false; } else { taosMemoryFree(*ppList); - taosHashRemove(ipWhiteMgt.pIpWhiteTab, user, strlen(user)); + (void)taosHashRemove(ipWhiteMgt.pIpWhiteTab, user, strlen(user)); } if (update) ipWhiteMgt.ver++; - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); return 0; } @@ -245,7 +245,7 @@ bool isRangeInWhiteList(SIpWhiteList *pList, SIpV4Range *range) { } #if 0 int32_t ipWhiteUpdateForAllUser(SIpWhiteList *pList) { - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); SHashObj *pIpWhiteTab = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), 1, HASH_ENTRY_LOCK); void *pIter = taosHashIterate(ipWhiteMgt.pIpWhiteTab, NULL); @@ -267,8 +267,8 @@ int32_t ipWhiteUpdateForAllUser(SIpWhiteList *pList) { if (clone->num != 0) { int32_t sz = clone->num + p->num; val = taosMemoryCalloc(1, sizeof(SIpWhiteList) + sz * sizeof(SIpV4Range)); - memcpy(val->pIpRange, p->pIpRange, sizeof(SIpV4Range) * p->num); - memcpy(((char *)val->pIpRange) + sizeof(SIpV4Range) * p->num, (char *)clone->pIpRange, + (void)memcpy(val->pIpRange, p->pIpRange, sizeof(SIpV4Range) * p->num); + (void)memcpy(((char *)val->pIpRange) + sizeof(SIpV4Range) * p->num, (char *)clone->pIpRange, sizeof(SIpV4Range) * clone->num); } else { @@ -285,7 +285,7 @@ int32_t ipWhiteUpdateForAllUser(SIpWhiteList *pList) { ipWhiteMgt.pIpWhiteTab = pIpWhiteTab; ipWhiteMgt.ver++; - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); return 0; } #endif @@ -305,29 +305,29 @@ static int32_t ipWhiteMgtUpdateAll(SMnode *pMnode) { #if 0 void ipWhiteMgtUpdate2(SMnode *pMnode) { - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); ipWhiteMgtUpdateAll(pMnode); - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); } #endif int64_t mndGetIpWhiteVer(SMnode *pMnode) { int64_t ver = 0; int32_t code = 0; - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); if (ipWhiteMgt.ver == 0) { // get user and dnode ip white list if ((code = ipWhiteMgtUpdateAll(pMnode)) != 0) { - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); mError("%s failed to update ip white list since %s", __func__, tstrerror(code)); return ver; } ipWhiteMgt.ver = taosGetTimestampMs(); } ver = ipWhiteMgt.ver; - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); if (mndEnableIpWhiteList(pMnode) == 0 || tsEnableWhiteList == false) { ver = 0; @@ -354,7 +354,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 if (pNewList == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memcpy(pNewList->pIpRange, &range, sizeof(SIpV4Range)); + (void)memcpy(pNewList->pIpRange, &range, sizeof(SIpV4Range)); pNewList->num = 1; if ((code = taosHashPut(pIpWhiteTab, user, strlen(user), &pNewList, sizeof(void *))) != 0) { @@ -369,7 +369,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 if (pNewList == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memcpy(pNewList->pIpRange, pList->pIpRange, sizeof(SIpV4Range) * (pList->num)); + (void)memcpy(pNewList->pIpRange, pList->pIpRange, sizeof(SIpV4Range) * (pList->num)); pNewList->pIpRange[pList->num].ip = range.ip; pNewList->pIpRange[pList->num].mask = range.mask; @@ -387,7 +387,7 @@ int32_t mndUpdateIpWhiteImpl(SHashObj *pIpWhiteTab, char *user, char *fqdn, int8 if (pList != NULL) { if (isRangeInWhiteList(pList, &range)) { if (pList->num == 1) { - taosHashRemove(pIpWhiteTab, user, strlen(user)); + (void)taosHashRemove(pIpWhiteTab, user, strlen(user)); taosMemoryFree(pList); } else { int32_t idx = 0; @@ -430,14 +430,14 @@ _OVER: int32_t mndRefreshUserIpWhiteList(SMnode *pMnode) { int32_t code = 0; - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); if ((code = ipWhiteMgtUpdateAll(pMnode)) != 0) { - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); TAOS_RETURN(code); } ipWhiteMgt.ver = taosGetTimestampMs(); - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); TAOS_RETURN(code); } @@ -448,7 +448,7 @@ int32_t mndUpdateIpWhiteForAllUser(SMnode *pMnode, char *user, char *fqdn, int8_ bool update = false; if (lock) { - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); if (ipWhiteMgt.ver == 0) { TAOS_CHECK_GOTO(ipWhiteMgtUpdateAll(pMnode), &lino, _OVER); ipWhiteMgt.ver = taosGetTimestampMs(); @@ -467,7 +467,7 @@ int32_t mndUpdateIpWhiteForAllUser(SMnode *pMnode, char *user, char *fqdn, int8_ if (keyDup == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memcpy(keyDup, key, klen); + (void)memcpy(keyDup, key, klen); bool upd = false; code = mndUpdateIpWhiteImpl(ipWhiteMgt.pIpWhiteTab, keyDup, fqdn, type, &upd); update |= upd; @@ -482,7 +482,7 @@ int32_t mndUpdateIpWhiteForAllUser(SMnode *pMnode, char *user, char *fqdn, int8_ _OVER: if (update) ipWhiteMgt.ver++; - if (lock) taosThreadRwlockUnlock(&ipWhiteMgt.rw); + if (lock) (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); if (code < 0) { mError("failed to update ip-white-list for user: %s, fqdn: %s at line %d since %s", user, fqdn, lino, tstrerror(code)); @@ -493,13 +493,13 @@ _OVER: static int64_t ipWhiteMgtFillMsg(SUpdateIpWhite *pUpdate) { int64_t ver = 0; - taosThreadRwlockWrlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockWrlock(&ipWhiteMgt.rw); ver = ipWhiteMgt.ver; int32_t num = taosHashGetSize(ipWhiteMgt.pIpWhiteTab); pUpdate->pUserIpWhite = taosMemoryCalloc(1, num * sizeof(SUpdateUserIpWhite)); if (pUpdate->pUserIpWhite == NULL) { - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } @@ -513,14 +513,14 @@ static int64_t ipWhiteMgtFillMsg(SUpdateIpWhite *pUpdate) { char *key = taosHashGetKey(pIter, &klen); if (list->num != 0) { pUser->ver = ver; - memcpy(pUser->user, key, klen); + (void)memcpy(pUser->user, key, klen); pUser->numOfRange = list->num; pUser->pIpRanges = taosMemoryCalloc(1, list->num * sizeof(SIpV4Range)); if (pUser->pIpRanges == NULL) { - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } - memcpy(pUser->pIpRanges, list->pIpRange, list->num * sizeof(SIpV4Range)); + (void)memcpy(pUser->pIpRanges, list->pIpRange, list->num * sizeof(SIpV4Range)); i++; } pIter = taosHashIterate(ipWhiteMgt.pIpWhiteTab, pIter); @@ -528,7 +528,7 @@ static int64_t ipWhiteMgtFillMsg(SUpdateIpWhite *pUpdate) { pUpdate->numOfUser = i; pUpdate->ver = ver; - taosThreadRwlockUnlock(&ipWhiteMgt.rw); + (void)taosThreadRwlockUnlock(&ipWhiteMgt.rw); TAOS_RETURN(0); } @@ -681,7 +681,7 @@ static void ipRangeToStr(SIpV4Range *range, char *buf) { uv_inet_ntop(AF_INET, &addr, buf, 32); if (range->mask != 32) { - sprintf(buf + strlen(buf), "/%d", range->mask); + (void)sprintf(buf + strlen(buf), "/%d", range->mask); } return; } @@ -1311,7 +1311,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1320,7 +1320,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->readTbs, key, keyLen, value, valuelen), &lino, _OVER); @@ -1334,7 +1334,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1343,7 +1343,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen), &lino, _OVER); @@ -1358,7 +1358,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1367,7 +1367,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->alterTbs, key, keyLen, value, valuelen), &lino, _OVER); @@ -1381,7 +1381,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1390,7 +1390,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->readViews, key, keyLen, value, valuelen), &lino, _OVER); @@ -1404,7 +1404,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1413,7 +1413,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->writeViews, key, keyLen, value, valuelen), &lino, _OVER); @@ -1427,7 +1427,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; @@ -1436,7 +1436,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (value == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(value, 0, valuelen); + (void)memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) TAOS_CHECK_GOTO(taosHashPut(pUser->alterViews, key, keyLen, value, valuelen), &lino, _OVER); @@ -1451,7 +1451,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (key == NULL) { TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _OVER); } - memset(key, 0, keyLen); + (void)memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t ref = 0; @@ -1642,7 +1642,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { pOld->sysInfo = pNew->sysInfo; pOld->enable = pNew->enable; pOld->flag = pNew->flag; - memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN); + (void)memcpy(pOld->pass, pNew->pass, TSDB_PASSWORD_LEN); TSWAP(pOld->readDbs, pNew->readDbs); TSWAP(pOld->writeDbs, pNew->writeDbs); TSWAP(pOld->topics, pNew->topics); @@ -1660,7 +1660,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { taosWUnLockLatch(&pOld->lock); return TSDB_CODE_OUT_OF_MEMORY; } - memcpy(pOld->pIpWhiteList, pNew->pIpWhiteList, sz); + (void)memcpy(pOld->pIpWhiteList, pNew->pIpWhiteList, sz); pOld->ipWhiteListVer = pNew->ipWhiteListVer; taosWUnLockLatch(&pOld->lock); @@ -1851,13 +1851,13 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) { if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; char detail[1000] = {0}; - sprintf(detail, "enable:%d, superUser:%d, sysInfo:%d, password:xxx", createReq.enable, createReq.superUser, - createReq.sysInfo); + (void)sprintf(detail, "enable:%d, superUser:%d, sysInfo:%d, password:xxx", createReq.enable, createReq.superUser, + createReq.sysInfo); char operation[15] = {0}; if (createReq.isImport == 1) { - strcpy(operation, "importUser"); + (void)strcpy(operation, "importUser"); } else { - strcpy(operation, "createUser"); + (void)strcpy(operation, "createUser"); } auditRecord(pReq, pMnode->clusterId, operation, "", createReq.user, detail, strlen(detail)); @@ -2034,7 +2034,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useD void *pIter = NULL; char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + (void)snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; if (alterReq->tagCond != NULL && alterReq->tagCondLen != 0) { @@ -2064,7 +2064,7 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj SSdb *pSdb) { void *pIter = NULL; char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + (void)snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; if (taosHashRemove(hash, tbFName, len) != 0) { @@ -2320,7 +2320,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (alterReq.alterType == TSDB_ALTER_USER_PASSWD) { char pass[TSDB_PASSWORD_LEN + 1] = {0}; taosEncryptPass_c((uint8_t *)alterReq.pass, strlen(alterReq.pass), pass); - memcpy(newUser.pass, pass, TSDB_PASSWORD_LEN); + (void)memcpy(newUser.pass, pass, TSDB_PASSWORD_LEN); if (0 != strncmp(pUser->pass, pass, TSDB_PASSWORD_LEN)) { ++newUser.passVersion; } @@ -2358,12 +2358,12 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } bool exist = false; - memcpy(pNew->pIpRange, pUser->pIpWhiteList->pIpRange, sizeof(SIpV4Range) * idx); + (void)memcpy(pNew->pIpRange, pUser->pIpWhiteList->pIpRange, sizeof(SIpV4Range) * idx); for (int i = 0; i < alterReq.numIpRanges; i++) { SIpV4Range *range = &(alterReq.pIpRanges[i]); if (!isRangeInIpWhiteList(pUser->pIpWhiteList, range)) { // already exist, just ignore; - memcpy(&pNew->pIpRange[idx], range, sizeof(SIpV4Range)); + (void)memcpy(&pNew->pIpRange[idx], range, sizeof(SIpV4Range)); idx++; continue; } else { @@ -2413,7 +2413,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (localHost) break; if (found == false) { - memcpy(&pNew->pIpRange[idx], oldRange, sizeof(SIpV4Range)); + (void)memcpy(&pNew->pIpRange[idx], oldRange, sizeof(SIpV4Range)); idx++; } else { noexist = false; @@ -2442,9 +2442,9 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (alterReq.alterType == TSDB_ALTER_USER_PASSWD) { char detail[1000] = {0}; - sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx", - mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo, - alterReq.createdb ? 1 : 0, alterReq.tabName); + (void)sprintf(detail, "alterType:%s, enable:%d, superUser:%d, sysInfo:%d, createdb:%d, tabName:%s, password:xxx", + mndUserAuditTypeStr(alterReq.alterType), alterReq.enable, alterReq.superUser, alterReq.sysInfo, + alterReq.createdb ? 1 : 0, alterReq.tabName); auditRecord(pReq, pMnode->clusterId, "alterUser", "", alterReq.user, detail, strlen(detail)); } else if (alterReq.alterType == TSDB_ALTER_USER_SUPERUSER || alterReq.alterType == TSDB_ALTER_USER_ENABLE || alterReq.alterType == TSDB_ALTER_USER_SYSINFO || alterReq.alterType == TSDB_ALTER_USER_CREATEDB) { @@ -2457,7 +2457,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { ALTER_USER_ADD_ALL_TB_PRIV(alterReq.alterType, alterReq.privileges, alterReq.tabName)) { if (strcmp(alterReq.objname, "1.*") != 0) { SName name = {0}; - tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB); + (void)tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB); auditRecord(pReq, pMnode->clusterId, "GrantPrivileges", name.dbname, alterReq.user, alterReq.sql, alterReq.sqlLen); } else { @@ -2472,7 +2472,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } else { if (strcmp(alterReq.objname, "1.*") != 0) { SName name = {0}; - tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB); + (void)tNameFromString(&name, alterReq.objname, T_NAME_ACCT | T_NAME_DB); auditRecord(pReq, pMnode->clusterId, "RevokePrivileges", name.dbname, alterReq.user, alterReq.sql, alterReq.sqlLen); } else { @@ -2655,7 +2655,7 @@ static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } varDataSetLen(varstr, tlen); - memcpy(varDataVal(varstr), buf, tlen); + (void)memcpy(varDataVal(varstr), buf, tlen); pColInfo = taosArrayGet(pBlock->pDataBlock, cols); COL_DATA_SET_VAL_GOTO((const char *)varstr, false, pUser, _exit); @@ -2740,7 +2740,7 @@ static int32_t mndRetrieveUsersFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } varDataSetLen(varstr, tlen); - memcpy(varDataVal(varstr), buf, tlen); + (void)memcpy(varDataVal(varstr), buf, tlen); pColInfo = taosArrayGet(pBlock->pDataBlock, cols); COL_DATA_SET_VAL_GOTO((const char *)varstr, false, pUser, _exit); @@ -2831,7 +2831,7 @@ static int32_t mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, i nodesDestroyNode(pAst); } else { sqlLen = 5; - sprintf(*sql, "error"); + (void)sprintf(*sql, "error"); } STR_WITH_MAXSIZE_TO_VARSTR((*condition), (*sql), pShow->pMeta->pSchemas[cols].bytes); @@ -2975,8 +2975,8 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock SName name = {0}; char objName[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - tNameFromString(&name, db, T_NAME_ACCT | T_NAME_DB); - tNameGetDbName(&name, varDataVal(objName)); + (void)tNameFromString(&name, db, T_NAME_ACCT | T_NAME_DB); + (void)tNameGetDbName(&name, varDataVal(objName)); varDataSetLen(objName, strlen(varDataVal(objName))); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); COL_DATA_SET_VAL_GOTO((const char *)objName, false, pUser, _exit); @@ -3019,8 +3019,8 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock SName name = {0}; char objName[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - tNameFromString(&name, db, T_NAME_ACCT | T_NAME_DB); - tNameGetDbName(&name, varDataVal(objName)); + (void)tNameFromString(&name, db, T_NAME_ACCT | T_NAME_DB); + (void)tNameGetDbName(&name, varDataVal(objName)); varDataSetLen(objName, strlen(varDataVal(objName))); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); COL_DATA_SET_VAL_GOTO((const char *)objName, false, pUser, _exit); @@ -3140,7 +3140,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_ if (pUser == NULL) { if (TSDB_CODE_MND_USER_NOT_EXIST == code) { SGetUserAuthRsp rsp = {.dropped = 1}; - memcpy(rsp.user, pUsers[i].user, TSDB_USER_LEN); + (void)memcpy(rsp.user, pUsers[i].user, TSDB_USER_LEN); (void)taosArrayPush(batchRsp.pArray, &rsp); } mError("user:%s, failed to auth user since %s", pUsers[i].user, terrstr()); diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index b3e072f823..e7a8de17a0 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -103,7 +103,7 @@ void smaCleanUp() { } if (old == 1) { - taosCloseRef(smaMgmt.rsetId); + (void)taosCloseRef(smaMgmt.rsetId); taosHashCleanup(smaMgmt.refHash); smaMgmt.refHash = NULL; taosTmrCleanUp(smaMgmt.tmrHandle); @@ -174,10 +174,10 @@ static void tRSmaInfoHashFreeNode(void *data) { if ((pRSmaInfo = *(SRSmaInfo **)data)) { if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 0)) && pItem->level) { - taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); + (void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); } if ((pItem = RSMA_INFO_ITEM((SRSmaInfo *)pRSmaInfo, 1)) && pItem->level) { - taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); + (void)taosHashRemove(smaMgmt.refHash, &pItem, POINTER_BYTES); } tdFreeRSmaInfo(pRSmaInfo->pSma, pRSmaInfo); } @@ -378,16 +378,16 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) { } // init sma env - tdLockSma(pSma); + (void)tdLockSma(pSma); pEnv = (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_load_ptr(&SMA_TSMA_ENV(pSma)) : atomic_load_ptr(&SMA_RSMA_ENV(pSma)); if (!pEnv) { if ((code = tdInitSmaEnv(pSma, smaType, &pEnv)) < 0) { - tdUnLockSma(pSma); + (void)tdUnLockSma(pSma); TAOS_RETURN(code); } } - tdUnLockSma(pSma); + (void)tdUnLockSma(pSma); TAOS_RETURN(TSDB_CODE_SUCCESS); } @@ -395,15 +395,15 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) { void *tdRSmaExecutorFunc(void *param) { setThreadName("vnode-rsma"); - tdRSmaProcessExecImpl((SSma *)param, RSMA_EXEC_OVERFLOW); + (void)tdRSmaProcessExecImpl((SSma *)param, RSMA_EXEC_OVERFLOW); return NULL; } static int32_t tdRsmaStartExecutor(const SSma *pSma) { int32_t code = 0; TdThreadAttr thAttr = {0}; - taosThreadAttrInit(&thAttr); - taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + (void)taosThreadAttrInit(&thAttr); + (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); SSmaEnv *pEnv = SMA_RSMA_ENV(pSma); SSmaStat *pStat = SMA_ENV_STAT(pEnv); @@ -418,7 +418,7 @@ static int32_t tdRsmaStartExecutor(const SSma *pSma) { smaDebug("vgId:%d, success to create pthread for rsma", SMA_VID(pSma)); } - taosThreadAttrDestroy(&thAttr); + (void)taosThreadAttrDestroy(&thAttr); TAOS_RETURN(code); } @@ -444,7 +444,7 @@ static int32_t tdRsmaStopExecutor(const SSma *pSma) { for (int32_t i = 0; i < tsNumOfVnodeRsmaThreads; ++i) { if (taosCheckPthreadValid(pthread[i])) { smaDebug("vgId:%d, start to join pthread for rsma:%" PRId64 "", SMA_VID(pSma), taosGetPthreadId(pthread[i])); - taosThreadJoin(pthread[i], NULL); + (void)taosThreadJoin(pthread[i], NULL); } } diff --git a/source/dnode/vnode/src/sma/smaOpen.c b/source/dnode/vnode/src/sma/smaOpen.c index 19f0c4a964..41d4c8994f 100644 --- a/source/dnode/vnode/src/sma/smaOpen.c +++ b/source/dnode/vnode/src/sma/smaOpen.c @@ -145,7 +145,7 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback, bool force) { pVnode->pSma = pSma; pSma->pVnode = pVnode; - taosThreadMutexInit(&pSma->mutex, NULL); + (void)taosThreadMutexInit(&pSma->mutex, NULL); pSma->locked = false; if (VND_IS_RSMA(pVnode)) { @@ -173,8 +173,8 @@ _exit: int32_t smaClose(SSma *pSma) { if (pSma) { - smaPreClose(pSma); - taosThreadMutexDestroy(&pSma->mutex); + (void)smaPreClose(pSma); + (void)taosThreadMutexDestroy(&pSma->mutex); SMA_TSMA_ENV(pSma) = tdFreeSmaEnv(SMA_TSMA_ENV(pSma)); SMA_RSMA_ENV(pSma) = tdFreeSmaEnv(SMA_RSMA_ENV(pSma)); if SMA_RSMA_TSDB0 (pSma) tsdbClose(&SMA_RSMA_TSDB0(pSma)); diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 8c12f80f2b..d5409cf268 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); - taosTmrStopA(&pItem->tmrId); + (void)taosTmrStopA(&pItem->tmrId); } if (pItem->pStreamState) { @@ -246,7 +246,7 @@ static void tdRSmaTaskInit(SStreamMeta *pMeta, SRSmaInfoItem *pItem, SStreamTask } static void tdRSmaTaskRemove(SStreamMeta *pMeta, int64_t streamId, int32_t taskId) { - streamMetaUnregisterTask(pMeta, streamId, taskId); + (void)streamMetaUnregisterTask(pMeta, streamId, taskId); streamMetaWLock(pMeta); int32_t numOfTasks = streamMetaGetNumOfTasks(pMeta); if (streamMetaCommit(pMeta) < 0) { @@ -296,7 +296,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat if (!pStreamTask->exec.qmsg) { TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } - sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG); + (void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG); pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta); tdRSmaTaskInit(pStreamTask->pMeta, pItem, &pStreamTask->id); @@ -347,7 +347,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } - taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId); + (void)taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId); smaInfo("vgId:%d, open rsma task:%p table:%" PRIi64 " level:%" PRIi8 ", checkpointId:%" PRIi64 ", submitReqVer:%" PRIi64 ", fetchResultVer:%" PRIi64 ", maxdelay:%" PRIi64 " watermark:%" PRIi64 @@ -799,7 +799,7 @@ static int32_t tdExecuteRSmaImplAsync(SSma *pSma, int64_t version, const void *p *(int32_t *)pItem = len; pItem = POINTER_SHIFT(pItem, sizeof(int32_t)); *(int64_t *)pItem = version; - memcpy(POINTER_SHIFT(pItem, sizeof(int64_t)), pMsg, len); + (void)memcpy(POINTER_SHIFT(pItem, sizeof(int64_t)), pMsg, len); TAOS_CHECK_RETURN(taosWriteQitem(pInfo->queue, qItem)); @@ -810,7 +810,7 @@ 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) { - tsem_post(&(pRSmaStat->notEmpty)); + (void)tsem_post(&(pRSmaStat->notEmpty)); } // smoothing consume @@ -1339,7 +1339,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { if (!(pStat = (SRSmaStat *)tdAcquireSmaRef(smaMgmt.rsetId, pRSmaRef->refId))) { smaWarn("rsma fetch task not start since rsma stat already destroyed, rsetId:%d refId:%" PRIi64 ")", smaMgmt.rsetId, pRSmaRef->refId); // pRSmaRef freed in taosHashRemove - taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); + (void)taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); return; } @@ -1348,8 +1348,8 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { if ((code = tdAcquireRSmaInfoBySuid(pSma, pRSmaRef->suid, &pRSmaInfo)) != 0) { smaDebug("rsma fetch task not start since rsma info not exist, rsetId:%d refId:%" PRIi64 ")", smaMgmt.rsetId, pRSmaRef->refId); // pRSmaRef freed in taosHashRemove - tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); - taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); + (void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); + (void)taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); return; } @@ -1357,8 +1357,8 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { smaDebug("rsma fetch task not start since rsma info already deleted, rsetId:%d refId:%" PRIi64 ")", smaMgmt.rsetId, pRSmaRef->refId); // pRSmaRef freed in taosHashRemove tdReleaseRSmaInfo(pSma, pRSmaInfo); - tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); - taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); + (void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); + (void)taosHashRemove(smaMgmt.refHash, ¶m, POINTER_BYTES); return; } @@ -1376,7 +1376,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { taosTmrReset(tdRSmaFetchTrigger, RSMA_FETCH_INTERVAL, pItem, smaMgmt.tmrHandle, &pItem->tmrId); } tdReleaseRSmaInfo(pSma, pRSmaInfo); - tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); + (void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); return; } default: @@ -1393,7 +1393,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { atomic_store_8(&pItem->fetchLevel, 1); if (atomic_load_8(&pRSmaInfo->assigned) == 0) { - tsem_post(&(pStat->notEmpty)); + (void)tsem_post(&(pStat->notEmpty)); } } break; case TASK_TRIGGER_STAT_INACTIVE: { @@ -1414,7 +1414,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { _end: taosTmrReset(tdRSmaFetchTrigger, pItem->maxDelay, pItem, smaMgmt.tmrHandle, &pItem->tmrId); tdReleaseRSmaInfo(pSma, pRSmaInfo); - tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); + (void)tdReleaseSmaRef(smaMgmt.rsetId, pRSmaRef->refId); } static void tdFreeRSmaSubmitItems(SArray *pItems, int32_t type) { @@ -1507,7 +1507,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA // the submitReq/deleteReq msg may exsit alternately in the msg queue, consume them sequentially in batch mode while (1) { - taosGetQitem(qall, (void **)&msg); + (void)taosGetQitem(qall, (void **)&msg); if (msg) { int8_t inputType = RSMA_EXEC_MSG_TYPE(msg); if (inputType == STREAM_INPUT__DATA_SUBMIT) { @@ -1574,7 +1574,7 @@ _exit: tdFreeRSmaSubmitItems(pSubmitArr, nSubmit ? STREAM_INPUT__MERGED_SUBMIT : STREAM_INPUT__REF_DATA_BLOCK); while (1) { void *msg = NULL; - taosGetQitem(qall, (void **)&msg); + (void)taosGetQitem(qall, (void **)&msg); if (msg) { taosFreeQitem(msg); } else { @@ -1687,7 +1687,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { break; } - tsem_wait(&pRSmaStat->notEmpty); + (void)tsem_wait(&pRSmaStat->notEmpty); if ((pEnv->flag & SMA_ENV_FLG_CLOSE) && (atomic_load_64(&pRSmaStat->nBufItems) <= 0)) { smaDebug("vgId:%d, exec task end, flag:%" PRIi8 ", nBufItems:%" PRIi64, SMA_VID(pSma), pEnv->flag, diff --git a/source/dnode/vnode/src/sma/smaSnapshot.c b/source/dnode/vnode/src/sma/smaSnapshot.c index cd8a334f4a..0095acf79a 100644 --- a/source/dnode/vnode/src/sma/smaSnapshot.c +++ b/source/dnode/vnode/src/sma/smaSnapshot.c @@ -93,7 +93,7 @@ int32_t rsmaSnapRead(SRSmaSnapReader* pReader, uint8_t** ppData) { _exit: if (code) { smaError("vgId:%d, %s failed at line %d since %s", SMA_VID(pReader->pSma), __func__, lino, tstrerror(code)); - rsmaSnapReaderClose(&pReader); + (void)rsmaSnapReaderClose(&pReader); } else { smaInfo("vgId:%d, vnode snapshot rsma read succeed", SMA_VID(pReader->pSma)); } @@ -106,7 +106,7 @@ int32_t rsmaSnapReaderClose(SRSmaSnapReader** ppReader) { for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { if (pReader->pDataReader[i]) { - tsdbSnapReaderClose(&pReader->pDataReader[i]); + (void)tsdbSnapReaderClose(&pReader->pDataReader[i]); } } diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index da99a2c9a2..918fd9e5d3 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -204,7 +204,10 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema * continue; } - taosArrayPush(pReq->aSubmitTbData, &tbData); + if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + continue; + } int32_t size = (int32_t)taosArrayGetSize(pReq->aSubmitTbData) - 1; TAOS_CHECK_EXIT(taosHashPut(pTableIndexMap, &groupId, sizeof(groupId), &size, sizeof(size))); diff --git a/source/dnode/vnode/src/sma/smaUtil.c b/source/dnode/vnode/src/sma/smaUtil.c index d94e58f954..8b908ed5bb 100644 --- a/source/dnode/vnode/src/sma/smaUtil.c +++ b/source/dnode/vnode/src/sma/smaUtil.c @@ -19,19 +19,19 @@ void tdRSmaQTaskInfoGetFullPath(SVnode *pVnode, tb_uid_t suid, int8_t level, STfs *pTfs, char *outputName) { tdRSmaGetDirName(pVnode, pTfs, true, outputName); int32_t rsmaLen = strlen(outputName); - snprintf(outputName + rsmaLen, TSDB_FILENAME_LEN - rsmaLen, "%" PRIi8 "%s%" PRIi64, level, TD_DIRSEP, suid); + (void)snprintf(outputName + rsmaLen, TSDB_FILENAME_LEN - rsmaLen, "%" PRIi8 "%s%" PRIi64, level, TD_DIRSEP, suid); } void tdRSmaGetDirName(SVnode *pVnode, STfs *pTfs, bool endWithSep, char *outputName) { int32_t offset = 0; // vnode - vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pTfs, outputName, TSDB_FILENAME_LEN); + (void)vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pTfs, outputName, TSDB_FILENAME_LEN); offset = strlen(outputName); // rsma - snprintf(outputName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s%s", TD_DIRSEP, VNODE_RSMA_DIR, - (endWithSep ? TD_DIRSEP : "")); + (void)snprintf(outputName + offset, TSDB_FILENAME_LEN - offset - 1, "%s%s%s", TD_DIRSEP, VNODE_RSMA_DIR, + (endWithSep ? TD_DIRSEP : "")); } // smaXXXUtil ================ diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 93a12f3d16..8b6092e839 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -38,16 +38,16 @@ FORCE_INLINE static int64_t syncGetRetryMaxWaitMs() { } int64_t syncLogBufferGetEndIndex(SSyncLogBuffer* pBuf) { - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); int64_t index = pBuf->endIndex; - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return index; } int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry) { int32_t code = 0; - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); SyncIndex index = pEntry->index; if (index - pBuf->startIndex >= pBuf->size) { @@ -86,13 +86,13 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt pBuf->entries[index % pBuf->size] = tmp; pBuf->endIndex = index + 1; - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); return 0; _err: - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); taosMsleep(1); TAOS_RETURN(code); } @@ -263,7 +263,7 @@ int32_t syncLogBufferInitWithoutLock(SSyncLogBuffer* pBuf, SSyncNode* pNode) { pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); // validate - syncLogBufferValidate(pBuf); + (void)syncLogBufferValidate(pBuf); return 0; _exit: @@ -274,29 +274,29 @@ _exit: } int32_t syncLogBufferInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); int32_t ret = syncLogBufferInitWithoutLock(pBuf, pNode); - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return ret; } int32_t syncLogBufferReInit(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); for (SyncIndex index = pBuf->startIndex; index < pBuf->endIndex; index++) { SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; if (pEntry == NULL) continue; syncEntryDestroy(pEntry); pEntry = NULL; - memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); + (void)memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); } pBuf->startIndex = pBuf->commitIndex = pBuf->matchIndex = pBuf->endIndex = 0; int32_t code = syncLogBufferInitWithoutLock(pBuf, pNode); if (code < 0) { sError("vgId:%d, failed to re-initialize sync log buffer since %s.", pNode->vgId, tstrerror(code)); } - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); return code; } @@ -308,22 +308,22 @@ FORCE_INLINE SyncTerm syncLogBufferGetLastMatchTermWithoutLock(SSyncLogBuffer* p } SyncTerm syncLogBufferGetLastMatchTerm(SSyncLogBuffer* pBuf) { - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); SyncTerm term = syncLogBufferGetLastMatchTermWithoutLock(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return term; } bool syncLogBufferIsEmpty(SSyncLogBuffer* pBuf) { - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); bool empty = (pBuf->endIndex <= pBuf->startIndex); - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return empty; } int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry, SyncTerm prevTerm) { - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); int32_t code = 0; SyncIndex index = pEntry->index; SyncIndex prevIndex = pEntry->index - 1; @@ -411,8 +411,8 @@ _out: syncEntryDestroy(pExist); pExist = NULL; } - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); TAOS_RETURN(code); } @@ -444,8 +444,8 @@ int32_t syncLogStorePersist(SSyncLogStore* pLogStore, SSyncNode* pNode, SSyncRaf } int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* pMatchTerm, char* str) { - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); SSyncLogStore* pLogStore = pNode->pLogStore; int64_t matchIndex = pBuf->matchIndex; @@ -544,8 +544,8 @@ _out: if (pMatchTerm) { *pMatchTerm = pBuf->entries[(matchIndex + pBuf->size) % pBuf->size].pItem->term; } - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); return matchIndex; } @@ -617,8 +617,8 @@ int32_t syncLogBufferValidate(SSyncLogBuffer* pBuf) { } int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t commitIndex) { - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); SSyncLogStore* pLogStore = pNode->pLogStore; SSyncFSM* pFsm = pNode->pFsm; @@ -720,7 +720,7 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; ASSERT(pEntry != NULL); syncEntryDestroy(pEntry); - memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); + (void)memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); pBuf->startIndex = index + 1; } @@ -743,8 +743,8 @@ _out: syncEntryDestroy(pNextEntry); pNextEntry = NULL; } - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); TAOS_RETURN(code); } @@ -753,7 +753,7 @@ void syncLogReplReset(SSyncLogReplMgr* pMgr) { ASSERT(pMgr->startIndex >= 0); for (SyncIndex index = pMgr->startIndex; index < pMgr->endIndex; index++) { - memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); + (void)memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); } pMgr->startIndex = 0; pMgr->matchIndex = 0; @@ -935,20 +935,20 @@ int32_t syncLogReplRecover(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEn int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) { SSyncLogBuffer* pBuf = pNode->pLogBuf; - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) { sInfo("vgId:%d, reset sync log repl in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "", pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); syncLogReplReset(pMgr); pMgr->peerStartTime = pMsg->startTime; } - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return 0; } int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg) { SSyncLogBuffer* pBuf = pNode->pLogBuf; - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != pMgr->peerStartTime) { sInfo("vgId:%d, reset sync log repl in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64, pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); @@ -961,7 +961,7 @@ int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncApp } else { (void)syncLogReplRecover(pMgr, pNode, pMsg); } - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); return 0; } @@ -1083,7 +1083,7 @@ int32_t syncLogReplContinue(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendE pMgr->states[pMsg->lastSendIndex % pMgr->size].acked = true; pMgr->matchIndex = TMAX(pMgr->matchIndex, pMsg->matchIndex); for (SyncIndex index = pMgr->startIndex; index < pMgr->matchIndex; index++) { - memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); + (void)memset(&pMgr->states[index % pMgr->size], 0, sizeof(pMgr->states[0])); } pMgr->startIndex = pMgr->matchIndex; } @@ -1169,16 +1169,16 @@ _exit: } void syncLogBufferClear(SSyncLogBuffer* pBuf) { - taosThreadMutexLock(&pBuf->mutex); + (void)taosThreadMutexLock(&pBuf->mutex); for (SyncIndex index = pBuf->startIndex; index < pBuf->endIndex; index++) { SSyncRaftEntry* pEntry = pBuf->entries[(index + pBuf->size) % pBuf->size].pItem; if (pEntry == NULL) continue; syncEntryDestroy(pEntry); pEntry = NULL; - memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); + (void)memset(&pBuf->entries[(index + pBuf->size) % pBuf->size], 0, sizeof(pBuf->entries[0])); } pBuf->startIndex = pBuf->commitIndex = pBuf->matchIndex = pBuf->endIndex = 0; - taosThreadMutexUnlock(&pBuf->mutex); + (void)taosThreadMutexUnlock(&pBuf->mutex); } void syncLogBufferDestroy(SSyncLogBuffer* pBuf) { @@ -1211,7 +1211,7 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex if (pEntry != NULL) { (void)syncEntryDestroy(pEntry); pEntry = NULL; - memset(&pBuf->entries[index % pBuf->size], 0, sizeof(pBuf->entries[0])); + (void)memset(&pBuf->entries[index % pBuf->size], 0, sizeof(pBuf->entries[0])); } index--; } @@ -1238,13 +1238,13 @@ int32_t syncLogBufferRollback(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncIndex } ASSERT(pBuf->endIndex == toIndex); - syncLogBufferValidate(pBuf); + (void)syncLogBufferValidate(pBuf); return 0; } int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) { - taosThreadMutexLock(&pBuf->mutex); - syncLogBufferValidate(pBuf); + (void)taosThreadMutexLock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); SyncIndex lastVer = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore); ASSERT(lastVer == pBuf->matchIndex); SyncIndex index = pBuf->endIndex - 1; @@ -1261,8 +1261,8 @@ int32_t syncLogBufferReset(SSyncLogBuffer* pBuf, SSyncNode* pNode) { SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i]; syncLogReplReset(pMgr); } - syncLogBufferValidate(pBuf); - taosThreadMutexUnlock(&pBuf->mutex); + (void)syncLogBufferValidate(pBuf); + (void)taosThreadMutexUnlock(&pBuf->mutex); return 0; } diff --git a/source/libs/sync/src/syncRaftCfg.c b/source/libs/sync/src/syncRaftCfg.c index 19080c2d1e..b0e6abffc6 100644 --- a/source/libs/sync/src/syncRaftCfg.c +++ b/source/libs/sync/src/syncRaftCfg.c @@ -124,7 +124,7 @@ int32_t syncWriteCfgFile(SSyncNode *pNode) { const char *realfile = pNode->configPath; SRaftCfg *pCfg = &pNode->raftCfg; char file[PATH_MAX] = {0}; - snprintf(file, sizeof(file), "%s.bak", realfile); + (void)snprintf(file, sizeof(file), "%s.bak", realfile); if ((pJson = tjsonCreateObject()) == NULL) { TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY); diff --git a/source/libs/sync/src/syncRespMgr.c b/source/libs/sync/src/syncRespMgr.c index d161fb885b..4663a1f6e9 100644 --- a/source/libs/sync/src/syncRespMgr.c +++ b/source/libs/sync/src/syncRespMgr.c @@ -38,7 +38,7 @@ int32_t syncRespMgrCreate(void *data, int64_t ttl, SSyncRespMgr **ppObj) { pObj->ttl = ttl; pObj->data = data; pObj->seqNum = 0; - taosThreadMutexInit(&(pObj->mutex), NULL); + (void)taosThreadMutexInit(&(pObj->mutex), NULL); SSyncNode *pNode = pObj->data; sDebug("vgId:%d, resp manager create", pNode->vgId); @@ -54,37 +54,37 @@ void syncRespMgrDestroy(SSyncRespMgr *pObj) { SSyncNode *pNode = pObj->data; sDebug("vgId:%d, resp manager destroy", pNode->vgId); - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); taosHashCleanup(pObj->pRespHash); - taosThreadMutexUnlock(&pObj->mutex); - taosThreadMutexDestroy(&(pObj->mutex)); + (void)taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexDestroy(&(pObj->mutex)); taosMemoryFree(pObj); } uint64_t syncRespMgrAdd(SSyncRespMgr *pObj, const SRespStub *pStub) { - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); uint64_t seq = ++(pObj->seqNum); int32_t code = taosHashPut(pObj->pRespHash, &seq, sizeof(uint64_t), pStub, sizeof(SRespStub)); sNTrace(pObj->data, "save message handle:%p, type:%s seq:%" PRIu64 " code:0x%x", pStub->rpcMsg.info.handle, TMSG_INFO(pStub->rpcMsg.msgType), seq, code); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return seq; } int32_t syncRespMgrDel(SSyncRespMgr *pObj, uint64_t seq) { - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); int32_t code = taosHashRemove(pObj->pRespHash, &seq, sizeof(seq)); sNTrace(pObj->data, "remove message handle, seq:%" PRIu64 " code:%d", seq, code); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return code; } int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t seq, SRespStub *pStub) { - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); SRespStub *pTmp = taosHashGet(pObj->pRespHash, &seq, sizeof(uint64_t)); if (pTmp != NULL) { @@ -92,18 +92,18 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t seq, SRespStub *pStub) { sNTrace(pObj->data, "get message handle, type:%s seq:%" PRIu64 " handle:%p", TMSG_INFO(pStub->rpcMsg.msgType), seq, pStub->rpcMsg.info.handle); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return 1; // get one object } else { sNError(pObj->data, "get message handle, no object of seq:%" PRIu64, seq); } - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return 0; // get none object } int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *pInfo) { - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); SRespStub *pStub = taosHashGet(pObj->pRespHash, &seq, sizeof(uint64_t)); if (pStub != NULL) { @@ -112,13 +112,13 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *p TMSG_INFO(pStub->rpcMsg.msgType), seq); (void)taosHashRemove(pObj->pRespHash, &seq, sizeof(uint64_t)); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return 1; // get one object } else { sNTrace(pObj->data, "get-and-del message handle, no object of seq:%" PRIu64, seq); } - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); return 0; // get none object } @@ -188,16 +188,16 @@ void syncRespCleanRsp(SSyncRespMgr *pObj) { SSyncNode *pNode = pObj->data; sTrace("vgId:%d, clean all resp", pNode->vgId); - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); (void)syncRespCleanByTTL(pObj, -1, true); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); } void syncRespClean(SSyncRespMgr *pObj) { SSyncNode *pNode = pObj->data; sTrace("vgId:%d, clean resp by ttl", pNode->vgId); - taosThreadMutexLock(&pObj->mutex); + (void)taosThreadMutexLock(&pObj->mutex); (void)syncRespCleanByTTL(pObj, pObj->ttl, false); - taosThreadMutexUnlock(&pObj->mutex); + (void)taosThreadMutexUnlock(&pObj->mutex); } diff --git a/source/libs/sync/src/syncSnapshot.c b/source/libs/sync/src/syncSnapshot.c index 0446630717..450d22528d 100644 --- a/source/libs/sync/src/syncSnapshot.c +++ b/source/libs/sync/src/syncSnapshot.c @@ -44,7 +44,7 @@ static void syncSnapBufferDestroy(SSyncSnapBuffer **ppBuf) { syncSnapBufferReset(pBuf); - taosThreadMutexDestroy(&pBuf->mutex); + (void)taosThreadMutexDestroy(&pBuf->mutex); taosMemoryFree(ppBuf[0]); ppBuf[0] = NULL; return; @@ -141,7 +141,7 @@ void snapshotSenderDestroy(SSyncSnapshotSender *pSender) { syncSnapBufferDestroy(&pSender->pSndBuf); } - snapshotSenderClearInfoData(pSender); + (void)snapshotSenderClearInfoData(pSender); // free sender taosMemoryFree(pSender); @@ -214,7 +214,7 @@ void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { // update flag int8_t stopped = !atomic_val_compare_exchange_8(&pSender->start, true, false); if (stopped) return; - taosThreadMutexLock(&pSender->pSndBuf->mutex); + (void)taosThreadMutexLock(&pSender->pSndBuf->mutex); { pSender->finish = finish; @@ -226,12 +226,12 @@ void snapshotSenderStop(SSyncSnapshotSender *pSender, bool finish) { syncSnapBufferReset(pSender->pSndBuf); - snapshotSenderClearInfoData(pSender); + (void)snapshotSenderClearInfoData(pSender); SRaftId destId = pSender->pSyncNode->replicasId[pSender->replicaIndex]; sSInfo(pSender, "snapshot sender stop, to dnode:%d, finish:%d", DID(&destId), finish); } - taosThreadMutexUnlock(&pSender->pSndBuf->mutex); + (void)taosThreadMutexUnlock(&pSender->pSndBuf->mutex); } int32_t syncSnapSendMsg(SSyncSnapshotSender *pSender, int32_t seq, void *pBlock, int32_t blockLen, int32_t typ) { @@ -256,7 +256,7 @@ int32_t syncSnapSendMsg(SSyncSnapshotSender *pSender, int32_t seq, void *pBlock, pMsg->seq = seq; if (pBlock != NULL && blockLen > 0) { - memcpy(pMsg->data, pBlock, blockLen); + (void)memcpy(pMsg->data, pBlock, blockLen); } pMsg->payloadType = typ; @@ -340,7 +340,7 @@ _OUT:; int32_t snapshotReSend(SSyncSnapshotSender *pSender) { SSyncSnapBuffer *pSndBuf = pSender->pSndBuf; int32_t code = 0; - taosThreadMutexLock(&pSndBuf->mutex); + (void)taosThreadMutexLock(&pSndBuf->mutex); if (pSender->pReader == NULL || pSender->finish || !snapshotSenderIsStart(pSender)) { code = TSDB_CODE_SYN_INTERNAL_ERROR; goto _out; @@ -371,7 +371,7 @@ int32_t snapshotReSend(SSyncSnapshotSender *pSender) { } } _out:; - taosThreadMutexUnlock(&pSndBuf->mutex); + (void)taosThreadMutexUnlock(&pSndBuf->mutex); TAOS_RETURN(code); } @@ -544,7 +544,7 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { int8_t stopped = !atomic_val_compare_exchange_8(&pReceiver->start, true, false); if (stopped) return; - taosThreadMutexLock(&pReceiver->pRcvBuf->mutex); + (void)taosThreadMutexLock(&pReceiver->pRcvBuf->mutex); { if (pReceiver->pWriter != NULL) { int32_t code = pReceiver->pSyncNode->pFsm->FpSnapshotStopWrite(pReceiver->pSyncNode->pFsm, pReceiver->pWriter, @@ -559,9 +559,9 @@ void snapshotReceiverStop(SSyncSnapshotReceiver *pReceiver) { syncSnapBufferReset(pReceiver->pRcvBuf); - snapshotReceiverClearInfoData(pReceiver); + (void)snapshotReceiverClearInfoData(pReceiver); } - taosThreadMutexUnlock(&pReceiver->pRcvBuf->mutex); + (void)taosThreadMutexUnlock(&pReceiver->pRcvBuf->mutex); } static int32_t snapshotReceiverFinish(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg) { @@ -685,7 +685,7 @@ static int32_t syncSnapReceiverExchgSnapInfo(SSyncNode *pSyncNode, SSyncSnapshot } pInfo->data = data; data = NULL; - memcpy(pInfo->data, pMsg->data, pMsg->dataLen); + (void)memcpy(pInfo->data, pMsg->data, pMsg->dataLen); // exchange snap info if ((code = pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, pInfo)) != 0) { @@ -711,7 +711,7 @@ static int32_t syncSnapReceiverExchgSnapInfo(SSyncNode *pSyncNode, SSyncSnapshot } pParam->data = data; data = NULL; - memcpy(pParam->data, pInfo->data, dataLen); + (void)memcpy(pParam->data, pInfo->data, dataLen); _exit: TAOS_RETURN(code); @@ -848,7 +848,7 @@ int32_t syncSnapSendRsp(SSyncSnapshotReceiver *pReceiver, SyncSnapshotSend *pMsg pRspMsg->payloadType = type; if (pBlock != NULL && blockLen > 0) { - memcpy(pRspMsg->data, pBlock, blockLen); + (void)memcpy(pRspMsg->data, pBlock, blockLen); } // send msg @@ -864,7 +864,7 @@ static int32_t syncSnapBufferRecv(SSyncSnapshotReceiver *pReceiver, SyncSnapshot SSyncSnapBuffer *pRcvBuf = pReceiver->pRcvBuf; SyncSnapshotSend *pMsg = ppMsg[0]; - taosThreadMutexLock(&pRcvBuf->mutex); + (void)taosThreadMutexLock(&pRcvBuf->mutex); if (pMsg->seq - pRcvBuf->start >= pRcvBuf->size) { code = TSDB_CODE_SYN_BUFFER_FULL; @@ -900,14 +900,14 @@ static int32_t syncSnapBufferRecv(SSyncSnapshotReceiver *pReceiver, SyncSnapshot } } pRcvBuf->start = seq + 1; - syncSnapSendRsp(pReceiver, pRcvBuf->entries[seq % pRcvBuf->size], NULL, 0, 0, code); + (void)syncSnapSendRsp(pReceiver, pRcvBuf->entries[seq % pRcvBuf->size], NULL, 0, 0, code); pRcvBuf->entryDeleteCb(pRcvBuf->entries[seq % pRcvBuf->size]); pRcvBuf->entries[seq % pRcvBuf->size] = NULL; if (code) goto _out; } _out: - taosThreadMutexUnlock(&pRcvBuf->mutex); + (void)taosThreadMutexUnlock(&pRcvBuf->mutex); TAOS_RETURN(code); } @@ -995,7 +995,7 @@ int32_t syncNodeOnSnapshot(SSyncNode *pSyncNode, SRpcMsg *pRpcMsg) { sRError(pReceiver, "reject snap replication with smaller term. msg term:%" PRId64 ", seq:%d", pMsg->term, pMsg->seq); code = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; - syncSnapSendRsp(pReceiver, pMsg, NULL, 0, 0, code); + (void)syncSnapSendRsp(pReceiver, pMsg, NULL, 0, 0, code); TAOS_RETURN(code); } @@ -1078,7 +1078,7 @@ static int32_t syncSnapSenderExchgSnapInfo(SSyncNode *pSyncNode, SSyncSnapshotSe if (data == NULL) { TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } - memcpy(data, pMsg->data, dataLen); + (void)memcpy(data, pMsg->data, dataLen); pParam->data = data; data = NULL; @@ -1098,7 +1098,7 @@ static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSend TAOS_RETURN(TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG); } - taosThreadMutexLock(&pSender->pSndBuf->mutex); + (void)taosThreadMutexLock(&pSender->pSndBuf->mutex); TAOS_CHECK_GOTO(pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot), NULL, _out); // prepare @@ -1128,7 +1128,7 @@ static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSend code = snapshotSend(pSender); _out: - taosThreadMutexUnlock(&pSender->pSndBuf->mutex); + (void)taosThreadMutexUnlock(&pSender->pSndBuf->mutex); TAOS_RETURN(code); } @@ -1145,7 +1145,7 @@ static int32_t syncSnapBufferSend(SSyncSnapshotSender *pSender, SyncSnapshotRsp SSyncSnapBuffer *pSndBuf = pSender->pSndBuf; SyncSnapshotRsp *pMsg = ppMsg[0]; - taosThreadMutexLock(&pSndBuf->mutex); + (void)taosThreadMutexLock(&pSndBuf->mutex); if (snapshotSenderSignatureCmp(pSender, pMsg) != 0) { code = TSDB_CODE_SYN_MISMATCHED_SIGNATURE; goto _out; @@ -1196,7 +1196,7 @@ static int32_t syncSnapBufferSend(SSyncSnapshotSender *pSender, SyncSnapshotRsp } } _out: - taosThreadMutexUnlock(&pSndBuf->mutex); + (void)taosThreadMutexUnlock(&pSndBuf->mutex); TAOS_RETURN(code); } diff --git a/source/libs/sync/src/syncUtil.c b/source/libs/sync/src/syncUtil.c index 66b7938440..1dac9f3ff8 100644 --- a/source/libs/sync/src/syncUtil.c +++ b/source/libs/sync/src/syncUtil.c @@ -103,10 +103,10 @@ bool syncUtilUserPreCommit(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && bool syncUtilUserRollback(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; } void syncUtilGenerateArbToken(int32_t nodeId, int32_t groupId, char* buf) { - memset(buf, 0, TSDB_ARB_TOKEN_SIZE); + (void)memset(buf, 0, TSDB_ARB_TOKEN_SIZE); int32_t randVal = taosSafeRand() % 1000; int64_t currentMs = taosGetTimestampMs(); - snprintf(buf, TSDB_ARB_TOKEN_SIZE, "d%d#g%d#%" PRId64 "#%d", nodeId, groupId, currentMs, randVal); + (void)snprintf(buf, TSDB_ARB_TOKEN_SIZE, "d%d#g%d#%" PRId64 "#%d", nodeId, groupId, currentMs, randVal); } // for leader diff --git a/source/libs/sync/src/syncVoteMgr.c b/source/libs/sync/src/syncVoteMgr.c index 83b0dde8e0..64f66c27a4 100644 --- a/source/libs/sync/src/syncVoteMgr.c +++ b/source/libs/sync/src/syncVoteMgr.c @@ -19,7 +19,7 @@ #include "syncUtil.h" static void voteGrantedClearVotes(SVotesGranted *pVotesGranted) { - memset(pVotesGranted->isGranted, 0, sizeof(pVotesGranted->isGranted)); + (void)memset(pVotesGranted->isGranted, 0, sizeof(pVotesGranted->isGranted)); pVotesGranted->votes = 0; } @@ -165,5 +165,5 @@ void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *p void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term) { pVotesRespond->term = term; - memset(pVotesRespond->isRespond, 0, sizeof(pVotesRespond->isRespond)); + (void)memset(pVotesRespond->isRespond, 0, sizeof(pVotesRespond->isRespond)); } diff --git a/source/libs/tfs/src/tfs.c b/source/libs/tfs/src/tfs.c index 81c853e546..ede7636011 100644 --- a/source/libs/tfs/src/tfs.c +++ b/source/libs/tfs/src/tfs.c @@ -81,7 +81,7 @@ void tfsClose(STfs *pTfs) { } taosHashCleanup(pTfs->hash); - taosThreadSpinDestroy(&pTfs->lock); + (void)taosThreadSpinDestroy(&pTfs->lock); taosMemoryFree(pTfs); } @@ -96,15 +96,15 @@ void tfsUpdateSize(STfs *pTfs) { size.used += pTier->size.used; } - tfsLock(pTfs); + (void)tfsLock(pTfs); pTfs->size = size; - tfsUnLock(pTfs); + (void)tfsUnLock(pTfs); } SDiskSize tfsGetSize(STfs *pTfs) { - tfsLock(pTfs); + (void)tfsLock(pTfs); SDiskSize size = pTfs->size; - tfsUnLock(pTfs); + (void)tfsUnLock(pTfs); return size; } @@ -190,7 +190,7 @@ void tfsInitFile(STfs *pTfs, STfsFile *pFile, SDiskID diskId, const char *rname) tstrncpy(pFile->rname, rname, TSDB_FILENAME_LEN); char tmpName[TMPNAME_LEN] = {0}; - snprintf(tmpName, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); + (void)snprintf(tmpName, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); tstrncpy(pFile->aname, tmpName, TSDB_FILENAME_LEN); pFile->pTfs = pTfs; } @@ -200,12 +200,12 @@ bool tfsIsSameFile(const STfsFile *pFile1, const STfsFile *pFile2) { if (pFile1->did.level != pFile2->did.level) return false; if (pFile1->did.id != pFile2->did.id) return false; char nameBuf1[TMPNAME_LEN], nameBuf2[TMPNAME_LEN]; - strncpy(nameBuf1, pFile1->rname, TMPNAME_LEN); - strncpy(nameBuf2, pFile2->rname, TMPNAME_LEN); + (void)strncpy(nameBuf1, pFile1->rname, TMPNAME_LEN); + (void)strncpy(nameBuf2, pFile2->rname, TMPNAME_LEN); nameBuf1[TMPNAME_LEN - 1] = 0; nameBuf2[TMPNAME_LEN - 1] = 0; - taosRealPath(nameBuf1, NULL, TMPNAME_LEN); - taosRealPath(nameBuf2, NULL, TMPNAME_LEN); + (void)taosRealPath(nameBuf1, NULL, TMPNAME_LEN); + (void)taosRealPath(nameBuf2, NULL, TMPNAME_LEN); if (strncmp(nameBuf1, nameBuf2, TMPNAME_LEN) != 0) return false; return true; } @@ -251,7 +251,7 @@ void tfsDirname(const STfsFile *pFile, char *dest) { void tfsAbsoluteName(STfs *pTfs, SDiskID diskId, const char *rname, char *aname) { STfsDisk *pDisk = TFS_DISK_AT(pTfs, diskId); - snprintf(aname, TSDB_FILENAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); + (void)snprintf(aname, TSDB_FILENAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); } int32_t tfsRemoveFile(const STfsFile *pFile) { return taosRemoveFile(pFile->aname); } @@ -267,7 +267,7 @@ int32_t tfsMkdirAt(STfs *pTfs, const char *rname, SDiskID diskId) { if (pDisk == NULL) { TAOS_RETURN(TSDB_CODE_FS_INVLD_CFG); } - snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); + (void)snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); if (taosMkDir(aname) != 0) { TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } @@ -347,7 +347,7 @@ bool tfsDirExistAt(STfs *pTfs, const char *rname, SDiskID diskId) { STfsDisk *pDisk = TFS_DISK_AT(pTfs, diskId); char aname[TMPNAME_LEN]; - snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); + (void)snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); return taosDirExist(aname); } @@ -362,7 +362,7 @@ int32_t tfsRmdir(STfs *pTfs, const char *rname) { STfsTier *pTier = TFS_TIER_AT(pTfs, level); for (int32_t id = 0; id < pTier->ndisk; id++) { STfsDisk *pDisk = pTier->disks[id]; - snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); + (void)snprintf(aname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, rname); uInfo("tfs remove dir:%s aname:%s rname:[%s]", pDisk->path, aname, rname); taosRemoveDir(aname); } @@ -379,8 +379,8 @@ static int32_t tfsRenameAt(STfs *pTfs, SDiskID diskId, const char *orname, const int32_t id = diskId.id; STfsTier *pTier = TFS_TIER_AT(pTfs, level); STfsDisk *pDisk = pTier->disks[id]; - snprintf(oaname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, orname); - snprintf(naname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, nrname); + (void)snprintf(oaname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, orname); + (void)snprintf(naname, TMPNAME_LEN, "%s%s%s", pDisk->path, TD_DIRSEP, nrname); if (taosRenameFile(oaname, naname) != 0 && errno != ENOENT) { int32_t code = TAOS_SYSTEM_ERROR(errno); // TODO: use return value of taosRenameFile directly @@ -417,7 +417,7 @@ int32_t tfsSearch(STfs *pTfs, int32_t level, const char *fname) { for (int32_t id = 0; id < pTier->ndisk; id++) { STfsDisk *pDisk = pTier->disks[id]; - snprintf(path, TMPNAME_LEN - 1, "%s%s%s", pDisk->path, TD_DIRSEP, fname); + (void)snprintf(path, TMPNAME_LEN - 1, "%s%s%s", pDisk->path, TD_DIRSEP, fname); if (taosCheckExistFile(path)) { return id; } @@ -460,9 +460,9 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) { if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue; if (pTfsDir->dirName[0] == 0) { - snprintf(bname, TMPNAME_LEN * 2, "%s", name); + (void)snprintf(bname, TMPNAME_LEN * 2, "%s", name); } else { - snprintf(bname, TMPNAME_LEN * 2, "%s%s%s", pTfsDir->dirName, TD_DIRSEP, name); + (void)snprintf(bname, TMPNAME_LEN * 2, "%s%s%s", pTfsDir->dirName, TD_DIRSEP, name); } tfsInitFile(pTfsDir->pTfs, &pTfsDir->tfile, pTfsDir->did, bname); @@ -655,9 +655,9 @@ static int32_t tfsOpendirImpl(STfs *pTfs, STfsDir *pTfsDir) { pTfsDir->did.id = pDisk->id; if (pDisk->path == NULL || pDisk->path[0] == 0) { - snprintf(adir, TMPNAME_LEN * 2, "%s", pTfsDir->dirName); + (void)snprintf(adir, TMPNAME_LEN * 2, "%s", pTfsDir->dirName); } else { - snprintf(adir, TMPNAME_LEN * 2, "%s%s%s", pDisk->path, TD_DIRSEP, pTfsDir->dirName); + (void)snprintf(adir, TMPNAME_LEN * 2, "%s%s%s", pDisk->path, TD_DIRSEP, pTfsDir->dirName); } pTfsDir->pDir = taosOpenDir(adir); if (pTfsDir->pDir != NULL) break; @@ -698,7 +698,7 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) { tfsUpdateSize(pTfs); - tfsLock(pTfs); + (void)tfsLock(pTfs); for (int32_t level = 0; level < pTfs->nlevel; level++) { STfsTier *pTier = &pTfs->tiers[level]; for (int32_t disk = 0; disk < pTier->ndisk; ++disk) { @@ -708,14 +708,14 @@ int32_t tfsGetMonitorInfo(STfs *pTfs, SMonDiskInfo *pInfo) { dinfo.level = pDisk->level; tstrncpy(dinfo.name, pDisk->path, sizeof(dinfo.name)); if (taosArrayPush(pInfo->datadirs, &dinfo) == NULL) { - tfsUnLock(pTfs); + (void)tfsUnLock(pTfs); taosArrayDestroy(pInfo->datadirs); pInfo->datadirs = NULL; TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } } } - tfsUnLock(pTfs); + (void)tfsUnLock(pTfs); TAOS_RETURN(0); } diff --git a/source/libs/tfs/src/tfsTier.c b/source/libs/tfs/src/tfsTier.c index 685f95c517..0733e3c76a 100644 --- a/source/libs/tfs/src/tfsTier.c +++ b/source/libs/tfs/src/tfsTier.c @@ -19,7 +19,7 @@ extern int64_t tsMinDiskFreeSize; int32_t tfsInitTier(STfsTier *pTier, int32_t level) { - memset(pTier, 0, sizeof(STfsTier)); + (void)memset(pTier, 0, sizeof(STfsTier)); if (taosThreadSpinInit(&pTier->lock, 0) != 0) { TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); @@ -35,7 +35,7 @@ void tfsDestroyTier(STfsTier *pTier) { } pTier->ndisk = 0; - taosThreadSpinDestroy(&pTier->lock); + (void)taosThreadSpinDestroy(&pTier->lock); } int32_t tfsMountDiskToTier(STfsTier *pTier, SDiskCfg *pCfg, STfsDisk **ppDisk) { @@ -88,7 +88,7 @@ void tfsUpdateTierSize(STfsTier *pTier) { SDiskSize size = {0}; int32_t nAvailDisks = 0; - tfsLockTier(pTier); + (void)tfsLockTier(pTier); for (int32_t id = 0; id < pTier->ndisk; id++) { STfsDisk *pDisk = pTier->disks[id]; @@ -104,15 +104,15 @@ void tfsUpdateTierSize(STfsTier *pTier) { pTier->size = size; pTier->nAvailDisks = nAvailDisks; - tfsUnLockTier(pTier); + (void)tfsUnLockTier(pTier); } // Round-Robin to allocate disk on a tier int32_t tfsAllocDiskOnTier(STfsTier *pTier) { - tfsLockTier(pTier); + (void)tfsLockTier(pTier); if (pTier->ndisk <= 0 || pTier->nAvailDisks <= 0) { - tfsUnLockTier(pTier); + (void)tfsUnLockTier(pTier); TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK); } @@ -155,7 +155,7 @@ int32_t tfsAllocDiskOnTier(STfsTier *pTier) { #endif } - tfsUnLockTier(pTier); + (void)tfsUnLockTier(pTier); if (retId < 0) { TAOS_RETURN(TSDB_CODE_FS_NO_VALID_DISK); } diff --git a/source/util/src/tbase58.c b/source/util/src/tbase58.c index 274249badf..b5d873f5ea 100644 --- a/source/util/src/tbase58.c +++ b/source/util/src/tbase58.c @@ -67,7 +67,7 @@ int32_t base58_encode(const uint8_t *value, int32_t vlen, char **result) { if (bfree) taosMemoryFree(pbuf); return TSDB_CODE_OUT_OF_MEMORY; } - memset(pResult, '1', nz); + (void)memset(pResult, '1', nz); while (pi != pbuf + size) pResult[nz++] = basis_58[*pi++]; if (bfree) taosMemoryFree(pbuf); @@ -152,7 +152,7 @@ int32_t base58_decode(const char *value, size_t inlen, int32_t *outlen, uint8_t return TSDB_CODE_OUT_OF_MEMORY; } - memset(pResult, 0, nz); + (void)memset(pResult, 0, nz); while (it != pbuf + size) pResult[nz++] = *it++; if (outlen) *outlen = nz;