remove void check

This commit is contained in:
yihaoDeng 2024-09-19 15:39:57 +08:00
parent 2e9c7c522f
commit 7518d274e0
2 changed files with 104 additions and 107 deletions

View File

@ -137,7 +137,7 @@ NextTbl:
memcpy(pVal, tVal, tLen); memcpy(pVal, tVal, tLen);
vLen = tLen; vLen = tLen;
} }
(void)tdbTbcMoveToNext(pReader->pCur); TAOS_UNUSED(tdbTbcMoveToNext(pReader->pCur));
break; break;
} }
if (except == 1) { if (except == 1) {
@ -147,7 +147,7 @@ NextTbl:
pReader->pos += 1; pReader->pos += 1;
pPair = taosArrayGet(pReader->tdbTbList, pReader->pos); pPair = taosArrayGet(pReader->tdbTbList, pReader->pos);
code = tdbTbcOpen(pPair->tbl, &pReader->pCur, NULL); code = tdbTbcOpen(pPair->tbl, &pReader->pCur, NULL);
(void)tdbTbcMoveToFirst(pReader->pCur); TAOS_UNUSED(tdbTbcMoveToFirst(pReader->pCur));
goto NextTbl; goto NextTbl;
} }
@ -210,7 +210,7 @@ int32_t streamTaskSnapWriterClose(SStreamTaskWriter* pWriter, int8_t rollback, i
streamMetaWLock(pTq->pStreamMeta); streamMetaWLock(pTq->pStreamMeta);
tqDebug("vgId:%d, vnode stream-task snapshot writer closed", TD_VID(pTq->pVnode)); tqDebug("vgId:%d, vnode stream-task snapshot writer closed", TD_VID(pTq->pVnode));
if (rollback) { if (rollback) {
(void)tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn); TAOS_UNUSED(tdbAbort(pTq->pStreamMeta->db, pTq->pStreamMeta->txn));
} else { } else {
code = tdbCommit(pTq->pStreamMeta->db, pTq->pStreamMeta->txn); code = tdbCommit(pTq->pStreamMeta->db, pTq->pStreamMeta->txn);
if (code) goto _err; if (code) goto _err;

View File

@ -427,7 +427,7 @@ void cleanDir(const char* pPath, const char* id) {
if (taosIsDir(pPath)) { if (taosIsDir(pPath)) {
taosRemoveDir(pPath); taosRemoveDir(pPath);
(void)taosMkDir(pPath); TAOS_UNUSED(taosMkDir(pPath));
stInfo("%s clear dir:%s, succ", id, pPath); stInfo("%s clear dir:%s, succ", id, pPath);
} }
} }
@ -533,7 +533,7 @@ int32_t rebuildFromRemoteChkp_s3(const char* key, char* chkpPath, int64_t chkpId
_EXIT: _EXIT:
if (code != 0) { if (code != 0) {
if (rename) { if (rename) {
(void)taosRenameFile(defaultTmp, defaultPath); TAOS_UNUSED(taosRenameFile(defaultTmp, defaultPath));
} }
} }
@ -653,13 +653,13 @@ int32_t backendFileCopyFilesImpl(const char* src, const char* dst) {
taosMemoryFreeClear(srcName); taosMemoryFreeClear(srcName);
taosMemoryFreeClear(dstName); taosMemoryFreeClear(dstName);
(void)taosCloseDir(&pDir); TAOS_UNUSED(taosCloseDir(&pDir));
return code; return code;
_ERROR: _ERROR:
taosMemoryFreeClear(srcName); taosMemoryFreeClear(srcName);
taosMemoryFreeClear(dstName); taosMemoryFreeClear(dstName);
(void)taosCloseDir(&pDir); TAOS_UNUSED(taosCloseDir(&pDir));
return code; return code;
} }
@ -829,8 +829,8 @@ void* streamBackendInit(const char* streamPath, int64_t chkpId, int32_t vgId) {
goto _EXIT; goto _EXIT;
} }
(void)taosThreadMutexInit(&pHandle->mutex, NULL); TAOS_UNUSED(taosThreadMutexInit(&pHandle->mutex, NULL));
(void)taosThreadMutexInit(&pHandle->cfMutex, NULL); TAOS_UNUSED(taosThreadMutexInit(&pHandle->cfMutex, NULL));
pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); pHandle->cfInst = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
if (pHandle->cfInst == NULL) { if (pHandle->cfInst == NULL) {
goto _EXIT; goto _EXIT;
@ -946,11 +946,11 @@ void streamBackendCleanup(void* arg) {
void streamBackendHandleCleanup(void* arg) { void streamBackendHandleCleanup(void* arg) {
SBackendCfWrapper* wrapper = arg; SBackendCfWrapper* wrapper = arg;
bool remove = wrapper->remove; bool remove = wrapper->remove;
(void)taosThreadRwlockWrlock(&wrapper->rwLock); TAOS_UNUSED(taosThreadRwlockWrlock(&wrapper->rwLock));
stDebug("start to do-close backendwrapper %p, %s", wrapper, wrapper->idstr); stDebug("start to do-close backendwrapper %p, %s", wrapper, wrapper->idstr);
if (wrapper->rocksdb == NULL) { if (wrapper->rocksdb == NULL) {
(void)taosThreadRwlockUnlock(&wrapper->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&wrapper->rwLock));
return; return;
} }
@ -1001,9 +1001,9 @@ void streamBackendHandleCleanup(void* arg) {
wrapper->readOpts = NULL; wrapper->readOpts = NULL;
taosMemoryFreeClear(wrapper->cfOpts); taosMemoryFreeClear(wrapper->cfOpts);
taosMemoryFreeClear(wrapper->param); taosMemoryFreeClear(wrapper->param);
(void)taosThreadRwlockUnlock(&wrapper->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&wrapper->rwLock));
(void)taosThreadRwlockDestroy(&wrapper->rwLock); TAOS_UNUSED(taosThreadRwlockDestroy(&wrapper->rwLock));
wrapper->rocksdb = NULL; wrapper->rocksdb = NULL;
// taosReleaseRef(streamBackendId, wrapper->backendId); // taosReleaseRef(streamBackendId, wrapper->backendId);
@ -1097,7 +1097,7 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
int32_t code = 0; int32_t code = 0;
STaskDbWrapper* pBackend = arg; STaskDbWrapper* pBackend = arg;
SArray * chkpDel = NULL, *chkpDup = NULL; SArray * chkpDel = NULL, *chkpDup = NULL;
(void)taosThreadRwlockWrlock(&pBackend->chkpDirLock); TAOS_UNUSED(taosThreadRwlockWrlock(&pBackend->chkpDirLock));
if (taosArrayPush(pBackend->chkpSaved, &chkpId) == NULL) { if (taosArrayPush(pBackend->chkpSaved, &chkpId) == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception); TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
@ -1150,7 +1150,7 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
taosArrayDestroy(pBackend->chkpSaved); taosArrayDestroy(pBackend->chkpSaved);
pBackend->chkpSaved = chkpDup; pBackend->chkpSaved = chkpDup;
(void)taosThreadRwlockUnlock(&pBackend->chkpDirLock); TAOS_UNUSED(taosThreadRwlockUnlock(&pBackend->chkpDirLock));
for (int i = 0; i < taosArrayGetSize(chkpDel); i++) { for (int i = 0; i < taosArrayGetSize(chkpDel); i++) {
int64_t id = *(int64_t*)taosArrayGet(chkpDel, i); int64_t id = *(int64_t*)taosArrayGet(chkpDel, i);
@ -1167,7 +1167,7 @@ int32_t chkpMayDelObsolete(void* arg, int64_t chkpId, char* path) {
_exception: _exception:
taosArrayDestroy(chkpDup); taosArrayDestroy(chkpDup);
taosArrayDestroy(chkpDel); taosArrayDestroy(chkpDel);
(void)taosThreadRwlockUnlock(&pBackend->chkpDirLock); TAOS_UNUSED(taosThreadRwlockUnlock(&pBackend->chkpDirLock));
return code; return code;
} }
@ -1313,12 +1313,12 @@ int32_t taskDbLoadChkpInfo(STaskDbWrapper* pBackend) {
taosArraySort(pBackend->chkpSaved, chkpIdComp); taosArraySort(pBackend->chkpSaved, chkpIdComp);
taosMemoryFree(pChkpDir); taosMemoryFree(pChkpDir);
(void)taosCloseDir(&pDir); TAOS_UNUSED(taosCloseDir(&pDir));
return 0; return 0;
_exception: _exception:
taosMemoryFree(pChkpDir); taosMemoryFree(pChkpDir);
(void)taosCloseDir(&pDir); TAOS_UNUSED(taosCloseDir(&pDir));
return code; return code;
} }
int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_handle_t*** ppHandle) { int32_t chkpGetAllDbCfHandle2(STaskDbWrapper* pBackend, rocksdb_column_family_handle_t*** ppHandle) {
@ -1559,7 +1559,7 @@ void* taskAcquireDb(int64_t refId) {
} }
void taskReleaseDb(int64_t refId) { void taskReleaseDb(int64_t refId) {
// release // release
(void)taosReleaseRef(taskDbWrapperId, refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, refId));
} }
int64_t taskGetDBRef(void* arg) { int64_t taskGetDBRef(void* arg) {
@ -1620,7 +1620,7 @@ int32_t chkpLoadExtraInfo(char* pChkpIdDir, int64_t* chkpId, int64_t* processId)
code = 0; code = 0;
_EXIT: _EXIT:
taosMemoryFree(pDst); taosMemoryFree(pDst);
(void)taosCloseFile(&pFile); TAOS_UNUSED(taosCloseFile(&pFile));
return code; return code;
} }
int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) { int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
@ -1675,7 +1675,7 @@ int32_t chkpAddExtraInfo(char* pChkpIdDir, int64_t chkpId, int64_t processId) {
code = 0; code = 0;
_EXIT: _EXIT:
(void)taosCloseFile(&pFile); TAOS_UNUSED(taosCloseFile(&pFile));
taosMemoryFree(pDst); taosMemoryFree(pDst);
return code; return code;
} }
@ -1733,7 +1733,7 @@ int32_t taskDbDoCheckpoint(void* arg, int64_t chkpId, int64_t processId) {
goto _EXIT; goto _EXIT;
} }
(void)atomic_store_64(&pTaskDb->dataWritten, 0); TAOS_UNUSED(atomic_store_64(&pTaskDb->dataWritten, 0));
pTaskDb->chkpId = chkpId; pTaskDb->chkpId = chkpId;
_EXIT: _EXIT:
@ -1741,13 +1741,13 @@ _EXIT:
// clear checkpoint dir if failed // clear checkpoint dir if failed
if (code != 0 && pChkpDir != NULL) { if (code != 0 && pChkpDir != NULL) {
if (taosDirExist(pChkpIdDir)) { if (taosDirExist(pChkpIdDir)) {
(void)taosRemoveDir(pChkpIdDir); TAOS_UNUSED(taosRemoveDir(pChkpIdDir));
} }
} }
taosMemoryFree(pChkpIdDir); taosMemoryFree(pChkpIdDir);
taosMemoryFree(pChkpDir); taosMemoryFree(pChkpDir);
(void)taosReleaseRef(taskDbWrapperId, refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, refId));
taosMemoryFree(ppCf); taosMemoryFree(ppCf);
return code; return code;
} }
@ -1820,7 +1820,7 @@ int defaultKeyComp(void* state, const char* aBuf, size_t aLen, const char* bBuf,
} }
int streamStateValueIsStale(char* v) { int streamStateValueIsStale(char* v) {
int64_t ts = 0; int64_t ts = 0;
(void)taosDecodeFixedI64(v, &ts); TAOS_UNUSED(taosDecodeFixedI64(v, &ts));
return (ts != 0 && ts < taosGetTimestampMs()) ? 1 : 0; return (ts != 0 && ts < taosGetTimestampMs()) ? 1 : 0;
} }
int iterValueIsStale(rocksdb_iterator_t* iter) { int iterValueIsStale(rocksdb_iterator_t* iter) {
@ -1863,8 +1863,8 @@ int stateKeyDBComp(void* state, const char* aBuf, size_t aLen, const char* bBuf,
p1 = taosDecodeFixedI64(p1, &key1.key.ts); p1 = taosDecodeFixedI64(p1, &key1.key.ts);
p2 = taosDecodeFixedI64(p2, &key2.key.ts); p2 = taosDecodeFixedI64(p2, &key2.key.ts);
(void)taosDecodeFixedI64(p1, &key1.opNum); TAOS_UNUSED(taosDecodeFixedI64(p1, &key1.opNum));
(void)taosDecodeFixedI64(p2, &key2.opNum); TAOS_UNUSED(taosDecodeFixedI64(p2, &key2.opNum));
return stateKeyCmpr(&key1, sizeof(key1), &key2, sizeof(key2)); return stateKeyCmpr(&key1, sizeof(key1), &key2, sizeof(key2));
} }
@ -2060,8 +2060,8 @@ int parKeyDBComp(void* state, const char* aBuf, size_t aLen, const char* bBuf, s
char* p1 = (char*)aBuf; char* p1 = (char*)aBuf;
char* p2 = (char*)bBuf; char* p2 = (char*)bBuf;
(void)taosDecodeFixedI64(p1, &w1); TAOS_UNUSED(taosDecodeFixedI64(p1, &w1));
(void)taosDecodeFixedI64(p2, &w2); TAOS_UNUSED(taosDecodeFixedI64(p2, &w2));
if (w1 == w2) { if (w1 == w2) {
return 0; return 0;
} else { } else {
@ -2105,7 +2105,7 @@ int32_t valueIsStale(void* k, int64_t ts) {
} }
void destroyCompare(void* arg) { void destroyCompare(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return; return;
} }
@ -2249,31 +2249,28 @@ _EXCEPT:
} }
const char* compareDefaultName(void* arg) { const char* compareDefaultName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[0].key; return ginitDict[0].key;
} }
const char* compareStateName(void* arg) { const char* compareStateName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[1].key; return ginitDict[1].key;
} }
const char* compareWinKeyName(void* arg) { const char* compareWinKeyName(void* arg) { return ginitDict[2].key; }
(void)arg;
return ginitDict[2].key;
}
const char* compareSessionKeyName(void* arg) { const char* compareSessionKeyName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[3].key; return ginitDict[3].key;
} }
const char* compareFuncKeyName(void* arg) { const char* compareFuncKeyName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[4].key; return ginitDict[4].key;
} }
const char* compareParKeyName(void* arg) { const char* compareParKeyName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[5].key; return ginitDict[5].key;
} }
const char* comparePartagKeyName(void* arg) { const char* comparePartagKeyName(void* arg) {
(void)arg; TAOS_UNUSED(arg);
return ginitDict[6].key; return ginitDict[6].key;
} }
@ -2301,7 +2298,7 @@ const char* compactFilteFactoryNameFunc(void* arg) {
return "stream_compact_factory_filter_func"; return "stream_compact_factory_filter_func";
} }
void destroyCompactFilte(void* arg) { (void)arg; } void destroyCompactFilte(void* arg) { TAOS_UNUSED(arg); }
unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen, unsigned char compactFilte(void* arg, int level, const char* key, size_t klen, const char* val, size_t vlen,
char** newval, size_t* newvlen, unsigned char* value_changed) { char** newval, size_t* newvlen, unsigned char* value_changed) {
return streamStateValueIsStale((char*)val) ? 1 : 0; return streamStateValueIsStale((char*)val) ? 1 : 0;
@ -2414,7 +2411,7 @@ void taskDbRemoveRef(void* pTaskDb) {
} }
STaskDbWrapper* pBackend = pTaskDb; STaskDbWrapper* pBackend = pTaskDb;
(void)taosReleaseRef(taskDbWrapperId, pBackend->refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, pBackend->refId));
} }
void taskDbSetClearFileFlag(void* pTaskDb) { void taskDbSetClearFileFlag(void* pTaskDb) {
@ -2489,24 +2486,24 @@ void taskDbInitChkpOpt(STaskDbWrapper* pTaskDb) {
pTaskDb->chkpId = -1; pTaskDb->chkpId = -1;
pTaskDb->chkpCap = 4; pTaskDb->chkpCap = 4;
pTaskDb->chkpSaved = taosArrayInit(4, sizeof(int64_t)); pTaskDb->chkpSaved = taosArrayInit(4, sizeof(int64_t));
(void)taskDbLoadChkpInfo(pTaskDb); TAOS_UNUSED(taskDbLoadChkpInfo(pTaskDb));
pTaskDb->chkpInUse = taosArrayInit(4, sizeof(int64_t)); pTaskDb->chkpInUse = taosArrayInit(4, sizeof(int64_t));
(void)taosThreadRwlockInit(&pTaskDb->chkpDirLock, NULL); TAOS_UNUSED(taosThreadRwlockInit(&pTaskDb->chkpDirLock, NULL));
} }
void taskDbRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) { void taskDbRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
(void)taosThreadRwlockWrlock(&pTaskDb->chkpDirLock); TAOS_UNUSED(taosThreadRwlockWrlock(&pTaskDb->chkpDirLock));
if (taosArrayPush(pTaskDb->chkpInUse, &chkp) == NULL) { if (taosArrayPush(pTaskDb->chkpInUse, &chkp) == NULL) {
stError("failed to push chkp: %" PRIi64 " into inuse", chkp); stError("failed to push chkp: %" PRIi64 " into inuse", chkp);
} }
taosArraySort(pTaskDb->chkpInUse, chkpIdComp); taosArraySort(pTaskDb->chkpInUse, chkpIdComp);
(void)taosThreadRwlockUnlock(&pTaskDb->chkpDirLock); TAOS_UNUSED(taosThreadRwlockUnlock(&pTaskDb->chkpDirLock));
} }
void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) { void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
(void)taosThreadRwlockWrlock(&pTaskDb->chkpDirLock); TAOS_UNUSED(taosThreadRwlockWrlock(&pTaskDb->chkpDirLock));
int32_t size = taosArrayGetSize(pTaskDb->chkpInUse); int32_t size = taosArrayGetSize(pTaskDb->chkpInUse);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
int64_t* p = taosArrayGet(pTaskDb->chkpInUse, i); int64_t* p = taosArrayGet(pTaskDb->chkpInUse, i);
@ -2515,13 +2512,13 @@ void taskDbUnRefChkp(STaskDbWrapper* pTaskDb, int64_t chkp) {
break; break;
} }
} }
(void)taosThreadRwlockUnlock(&pTaskDb->chkpDirLock); TAOS_UNUSED(taosThreadRwlockUnlock(&pTaskDb->chkpDirLock));
} }
void taskDbDestroyChkpOpt(STaskDbWrapper* pTaskDb) { void taskDbDestroyChkpOpt(STaskDbWrapper* pTaskDb) {
taosArrayDestroy(pTaskDb->chkpSaved); taosArrayDestroy(pTaskDb->chkpSaved);
taosArrayDestroy(pTaskDb->chkpInUse); taosArrayDestroy(pTaskDb->chkpInUse);
(void)taosThreadRwlockDestroy(&pTaskDb->chkpDirLock); TAOS_UNUSED(taosThreadRwlockDestroy(&pTaskDb->chkpDirLock));
} }
int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** stateFullPath) { int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** stateFullPath) {
@ -2567,9 +2564,9 @@ int32_t taskDbBuildFullPath(char* path, char* key, char** dbFullPath, char** sta
void taskDbUpdateChkpId(void* pTaskDb, int64_t chkpId) { void taskDbUpdateChkpId(void* pTaskDb, int64_t chkpId) {
STaskDbWrapper* p = pTaskDb; STaskDbWrapper* p = pTaskDb;
(void)streamMutexLock(&p->mutex); TAOS_UNUSED(streamMutexLock(&p->mutex));
p->chkpId = chkpId; p->chkpId = chkpId;
(void)streamMutexUnlock(&p->mutex); TAOS_UNUSED(streamMutexUnlock(&p->mutex));
} }
STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) { STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
@ -2585,7 +2582,7 @@ STaskDbWrapper* taskDbOpenImpl(const char* key, char* statePath, char* dbPath) {
pTaskDb->idstr = key ? taosStrdup(key) : NULL; pTaskDb->idstr = key ? taosStrdup(key) : NULL;
pTaskDb->path = statePath ? taosStrdup(statePath) : NULL; pTaskDb->path = statePath ? taosStrdup(statePath) : NULL;
(void)taosThreadMutexInit(&pTaskDb->mutex, NULL); TAOS_UNUSED(taosThreadMutexInit(&pTaskDb->mutex, NULL));
taskDbInitChkpOpt(pTaskDb); taskDbInitChkpOpt(pTaskDb);
taskDbInitOpt(pTaskDb); taskDbInitOpt(pTaskDb);
@ -2770,7 +2767,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
char* buf = taosMemoryCalloc(1, cap); char* buf = taosMemoryCalloc(1, cap);
if (buf == NULL) { if (buf == NULL) {
(void)taosReleaseRef(taskDbWrapperId, refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, refId));
return terrno; return terrno;
} }
@ -2778,7 +2775,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
snprintf(buf, cap, "%s%s%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", chkpId); snprintf(buf, cap, "%s%s%s%s%s%" PRId64 "", pDb->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, "checkpoint", chkpId);
if (nBytes <= 0 || nBytes >= cap) { if (nBytes <= 0 || nBytes >= cap) {
taosMemoryFree(buf); taosMemoryFree(buf);
(void)taosReleaseRef(taskDbWrapperId, refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, refId));
return TSDB_CODE_OUT_OF_RANGE; return TSDB_CODE_OUT_OF_RANGE;
} }
@ -2789,7 +2786,7 @@ int32_t taskDbGenChkpUploadData__rsync(STaskDbWrapper* pDb, int64_t chkpId, char
taosMemoryFree(buf); taosMemoryFree(buf);
} }
(void)taosReleaseRef(taskDbWrapperId, refId); TAOS_UNUSED(taosReleaseRef(taskDbWrapperId, refId));
return code; return code;
} }
@ -3026,7 +3023,7 @@ int32_t streamStateOpenBackendCf(void* backend, char* name, char** cfs, int32_t
inst->dbOpt = handle->dbOpt; inst->dbOpt = handle->dbOpt;
rocksdb_writeoptions_disable_WAL(inst->wOpt, 1); rocksdb_writeoptions_disable_WAL(inst->wOpt, 1);
(void)taosHashPut(handle->cfInst, idstr, strlen(idstr) + 1, &inst, sizeof(void*)); TAOS_UNUSED(taosHashPut(handle->cfInst, idstr, strlen(idstr) + 1, &inst, sizeof(void*)));
} else { } else {
inst = *pInst; inst = *pInst;
} }
@ -3267,9 +3264,9 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
break; \ break; \
} \ } \
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \ STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); \ TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1)); \
char toString[128] = {0}; \ char toString[128] = {0}; \
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \ if (stDebugFlag & DEBUG_TRACE) TAOS_UNUSED((ginitDict[i].toStrFunc((void*)key, toString))); \
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \ int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \ rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
rocksdb_writeoptions_t* opts = wrapper->writeOpt; \ rocksdb_writeoptions_t* opts = wrapper->writeOpt; \
@ -3301,7 +3298,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
} \ } \
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \ STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
char toString[128] = {0}; \ char toString[128] = {0}; \
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \ if (stDebugFlag & DEBUG_TRACE) TAOS_UNUSED((ginitDict[i].toStrFunc((void*)key, toString))); \
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \ int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \ rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
rocksdb_t* db = wrapper->db; \ rocksdb_t* db = wrapper->db; \
@ -3344,9 +3341,9 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
break; \ break; \
} \ } \
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \ STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; \
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); \ TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1)); \
char toString[128] = {0}; \ char toString[128] = {0}; \
if (stDebugFlag & DEBUG_TRACE) (void)(ginitDict[i].toStrFunc((void*)key, toString)); \ if (stDebugFlag & DEBUG_TRACE) TAOS_UNUSED(ginitDict[i].toStrFunc((void*)key, toString)); \
int32_t klen = ginitDict[i].enFunc((void*)key, buf); \ int32_t klen = ginitDict[i].enFunc((void*)key, buf); \
rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \ rocksdb_column_family_handle_t* pHandle = ((rocksdb_column_family_handle_t**)wrapper->pCf)[ginitDict[i].idx]; \
rocksdb_t* db = wrapper->db; \ rocksdb_t* db = wrapper->db; \
@ -3385,7 +3382,7 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) {
stDebug("streamStateClear_rocksdb"); stDebug("streamStateClear_rocksdb");
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1));
char sKeyStr[128] = {0}; char sKeyStr[128] = {0};
char eKeyStr[128] = {0}; char eKeyStr[128] = {0};
@ -3401,8 +3398,8 @@ int32_t streamStateClear_rocksdb(SStreamState* pState) {
if (err != NULL) { if (err != NULL) {
char toStringStart[128] = {0}; char toStringStart[128] = {0};
char toStringEnd[128] = {0}; char toStringEnd[128] = {0};
(void)stateKeyToString(&sKey, toStringStart); TAOS_UNUSED(stateKeyToString(&sKey, toStringStart));
(void)stateKeyToString(&eKey, toStringEnd); TAOS_UNUSED(stateKeyToString(&eKey, toStringEnd));
stWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err); stWarn("failed to delete range cf(state) start: %s, end:%s, reason:%s", toStringStart, toStringEnd, err);
taosMemoryFree(err); taosMemoryFree(err);
@ -3481,7 +3478,7 @@ int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, cons
if (rocksdb_iter_valid(pCur->iter) && !iterValueIsStale(pCur->iter)) { if (rocksdb_iter_valid(pCur->iter) && !iterValueIsStale(pCur->iter)) {
size_t tlen; size_t tlen;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &tlen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &tlen);
(void)stateKeyDecode((void*)pKtmp, keyStr); TAOS_UNUSED(stateKeyDecode((void*)pKtmp, keyStr));
if (pKtmp->opNum != pCur->number) { if (pKtmp->opNum != pCur->number) {
return -1; return -1;
} }
@ -3534,7 +3531,7 @@ SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWin
SStateKey curKey; SStateKey curKey;
size_t kLen; size_t kLen;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
(void)stateKeyDecode((void*)&curKey, keyStr); TAOS_UNUSED(stateKeyDecode((void*)&curKey, keyStr));
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) { if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) {
return pCur; return pCur;
} }
@ -3556,7 +3553,7 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState) {
{ {
char tbuf[256] = {0}; char tbuf[256] = {0};
(void)stateKeyToString((void*)&maxStateKey, tbuf); TAOS_UNUSED(stateKeyToString((void*)&maxStateKey, tbuf));
stDebug("seek to last:%s", tbuf); stDebug("seek to last:%s", tbuf);
} }
@ -3606,7 +3603,7 @@ SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey*
SStateKey curKey; SStateKey curKey;
size_t kLen = 0; size_t kLen = 0;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
(void)stateKeyDecode((void*)&curKey, keyStr); TAOS_UNUSED(stateKeyDecode((void*)&curKey, keyStr));
if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) == 0) { if (stateKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) == 0) {
pCur->number = pState->number; pCur->number = pState->number;
@ -3754,7 +3751,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev_rocksdb(SStreamState* pSta
size_t klen; size_t klen;
const char* iKey = rocksdb_iter_key(pCur->iter, &klen); const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
SStateSessionKey curKey = {0}; SStateSessionKey curKey = {0};
(void)stateSessionKeyDecode(&curKey, (char*)iKey); TAOS_UNUSED(stateSessionKeyDecode(&curKey, (char*)iKey));
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) >= 0) return pCur; if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) >= 0) return pCur;
rocksdb_iter_prev(pCur->iter); rocksdb_iter_prev(pCur->iter);
@ -3791,7 +3788,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext_rocksdb(SStreamState* pSta
size_t klen; size_t klen;
const char* iKey = rocksdb_iter_key(pCur->iter, &klen); const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
SStateSessionKey curKey = {0}; SStateSessionKey curKey = {0};
(void)stateSessionKeyDecode(&curKey, (char*)iKey); TAOS_UNUSED(stateSessionKeyDecode(&curKey, (char*)iKey));
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) <= 0) return pCur; if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) <= 0) return pCur;
rocksdb_iter_next(pCur->iter); rocksdb_iter_next(pCur->iter);
@ -3831,7 +3828,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, con
size_t klen; size_t klen;
const char* iKey = rocksdb_iter_key(pCur->iter, &klen); const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
SStateSessionKey curKey = {0}; SStateSessionKey curKey = {0};
(void)stateSessionKeyDecode(&curKey, (char*)iKey); TAOS_UNUSED(stateSessionKeyDecode(&curKey, (char*)iKey));
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) < 0) return pCur; if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) < 0) return pCur;
rocksdb_iter_next(pCur->iter); rocksdb_iter_next(pCur->iter);
@ -3871,7 +3868,7 @@ SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, con
size_t klen; size_t klen;
const char* iKey = rocksdb_iter_key(pCur->iter, &klen); const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
SStateSessionKey curKey = {0}; SStateSessionKey curKey = {0};
(void)stateSessionKeyDecode(&curKey, (char*)iKey); TAOS_UNUSED(stateSessionKeyDecode(&curKey, (char*)iKey));
if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) return pCur; if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) return pCur;
rocksdb_iter_prev(pCur->iter); rocksdb_iter_prev(pCur->iter);
@ -3894,7 +3891,7 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
return -1; return -1;
} }
const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen); const char* curKey = rocksdb_iter_key(pCur->iter, (size_t*)&kLen);
(void)stateSessionKeyDecode((void*)&ktmp, (char*)curKey); TAOS_UNUSED(stateSessionKeyDecode((void*)&ktmp, (char*)curKey));
if (pVal != NULL) *pVal = NULL; if (pVal != NULL) *pVal = NULL;
if (pVLen != NULL) *pVLen = 0; if (pVLen != NULL) *pVLen = 0;
@ -3973,7 +3970,7 @@ SStreamStateCur* streamStateFillGetCur_rocksdb(SStreamState* pState, const SWinK
size_t kLen; size_t kLen;
SWinKey curKey; SWinKey curKey;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
(void)winKeyDecode((void*)&curKey, keyStr); TAOS_UNUSED(winKeyDecode((void*)&curKey, keyStr));
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) == 0) { if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) == 0) {
return pCur; return pCur;
} }
@ -3993,7 +3990,7 @@ int32_t streamStateFillGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey,
} }
size_t klen, vlen; size_t klen, vlen;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &klen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &klen);
(void)winKeyDecode(&winKey, keyStr); TAOS_UNUSED(winKeyDecode(&winKey, keyStr));
const char* valStr = rocksdb_iter_value(pCur->iter, &vlen); const char* valStr = rocksdb_iter_value(pCur->iter, &vlen);
int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)pVal); int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)pVal);
@ -4034,7 +4031,7 @@ SStreamStateCur* streamStateFillSeekKeyNext_rocksdb(SStreamState* pState, const
SWinKey curKey; SWinKey curKey;
size_t kLen = 0; size_t kLen = 0;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
(void)winKeyDecode((void*)&curKey, keyStr); TAOS_UNUSED(winKeyDecode((void*)&curKey, keyStr));
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) { if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) < 0) {
return pCur; return pCur;
} }
@ -4071,7 +4068,7 @@ SStreamStateCur* streamStateFillSeekKeyPrev_rocksdb(SStreamState* pState, const
SWinKey curKey; SWinKey curKey;
size_t kLen = 0; size_t kLen = 0;
char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen); char* keyStr = (char*)rocksdb_iter_key(pCur->iter, &kLen);
(void)winKeyDecode((void*)&curKey, keyStr); TAOS_UNUSED(winKeyDecode((void*)&curKey, keyStr));
if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) { if (winKeyCmpr(key, sizeof(*key), &curKey, sizeof(curKey)) > 0) {
return pCur; return pCur;
} }
@ -4207,7 +4204,7 @@ void streamStateSessionClear_rocksdb(SStreamState* pState) {
if (code == 0 && size > 0) { if (code == 0 && size > 0) {
memset(buf, 0, size); memset(buf, 0, size);
// refactor later // refactor later
(void)streamStateSessionPut_rocksdb(pState, &delKey, buf, size); TAOS_UNUSED(streamStateSessionPut_rocksdb(pState, &delKey, buf, size));
} else { } else {
taosMemoryFreeClear(buf); taosMemoryFreeClear(buf);
break; break;
@ -4420,7 +4417,7 @@ void streamStateDestroyBatch(void* pBatch) { rocksdb_writebatch_destroy((rock
int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb_writebatch_t* pBatch, void* key, int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb_writebatch_t* pBatch, void* key,
void* val, int32_t vlen, int64_t ttl) { void* val, int32_t vlen, int64_t ttl) {
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1));
int i = streamStateGetCfIdx(pState, cfKeyName); int i = streamStateGetCfIdx(pState, cfKeyName);
if (i < 0) { if (i < 0) {
@ -4440,7 +4437,7 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb
{ {
char tbuf[256] = {0}; char tbuf[256] = {0};
(void)(ginitDict[i].toStrFunc((void*)key, tbuf)); TAOS_UNUSED(ginitDict[i].toStrFunc((void*)key, tbuf));
stTrace("streamState str: %s succ to write to %s_%s, len: %d", tbuf, wrapper->idstr, ginitDict[i].key, vlen); stTrace("streamState str: %s succ to write to %s_%s, len: %d", tbuf, wrapper->idstr, ginitDict[i].key, vlen);
} }
return 0; return 0;
@ -4455,7 +4452,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1));
rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx]; rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx];
rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen); rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen);
@ -4466,7 +4463,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
{ {
char tbuf[256] = {0}; char tbuf[256] = {0};
(void)(ginitDict[cfIdx].toStrFunc((void*)key, tbuf)); TAOS_UNUSED(ginitDict[cfIdx].toStrFunc((void*)key, tbuf));
stTrace("streamState str: %s succ to write to %s_%s", tbuf, wrapper->idstr, ginitDict[cfIdx].key); stTrace("streamState str: %s succ to write to %s_%s", tbuf, wrapper->idstr, ginitDict[cfIdx].key);
} }
return 0; return 0;
@ -4474,7 +4471,7 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) { int32_t streamStatePutBatch_rocksdb(SStreamState* pState, void* pBatch) {
char* err = NULL; char* err = NULL;
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
(void)atomic_add_fetch_64(&wrapper->dataWritten, 1); TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1));
rocksdb_write(wrapper->db, wrapper->writeOpt, (rocksdb_writebatch_t*)pBatch, &err); rocksdb_write(wrapper->db, wrapper->writeOpt, (rocksdb_writebatch_t*)pBatch, &err);
if (err != NULL) { if (err != NULL) {
stError("streamState failed to write batch, err:%s", err); stError("streamState failed to write batch, err:%s", err);
@ -4563,7 +4560,7 @@ int32_t compareHashTableImpl(SHashObj* p1, SHashObj* p2, SArray* diff) {
if (fname == NULL) { if (fname == NULL) {
return terrno; return terrno;
} }
(void)strncpy(fname, name, len); TAOS_UNUSED(strncpy(fname, name, len));
if (taosArrayPush(diff, &fname) == NULL) { if (taosArrayPush(diff, &fname) == NULL) {
taosMemoryFree(fname); taosMemoryFree(fname);
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
@ -4643,7 +4640,7 @@ void dbChkpDebugInfo(SDbChkp* pDb) {
int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) { int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
int32_t code = 0; int32_t code = 0;
int32_t nBytes; int32_t nBytes;
(void)taosThreadRwlockWrlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockWrlock(&p->rwLock));
p->preCkptId = p->curChkpId; p->preCkptId = p->curChkpId;
p->curChkpId = chkpId; p->curChkpId = chkpId;
@ -4661,7 +4658,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
nBytes = nBytes =
snprintf(p->buf, p->len, "%s%s%s%scheckpoint%" PRId64 "", p->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId); snprintf(p->buf, p->len, "%s%s%s%scheckpoint%" PRId64 "", p->path, TD_DIRSEP, "checkpoints", TD_DIRSEP, chkpId);
if (nBytes <= 0 || nBytes >= p->len) { if (nBytes <= 0 || nBytes >= p->len) {
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return TSDB_CODE_OUT_OF_RANGE; return TSDB_CODE_OUT_OF_RANGE;
} }
@ -4671,7 +4668,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
TdDirPtr pDir = taosOpenDir(p->buf); TdDirPtr pDir = taosOpenDir(p->buf);
if (pDir == NULL) { if (pDir == NULL) {
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return terrno; return terrno;
} }
@ -4707,9 +4704,9 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
continue; continue;
} }
} }
(void)taosCloseDir(&pDir); TAOS_UNUSED(taosCloseDir(&pDir));
if (code != 0) { if (code != 0) {
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return code; return code;
} }
@ -4721,14 +4718,14 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
if (name != NULL && !isBkdDataMeta(name, len)) { if (name != NULL && !isBkdDataMeta(name, len)) {
char* fname = taosMemoryCalloc(1, len + 1); char* fname = taosMemoryCalloc(1, len + 1);
if (fname == NULL) { if (fname == NULL) {
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return terrno; return terrno;
} }
(void)strncpy(fname, name, len); TAOS_UNUSED(strncpy(fname, name, len));
if (taosArrayPush(p->pAdd, &fname) == NULL) { if (taosArrayPush(p->pAdd, &fname) == NULL) {
taosMemoryFree(fname); taosMemoryFree(fname);
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
} }
} }
@ -4762,7 +4759,7 @@ int32_t dbChkpGetDelta(SDbChkp* p, int64_t chkpId, SArray* list) {
p->idx = 1 - p->idx; p->idx = 1 - p->idx;
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return code; return code;
} }
@ -4820,7 +4817,7 @@ int32_t dbChkpCreate(char* path, int64_t initChkpId, SDbChkp** ppChkp) {
} }
p->update = 0; p->update = 0;
(void)taosThreadRwlockInit(&p->rwLock, NULL); TAOS_UNUSED(taosThreadRwlockInit(&p->rwLock, NULL));
SArray* list = NULL; SArray* list = NULL;
code = dbChkpGetDelta(p, initChkpId, list); code = dbChkpGetDelta(p, initChkpId, list);
@ -4861,7 +4858,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
static char* chkpMeta = "META"; static char* chkpMeta = "META";
int32_t code = 0; int32_t code = 0;
(void)taosThreadRwlockRdlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockRdlock(&p->rwLock));
int32_t cap = p->len + 128; int32_t cap = p->len + 128;
@ -5004,7 +5001,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
if (nBytes <= 0 || nBytes >= sizeof(content)) { if (nBytes <= 0 || nBytes >= sizeof(content)) {
code = TSDB_CODE_OUT_OF_RANGE; code = TSDB_CODE_OUT_OF_RANGE;
stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir); stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir);
(void)taosCloseFile(&pFile); TAOS_UNUSED(taosCloseFile(&pFile));
goto _ERROR; goto _ERROR;
} }
@ -5012,10 +5009,10 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
if (nBytes != strlen(content)) { if (nBytes != strlen(content)) {
code = terrno; code = terrno;
stError("chkp failed to write meta file: %s,reason:%s", dstDir, tstrerror(code)); stError("chkp failed to write meta file: %s,reason:%s", dstDir, tstrerror(code));
(void)taosCloseFile(&pFile); TAOS_UNUSED(taosCloseFile(&pFile));
goto _ERROR; goto _ERROR;
} }
(void)taosCloseFile(&pFile); TAOS_UNUSED(taosCloseFile(&pFile));
// clear delta data buf // clear delta data buf
taosArrayClearP(p->pAdd, taosMemoryFree); taosArrayClearP(p->pAdd, taosMemoryFree);
@ -5024,7 +5021,7 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
_ERROR: _ERROR:
taosMemoryFree(buffer); taosMemoryFree(buffer);
(void)taosThreadRwlockUnlock(&p->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&p->rwLock));
return code; return code;
} }
@ -5069,7 +5066,7 @@ void bkdMgtDestroy(SBkdMgt* bm) {
pIter = taosHashIterate(bm->pDbChkpTbl, pIter); pIter = taosHashIterate(bm->pDbChkpTbl, pIter);
} }
(void)taosThreadRwlockDestroy(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockDestroy(&bm->rwLock));
taosMemoryFree(bm->path); taosMemoryFree(bm->path);
taosHashCleanup(bm->pDbChkpTbl); taosHashCleanup(bm->pDbChkpTbl);
@ -5077,7 +5074,7 @@ void bkdMgtDestroy(SBkdMgt* bm) {
} }
int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* dname) { int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* dname) {
int32_t code = 0; int32_t code = 0;
(void)taosThreadRwlockWrlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockWrlock(&bm->rwLock));
SDbChkp** ppChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId)); SDbChkp** ppChkp = taosHashGet(bm->pDbChkpTbl, taskId, strlen(taskId));
SDbChkp* pChkp = ppChkp != NULL ? *ppChkp : NULL; SDbChkp* pChkp = ppChkp != NULL ? *ppChkp : NULL;
@ -5085,14 +5082,14 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
int32_t cap = strlen(bm->path) + 64; int32_t cap = strlen(bm->path) + 64;
char* path = taosMemoryCalloc(1, cap); char* path = taosMemoryCalloc(1, cap);
if (path == NULL) { if (path == NULL) {
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
return terrno; return terrno;
} }
int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId); int32_t nBytes = snprintf(path, cap, "%s%s%s", bm->path, TD_DIRSEP, taskId);
if (nBytes <= 0 || nBytes >= cap) { if (nBytes <= 0 || nBytes >= cap) {
taosMemoryFree(path); taosMemoryFree(path);
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
code = TSDB_CODE_OUT_OF_RANGE; code = TSDB_CODE_OUT_OF_RANGE;
return code; return code;
} }
@ -5101,20 +5098,20 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
code = dbChkpCreate(path, chkpId, &p); code = dbChkpCreate(path, chkpId, &p);
if (code != 0) { if (code != 0) {
taosMemoryFree(path); taosMemoryFree(path);
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
return code; return code;
} }
if (taosHashPut(bm->pDbChkpTbl, taskId, strlen(taskId), &p, sizeof(void*)) != 0) { if (taosHashPut(bm->pDbChkpTbl, taskId, strlen(taskId), &p, sizeof(void*)) != 0) {
dbChkpDestroy(p); dbChkpDestroy(p);
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
code = terrno; code = terrno;
return code; return code;
} }
pChkp = p; pChkp = p;
code = dbChkpDumpTo(pChkp, dname, list); code = dbChkpDumpTo(pChkp, dname, list);
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
return code; return code;
} else { } else {
code = dbChkpGetDelta(pChkp, chkpId, NULL); code = dbChkpGetDelta(pChkp, chkpId, NULL);
@ -5123,7 +5120,7 @@ int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list,
} }
} }
(void)taosThreadRwlockUnlock(&bm->rwLock); TAOS_UNUSED(taosThreadRwlockUnlock(&bm->rwLock));
return code; return code;
} }