fix return code
This commit is contained in:
parent
b9a0164fda
commit
02d46c0550
|
@ -55,7 +55,7 @@ extern "C" {
|
|||
} \
|
||||
} \
|
||||
if (f == false) { \
|
||||
taosArrayPush(dst, &tgt); \
|
||||
(void)taosArrayPush(dst, &tgt); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void indexCleanup() {
|
|||
// refacto later
|
||||
taosCleanUpScheduler(indexQhandle);
|
||||
taosMemoryFreeClear(indexQhandle);
|
||||
taosCloseRef(indexRefMgt);
|
||||
(void)taosCloseRef(indexRefMgt);
|
||||
}
|
||||
|
||||
typedef struct SIdxColInfo {
|
||||
|
@ -99,15 +99,15 @@ static void idxMergeCacheAndTFile(SArray* result, IterateValue* icache, IterateV
|
|||
|
||||
static void idxPost(void* idx) {
|
||||
SIndex* pIdx = idx;
|
||||
tsem_post(&pIdx->sem);
|
||||
(void)tsem_post(&pIdx->sem);
|
||||
}
|
||||
static void indexWait(void* idx) {
|
||||
SIndex* pIdx = idx;
|
||||
tsem_wait(&pIdx->sem);
|
||||
(void)tsem_wait(&pIdx->sem);
|
||||
}
|
||||
|
||||
int32_t indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
||||
taosThreadOnce(&isInit, indexEnvInit);
|
||||
(void)taosThreadOnce(&isInit, indexEnvInit);
|
||||
|
||||
int code = TSDB_CODE_SUCCESS;
|
||||
SIndex* idx = taosMemoryCalloc(1, sizeof(SIndex));
|
||||
|
@ -137,8 +137,8 @@ int32_t indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, END);
|
||||
}
|
||||
|
||||
taosThreadMutexInit(&idx->mtx, NULL);
|
||||
tsem_init(&idx->sem, 0, 0);
|
||||
(void)taosThreadMutexInit(&idx->mtx, NULL);
|
||||
(void)tsem_init(&idx->sem, 0, 0);
|
||||
|
||||
idx->refId = idxAddRef(idx);
|
||||
idx->opts = *opts;
|
||||
|
@ -158,8 +158,8 @@ END:
|
|||
void indexDestroy(void* handle) {
|
||||
if (handle == NULL) return;
|
||||
SIndex* idx = handle;
|
||||
taosThreadMutexDestroy(&idx->mtx);
|
||||
tsem_destroy(&idx->sem);
|
||||
(void)taosThreadMutexDestroy(&idx->mtx);
|
||||
(void)tsem_destroy(&idx->sem);
|
||||
idxTFileDestroy(idx->tindex);
|
||||
taosMemoryFree(idx->path);
|
||||
|
||||
|
@ -190,7 +190,7 @@ void indexClose(SIndex* sIdx) {
|
|||
}
|
||||
|
||||
idxReleaseRef(sIdx->refId);
|
||||
idxRemoveRef(sIdx->refId);
|
||||
(void)idxRemoveRef(sIdx->refId);
|
||||
}
|
||||
int64_t idxAddRef(void* p) {
|
||||
// impl
|
||||
|
@ -203,16 +203,16 @@ int32_t idxRemoveRef(int64_t ref) {
|
|||
|
||||
void idxAcquireRef(int64_t ref) {
|
||||
// impl
|
||||
taosAcquireRef(indexRefMgt, ref);
|
||||
(void)taosAcquireRef(indexRefMgt, ref);
|
||||
}
|
||||
void idxReleaseRef(int64_t ref) {
|
||||
// impl
|
||||
taosReleaseRef(indexRefMgt, ref);
|
||||
(void)taosReleaseRef(indexRefMgt, ref);
|
||||
}
|
||||
|
||||
int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
||||
// TODO(yihao): reduce the lock range
|
||||
taosThreadMutexLock(&index->mtx);
|
||||
(void)taosThreadMutexLock(&index->mtx);
|
||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||
|
||||
|
@ -223,10 +223,10 @@ int32_t indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
|||
IndexCache** cache = taosHashGet(index->colObj, buf, sz);
|
||||
if (cache == NULL) {
|
||||
IndexCache* pCache = idxCacheCreate(index, p->suid, p->colName, p->colType);
|
||||
taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*));
|
||||
(void)taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*));
|
||||
}
|
||||
}
|
||||
taosThreadMutexUnlock(&index->mtx);
|
||||
(void)taosThreadMutexUnlock(&index->mtx);
|
||||
|
||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||
|
@ -255,8 +255,8 @@ int32_t indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* re
|
|||
for (size_t i = 0; i < nQuery; i++) {
|
||||
SIndexTermQuery* qterm = taosArrayGet(multiQuerys->query, i);
|
||||
SArray* trslt = NULL;
|
||||
idxTermSearch(index, qterm, &trslt);
|
||||
taosArrayPush(iRslts, (void*)&trslt);
|
||||
(void)idxTermSearch(index, qterm, &trslt);
|
||||
(void)taosArrayPush(iRslts, (void*)&trslt);
|
||||
}
|
||||
idxMergeFinalResults(iRslts, opera, result);
|
||||
idxInterRsltDestroy(iRslts);
|
||||
|
@ -295,7 +295,7 @@ void indexMultiTermQueryDestroy(SIndexMultiTermQuery* pQuery) {
|
|||
};
|
||||
int32_t indexMultiTermQueryAdd(SIndexMultiTermQuery* pQuery, SIndexTerm* term, EIndexQueryType qType) {
|
||||
SIndexTermQuery q = {.qType = qType, .term = term};
|
||||
taosArrayPush(pQuery->query, &q);
|
||||
(void)taosArrayPush(pQuery->query, &q);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ void indexTermDestroy(SIndexTerm* p) {
|
|||
SIndexMultiTerm* indexMultiTermCreate() { return taosArrayInit(4, sizeof(SIndexTerm*)); }
|
||||
|
||||
int32_t indexMultiTermAdd(SIndexMultiTerm* terms, SIndexTerm* term) {
|
||||
taosArrayPush(terms, &term);
|
||||
(void)taosArrayPush(terms, &term);
|
||||
return 0;
|
||||
}
|
||||
void indexMultiTermDestroy(SIndexMultiTerm* terms) {
|
||||
|
@ -374,7 +374,7 @@ void indexRebuild(SIndexJson* idx, void* iter) {
|
|||
schedMsg.fp = idxSchedRebuildIdx;
|
||||
schedMsg.ahandle = idx;
|
||||
idxAcquireRef(idx->refId);
|
||||
taosScheduleTask(indexQhandle, &schedMsg);
|
||||
(void)taosScheduleTask(indexQhandle, &schedMsg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -415,10 +415,10 @@ static int32_t idxTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** resu
|
|||
|
||||
int32_t sz = idxSerialCacheKey(&key, buf);
|
||||
|
||||
taosThreadMutexLock(&sIdx->mtx);
|
||||
(void)taosThreadMutexLock(&sIdx->mtx);
|
||||
IndexCache** pCache = taosHashGet(sIdx->colObj, buf, sz);
|
||||
cache = (pCache == NULL) ? NULL : *pCache;
|
||||
taosThreadMutexUnlock(&sIdx->mtx);
|
||||
(void)taosThreadMutexUnlock(&sIdx->mtx);
|
||||
|
||||
*result = taosArrayInit(4, sizeof(uint64_t));
|
||||
if (*result == NULL) {
|
||||
|
@ -501,7 +501,7 @@ static void idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRsl
|
|||
idxTRsltMergeTo(tr, lv->tableId);
|
||||
idxTRsltClear(tr);
|
||||
|
||||
taosArrayPush(result, &tfv);
|
||||
(void)taosArrayPush(result, &tfv);
|
||||
} else if (tfv == NULL) {
|
||||
// handle last iterator
|
||||
idxTRsltMergeTo(tr, lv->tableId);
|
||||
|
@ -509,7 +509,7 @@ static void idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxTRsl
|
|||
tfileValueDestroy(tfv);
|
||||
}
|
||||
} else {
|
||||
taosArrayPush(result, &tfv);
|
||||
(void)taosArrayPush(result, &tfv);
|
||||
}
|
||||
}
|
||||
static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue* tv, SIdxTRslt* tr) {
|
||||
|
@ -528,7 +528,7 @@ static void idxMergeCacheAndTFile(SArray* result, IterateValue* cv, IterateValue
|
|||
}
|
||||
}
|
||||
if (tv != NULL) {
|
||||
taosArrayAddAll(tr->total, tv->val);
|
||||
(void)taosArrayAddAll(tr->total, tv->val);
|
||||
}
|
||||
}
|
||||
static void idxDestroyFinalRslt(SArray* result) {
|
||||
|
@ -655,9 +655,9 @@ static int64_t idxGetAvailableVer(SIndex* sIdx, IndexCache* cache) {
|
|||
|
||||
IndexTFile* tf = (IndexTFile*)(sIdx->tindex);
|
||||
|
||||
taosThreadMutexLock(&tf->mtx);
|
||||
(void)taosThreadMutexLock(&tf->mtx);
|
||||
TFileReader* rd = tfileCacheGet(tf->cache, &key);
|
||||
taosThreadMutexUnlock(&tf->mtx);
|
||||
(void)taosThreadMutexUnlock(&tf->mtx);
|
||||
|
||||
if (rd != NULL) {
|
||||
ver = (ver > rd->header.version ? ver : rd->header.version) + 1;
|
||||
|
@ -698,9 +698,9 @@ static int32_t idxGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
|
|||
TFileHeader* header = &reader->header;
|
||||
ICacheKey key = {.suid = cache->suid, .colName = header->colName, .nColName = strlen(header->colName)};
|
||||
|
||||
taosThreadMutexLock(&tf->mtx);
|
||||
(void)taosThreadMutexLock(&tf->mtx);
|
||||
code = tfileCachePut(tf->cache, &key, reader);
|
||||
taosThreadMutexUnlock(&tf->mtx);
|
||||
(void)taosThreadMutexUnlock(&tf->mtx);
|
||||
|
||||
return code;
|
||||
|
||||
|
@ -717,7 +717,7 @@ int32_t idxSerialCacheKey(ICacheKey* key, char* buf) {
|
|||
|
||||
char* p = buf;
|
||||
char tbuf[65] = {0};
|
||||
idxInt2str((int64_t)key->suid, tbuf, 0);
|
||||
(void)idxInt2str((int64_t)key->suid, tbuf, 0);
|
||||
|
||||
SERIALIZE_STR_VAR_TO_BUF(buf, tbuf, strlen(tbuf));
|
||||
SERIALIZE_VAR_TO_BUF(buf, '_', char);
|
||||
|
|
|
@ -104,7 +104,7 @@ static int32_t cacheSearchTerm(void* cache, SIndexTerm* term, SIdxTRslt* tr, STe
|
|||
}
|
||||
|
||||
taosMemoryFree(pCt);
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return 0;
|
||||
}
|
||||
static int32_t cacheSearchPrefix(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
|
@ -162,7 +162,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
|
|||
}
|
||||
}
|
||||
taosMemoryFree(pCt);
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
static int32_t cacheSearchLessThan(void* cache, SIndexTerm* term, SIdxTRslt* tr, STermValueType* s) {
|
||||
|
@ -222,7 +222,7 @@ static int32_t cacheSearchTerm_JSON(void* cache, SIndexTerm* term, SIdxTRslt* tr
|
|||
|
||||
taosMemoryFree(pCt);
|
||||
taosMemoryFree(exBuf);
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
return 0;
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
@ -329,7 +329,7 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
|
|||
|
||||
taosMemoryFree(pCt);
|
||||
taosMemoryFree(exBuf);
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
@ -356,8 +356,8 @@ IndexCache* idxCacheCreate(SIndex* idx, uint64_t suid, const char* colName, int8
|
|||
cache->suid = suid;
|
||||
cache->occupiedMem = 0;
|
||||
|
||||
taosThreadMutexInit(&cache->mtx, NULL);
|
||||
taosThreadCondInit(&cache->finished, NULL);
|
||||
(void)taosThreadMutexInit(&cache->mtx, NULL);
|
||||
(void)taosThreadCondInit(&cache->finished, NULL);
|
||||
|
||||
idxCacheRef(cache);
|
||||
if (idx != NULL) {
|
||||
|
@ -368,10 +368,10 @@ IndexCache* idxCacheCreate(SIndex* idx, uint64_t suid, const char* colName, int8
|
|||
void idxCacheDebug(IndexCache* cache) {
|
||||
MemTable* tbl = NULL;
|
||||
|
||||
taosThreadMutexLock(&cache->mtx);
|
||||
(void)taosThreadMutexLock(&cache->mtx);
|
||||
tbl = cache->mem;
|
||||
idxMemRef(tbl);
|
||||
taosThreadMutexUnlock(&cache->mtx);
|
||||
(void)taosThreadMutexUnlock(&cache->mtx);
|
||||
|
||||
{
|
||||
SSkipList* slt = tbl->mem;
|
||||
|
@ -384,7 +384,7 @@ void idxCacheDebug(IndexCache* cache) {
|
|||
indexInfo("{colVal: %s, version: %" PRId64 "} \t", ct->colVal, ct->version);
|
||||
}
|
||||
}
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
|
||||
idxMemUnRef(tbl);
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ void idxCacheDebug(IndexCache* cache) {
|
|||
indexInfo("{colVal: %s, version: %" PRId64 "} \t", ct->colVal, ct->version);
|
||||
}
|
||||
}
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
}
|
||||
|
||||
idxMemUnRef(tbl);
|
||||
|
@ -422,16 +422,16 @@ void idxCacheDestroySkiplist(SSkipList* slt) {
|
|||
taosMemoryFree(ct);
|
||||
}
|
||||
}
|
||||
tSkipListDestroyIter(iter);
|
||||
(void)tSkipListDestroyIter(iter);
|
||||
tSkipListDestroy(slt);
|
||||
}
|
||||
void idxCacheBroadcast(void* cache) {
|
||||
IndexCache* pCache = cache;
|
||||
taosThreadCondBroadcast(&pCache->finished);
|
||||
(void)taosThreadCondBroadcast(&pCache->finished);
|
||||
}
|
||||
void idxCacheWait(void* cache) {
|
||||
IndexCache* pCache = cache;
|
||||
taosThreadCondWait(&pCache->finished, &pCache->mtx);
|
||||
(void)taosThreadCondWait(&pCache->finished, &pCache->mtx);
|
||||
}
|
||||
void idxCacheDestroyImm(IndexCache* cache) {
|
||||
if (cache == NULL) {
|
||||
|
@ -444,7 +444,7 @@ void idxCacheDestroyImm(IndexCache* cache) {
|
|||
cache->imm = NULL; // or throw int bg thread
|
||||
idxCacheBroadcast(cache);
|
||||
|
||||
taosThreadMutexUnlock(&cache->mtx);
|
||||
(void)taosThreadMutexUnlock(&cache->mtx);
|
||||
|
||||
idxMemUnRef(tbl);
|
||||
idxMemUnRef(tbl);
|
||||
|
@ -459,8 +459,8 @@ void idxCacheDestroy(void* cache) {
|
|||
idxMemUnRef(pCache->imm);
|
||||
taosMemoryFree(pCache->colName);
|
||||
|
||||
taosThreadMutexDestroy(&pCache->mtx);
|
||||
taosThreadCondDestroy(&pCache->finished);
|
||||
(void)taosThreadMutexDestroy(&pCache->mtx);
|
||||
(void)taosThreadCondDestroy(&pCache->finished);
|
||||
if (pCache->index != NULL) {
|
||||
idxReleaseRef(((SIndex*)pCache->index)->refId);
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ Iterate* idxCacheIteratorCreate(IndexCache* cache) {
|
|||
if (iter == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
taosThreadMutexLock(&cache->mtx);
|
||||
(void)taosThreadMutexLock(&cache->mtx);
|
||||
|
||||
idxMemRef(cache->imm);
|
||||
|
||||
|
@ -486,7 +486,7 @@ Iterate* idxCacheIteratorCreate(IndexCache* cache) {
|
|||
iter->next = idxCacheIteratorNext;
|
||||
iter->getValue = idxCacheIteratorGetValue;
|
||||
|
||||
taosThreadMutexUnlock(&cache->mtx);
|
||||
(void)taosThreadMutexUnlock(&cache->mtx);
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ void idxCacheIteratorDestroy(Iterate* iter) {
|
|||
if (iter == NULL) {
|
||||
return;
|
||||
}
|
||||
tSkipListDestroyIter(iter->iter);
|
||||
(void)tSkipListDestroyIter(iter->iter);
|
||||
iterateValueDestroy(&iter->val, true);
|
||||
taosMemoryFree(iter);
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ int idxCacheSchedToMerge(IndexCache* pCache, bool notify) {
|
|||
}
|
||||
schedMsg.msg = NULL;
|
||||
idxAcquireRef(pCache->index->refId);
|
||||
taosScheduleTask(indexQhandle, &schedMsg);
|
||||
(void)taosScheduleTask(indexQhandle, &schedMsg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
|
|||
// encode data
|
||||
CacheTerm* ct = taosMemoryCalloc(1, sizeof(CacheTerm));
|
||||
if (ct == NULL) {
|
||||
return -1;
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
// set up key
|
||||
ct->colType = term->colType;
|
||||
|
@ -556,6 +556,10 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
|
|||
ct->colVal = idxPackJsonData(term);
|
||||
} else {
|
||||
ct->colVal = (char*)taosMemoryCalloc(1, sizeof(char) * (term->nColVal + 1));
|
||||
if (ct->colVal == NULL) {
|
||||
taosMemoryFree(ct);
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
memcpy(ct->colVal, term->colVal, term->nColVal);
|
||||
}
|
||||
ct->version = atomic_add_fetch_64(&pCache->version, 1);
|
||||
|
@ -565,15 +569,15 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
|
|||
// ugly code, refactor later
|
||||
int64_t estimate = sizeof(ct) + strlen(ct->colVal);
|
||||
|
||||
taosThreadMutexLock(&pCache->mtx);
|
||||
(void)taosThreadMutexLock(&pCache->mtx);
|
||||
pCache->occupiedMem += estimate;
|
||||
idxCacheMakeRoomForWrite(pCache);
|
||||
MemTable* tbl = pCache->mem;
|
||||
idxMemRef(tbl);
|
||||
tSkipListPut(tbl->mem, (char*)ct);
|
||||
(void)tSkipListPut(tbl->mem, (char*)ct);
|
||||
idxMemUnRef(tbl);
|
||||
|
||||
taosThreadMutexUnlock(&pCache->mtx);
|
||||
(void)taosThreadMutexUnlock(&pCache->mtx);
|
||||
idxCacheUnRef(pCache);
|
||||
return 0;
|
||||
}
|
||||
|
@ -581,13 +585,13 @@ void idxCacheForceToMerge(void* cache) {
|
|||
IndexCache* pCache = cache;
|
||||
|
||||
idxCacheRef(pCache);
|
||||
taosThreadMutexLock(&pCache->mtx);
|
||||
(void)taosThreadMutexLock(&pCache->mtx);
|
||||
|
||||
indexInfo("%p is forced to merge into tfile", pCache);
|
||||
pCache->occupiedMem += MEM_SIGNAL_QUIT;
|
||||
idxCacheMakeRoomForWrite(pCache);
|
||||
|
||||
taosThreadMutexUnlock(&pCache->mtx);
|
||||
(void)taosThreadMutexUnlock(&pCache->mtx);
|
||||
idxCacheUnRef(pCache);
|
||||
return;
|
||||
}
|
||||
|
@ -618,12 +622,12 @@ int idxCacheSearch(void* cache, SIndexTermQuery* query, SIdxTRslt* result, STerm
|
|||
IndexCache* pCache = cache;
|
||||
|
||||
MemTable *mem = NULL, *imm = NULL;
|
||||
taosThreadMutexLock(&pCache->mtx);
|
||||
(void)taosThreadMutexLock(&pCache->mtx);
|
||||
mem = pCache->mem;
|
||||
imm = pCache->imm;
|
||||
idxMemRef(mem);
|
||||
idxMemRef(imm);
|
||||
taosThreadMutexUnlock(&pCache->mtx);
|
||||
(void)taosThreadMutexUnlock(&pCache->mtx);
|
||||
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
|
@ -759,7 +763,7 @@ static void idxDoMergeWork(SSchedMsg* msg) {
|
|||
|
||||
int quit = msg->thandle ? true : false;
|
||||
taosMemoryFree(msg->thandle);
|
||||
idxFlushCacheToTFile(sidx, pCache, quit);
|
||||
(void)idxFlushCacheToTFile(sidx, pCache, quit);
|
||||
}
|
||||
static bool idxCacheIteratorNext(Iterate* itera) {
|
||||
SSkipListIterator* iter = itera->iter;
|
||||
|
@ -777,7 +781,7 @@ static bool idxCacheIteratorNext(Iterate* itera) {
|
|||
iv->type = ct->operaType;
|
||||
iv->ver = ct->version;
|
||||
iv->colVal = taosStrdup(ct->colVal);
|
||||
taosArrayPush(iv->val, &ct->uid);
|
||||
(void)taosArrayPush(iv->val, &ct->uid);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
|
|
@ -378,6 +378,9 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) {
|
|||
int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
||||
if (src == NULL) {
|
||||
*dst = strndup(INDEX_DATA_NULL_STR, (int)strlen(INDEX_DATA_NULL_STR));
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
return (int32_t)strlen(INDEX_DATA_NULL_STR);
|
||||
}
|
||||
int tlen = tDataTypes[type].bytes;
|
||||
|
@ -385,63 +388,96 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
switch (type) {
|
||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(int64_t*)src, *dst, -1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(int64_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_BOOL:
|
||||
case TSDB_DATA_TYPE_UTINYINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(uint8_t*)src, *dst, 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(uint8_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_TINYINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(int8_t*)src, *dst, 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(int8_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_SMALLINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(int16_t*)src, *dst, -1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(int16_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_USMALLINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(uint16_t*)src, *dst, -1);
|
||||
(void)idxInt2str(*(uint16_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_INT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(int32_t*)src, *dst, -1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(int32_t*)src, *dst, -1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(uint32_t*)src, *dst, 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(uint32_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_BIGINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
sprintf(*dst, "%" PRIu64, *(uint64_t*)src);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_UBIGINT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
idxInt2str(*(uint64_t*)src, *dst, 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)idxInt2str(*(uint64_t*)src, *dst, 1);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_FLOAT:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
sprintf(*dst, "%.9lf", *(float*)src);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_DOUBLE:
|
||||
*dst = taosMemoryCalloc(1, bufSize + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
sprintf(*dst, "%.9lf", *(double*)src);
|
||||
tlen = strlen(*dst);
|
||||
break;
|
||||
case TSDB_DATA_TYPE_NCHAR: {
|
||||
tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src));
|
||||
*dst = taosMemoryCalloc(1, tlen + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src));
|
||||
*dst = (char*)*dst - tlen;
|
||||
break;
|
||||
|
@ -451,6 +487,9 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
|
|||
case TSDB_DATA_TYPE_GEOMETRY: {
|
||||
tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src));
|
||||
*dst = taosMemoryCalloc(1, tlen + 1);
|
||||
if (*dst == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src));
|
||||
*dst = (char*)*dst - tlen;
|
||||
break;
|
||||
|
|
|
@ -646,7 +646,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
|||
}
|
||||
|
||||
SIndexMultiTermQuery *mtm = indexMultiTermQueryCreate(MUST);
|
||||
indexMultiTermQueryAdd(mtm, tm, qtype);
|
||||
(void)indexMultiTermQueryAdd(mtm, tm, qtype);
|
||||
ret = indexJsonSearch(arg->ivtIdx, mtm, output->result);
|
||||
indexMultiTermQueryDestroy(mtm);
|
||||
} else {
|
||||
|
@ -882,9 +882,9 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
|
|||
if (ctx->noExec == false) {
|
||||
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
||||
if (node->condType == LOGIC_COND_TYPE_AND) {
|
||||
taosArrayAddAll(output->result, params[m].result);
|
||||
(void)taosArrayAddAll(output->result, params[m].result);
|
||||
} else if (node->condType == LOGIC_COND_TYPE_OR) {
|
||||
taosArrayAddAll(output->result, params[m].result);
|
||||
(void)taosArrayAddAll(output->result, params[m].result);
|
||||
} else if (node->condType == LOGIC_COND_TYPE_NOT) {
|
||||
// taosArrayAddAll(output->result, params[m].result);
|
||||
}
|
||||
|
@ -1018,12 +1018,12 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
|||
SIF_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||
}
|
||||
if (res->result != NULL) {
|
||||
taosArrayAddAll(pDst->result, res->result);
|
||||
(void)taosArrayAddAll(pDst->result, res->result);
|
||||
}
|
||||
pDst->status = res->status;
|
||||
|
||||
sifFreeParam(res);
|
||||
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
(void)taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
}
|
||||
sifFreeRes(ctx.pRes);
|
||||
return code;
|
||||
|
@ -1055,7 +1055,7 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status, SMetaDataFilte
|
|||
}
|
||||
*status = res->status;
|
||||
sifFreeParam(res);
|
||||
taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
(void)taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES);
|
||||
|
||||
void *iter = taosHashIterate(ctx.pRes, NULL);
|
||||
while (iter != NULL) {
|
||||
|
@ -1090,7 +1090,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
|||
*status = st;
|
||||
}
|
||||
|
||||
taosArrayAddAll(result, param.result);
|
||||
(void)taosArrayAddAll(result, param.result);
|
||||
sifFreeParam(¶m);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void fstUnFinishedNodesPushEmpty(FstUnFinishedNodes* nodes, bool isFinal) {
|
|||
node->trans = taosArrayInit(16, sizeof(FstTransition));
|
||||
|
||||
FstBuilderNodeUnfinished un = {.node = node, .last = NULL};
|
||||
taosArrayPush(nodes->stack, &un);
|
||||
(void)taosArrayPush(nodes->stack, &un);
|
||||
}
|
||||
FstBuilderNode* fstUnFinishedNodesPopRoot(FstUnFinishedNodes* nodes) {
|
||||
FstBuilderNodeUnfinished* un = taosArrayPop(nodes->stack);
|
||||
|
@ -120,7 +120,7 @@ void fstUnFinishedNodesAddSuffix(FstUnFinishedNodes* nodes, FstSlice bs, Output
|
|||
FstLastTransition* trn = fstLastTransitionCreate(data[i], 0);
|
||||
|
||||
FstBuilderNodeUnfinished un = {.node = n, .last = trn};
|
||||
taosArrayPush(nodes->stack, &un);
|
||||
(void)taosArrayPush(nodes->stack, &un);
|
||||
}
|
||||
fstUnFinishedNodesPushEmpty(nodes, true);
|
||||
}
|
||||
|
@ -214,9 +214,9 @@ void fstStateCompileForOneTransNext(IdxFstFile* w, CompiledAddr addr, uint8_t in
|
|||
uint8_t v = fstStateCommInput(&s, &null);
|
||||
if (null) {
|
||||
// w->write_all(&[inp])
|
||||
idxFileWrite(w, &inp, 1);
|
||||
(void)idxFileWrite(w, &inp, 1);
|
||||
}
|
||||
idxFileWrite(w, &(s.val), 1);
|
||||
(void)idxFileWrite(w, &(s.val), 1);
|
||||
// w->write_all(&[s.val])
|
||||
return;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void fstStateCompileForOneTrans(IdxFstFile* w, CompiledAddr addr, FstTransition*
|
|||
|
||||
FST_SET_OUTPUT_PACK_SIZE(packSizes, outPackSize);
|
||||
FST_SET_TRANSITION_PACK_SIZE(packSizes, transPackSize);
|
||||
idxFileWrite(w, (char*)&packSizes, sizeof(packSizes));
|
||||
(void)idxFileWrite(w, (char*)&packSizes, sizeof(packSizes));
|
||||
|
||||
FstState st = fstStateCreate(OneTrans);
|
||||
|
||||
|
@ -237,9 +237,9 @@ void fstStateCompileForOneTrans(IdxFstFile* w, CompiledAddr addr, FstTransition*
|
|||
bool null = false;
|
||||
uint8_t inp = fstStateCommInput(&st, &null);
|
||||
if (null == true) {
|
||||
idxFileWrite(w, (char*)&trn->inp, sizeof(trn->inp));
|
||||
(void)idxFileWrite(w, (char*)&trn->inp, sizeof(trn->inp));
|
||||
}
|
||||
idxFileWrite(w, (char*)(&(st.val)), sizeof(st.val));
|
||||
(void)idxFileWrite(w, (char*)(&(st.val)), sizeof(st.val));
|
||||
return;
|
||||
}
|
||||
void fstStateCompileForAnyTrans(IdxFstFile* w, CompiledAddr addr, FstBuilderNode* node) {
|
||||
|
@ -295,24 +295,24 @@ void fstStateCompileForAnyTrans(IdxFstFile* w, CompiledAddr addr, FstBuilderNode
|
|||
FstTransition* t = taosArrayGet(node->trans, i);
|
||||
index[t->inp] = i;
|
||||
}
|
||||
idxFileWrite(w, (char*)index, 256);
|
||||
(void)idxFileWrite(w, (char*)index, 256);
|
||||
taosMemoryFree(index);
|
||||
}
|
||||
idxFileWrite(w, (char*)&packSizes, 1);
|
||||
(void)idxFileWrite(w, (char*)&packSizes, 1);
|
||||
bool null = false;
|
||||
fstStateStateNtrans(&st, &null);
|
||||
(void)fstStateStateNtrans(&st, &null);
|
||||
if (null == true) {
|
||||
// 256 can't be represented in a u8, so we abuse the fact that
|
||||
// the # of transitions can never be 1 here, since 1 is always
|
||||
// encoded in the state byte.
|
||||
uint8_t v = 1;
|
||||
if (sz == 256) {
|
||||
idxFileWrite(w, (char*)&v, 1);
|
||||
(void)idxFileWrite(w, (char*)&v, 1);
|
||||
} else {
|
||||
idxFileWrite(w, (char*)&sz, 1);
|
||||
(void)idxFileWrite(w, (char*)&sz, 1);
|
||||
}
|
||||
}
|
||||
idxFileWrite(w, (char*)(&(st.val)), 1);
|
||||
(void)idxFileWrite(w, (char*)(&(st.val)), 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ uint8_t fstStateCommInput(FstState* s, bool* null) {
|
|||
uint64_t fstStateInputLen(FstState* s) {
|
||||
ASSERT(s->state == OneTransNext || s->state == OneTrans);
|
||||
bool null = false;
|
||||
fstStateCommInput(s, &null);
|
||||
(void)fstStateCommInput(s, &null);
|
||||
return null ? 1 : 0;
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ uint64_t fstStateTransIndexSize(FstState* s, uint64_t version, uint64_t nTrans)
|
|||
uint64_t fstStateNtransLen(FstState* s) {
|
||||
ASSERT(s->state == AnyTrans);
|
||||
bool null = false;
|
||||
fstStateStateNtrans(s, &null);
|
||||
(void)fstStateStateNtrans(s, &null);
|
||||
return null == true ? 1 : 0;
|
||||
}
|
||||
uint64_t fstStateNtrans(FstState* s, FstSlice* slice) {
|
||||
|
@ -673,12 +673,12 @@ bool fstNodeGetTransitionAddrAt(FstNode* node, uint64_t i, CompiledAddr* res) {
|
|||
FstState* st = &node->state;
|
||||
if (st->state == OneTransNext) {
|
||||
ASSERT(i == 0);
|
||||
fstStateTransAddr(st, node);
|
||||
(void)fstStateTransAddr(st, node);
|
||||
} else if (st->state == OneTrans) {
|
||||
ASSERT(i == 0);
|
||||
fstStateTransAddr(st, node);
|
||||
(void)fstStateTransAddr(st, node);
|
||||
} else if (st->state == AnyTrans) {
|
||||
fstStateTransAddrForAnyTrans(st, node, i);
|
||||
(void)fstStateTransAddrForAnyTrans(st, node, i);
|
||||
} else if (FST_STATE_EMPTY_FINAL(node)) {
|
||||
s = false;
|
||||
} else {
|
||||
|
@ -755,13 +755,13 @@ FstBuilder* fstBuilderCreate(void* w, FstType ty) {
|
|||
|
||||
char buf64[8] = {0};
|
||||
void* pBuf64 = buf64;
|
||||
taosEncodeFixedU64(&pBuf64, VERSION);
|
||||
idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
(void)taosEncodeFixedU64(&pBuf64, VERSION);
|
||||
(void)idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
|
||||
pBuf64 = buf64;
|
||||
memset(buf64, 0, sizeof(buf64));
|
||||
taosEncodeFixedU64(&pBuf64, ty);
|
||||
idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
(void)taosEncodeFixedU64(&pBuf64, ty);
|
||||
(void)idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ CompiledAddr fstBuilderCompile(FstBuilder* b, FstBuilderNode* bn) {
|
|||
}
|
||||
CompiledAddr startAddr = (CompiledAddr)(FST_WRITER_COUNT(b->wrt));
|
||||
|
||||
fstBuilderNodeCompileTo(bn, b->wrt, b->lastAddr, startAddr);
|
||||
(void)fstBuilderNodeCompileTo(bn, b->wrt, b->lastAddr, startAddr);
|
||||
b->lastAddr = (CompiledAddr)(FST_WRITER_COUNT(b->wrt) - 1);
|
||||
if (entry->state == NOTFOUND) {
|
||||
FST_REGISTRY_CELL_INSERT(entry->cell, b->lastAddr);
|
||||
|
@ -881,23 +881,23 @@ void* fstBuilderInsertInner(FstBuilder* b) {
|
|||
char buf64[8] = {0};
|
||||
|
||||
void* pBuf64 = buf64;
|
||||
taosEncodeFixedU64(&pBuf64, b->len);
|
||||
idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
(void)taosEncodeFixedU64(&pBuf64, b->len);
|
||||
(void)idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
|
||||
pBuf64 = buf64;
|
||||
taosEncodeFixedU64(&pBuf64, rootAddr);
|
||||
idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
(void)taosEncodeFixedU64(&pBuf64, rootAddr);
|
||||
(void)idxFileWrite(b->wrt, buf64, sizeof(buf64));
|
||||
|
||||
char buf32[4] = {0};
|
||||
void* pBuf32 = buf32;
|
||||
uint32_t sum = idxFileMaskedCheckSum(b->wrt);
|
||||
taosEncodeFixedU32(&pBuf32, sum);
|
||||
idxFileWrite(b->wrt, buf32, sizeof(buf32));
|
||||
(void)taosEncodeFixedU32(&pBuf32, sum);
|
||||
(void)idxFileWrite(b->wrt, buf32, sizeof(buf32));
|
||||
|
||||
idxFileFlush(b->wrt);
|
||||
(void)idxFileFlush(b->wrt);
|
||||
return b->wrt;
|
||||
}
|
||||
void fstBuilderFinish(FstBuilder* b) { fstBuilderInsertInner(b); }
|
||||
void fstBuilderFinish(FstBuilder* b) { (void)fstBuilderInsertInner(b); }
|
||||
|
||||
FstSlice fstNodeAsSlice(FstNode* node) {
|
||||
FstSlice* slice = &node->data;
|
||||
|
@ -924,7 +924,7 @@ void fstBuilderNodeUnfinishedLastCompiled(FstBuilderNodeUnfinished* unNode, Comp
|
|||
return;
|
||||
}
|
||||
FstTransition t = {.inp = trn->inp, .out = trn->out, .addr = addr};
|
||||
taosArrayPush(unNode->node->trans, &t);
|
||||
(void)taosArrayPush(unNode->node->trans, &t);
|
||||
fstLastTransitionDestroy(trn);
|
||||
unNode->last = NULL;
|
||||
return;
|
||||
|
@ -955,19 +955,19 @@ Fst* fstCreate(FstSlice* slice) {
|
|||
uint64_t skip = 0;
|
||||
|
||||
uint64_t version;
|
||||
taosDecodeFixedU64(buf, &version);
|
||||
(void)taosDecodeFixedU64(buf, &version);
|
||||
skip += sizeof(version);
|
||||
if (version == 0 || version > VERSION) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint64_t type;
|
||||
taosDecodeFixedU64(buf + skip, &type);
|
||||
(void)taosDecodeFixedU64(buf + skip, &type);
|
||||
skip += sizeof(type);
|
||||
|
||||
uint32_t checkSum = 0;
|
||||
len -= sizeof(checkSum);
|
||||
taosDecodeFixedU32(buf + len, &checkSum);
|
||||
(void)taosDecodeFixedU32(buf + len, &checkSum);
|
||||
if (taosCheckChecksum(buf, len, checkSum)) {
|
||||
indexError("index file is corrupted");
|
||||
// verify fst
|
||||
|
@ -975,11 +975,11 @@ Fst* fstCreate(FstSlice* slice) {
|
|||
}
|
||||
CompiledAddr rootAddr;
|
||||
len -= sizeof(rootAddr);
|
||||
taosDecodeFixedU64(buf + len, &rootAddr);
|
||||
(void)taosDecodeFixedU64(buf + len, &rootAddr);
|
||||
|
||||
uint64_t fstLen;
|
||||
len -= sizeof(fstLen);
|
||||
taosDecodeFixedU64(buf + len, &fstLen);
|
||||
(void)taosDecodeFixedU64(buf + len, &fstLen);
|
||||
// TODO(validate root addr)
|
||||
Fst* fst = (Fst*)taosMemoryCalloc(1, sizeof(Fst));
|
||||
if (fst == NULL) {
|
||||
|
@ -1001,7 +1001,7 @@ Fst* fstCreate(FstSlice* slice) {
|
|||
*s = fstSliceCopy(slice, 0, FST_SLICE_LEN(slice) - 1);
|
||||
fst->data = s;
|
||||
|
||||
taosThreadMutexInit(&fst->mtx, NULL);
|
||||
(void)taosThreadMutexInit(&fst->mtx, NULL);
|
||||
return fst;
|
||||
|
||||
FST_CREAT_FAILED:
|
||||
|
@ -1029,7 +1029,7 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
|||
uint8_t* data = fstSliceData(b, &len);
|
||||
|
||||
SArray* nodes = (SArray*)taosArrayInit(len, sizeof(FstNode*));
|
||||
taosArrayPush(nodes, &root);
|
||||
(void)taosArrayPush(nodes, &root);
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
uint8_t inp = data[i];
|
||||
Output res = 0;
|
||||
|
@ -1038,10 +1038,10 @@ bool fstGet(Fst* fst, FstSlice* b, Output* out) {
|
|||
}
|
||||
|
||||
FstTransition trn;
|
||||
fstNodeGetTransitionAt(root, res, &trn);
|
||||
(void)fstNodeGetTransitionAt(root, res, &trn);
|
||||
tOut += trn.out;
|
||||
root = fstGetNode(fst, trn.addr);
|
||||
taosArrayPush(nodes, &root);
|
||||
(void)taosArrayPush(nodes, &root);
|
||||
}
|
||||
if (!FST_NODE_IS_FINAL(root)) {
|
||||
goto _return;
|
||||
|
@ -1163,7 +1163,7 @@ FStmSt* stmStCreate(Fst* fst, FAutoCtx* automation, FstBoundWithData* min, FstBo
|
|||
|
||||
sws->stack = (SArray*)taosArrayInit(256, sizeof(FstStreamState));
|
||||
sws->endAt = max;
|
||||
stmStSeekMin(sws, min);
|
||||
(void)stmStSeekMin(sws, min);
|
||||
|
||||
return sws;
|
||||
}
|
||||
|
@ -1188,7 +1188,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
.trans = 0,
|
||||
.out = {.null = false, .out = 0},
|
||||
.autState = automFuncs[aut->type].start(aut)}; // auto.start callback
|
||||
taosArrayPush(sws->stack, &s);
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
return true;
|
||||
}
|
||||
FstSlice* key = NULL;
|
||||
|
@ -1214,15 +1214,15 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
uint64_t res = 0;
|
||||
if (fstNodeFindInput(node, b, &res)) {
|
||||
FstTransition trn;
|
||||
fstNodeGetTransitionAt(node, res, &trn);
|
||||
(void)fstNodeGetTransitionAt(node, res, &trn);
|
||||
void* preState = autState;
|
||||
autState = automFuncs[aut->type].accept(aut, preState, b);
|
||||
taosArrayPush(sws->inp, &b);
|
||||
(void)taosArrayPush(sws->inp, &b);
|
||||
|
||||
FstStreamState s = {.node = node, .trans = res + 1, .out = {.null = false, .out = out}, .autState = preState};
|
||||
node = NULL;
|
||||
|
||||
taosArrayPush(sws->stack, &s);
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
out += trn.out;
|
||||
node = fstGetNode(sws->fst, trn.addr);
|
||||
} else {
|
||||
|
@ -1241,7 +1241,7 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
}
|
||||
|
||||
FstStreamState s = {.node = node, .trans = i, .out = {.null = false, .out = out}, .autState = autState};
|
||||
taosArrayPush(sws->stack, &s);
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
taosMemoryFree(trans);
|
||||
return true;
|
||||
}
|
||||
|
@ -1254,15 +1254,15 @@ bool stmStSeekMin(FStmSt* sws, FstBoundWithData* min) {
|
|||
FstStreamState* s = taosArrayGet(sws->stack, sz - 1);
|
||||
if (inclusize) {
|
||||
s->trans -= 1;
|
||||
taosArrayPop(sws->inp);
|
||||
(void)taosArrayPop(sws->inp);
|
||||
} else {
|
||||
FstNode* n = s->node;
|
||||
uint64_t trans = s->trans;
|
||||
FstTransition trn;
|
||||
fstNodeGetTransitionAt(n, trans - 1, &trn);
|
||||
(void)fstNodeGetTransitionAt(n, trans - 1, &trn);
|
||||
FstStreamState s = {
|
||||
.node = fstGetNode(sws->fst, trn.addr), .trans = 0, .out = {.null = false, .out = out}, .autState = autState};
|
||||
taosArrayPush(sws->stack, &s);
|
||||
(void)taosArrayPush(sws->stack, &s);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1291,13 +1291,13 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) {
|
|||
FstStreamState* p = (FstStreamState*)taosArrayPop(sws->stack);
|
||||
if (p->trans >= FST_NODE_LEN(p->node) || !automFuncs[aut->type].canMatch(aut, p->autState)) {
|
||||
if (FST_NODE_ADDR(p->node) != fstGetRootAddr(sws->fst)) {
|
||||
taosArrayPop(sws->inp);
|
||||
(void)taosArrayPop(sws->inp);
|
||||
}
|
||||
fstStreamStateDestroy(p);
|
||||
continue;
|
||||
}
|
||||
FstTransition trn;
|
||||
fstNodeGetTransitionAt(p->node, p->trans, &trn);
|
||||
(void)fstNodeGetTransitionAt(p->node, p->trans, &trn);
|
||||
|
||||
Output out = p->out.out + trn.out;
|
||||
void* nextState = automFuncs[aut->type].accept(aut, p->autState, trn.inp);
|
||||
|
@ -1305,8 +1305,8 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) {
|
|||
bool isMatch = automFuncs[aut->type].isMatch(aut, nextState);
|
||||
|
||||
FstNode* nextNode = fstGetNode(sws->fst, trn.addr);
|
||||
taosArrayPush(nodes, &nextNode);
|
||||
taosArrayPush(sws->inp, &(trn.inp));
|
||||
(void)taosArrayPush(nodes, &nextNode);
|
||||
(void)taosArrayPush(sws->inp, &(trn.inp));
|
||||
|
||||
if (FST_NODE_IS_FINAL(nextNode)) {
|
||||
void* eofState = automFuncs[aut->type].acceptEof(aut, nextState);
|
||||
|
@ -1315,10 +1315,10 @@ FStmStRslt* stmStNextWith(FStmSt* sws, streamCallback__fn callback) {
|
|||
}
|
||||
}
|
||||
FstStreamState s1 = {.node = p->node, .trans = p->trans + 1, .out = p->out, .autState = p->autState};
|
||||
taosArrayPush(sws->stack, &s1);
|
||||
(void)taosArrayPush(sws->stack, &s1);
|
||||
|
||||
FstStreamState s2 = {.node = nextNode, .trans = 0, .out = {.null = false, .out = out}, .autState = nextState};
|
||||
taosArrayPush(sws->stack, &s2);
|
||||
(void)taosArrayPush(sws->stack, &s2);
|
||||
|
||||
int32_t isz = taosArrayGetSize(sws->inp);
|
||||
uint8_t* buf = (uint8_t*)taosMemoryMalloc(isz * sizeof(uint8_t));
|
||||
|
|
|
@ -74,7 +74,7 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) {
|
|||
uint32_t result;
|
||||
SArray *states = taosArrayInit(0, sizeof(uint32_t));
|
||||
if (dfaBuilderCacheState(builder, cur, &result)) {
|
||||
taosArrayPush(states, &result);
|
||||
(void)taosArrayPush(states, &result);
|
||||
}
|
||||
SHashObj *seen = taosHashInit(12, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||
while (taosArrayGetSize(states) != 0) {
|
||||
|
@ -83,8 +83,8 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) {
|
|||
uint32_t ns, dummpy = 0;
|
||||
if (dfaBuilderRunState(builder, cur, nxt, result, i, &ns)) {
|
||||
if (taosHashGet(seen, &ns, sizeof(ns)) == NULL) {
|
||||
taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy));
|
||||
taosArrayPush(states, &ns);
|
||||
(void)taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy));
|
||||
(void)taosArrayPush(states, &ns);
|
||||
}
|
||||
}
|
||||
if (taosArrayGetSize(builder->dfa->states) > STATE_LIMIT) {
|
||||
|
@ -108,7 +108,7 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet
|
|||
bool succ = sparSetAdd(cur, ip, NULL);
|
||||
if (succ == false) return false;
|
||||
}
|
||||
dfaRun(builder->dfa, cur, next, byte);
|
||||
(void)dfaRun(builder->dfa, cur, next, byte);
|
||||
|
||||
t = taosArrayGet(builder->dfa->states, state);
|
||||
|
||||
|
@ -133,10 +133,10 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
if (inst->ty == JUMP || inst->ty == SPLIT) {
|
||||
continue;
|
||||
} else if (inst->ty == RANGE) {
|
||||
taosArrayPush(tinsts, &ip);
|
||||
(void)taosArrayPush(tinsts, &ip);
|
||||
} else if (inst->ty == MATCH) {
|
||||
isMatch = true;
|
||||
taosArrayPush(tinsts, &ip);
|
||||
(void)taosArrayPush(tinsts, &ip);
|
||||
}
|
||||
}
|
||||
if (taosArrayGetSize(tinsts) == 0) {
|
||||
|
@ -149,10 +149,10 @@ bool dfaBuilderCacheState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *r
|
|||
taosArrayDestroy(tinsts);
|
||||
} else {
|
||||
DfaState st = {.insts = tinsts, .isMatch = isMatch};
|
||||
taosArrayPush(builder->dfa->states, &st);
|
||||
(void)taosArrayPush(builder->dfa->states, &st);
|
||||
|
||||
int32_t sz = taosArrayGetSize(builder->dfa->states) - 1;
|
||||
taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz));
|
||||
(void)taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz));
|
||||
*result = sz;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -38,7 +38,7 @@ static FORCE_INLINE void idxGenLRUKey(char* buf, const char* path, int32_t block
|
|||
char* p = buf;
|
||||
SERIALIZE_STR_VAR_TO_BUF(p, path, strlen(path));
|
||||
SERIALIZE_VAR_TO_BUF(p, '_', char);
|
||||
idxInt2str(blockId, p, 0);
|
||||
(void)idxInt2str(blockId, p, 0);
|
||||
return;
|
||||
}
|
||||
static FORCE_INLINE int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) {
|
||||
|
@ -48,7 +48,7 @@ static FORCE_INLINE int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len)
|
|||
if (len + ctx->file.wBufOffset >= cap) {
|
||||
int32_t nw = cap - ctx->file.wBufOffset;
|
||||
memcpy(ctx->file.wBuf + ctx->file.wBufOffset, buf, nw);
|
||||
taosWriteFile(ctx->file.pFile, ctx->file.wBuf, cap);
|
||||
(void)taosWriteFile(ctx->file.pFile, ctx->file.wBuf, cap);
|
||||
|
||||
memset(ctx->file.wBuf, 0, cap);
|
||||
ctx->file.wBufOffset = 0;
|
||||
|
@ -58,7 +58,7 @@ static FORCE_INLINE int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len)
|
|||
|
||||
nw = (len / cap) * cap;
|
||||
if (nw != 0) {
|
||||
taosWriteFile(ctx->file.pFile, buf, nw);
|
||||
(void)taosWriteFile(ctx->file.pFile, buf, nw);
|
||||
}
|
||||
|
||||
len -= nw;
|
||||
|
@ -112,7 +112,7 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
|
|||
SDataBlock* blk = taosLRUCacheValue(ctx->lru, h);
|
||||
nread = TMIN(blkLeft, len);
|
||||
memcpy(buf + total, blk->buf + blkOffset, nread);
|
||||
taosLRUCacheRelease(ctx->lru, h, false);
|
||||
(void)taosLRUCacheRelease(ctx->lru, h, false);
|
||||
} else {
|
||||
int32_t left = ctx->file.size - offset;
|
||||
if (left < kBlockSize) {
|
||||
|
@ -162,7 +162,7 @@ static FORCE_INLINE int idxFileCtxGetSize(IFileCtx* ctx) {
|
|||
return ctx->offset;
|
||||
} else {
|
||||
int64_t file_size = 0;
|
||||
taosStatFile(ctx->file.buf, &file_size, NULL, NULL);
|
||||
(void)taosStatFile(ctx->file.buf, &file_size, NULL, NULL);
|
||||
return (int)file_size;
|
||||
}
|
||||
}
|
||||
|
@ -250,16 +250,16 @@ void idxFileCtxDestroy(IFileCtx* ctx, bool remove) {
|
|||
int32_t nw = taosWriteFile(ctx->file.pFile, ctx->file.wBuf, ctx->file.wBufOffset);
|
||||
ctx->file.wBufOffset = 0;
|
||||
}
|
||||
ctx->flush(ctx);
|
||||
(void)(ctx->flush(ctx));
|
||||
taosMemoryFreeClear(ctx->file.wBuf);
|
||||
taosCloseFile(&ctx->file.pFile);
|
||||
(void)taosCloseFile(&ctx->file.pFile);
|
||||
if (ctx->file.readOnly) {
|
||||
#ifdef USE_MMAP
|
||||
munmap(ctx->file.ptr, ctx->file.size);
|
||||
#endif
|
||||
}
|
||||
if (remove) {
|
||||
unlink(ctx->file.buf);
|
||||
(void)unlink(ctx->file.buf);
|
||||
}
|
||||
}
|
||||
taosMemoryFree(ctx);
|
||||
|
|
|
@ -68,7 +68,7 @@ FstBuilderNode* fstBuilderNodeClone(FstBuilderNode* src) {
|
|||
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
FstTransition* tran = taosArrayGet(src->trans, i);
|
||||
taosArrayPush(trans, tran);
|
||||
(void)taosArrayPush(trans, tran);
|
||||
}
|
||||
|
||||
node->trans = trans;
|
||||
|
@ -91,7 +91,7 @@ void fstBuilderNodeCloneFrom(FstBuilderNode* dst, FstBuilderNode* src) {
|
|||
dst->trans = taosArrayInit(sz, sizeof(FstTransition));
|
||||
for (size_t i = 0; i < sz; i++) {
|
||||
FstTransition* trn = taosArrayGet(src->trans, i);
|
||||
taosArrayPush(dst->trans, trn);
|
||||
(void)taosArrayPush(dst->trans, trn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,22 @@ FstRegex *regexCreate(const char *str) {
|
|||
}
|
||||
|
||||
regex->orig = taosStrdup(str);
|
||||
if (regex->orig == NULL) {
|
||||
taosMemoryFree(regex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// construct insts based on str
|
||||
SArray *insts = taosArrayInit(256, sizeof(uint8_t));
|
||||
if (insts == NULL) {
|
||||
taosMemoryFree(regex->orig);
|
||||
taosMemoryFree(regex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < strlen(str); i++) {
|
||||
uint8_t v = str[i];
|
||||
taosArrayPush(insts, &v);
|
||||
(void)taosArrayPush(insts, &v);
|
||||
}
|
||||
FstDfaBuilder *builder = dfaBuilderCreate(insts);
|
||||
regex->dfa = dfaBuilderBuild(builder);
|
||||
|
|
|
@ -83,7 +83,7 @@ FstRegistry* fstRegistryCreate(uint64_t tableSize, uint64_t mruSize) {
|
|||
|
||||
for (uint64_t i = 0; i < nCells; i++) {
|
||||
FstRegistryCell cell = {.addr = NONE_ADDRESS, .node = fstBuilderNodeDefault()};
|
||||
taosArrayPush(tb, &cell);
|
||||
(void)taosArrayPush(tb, &cell);
|
||||
}
|
||||
|
||||
registry->table = tb;
|
||||
|
|
|
@ -81,7 +81,7 @@ FstSlice fstSliceCreate(uint8_t* data, uint64_t len) {
|
|||
str->len = len;
|
||||
str->data = taosMemoryMalloc(len * sizeof(uint8_t));
|
||||
|
||||
if (data != NULL) {
|
||||
if (data != NULL && str->data != NULL) {
|
||||
memcpy(str->data, data, len);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ FstSlice fstSliceCreate(uint8_t* data, uint64_t len) {
|
|||
// just shallow copy
|
||||
FstSlice fstSliceCopy(FstSlice* s, int32_t start, int32_t end) {
|
||||
FstString* str = s->str;
|
||||
atomic_add_fetch_32(&str->ref, 1);
|
||||
(void)atomic_add_fetch_32(&str->ref, 1);
|
||||
|
||||
FstSlice t = {.str = str, .start = start + s->start, .end = end + s->start};
|
||||
return t;
|
||||
|
|
|
@ -125,7 +125,7 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
|
|||
|
||||
char buf[128] = {0};
|
||||
int32_t sz = idxSerialCacheKey(&key, buf);
|
||||
taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||
(void)taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||
tfileReaderRef(reader);
|
||||
}
|
||||
taosArrayDestroyEx(files, tfileDestroyFileName);
|
||||
|
@ -172,7 +172,7 @@ int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
|
|||
TFileReader** p = taosHashGet(tcache->tableCache, buf, sz);
|
||||
if (p != NULL && *p != NULL) {
|
||||
TFileReader* oldRdr = *p;
|
||||
taosHashRemove(tcache->tableCache, buf, sz);
|
||||
(void)taosHashRemove(tcache->tableCache, buf, sz);
|
||||
indexInfo("found %s, should remove file %s", buf, oldRdr->ctx->file.buf);
|
||||
oldRdr->remove = true;
|
||||
tfileReaderUnRef(oldRdr);
|
||||
|
@ -265,7 +265,7 @@ static int32_t tfSearchPrefix(void* reader, SIndexTerm* tem, SIdxTRslt* tr) {
|
|||
FStmSt* st = stmBuilderIntoStm(sb);
|
||||
FStmStRslt* rt = NULL;
|
||||
while ((rt = stmStNextWith(st, NULL)) != NULL) {
|
||||
taosArrayPush(offsets, &(rt->out.out));
|
||||
(void)taosArrayPush(offsets, &(rt->out.out));
|
||||
swsResultDestroy(rt);
|
||||
}
|
||||
stmStDestroy(st);
|
||||
|
@ -337,7 +337,7 @@ static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr,
|
|||
|
||||
TExeCond cond = cmpFn(ch, p, tem->colType);
|
||||
if (MATCH == cond) {
|
||||
tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
(void)tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
} else if (CONTINUE == cond) {
|
||||
} else if (BREAK == cond) {
|
||||
swsResultDestroy(rt);
|
||||
|
@ -474,7 +474,7 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
|
|||
taosMemoryFree(tBuf);
|
||||
}
|
||||
if (MATCH == cond) {
|
||||
tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
(void)tfileReaderLoadTableIds((TFileReader*)reader, rt->out.out, tr->total);
|
||||
} else if (CONTINUE == cond) {
|
||||
} else if (BREAK == cond) {
|
||||
swsResultDestroy(rt);
|
||||
|
@ -552,7 +552,7 @@ int32_t tfileWriterCreate(IFileCtx* ctx, TFileHeader* header, TFileWriter** pWri
|
|||
}
|
||||
tw->ctx = ctx;
|
||||
tw->header = *header;
|
||||
tfileWriteHeader(tw);
|
||||
(void)tfileWriteHeader(tw);
|
||||
|
||||
*pWriter = tw;
|
||||
return code;
|
||||
|
@ -571,7 +571,7 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
} else {
|
||||
fn = getComparFunc(colType, 0);
|
||||
}
|
||||
taosArraySortPWithExt((SArray*)(data), tfileValueCompare, &fn);
|
||||
(void)taosArraySortPWithExt((SArray*)(data), tfileValueCompare, &fn);
|
||||
}
|
||||
|
||||
int32_t sz = taosArrayGetSize((SArray*)data);
|
||||
|
@ -586,7 +586,7 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
if (tbsz == 0) continue;
|
||||
fstOffset += TF_TABLE_TATOAL_SIZE(tbsz);
|
||||
}
|
||||
tfileWriteFstOffset(tw, fstOffset);
|
||||
(void)tfileWriteFstOffset(tw, fstOffset);
|
||||
|
||||
int32_t cap = 4 * 1024;
|
||||
char* buf = taosMemoryCalloc(1, cap);
|
||||
|
@ -614,7 +614,7 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
|
||||
char* p = buf;
|
||||
tfileSerialTableIdsToBuf(p, v->tableId);
|
||||
tw->ctx->write(tw->ctx, buf, ttsz);
|
||||
(void)(tw->ctx->write(tw->ctx, buf, ttsz));
|
||||
v->offset = tw->offset;
|
||||
tw->offset += ttsz;
|
||||
memset(buf, 0, cap);
|
||||
|
@ -642,7 +642,7 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
|||
}
|
||||
}
|
||||
fstBuilderDestroy(tw->fb);
|
||||
tfileWriteFooter(tw);
|
||||
(void)tfileWriteFooter(tw);
|
||||
return 0;
|
||||
}
|
||||
void tfileWriterClose(TFileWriter* tw) {
|
||||
|
@ -679,7 +679,7 @@ void idxTFileDestroy(IndexTFile* tfile) {
|
|||
if (tfile == NULL) {
|
||||
return;
|
||||
}
|
||||
taosThreadMutexDestroy(&tfile->mtx);
|
||||
(void)taosThreadMutexDestroy(&tfile->mtx);
|
||||
tfileCacheDestroy(tfile->cache);
|
||||
taosMemoryFree(tfile);
|
||||
}
|
||||
|
@ -696,9 +696,9 @@ int idxTFileSearch(void* tfile, SIndexTermQuery* query, SIdxTRslt* result) {
|
|||
SIndexTerm* term = query->term;
|
||||
ICacheKey key = {.suid = term->suid, .colType = term->colType, .colName = term->colName, .nColName = term->nColName};
|
||||
|
||||
taosThreadMutexLock(&pTfile->mtx);
|
||||
(void)taosThreadMutexLock(&pTfile->mtx);
|
||||
TFileReader* reader = tfileCacheGet(pTfile->cache, &key);
|
||||
taosThreadMutexUnlock(&pTfile->mtx);
|
||||
(void)taosThreadMutexUnlock(&pTfile->mtx);
|
||||
if (reader == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -802,9 +802,9 @@ TFileReader* tfileGetReaderByCol(IndexTFile* tf, uint64_t suid, char* colName) {
|
|||
TFileReader* rd = NULL;
|
||||
ICacheKey key = {.suid = suid, .colType = TSDB_DATA_TYPE_BINARY, .colName = colName, .nColName = strlen(colName)};
|
||||
|
||||
taosThreadMutexLock(&tf->mtx);
|
||||
(void)taosThreadMutexLock(&tf->mtx);
|
||||
rd = tfileCacheGet(tf->cache, &key);
|
||||
taosThreadMutexUnlock(&tf->mtx);
|
||||
(void)taosThreadMutexUnlock(&tf->mtx);
|
||||
return rd;
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ int tfileValuePush(TFileValue* tf, uint64_t val) {
|
|||
if (tf == NULL) {
|
||||
return -1;
|
||||
}
|
||||
taosArrayPush(tf->tableId, &val);
|
||||
(void)taosArrayPush(tf->tableId, &val);
|
||||
return 0;
|
||||
}
|
||||
void tfileValueDestroy(TFileValue* tf) {
|
||||
|
@ -897,7 +897,7 @@ static int tfileWriteData(TFileWriter* write, TFileValue* tval) {
|
|||
static int tfileWriteFooter(TFileWriter* write) {
|
||||
char buf[sizeof(FILE_MAGIC_NUMBER) + 1] = {0};
|
||||
void* pBuf = (void*)buf;
|
||||
taosEncodeFixedU64((void**)(void*)&pBuf, FILE_MAGIC_NUMBER);
|
||||
(void)taosEncodeFixedU64((void**)(void*)&pBuf, FILE_MAGIC_NUMBER);
|
||||
int nwrite = write->ctx->write(write->ctx, buf, (int32_t)strlen(buf));
|
||||
|
||||
indexInfo("tfile write footer size: %d", write->ctx->size(write->ctx));
|
||||
|
@ -964,7 +964,7 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray*
|
|||
while (nid > 0) {
|
||||
int32_t left = block + sizeof(block) - p;
|
||||
if (left >= sizeof(uint64_t)) {
|
||||
taosArrayPush(result, (uint64_t*)p);
|
||||
(void)taosArrayPush(result, (uint64_t*)p);
|
||||
p += sizeof(uint64_t);
|
||||
} else {
|
||||
char buf[sizeof(uint64_t)] = {0};
|
||||
|
@ -975,7 +975,7 @@ static int tfileReaderLoadTableIds(TFileReader* reader, int32_t offset, SArray*
|
|||
nread = ctx->readFrom(ctx, block, sizeof(block), offset);
|
||||
memcpy(buf + left, block, sizeof(uint64_t) - left);
|
||||
|
||||
taosArrayPush(result, (uint64_t*)buf);
|
||||
(void)taosArrayPush(result, (uint64_t*)buf);
|
||||
p = block + sizeof(uint64_t) - left;
|
||||
}
|
||||
nid -= 1;
|
||||
|
@ -996,7 +996,7 @@ static int tfileReaderVerify(TFileReader* reader) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
taosDecodeFixedU64(buf, &tMagicNumber);
|
||||
(void)taosDecodeFixedU64(buf, &tMagicNumber);
|
||||
return tMagicNumber == FILE_MAGIC_NUMBER ? 0 : -1;
|
||||
}
|
||||
|
||||
|
@ -1040,12 +1040,12 @@ static SArray* tfileGetFileList(const char* path) {
|
|||
size_t len = strlen(path) + 1 + strlen(file) + 1;
|
||||
char* buf = taosMemoryCalloc(1, len);
|
||||
sprintf(buf, "%s/%s", path, file);
|
||||
taosArrayPush(files, &buf);
|
||||
(void)taosArrayPush(files, &buf);
|
||||
}
|
||||
taosCloseDir(&pDir);
|
||||
(void)taosCloseDir(&pDir);
|
||||
|
||||
taosArraySort(files, tfileCompare);
|
||||
tfileRmExpireFile(files);
|
||||
(void)tfileRmExpireFile(files);
|
||||
|
||||
return files;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ void iIntersection(SArray *in, SArray *out) {
|
|||
}
|
||||
}
|
||||
if (has == true) {
|
||||
taosArrayPush(out, &tgt);
|
||||
(void)taosArrayPush(out, &tgt);
|
||||
}
|
||||
}
|
||||
taosMemoryFreeClear(mi);
|
||||
|
@ -75,7 +75,7 @@ void iUnion(SArray *in, SArray *out) {
|
|||
return;
|
||||
}
|
||||
if (sz == 1) {
|
||||
taosArrayAddAll(out, taosArrayGetP(in, 0));
|
||||
(void)taosArrayAddAll(out, taosArrayGetP(in, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ void iUnion(SArray *in, SArray *out) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
taosArrayPush(out, &mVal);
|
||||
(void)taosArrayPush(out, &mVal);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ void idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) {
|
|||
|
||||
if (taosArrayGetSize(tr->total) == 0 || taosArrayGetSize(tr->add) == 0) {
|
||||
SArray *t = taosArrayGetSize(tr->total) == 0 ? tr->add : tr->total;
|
||||
taosArrayAddAll(result, t);
|
||||
(void)taosArrayAddAll(result, t);
|
||||
} else {
|
||||
SArray *arrs = taosArrayInit(2, sizeof(void *));
|
||||
taosArrayPush(arrs, &tr->total);
|
||||
taosArrayPush(arrs, &tr->add);
|
||||
(void)taosArrayPush(arrs, &tr->total);
|
||||
(void)taosArrayPush(arrs, &tr->add);
|
||||
iUnion(arrs, result);
|
||||
taosArrayDestroy(arrs);
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port,
|
|||
static void* httpThread(void* arg) {
|
||||
SHttpModule* http = (SHttpModule*)arg;
|
||||
setThreadName("http-cli-send-thread");
|
||||
uv_run(http->loop, UV_RUN_DEFAULT);
|
||||
(void)uv_run(http->loop, UV_RUN_DEFAULT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ static FORCE_INLINE void clientCloseCb(uv_handle_t* handle) {
|
|||
SHttpModule* http = taosAcquireRef(httpRefMgt, cli->chanId);
|
||||
if (http != NULL) {
|
||||
http->connNum -= 1;
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
}
|
||||
|
||||
destroyHttpClient(cli);
|
||||
|
@ -389,7 +389,7 @@ static void clientConnCb(uv_connect_t* req, int32_t status) {
|
|||
if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
|
||||
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
|
||||
}
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
http->connNum += 1;
|
||||
|
@ -404,7 +404,7 @@ static void clientConnCb(uv_connect_t* req, int32_t status) {
|
|||
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
|
||||
}
|
||||
}
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
}
|
||||
|
||||
int32_t httpSendQuit(SHttpModule* http, int64_t chanId) {
|
||||
|
@ -449,7 +449,7 @@ static void httpHandleQuit(SHttpMsg* msg) {
|
|||
SHttpModule* http = taosAcquireRef(httpRefMgt, chanId);
|
||||
if (http == NULL) return;
|
||||
uv_walk(http->loop, httpWalkCb, NULL);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
}
|
||||
|
||||
static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t port) {
|
||||
|
@ -474,10 +474,10 @@ static void httpFailFastMayUpdate(SHashObj* pTable, char* server, int16_t port,
|
|||
sprintf(buf, "%s:%d", server, port);
|
||||
|
||||
if (succ) {
|
||||
taosHashRemove(pTable, buf, strlen(buf));
|
||||
(void)taosHashRemove(pTable, buf, strlen(buf));
|
||||
} else {
|
||||
int32_t st = taosGetTimestampSec();
|
||||
taosHashPut(pTable, buf, strlen(buf), &st, sizeof(st));
|
||||
(void)taosHashPut(pTable, buf, strlen(buf), &st, sizeof(st));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
tError("http-report failed to alloc read buf, dst:%s:%d,chanId:%" PRId64 ", reason:%s", cli->addr, cli->port,
|
||||
chanId, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
|
||||
destroyHttpClient(cli);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -568,7 +568,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
tError("http-report failed to init socket handle, dst:%s:%d,chanId:%" PRId64 ", reason:%s", cli->addr, cli->port,
|
||||
chanId, uv_strerror(err));
|
||||
destroyHttpClient(cli);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
tError("http-report failed to open socket, dst:%s:%d, chanId:%" PRId64 ", reason:%s", cli->addr, cli->port, chanId,
|
||||
tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||
destroyHttpClient(cli);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
tError("http-report failed to open socket, reason:%s, dst:%s:%d, chanId:%" PRId64 ",reason:%s", uv_strerror(ret),
|
||||
cli->addr, cli->port, chanId, uv_strerror(ret));
|
||||
destroyHttpClient(cli);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ static void httpHandleReq(SHttpMsg* msg) {
|
|||
httpFailFastMayUpdate(http->connStatusTable, cli->addr, cli->port, 0);
|
||||
destroyHttpClient(cli);
|
||||
}
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
|
||||
END:
|
||||
|
@ -608,7 +608,7 @@ END:
|
|||
}
|
||||
httpDestroyMsg(msg);
|
||||
taosMemoryFree(header);
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
}
|
||||
|
||||
static void httpModuleDestroy(SHttpModule* http) {
|
||||
|
@ -619,7 +619,7 @@ static void httpModuleDestroy(SHttpModule* http) {
|
|||
transAsyncPoolDestroy(http->asyncPool);
|
||||
}
|
||||
if (http->loop) {
|
||||
uv_loop_close(http->loop);
|
||||
(void)uv_loop_close(http->loop);
|
||||
taosMemoryFree(http->loop);
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ int32_t taosSendHttpReportByChan(const char* server, const char* uri, uint16_t p
|
|||
|
||||
int32_t taosSendHttpReport(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
||||
EHttpCompFlag flag) {
|
||||
taosThreadOnce(&transHttpInit, transHttpEnvInit);
|
||||
(void)taosThreadOnce(&transHttpInit, transHttpEnvInit);
|
||||
return taosSendHttpReportImplByChan(server, uri, port, pCont, contLen, flag, httpDefaultChanId);
|
||||
}
|
||||
|
||||
|
@ -743,7 +743,7 @@ _ERROR:
|
|||
return code;
|
||||
}
|
||||
int64_t taosInitHttpChan() {
|
||||
taosThreadOnce(&transHttpInit, transHttpEnvInit);
|
||||
(void)taosThreadOnce(&transHttpInit, transHttpEnvInit);
|
||||
return transInitHttpChanImpl();
|
||||
}
|
||||
|
||||
|
@ -762,14 +762,14 @@ void taosDestroyHttpChan(int64_t chanId) {
|
|||
ret = httpSendQuit(load, chanId);
|
||||
if (ret != 0) {
|
||||
tDebug("http-report already destroyed, chanId %" PRId64 ",reason:%s", chanId, tstrerror(ret));
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
return;
|
||||
}
|
||||
|
||||
taosThreadJoin(load->thread, NULL);
|
||||
(void)taosThreadJoin(load->thread, NULL);
|
||||
|
||||
httpModuleDestroy(load);
|
||||
|
||||
taosReleaseRef(httpRefMgt, chanId);
|
||||
taosRemoveRef(httpRefMgt, chanId);
|
||||
(void)taosReleaseRef(httpRefMgt, chanId);
|
||||
(void)taosRemoveRef(httpRefMgt, chanId);
|
||||
}
|
|
@ -59,7 +59,7 @@ int32_t tmsgSendSyncReq(const SEpSet* epSet, SRpcMsg* pMsg) {
|
|||
|
||||
void tmsgSendRsp(SRpcMsg* pMsg) {
|
||||
#if 1
|
||||
rpcSendResponse(pMsg);
|
||||
(void)rpcSendResponse(pMsg);
|
||||
#else
|
||||
return (*defaultMsgCb.sendRspFp)(pMsg);
|
||||
#endif
|
||||
|
@ -81,6 +81,6 @@ bool tmsgUpdateDnodeInfo(int32_t* dnodeId, int64_t* clusterId, char* fqdn, uint1
|
|||
|
||||
void tmsgUpdateDnodeEpSet(SEpSet* epset) {
|
||||
for (int32_t i = 0; i < epset->numOfEps; ++i) {
|
||||
tmsgUpdateDnodeInfo(NULL, NULL, epset->eps[i].fqdn, &epset->eps[i].port);
|
||||
(void)tmsgUpdateDnodeInfo(NULL, NULL, epset->eps[i].fqdn, &epset->eps[i].port);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ void* rpcOpen(const SRpcInit* pInit) {
|
|||
}
|
||||
|
||||
int64_t refId = transAddExHandle(transGetInstMgt(), pRpc);
|
||||
transAcquireExHandle(transGetInstMgt(), refId);
|
||||
(void)transAcquireExHandle(transGetInstMgt(), refId);
|
||||
pRpc->refId = refId;
|
||||
return (void*)refId;
|
||||
_end:
|
||||
|
@ -122,8 +122,8 @@ _end:
|
|||
}
|
||||
void rpcClose(void* arg) {
|
||||
tInfo("start to close rpc");
|
||||
transRemoveExHandle(transGetInstMgt(), (int64_t)arg);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)arg);
|
||||
(void)transRemoveExHandle(transGetInstMgt(), (int64_t)arg);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)arg);
|
||||
tInfo("end to close rpc");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -232,9 +232,9 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
|
|||
|
||||
#define CLI_RELEASE_UV(loop) \
|
||||
do { \
|
||||
uv_walk(loop, cliWalkCb, NULL); \
|
||||
uv_run(loop, UV_RUN_DEFAULT); \
|
||||
uv_loop_close(loop); \
|
||||
(void)uv_walk(loop, cliWalkCb, NULL); \
|
||||
(void)uv_run(loop, UV_RUN_DEFAULT); \
|
||||
(void)uv_loop_close(loop); \
|
||||
} while (0);
|
||||
|
||||
// snprintf may cause performance problem
|
||||
|
@ -244,7 +244,7 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
|
|||
int16_t len = strlen(ip); \
|
||||
if (ip != NULL) memcpy(t, ip, len); \
|
||||
t[len] = ':'; \
|
||||
titoa(port, 10, &t[len + 1]); \
|
||||
(void)titoa(port, 10, &t[len + 1]); \
|
||||
} while (0)
|
||||
|
||||
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
|
||||
|
@ -357,15 +357,15 @@ bool cliConnSendSeqMsg(int64_t refId, SCliConn* conn) {
|
|||
taosWUnLockLatch(&exh->latch);
|
||||
SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq);
|
||||
transCtxMerge(&conn->ctx, &t->ctx->appCtx);
|
||||
transQueuePush(&conn->cliMsgs, t);
|
||||
(void)transQueuePush(&conn->cliMsgs, t);
|
||||
tDebug("pop from conn %p, refId: %" PRId64 "", conn, refId);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
cliSend(conn);
|
||||
return true;
|
||||
}
|
||||
taosWUnLockLatch(&exh->latch);
|
||||
tDebug("empty conn %p, refId: %" PRId64 "", conn, refId);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -376,9 +376,9 @@ void cliHandleResp(SCliConn* conn) {
|
|||
if (conn->timer) {
|
||||
if (uv_is_active((uv_handle_t*)conn->timer)) {
|
||||
tDebug("%s conn %p stop timer", CONN_GET_INST_LABEL(conn), conn);
|
||||
uv_timer_stop(conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
}
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
conn->timer = NULL;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void cliHandleResp(SCliConn* conn) {
|
|||
return addConnToPool(pThrd->pool, conn);
|
||||
}
|
||||
|
||||
uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb);
|
||||
(void)uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb);
|
||||
}
|
||||
static void cliDestroyMsgInExhandle(int64_t refId) {
|
||||
if (refId == 0) return;
|
||||
|
@ -500,7 +500,7 @@ static void cliDestroyMsgInExhandle(int64_t refId) {
|
|||
destroyCmsg(t);
|
||||
}
|
||||
taosWUnLockLatch(&exh->latch);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,9 +588,9 @@ void cliConnTimeout(uv_timer_t* handle) {
|
|||
|
||||
tTrace("%s conn %p conn timeout, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
|
||||
|
||||
uv_timer_stop(handle);
|
||||
(void)uv_timer_stop(handle);
|
||||
handle->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
|
||||
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
|
||||
|
@ -600,7 +600,7 @@ void cliReadTimeoutCb(uv_timer_t* handle) {
|
|||
// set up timeout cb
|
||||
SCliConn* conn = handle->data;
|
||||
tTrace("%s conn %p timeout, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
|
||||
uv_read_stop(conn->stream);
|
||||
(void)uv_read_stop(conn->stream);
|
||||
cliHandleExceptImpl(conn, TSDB_CODE_RPC_TIMEOUT);
|
||||
}
|
||||
|
||||
|
@ -687,7 +687,7 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) {
|
|||
SConnList* plist = taosHashGet((SHashObj*)pool, key, klen);
|
||||
if (plist == NULL) {
|
||||
SConnList list = {0};
|
||||
taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list));
|
||||
(void)taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list));
|
||||
plist = taosHashGet(pool, key, klen);
|
||||
|
||||
SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
|
||||
|
@ -800,8 +800,8 @@ static void addConnToPool(void* pool, SCliConn* conn) {
|
|||
|
||||
SCliThrd* thrd = conn->hostThrd;
|
||||
if (conn->timer != NULL) {
|
||||
uv_timer_stop(conn->timer);
|
||||
taosArrayPush(thrd->timerList, &conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
(void)taosArrayPush(thrd->timerList, &conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
conn->timer = NULL;
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ static void addConnToPool(void* pool, SCliConn* conn) {
|
|||
pMsg->ctx->task = NULL;
|
||||
|
||||
transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
|
||||
transQueuePush(&conn->cliMsgs, pMsg);
|
||||
(void)transQueuePush(&conn->cliMsgs, pMsg);
|
||||
|
||||
conn->status = ConnNormal;
|
||||
cliSend(conn);
|
||||
|
@ -851,8 +851,8 @@ static void addConnToPool(void* pool, SCliConn* conn) {
|
|||
}
|
||||
static int32_t allocConnRef(SCliConn* conn, bool update) {
|
||||
if (update) {
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
conn->refId = -1;
|
||||
}
|
||||
|
||||
|
@ -887,8 +887,8 @@ static int32_t allocConnRef(SCliConn* conn, bool update) {
|
|||
|
||||
static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
|
||||
if (update) {
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
conn->refId = -1;
|
||||
}
|
||||
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
|
||||
|
@ -982,7 +982,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
|
|||
}
|
||||
|
||||
tDebug("no available timer, create a timer %p", timer);
|
||||
uv_timer_init(pThrd->loop, timer);
|
||||
(void)uv_timer_init(pThrd->loop, timer);
|
||||
}
|
||||
timer->data = conn;
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
|
|||
conn->broken = false;
|
||||
transRefCliHandle(conn);
|
||||
|
||||
atomic_add_fetch_32(&pThrd->connCount, 1);
|
||||
(void)atomic_add_fetch_32(&pThrd->connCount, 1);
|
||||
|
||||
TAOS_CHECK_GOTO(allocConnRef(conn, false), NULL, _failed);
|
||||
|
||||
|
@ -1038,8 +1038,8 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
|
|||
|
||||
conn->list = NULL;
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
conn->refId = -1;
|
||||
|
||||
if (conn->task != NULL) {
|
||||
|
@ -1047,15 +1047,15 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
|
|||
conn->task = NULL;
|
||||
}
|
||||
if (conn->timer != NULL) {
|
||||
uv_timer_stop(conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
}
|
||||
|
||||
if (clear) {
|
||||
if (!uv_is_closing((uv_handle_t*)conn->stream)) {
|
||||
uv_read_stop(conn->stream);
|
||||
(void)uv_read_stop(conn->stream);
|
||||
uv_close((uv_handle_t*)conn->stream, cliDestroy);
|
||||
}
|
||||
}
|
||||
|
@ -1067,16 +1067,16 @@ static void cliDestroy(uv_handle_t* handle) {
|
|||
SCliConn* conn = handle->data;
|
||||
SCliThrd* pThrd = conn->hostThrd;
|
||||
if (conn->timer != NULL) {
|
||||
uv_timer_stop(conn->timer);
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
conn->timer = NULL;
|
||||
}
|
||||
|
||||
atomic_sub_fetch_32(&pThrd->connCount, 1);
|
||||
(void)atomic_sub_fetch_32(&pThrd->connCount, 1);
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
taosMemoryFree(conn->dstAddr);
|
||||
taosMemoryFree(conn->stream);
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ static void cliDestroy(uv_handle_t* handle) {
|
|||
|
||||
tTrace("%s conn %p destroy successfully", CONN_GET_INST_LABEL(conn), conn);
|
||||
transReqQueueClear(&conn->wreqQueue);
|
||||
transDestroyBuffer(&conn->readBuf);
|
||||
(void)transDestroyBuffer(&conn->readBuf);
|
||||
|
||||
taosMemoryFree(conn);
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ static bool cliHandleNoResp(SCliConn* conn) {
|
|||
if (!transQueueEmpty(&conn->cliMsgs)) {
|
||||
SCliMsg* pMsg = transQueueGet(&conn->cliMsgs, 0);
|
||||
if (REQUEST_NO_RESP(&pMsg->msg)) {
|
||||
transQueuePop(&conn->cliMsgs);
|
||||
(void)transQueuePop(&conn->cliMsgs);
|
||||
destroyCmsg(pMsg);
|
||||
res = true;
|
||||
}
|
||||
|
@ -1138,7 +1138,7 @@ static void cliSendCb(uv_write_t* req, int status) {
|
|||
tTrace("%s conn %p no resp required", CONN_GET_INST_LABEL(pConn), pConn);
|
||||
return;
|
||||
}
|
||||
uv_read_start((uv_stream_t*)pConn->stream, cliAllocRecvBufferCb, cliRecvCb);
|
||||
(void)uv_read_start((uv_stream_t*)pConn->stream, cliAllocRecvBufferCb, cliRecvCb);
|
||||
}
|
||||
void cliSendBatch(SCliConn* pConn) {
|
||||
SCliThrd* pThrd = pConn->hostThrd;
|
||||
|
@ -1197,7 +1197,7 @@ void cliSendBatch(SCliConn* pConn) {
|
|||
req->data = pConn;
|
||||
tDebug("%s conn %p start to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(pConn), pConn,
|
||||
pBatch->wLen, pBatch->batchSize);
|
||||
uv_write(req, (uv_stream_t*)pConn->stream, wb, wLen, cliSendBatchCb);
|
||||
(void)uv_write(req, (uv_stream_t*)pConn->stream, wb, wLen, cliSendBatchCb);
|
||||
taosMemoryFree(wb);
|
||||
}
|
||||
void cliSend(SCliConn* pConn) {
|
||||
|
@ -1252,13 +1252,13 @@ void cliSend(SCliConn* pConn) {
|
|||
if (timer == NULL) {
|
||||
timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
|
||||
tDebug("no available timer, create a timer %p", timer);
|
||||
uv_timer_init(pThrd->loop, timer);
|
||||
(void)uv_timer_init(pThrd->loop, timer);
|
||||
}
|
||||
timer->data = pConn;
|
||||
pConn->timer = timer;
|
||||
|
||||
tGTrace("%s conn %p start timer for msg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType));
|
||||
uv_timer_start((uv_timer_t*)pConn->timer, cliReadTimeoutCb, TRANS_READ_TIMEOUT, 0);
|
||||
(void)uv_timer_start((uv_timer_t*)pConn->timer, cliReadTimeoutCb, TRANS_READ_TIMEOUT, 0);
|
||||
}
|
||||
|
||||
if (pHead->comp == 0 && pMsg->info.compressed == 0 && pConn->clientIp != pConn->serverIp) {
|
||||
|
@ -1345,9 +1345,9 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
|||
|
||||
uint32_t ipaddr = 0;
|
||||
if ((code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, pList->ip, &ipaddr)) != 0) {
|
||||
uv_timer_stop(conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
cliHandleFastFail(conn, code);
|
||||
return;
|
||||
|
@ -1381,9 +1381,9 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
|||
|
||||
ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
|
||||
if (ret != 0) {
|
||||
uv_timer_stop(conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
|
||||
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
|
||||
|
@ -1461,7 +1461,7 @@ static void cliHandleFastFail(SCliConn* pConn, int status) {
|
|||
}
|
||||
} else {
|
||||
SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
|
||||
taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem));
|
||||
(void)taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1499,12 +1499,12 @@ void cliConnCb(uv_connect_t* req, int status) {
|
|||
|
||||
struct sockaddr peername, sockname;
|
||||
int addrlen = sizeof(peername);
|
||||
uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen);
|
||||
transSockInfo2Str(&peername, pConn->dst);
|
||||
(void)uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen);
|
||||
(void)transSockInfo2Str(&peername, pConn->dst);
|
||||
|
||||
addrlen = sizeof(sockname);
|
||||
uv_tcp_getsockname((uv_tcp_t*)pConn->stream, &sockname, &addrlen);
|
||||
transSockInfo2Str(&sockname, pConn->src);
|
||||
(void)uv_tcp_getsockname((uv_tcp_t*)pConn->stream, &sockname, &addrlen);
|
||||
(void)transSockInfo2Str(&sockname, pConn->src);
|
||||
|
||||
struct sockaddr_in addr = *(struct sockaddr_in*)&sockname;
|
||||
struct sockaddr_in saddr = *(struct sockaddr_in*)&peername;
|
||||
|
@ -1554,8 +1554,8 @@ static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
tDebug("cli work thread %p start to quit", pThrd);
|
||||
destroyCmsg(pMsg);
|
||||
|
||||
destroyConnPool(pThrd);
|
||||
uv_walk(pThrd->loop, cliWalkCb, NULL);
|
||||
(void)destroyConnPool(pThrd);
|
||||
(void)uv_walk(pThrd->loop, cliWalkCb, NULL);
|
||||
}
|
||||
static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||
int64_t refId = (int64_t)(pMsg->msg.info.handle);
|
||||
|
@ -1570,7 +1570,7 @@ static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
SCliConn* conn = exh->handle;
|
||||
taosRUnLockLatch(&exh->latch);
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
tDebug("%s conn %p start to release to inst", CONN_GET_INST_LABEL(conn), conn);
|
||||
|
||||
if (T_REF_VAL_GET(conn) == 2) {
|
||||
|
@ -1705,7 +1705,7 @@ static void cliMayUpdateFqdnCache(SHashObj* cache, char* dst) {
|
|||
if (i > 0) {
|
||||
char fqdn[TSDB_FQDN_LEN + 1] = {0};
|
||||
memcpy(fqdn, dst, i);
|
||||
cliUpdateFqdnCache(cache, fqdn);
|
||||
(void)cliUpdateFqdnCache(cache, fqdn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
if (ignore == true) {
|
||||
// persist conn already release by server
|
||||
STransMsg resp = {0};
|
||||
cliBuildExceptResp(pMsg, &resp);
|
||||
(void)cliBuildExceptResp(pMsg, &resp);
|
||||
// refactorr later
|
||||
resp.info.cliVer = pTransInst->compatibilityVer;
|
||||
|
||||
|
@ -1780,16 +1780,16 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
if (refId != 0) specifyConnRef(conn, true, refId);
|
||||
|
||||
transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
|
||||
transQueuePush(&conn->cliMsgs, pMsg);
|
||||
(void)transQueuePush(&conn->cliMsgs, pMsg);
|
||||
|
||||
conn->dstAddr = taosStrdup(addr);
|
||||
|
||||
uint32_t ipaddr;
|
||||
int32_t code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, fqdn, &ipaddr);
|
||||
if (code != 0) {
|
||||
uv_timer_stop(conn->timer);
|
||||
(void)uv_timer_stop(conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
|
||||
cliHandleExcept(conn, code);
|
||||
|
@ -1829,14 +1829,14 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
if (ret != 0) {
|
||||
uv_timer_stop(conn->timer);
|
||||
conn->timer->data = NULL;
|
||||
taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &conn->timer);
|
||||
conn->timer = NULL;
|
||||
|
||||
cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
|
||||
cliHandleFastFail(conn, ret);
|
||||
return;
|
||||
}
|
||||
uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
|
||||
(void)uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
|
||||
}
|
||||
tGTrace("%s conn %p ready", pTransInst->label, conn);
|
||||
}
|
||||
|
@ -1989,9 +1989,9 @@ static void cliAsyncCb(uv_async_t* handle) {
|
|||
|
||||
// batch process to avoid to lock/unlock frequently
|
||||
queue wq;
|
||||
taosThreadMutexLock(&item->mtx);
|
||||
(void)taosThreadMutexLock(&item->mtx);
|
||||
QUEUE_MOVE(&item->qmsg, &wq);
|
||||
taosThreadMutexUnlock(&item->mtx);
|
||||
(void)taosThreadMutexUnlock(&item->mtx);
|
||||
|
||||
int8_t supportBatch = pTransInst->supportBatch;
|
||||
if (supportBatch == 0) {
|
||||
|
@ -2012,9 +2012,9 @@ static void cliPrepareCb(uv_prepare_t* handle) {
|
|||
SAsyncItem* item = async->data;
|
||||
|
||||
queue wq;
|
||||
taosThreadMutexLock(&item->mtx);
|
||||
(void)taosThreadMutexLock(&item->mtx);
|
||||
QUEUE_MOVE(&item->qmsg, &wq);
|
||||
taosThreadMutexUnlock(&item->mtx);
|
||||
(void)taosThreadMutexUnlock(&item->mtx);
|
||||
|
||||
int count = 0;
|
||||
while (!QUEUE_IS_EMPTY(&wq)) {
|
||||
|
@ -2068,7 +2068,7 @@ bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) {
|
|||
tDebug("%s conn %p receive release request, refId:%" PRId64 ", may ignore", CONN_GET_INST_LABEL(conn), conn,
|
||||
conn->refId);
|
||||
|
||||
transClearBuffer(&conn->readBuf);
|
||||
(void)transClearBuffer(&conn->readBuf);
|
||||
transFreeMsg(transContFromHead((char*)pHead));
|
||||
|
||||
for (int i = 0; ahandle == 0 && i < transQueueSize(&conn->cliMsgs); i++) {
|
||||
|
@ -2243,8 +2243,8 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
if (timer == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
|
||||
}
|
||||
uv_timer_init(pThrd->loop, timer);
|
||||
taosArrayPush(pThrd->timerList, &timer);
|
||||
(void)uv_timer_init(pThrd->loop, timer);
|
||||
(void)taosArrayPush(pThrd->timerList, &timer);
|
||||
}
|
||||
|
||||
pThrd->pool = createConnPool(4);
|
||||
|
@ -2288,7 +2288,7 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
|
|||
|
||||
_end:
|
||||
if (pThrd) {
|
||||
uv_loop_close(pThrd->loop);
|
||||
(void)uv_loop_close(pThrd->loop);
|
||||
taosMemoryFree(pThrd->loop);
|
||||
taosMemoryFree(pThrd->prepare);
|
||||
taosThreadMutexDestroy(&pThrd->msgMtx);
|
||||
|
@ -2312,9 +2312,9 @@ static void destroyThrdObj(SCliThrd* pThrd) {
|
|||
return;
|
||||
}
|
||||
|
||||
taosThreadJoin(pThrd->thread, NULL);
|
||||
(void)taosThreadJoin(pThrd->thread, NULL);
|
||||
CLI_RELEASE_UV(pThrd->loop);
|
||||
taosThreadMutexDestroy(&pThrd->msgMtx);
|
||||
(void)taosThreadMutexDestroy(&pThrd->msgMtx);
|
||||
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsgWrapper, (void*)pThrd);
|
||||
transAsyncPoolDestroy(pThrd->asyncPool);
|
||||
|
||||
|
@ -2381,9 +2381,9 @@ void cliWalkCb(uv_handle_t* handle, void* arg) {
|
|||
if (uv_handle_get_type(handle) == UV_TIMER) {
|
||||
// do nothing
|
||||
} else {
|
||||
uv_read_stop((uv_stream_t*)handle);
|
||||
(void)uv_read_stop((uv_stream_t*)handle);
|
||||
}
|
||||
uv_close(handle, cliDestroy);
|
||||
(void)uv_close(handle, cliDestroy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2421,7 +2421,7 @@ static void cliSchedMsgToDebug(SCliMsg* pMsg, char* label) {
|
|||
STransConnCtx* pCtx = pMsg->ctx;
|
||||
STraceId* trace = &pMsg->msg.info.traceId;
|
||||
char tbuf[512] = {0};
|
||||
epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf));
|
||||
(void)epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf));
|
||||
tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", label, tbuf, pCtx->retryStep,
|
||||
pCtx->retryNextInterval);
|
||||
return;
|
||||
|
@ -2436,7 +2436,7 @@ static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) {
|
|||
arg->param1 = pMsg;
|
||||
arg->param2 = pThrd;
|
||||
|
||||
transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval);
|
||||
(void)transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval);
|
||||
}
|
||||
|
||||
FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) {
|
||||
|
@ -2654,7 +2654,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
|||
if (hasEpSet) {
|
||||
if (rpcDebugFlag & DEBUG_TRACE) {
|
||||
char tbuf[512] = {0};
|
||||
epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf));
|
||||
(void)epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf));
|
||||
tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn);
|
||||
}
|
||||
}
|
||||
|
@ -2666,7 +2666,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
|||
} else {
|
||||
memcpy((char*)pCtx->pRsp, (char*)pResp, sizeof(*pResp));
|
||||
}
|
||||
tsem_post(pCtx->pSem);
|
||||
(void)tsem_post(pCtx->pSem);
|
||||
pCtx->pRsp = NULL;
|
||||
} else {
|
||||
STransSyncMsg* pSyncMsg = taosAcquireRef(transGetSyncMsgMgt(), pCtx->syncMsgRef);
|
||||
|
@ -2676,8 +2676,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
|||
pSyncMsg->hasEpSet = 1;
|
||||
epsetAssign(&pSyncMsg->epSet, &pCtx->epSet);
|
||||
}
|
||||
tsem2_post(pSyncMsg->pSem);
|
||||
taosReleaseRef(transGetSyncMsgMgt(), pCtx->syncMsgRef);
|
||||
(void)tsem2_post(pSyncMsg->pSem);
|
||||
(void)taosReleaseRef(transGetSyncMsgMgt(), pCtx->syncMsgRef);
|
||||
} else {
|
||||
rpcFreeCont(pResp->pCont);
|
||||
}
|
||||
|
@ -2746,7 +2746,7 @@ static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t
|
|||
|
||||
pThrd = exh->pThrd;
|
||||
taosWUnLockLatch(&exh->latch);
|
||||
transReleaseExHandle(transGetRefMgt(), handle);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), handle);
|
||||
|
||||
return pThrd;
|
||||
}
|
||||
|
@ -2839,7 +2839,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
|
|||
SCliThrd* pThrd = transGetWorkThrd(pTransInst, handle);
|
||||
if (pThrd == NULL) {
|
||||
transFreeMsg(pReq->pCont);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return TSDB_CODE_RPC_BROKEN_LINK;
|
||||
}
|
||||
if (handle != 0) {
|
||||
|
@ -2854,19 +2854,19 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
|
|||
QUEUE_PUSH(&exh->q, &pCliMsg->seqq);
|
||||
taosWUnLockLatch(&exh->latch);
|
||||
tDebug("msg refId: %" PRId64 "", handle);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return 0;
|
||||
}
|
||||
exh->inited = 1;
|
||||
taosWUnLockLatch(&exh->latch);
|
||||
transReleaseExHandle(transGetRefMgt(), handle);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), handle);
|
||||
}
|
||||
}
|
||||
|
||||
SCliMsg* pCliMsg = NULL;
|
||||
code = transInitMsg(shandle, pEpSet, pReq, ctx, &pCliMsg);
|
||||
if (code != 0) {
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -2875,10 +2875,10 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
|
|||
EPSET_GET_INUSE_IP(pEpSet), EPSET_GET_INUSE_PORT(pEpSet), pReq->info.ahandle);
|
||||
if ((code = transAsyncSend(pThrd->asyncPool, &(pCliMsg->q))) != 0) {
|
||||
destroyCmsg(pCliMsg);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return (code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code);
|
||||
}
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2958,11 +2958,11 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
|
|||
_RETURN:
|
||||
tsem_destroy(sem);
|
||||
taosMemoryFree(sem);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
taosMemoryFree(pTransRsp);
|
||||
return code;
|
||||
_RETURN1:
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
taosMemoryFree(pTransRsp);
|
||||
taosMemoryFree(pReq->pCont);
|
||||
return code;
|
||||
|
@ -2998,7 +2998,7 @@ int32_t transCreateSyncMsg(STransMsg* pTransMsg, int64_t* refId) {
|
|||
return 0;
|
||||
|
||||
_EXIT:
|
||||
tsem2_destroy(sem);
|
||||
(void)tsem2_destroy(sem);
|
||||
taosMemoryFree(sem);
|
||||
taosMemoryFree(pSyncMsg);
|
||||
return code;
|
||||
|
@ -3083,14 +3083,14 @@ int transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq, STr
|
|||
code = 0;
|
||||
}
|
||||
_RETURN:
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
taosReleaseRef(transGetSyncMsgMgt(), ref);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)taosReleaseRef(transGetSyncMsgMgt(), ref);
|
||||
taosRemoveRef(transGetSyncMsgMgt(), ref);
|
||||
return code;
|
||||
_RETURN2:
|
||||
transFreeMsg(pReq->pCont);
|
||||
taosMemoryFree(pTransMsg);
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return code;
|
||||
}
|
||||
/*
|
||||
|
@ -3141,7 +3141,7 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
|
|||
}
|
||||
}
|
||||
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ bool transReadComplete(SConnBuffer* connBuf) {
|
|||
int transSetConnOption(uv_tcp_t* stream, int keepalive) {
|
||||
#if defined(WINDOWS) || defined(DARWIN)
|
||||
#else
|
||||
uv_tcp_keepalive(stream, 1, keepalive);
|
||||
return uv_tcp_keepalive(stream, 1, keepalive);
|
||||
#endif
|
||||
return uv_tcp_nodelay(stream, 1);
|
||||
// int ret = uv_tcp_keepalive(stream, 5, 60);
|
||||
|
@ -269,7 +269,7 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
|
|||
}
|
||||
item->pThrd = arg;
|
||||
QUEUE_INIT(&item->qmsg);
|
||||
taosThreadMutexInit(&item->mtx, NULL);
|
||||
(void)taosThreadMutexInit(&item->mtx, NULL);
|
||||
|
||||
async->data = item;
|
||||
err = uv_async_init(loop, async, cb);
|
||||
|
@ -298,7 +298,7 @@ void transAsyncPoolDestroy(SAsyncPool* pool) {
|
|||
SAsyncItem* item = async->data;
|
||||
if (item == NULL) continue;
|
||||
|
||||
taosThreadMutexDestroy(&item->mtx);
|
||||
(void)taosThreadMutexDestroy(&item->mtx);
|
||||
taosMemoryFree(item);
|
||||
}
|
||||
taosMemoryFree(pool->asyncs);
|
||||
|
@ -325,9 +325,9 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
|
|||
uv_async_t* async = &(pool->asyncs[idx]);
|
||||
SAsyncItem* item = async->data;
|
||||
|
||||
taosThreadMutexLock(&item->mtx);
|
||||
(void)taosThreadMutexLock(&item->mtx);
|
||||
QUEUE_PUSH(&item->qmsg, q);
|
||||
taosThreadMutexUnlock(&item->mtx);
|
||||
(void)taosThreadMutexUnlock(&item->mtx);
|
||||
int ret = uv_async_send(async);
|
||||
if (ret != 0) {
|
||||
tError("failed to send async,reason:%s", uv_err_name(ret));
|
||||
|
@ -391,7 +391,7 @@ void* transCtxDumpVal(STransCtx* ctx, int32_t key) {
|
|||
return NULL;
|
||||
}
|
||||
void* ret = NULL;
|
||||
(*cVal->clone)(cVal->val, &ret);
|
||||
(void)(*cVal->clone)(cVal->val, &ret);
|
||||
return ret;
|
||||
}
|
||||
void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType) {
|
||||
|
@ -399,7 +399,7 @@ void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType) {
|
|||
if (ctx->brokenVal.clone == NULL) {
|
||||
return ret;
|
||||
}
|
||||
(*ctx->brokenVal.clone)(ctx->brokenVal.val, &ret);
|
||||
(void)(*ctx->brokenVal.clone)(ctx->brokenVal.val, &ret);
|
||||
|
||||
*msgType = ctx->brokenVal.msgType;
|
||||
|
||||
|
@ -451,7 +451,7 @@ bool transQueuePush(STransQueue* queue, void* arg) {
|
|||
if (queue->q == NULL) {
|
||||
return true;
|
||||
}
|
||||
taosArrayPush(queue->q, &arg);
|
||||
(void)taosArrayPush(queue->q, &arg);
|
||||
if (taosArrayGetSize(queue->q) > 1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ static void transDQTimeout(uv_timer_t* timer) {
|
|||
}
|
||||
} while (1);
|
||||
if (timeout != 0) {
|
||||
uv_timer_start(queue->timer, transDQTimeout, timeout, 0);
|
||||
(void)uv_timer_start(queue->timer, transDQTimeout, timeout, 0);
|
||||
}
|
||||
}
|
||||
int32_t transDQCreate(uv_loop_t* loop, SDelayQueue** queue) {
|
||||
|
@ -610,7 +610,7 @@ void transDQDestroy(SDelayQueue* queue, void (*freeFunc)(void* arg)) {
|
|||
taosMemoryFree(queue);
|
||||
}
|
||||
void transDQCancel(SDelayQueue* queue, SDelayTask* task) {
|
||||
uv_timer_stop(queue->timer);
|
||||
(void)uv_timer_stop(queue->timer);
|
||||
|
||||
if (heapSize(queue->heap) <= 0) {
|
||||
taosMemoryFree(task->arg);
|
||||
|
@ -630,7 +630,7 @@ void transDQCancel(SDelayQueue* queue, SDelayTask* task) {
|
|||
SDelayTask* task = container_of(minNode, SDelayTask, node);
|
||||
uint64_t timeout = now > task->execTime ? now - task->execTime : 0;
|
||||
|
||||
uv_timer_start(queue->timer, transDQTimeout, timeout, 0);
|
||||
(void)uv_timer_start(queue->timer, transDQTimeout, timeout, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ SDelayTask* transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg,
|
|||
|
||||
tTrace("timer %p put task into delay queue, timeoutMs:%" PRIu64, queue->timer, timeoutMs);
|
||||
heapInsert(queue->heap, &task->node);
|
||||
uv_timer_start(queue->timer, transDQTimeout, timeoutMs, 0);
|
||||
(void)uv_timer_start(queue->timer, transDQTimeout, timeoutMs, 0);
|
||||
return task;
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ static void transInitEnv() {
|
|||
refMgt = transOpenRefMgt(50000, transDestroyExHandle);
|
||||
instMgt = taosOpenRef(50, rpcCloseImpl);
|
||||
transSyncMsgMgt = taosOpenRef(50, transDestroySyncMsg);
|
||||
uv_os_setenv("UV_TCP_SINGLE_ACCEPT", "1");
|
||||
(void)uv_os_setenv("UV_TCP_SINGLE_ACCEPT", "1");
|
||||
}
|
||||
static void transDestroyEnv() {
|
||||
transCloseRefMgt(refMgt);
|
||||
|
@ -734,7 +734,7 @@ int32_t transOpenRefMgt(int size, void (*func)(void*)) {
|
|||
}
|
||||
void transCloseRefMgt(int32_t mgt) {
|
||||
// close ref
|
||||
taosCloseRef(mgt);
|
||||
(void)taosCloseRef(mgt);
|
||||
}
|
||||
int64_t transAddExHandle(int32_t refMgt, void* p) {
|
||||
// acquire extern handle
|
||||
|
@ -769,7 +769,7 @@ void transDestroySyncMsg(void* msg) {
|
|||
if (msg == NULL) return;
|
||||
|
||||
STransSyncMsg* pSyncMsg = msg;
|
||||
tsem2_destroy(pSyncMsg->pSem);
|
||||
(void)tsem2_destroy(pSyncMsg->pSem);
|
||||
taosMemoryFree(pSyncMsg->pSem);
|
||||
transFreeMsg(pSyncMsg->pRsp->pCont);
|
||||
taosMemoryFree(pSyncMsg->pRsp);
|
||||
|
|
|
@ -186,9 +186,9 @@ static int32_t addHandleToAcceptloop(void* arg);
|
|||
|
||||
#define SRV_RELEASE_UV(loop) \
|
||||
do { \
|
||||
uv_walk(loop, uvWalkCb, NULL); \
|
||||
uv_run(loop, UV_RUN_DEFAULT); \
|
||||
uv_loop_close(loop); \
|
||||
(void)uv_walk(loop, uvWalkCb, NULL); \
|
||||
(void)uv_run(loop, UV_RUN_DEFAULT); \
|
||||
(void)uv_loop_close(loop); \
|
||||
} while (0);
|
||||
|
||||
#define ASYNC_ERR_JRET(thrd) \
|
||||
|
@ -484,7 +484,7 @@ static bool uvHandleReq(SSvrConn* pConn) {
|
|||
pConnInfo->clientPort = pConn->port;
|
||||
tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user));
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), pConn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), pConn->refId);
|
||||
|
||||
(*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
|
||||
return true;
|
||||
|
@ -578,7 +578,7 @@ void uvOnSendCb(uv_write_t* req, int status) {
|
|||
(pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL);
|
||||
memset(&conn->regArg, 0, sizeof(conn->regArg));
|
||||
}
|
||||
transQueuePop(&conn->srvMsgs);
|
||||
(void)transQueuePop(&conn->srvMsgs);
|
||||
taosMemoryFree(msg);
|
||||
|
||||
msg = (SSvrMsg*)transQueueGet(&conn->srvMsgs, 0);
|
||||
|
@ -634,7 +634,7 @@ static int uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
|
|||
|
||||
// handle invalid drop_task resp, TD-20098
|
||||
if (pConn->inType == TDMT_SCH_DROP_TASK && pMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
|
||||
transQueuePop(&pConn->srvMsgs);
|
||||
(void)transQueuePop(&pConn->srvMsgs);
|
||||
destroySmsg(smsg);
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) {
|
|||
|
||||
transRefSrvHandle(pConn);
|
||||
uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
|
||||
uv_write(req, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb);
|
||||
(void)uv_write(req, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb);
|
||||
}
|
||||
static void uvStartSendResp(SSvrMsg* smsg) {
|
||||
// impl
|
||||
|
@ -742,9 +742,9 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
|
|||
queue wq;
|
||||
|
||||
// batch process to avoid to lock/unlock frequently
|
||||
taosThreadMutexLock(&item->mtx);
|
||||
(void)taosThreadMutexLock(&item->mtx);
|
||||
QUEUE_MOVE(&item->qmsg, &wq);
|
||||
taosThreadMutexUnlock(&item->mtx);
|
||||
(void)taosThreadMutexUnlock(&item->mtx);
|
||||
|
||||
while (!QUEUE_IS_EMPTY(&wq)) {
|
||||
queue* head = QUEUE_HEAD(&wq);
|
||||
|
@ -767,12 +767,12 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
|
|||
SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), refId);
|
||||
if (exh2 == NULL || exh1 != exh2) {
|
||||
tTrace("handle except msg %p, ignore it", exh1);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
destroySmsg(msg);
|
||||
continue;
|
||||
}
|
||||
msg->pConn = exh1->handle;
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(*transAsyncHandle[msg->type])(msg, pThrd);
|
||||
}
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ static bool uvRecvReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) {
|
|||
tTrace("conn %p received release request", pConn);
|
||||
|
||||
STraceId traceId = pHead->traceId;
|
||||
transClearBuffer(&pConn->readBuf);
|
||||
(void)transClearBuffer(&pConn->readBuf);
|
||||
transFreeMsg(transContFromHead((char*)pHead));
|
||||
if (pConn->status != ConnAcquire) {
|
||||
return true;
|
||||
|
@ -846,9 +846,9 @@ static void uvPrepareCb(uv_prepare_t* handle) {
|
|||
SAsyncItem* item = async->data;
|
||||
|
||||
queue wq;
|
||||
taosThreadMutexLock(&item->mtx);
|
||||
(void)taosThreadMutexLock(&item->mtx);
|
||||
QUEUE_MOVE(&item->qmsg, &wq);
|
||||
taosThreadMutexUnlock(&item->mtx);
|
||||
(void)taosThreadMutexUnlock(&item->mtx);
|
||||
|
||||
while (!QUEUE_IS_EMPTY(&wq)) {
|
||||
queue* head = QUEUE_HEAD(&wq);
|
||||
|
@ -871,12 +871,12 @@ static void uvPrepareCb(uv_prepare_t* handle) {
|
|||
SExHandle* exh2 = transAcquireExHandle(transGetRefMgt(), refId);
|
||||
if (exh2 == NULL || exh1 != exh2) {
|
||||
tTrace("handle except msg %p, ignore it", exh1);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
destroySmsg(msg);
|
||||
continue;
|
||||
}
|
||||
msg->pConn = exh1->handle;
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(*transAsyncHandle[msg->type])(msg, pThrd);
|
||||
}
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
|
|||
|
||||
tTrace("new connection accepted by main server, dispatch to %dth worker-thread", pObj->workerIdx);
|
||||
|
||||
uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb);
|
||||
(void)uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb);
|
||||
} else {
|
||||
if (!uv_is_closing((uv_handle_t*)cli)) {
|
||||
tError("failed to accept tcp: %s", uv_err_name(err));
|
||||
|
@ -995,7 +995,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
|
|||
|
||||
if (uv_accept(q, (uv_stream_t*)(pConn->pTcp)) == 0) {
|
||||
uv_os_fd_t fd;
|
||||
uv_fileno((const uv_handle_t*)pConn->pTcp, &fd);
|
||||
(void)uv_fileno((const uv_handle_t*)pConn->pTcp, &fd);
|
||||
tTrace("conn %p created, fd:%d", pConn, fd);
|
||||
|
||||
struct sockaddr peername, sockname;
|
||||
|
@ -1005,7 +1005,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
|
|||
transUnrefSrvHandle(pConn);
|
||||
return;
|
||||
}
|
||||
transSockInfo2Str(&peername, pConn->dst);
|
||||
(void)transSockInfo2Str(&peername, pConn->dst);
|
||||
|
||||
addrlen = sizeof(sockname);
|
||||
if (0 != uv_tcp_getsockname(pConn->pTcp, (struct sockaddr*)&sockname, &addrlen)) {
|
||||
|
@ -1013,7 +1013,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
|
|||
transUnrefSrvHandle(pConn);
|
||||
return;
|
||||
}
|
||||
transSockInfo2Str(&sockname, pConn->src);
|
||||
(void)transSockInfo2Str(&sockname, pConn->src);
|
||||
|
||||
struct sockaddr_in addr = *(struct sockaddr_in*)&peername;
|
||||
struct sockaddr_in saddr = *(struct sockaddr_in*)&sockname;
|
||||
|
@ -1022,7 +1022,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
|
|||
pConn->serverIp = saddr.sin_addr.s_addr;
|
||||
pConn->port = ntohs(addr.sin_port);
|
||||
|
||||
uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb);
|
||||
(void)uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb);
|
||||
|
||||
} else {
|
||||
tDebug("failed to create new connection");
|
||||
|
@ -1034,7 +1034,7 @@ void* transAcceptThread(void* arg) {
|
|||
// opt
|
||||
setThreadName("trans-accept");
|
||||
SServerObj* srv = (SServerObj*)arg;
|
||||
uv_run(srv->loop, UV_RUN_DEFAULT);
|
||||
(void)uv_run(srv->loop, UV_RUN_DEFAULT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1043,7 +1043,7 @@ void uvOnPipeConnectionCb(uv_connect_t* connect, int status) {
|
|||
return;
|
||||
}
|
||||
SWorkThrd* pThrd = container_of(connect, SWorkThrd, connect_req);
|
||||
uv_read_start((uv_stream_t*)pThrd->pipe, uvAllocConnBufferCb, uvOnConnectionCb);
|
||||
(void)uv_read_start((uv_stream_t*)pThrd->pipe, uvAllocConnBufferCb, uvOnConnectionCb);
|
||||
}
|
||||
static int32_t addHandleToWorkloop(SWorkThrd* pThrd, char* pipeName) {
|
||||
int32_t code = 0;
|
||||
|
@ -1165,7 +1165,7 @@ static int32_t addHandleToAcceptloop(void* arg) {
|
|||
void* transWorkerThread(void* arg) {
|
||||
setThreadName("trans-svr-work");
|
||||
SWorkThrd* pThrd = (SWorkThrd*)arg;
|
||||
uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
||||
(void)uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
_end:
|
||||
if (pConn) {
|
||||
transQueueDestroy(&pConn->srvMsgs);
|
||||
transDestroyBuffer(&pConn->readBuf);
|
||||
(void)transDestroyBuffer(&pConn->readBuf);
|
||||
taosMemoryFree(pConn->pTcp);
|
||||
taosMemoryFree(pConn);
|
||||
pConn = NULL;
|
||||
|
@ -1271,8 +1271,8 @@ static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn) {
|
|||
}
|
||||
static int32_t reallocConnRef(SSvrConn* conn) {
|
||||
if (conn->refId > 0) {
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
}
|
||||
// avoid app continue to send msg on invalid handle
|
||||
SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle));
|
||||
|
@ -1308,8 +1308,8 @@ static void uvDestroyConn(uv_handle_t* handle) {
|
|||
}
|
||||
SWorkThrd* thrd = conn->hostThrd;
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), conn->refId);
|
||||
(void)transRemoveExHandle(transGetRefMgt(), conn->refId);
|
||||
|
||||
STrans* pTransInst = thrd->pTransInst;
|
||||
tDebug("%s conn %p destroy", transLabel(pTransInst), conn);
|
||||
|
@ -1324,7 +1324,7 @@ static void uvDestroyConn(uv_handle_t* handle) {
|
|||
QUEUE_REMOVE(&conn->queue);
|
||||
taosMemoryFree(conn->pTcp);
|
||||
destroyConnRegArg(conn);
|
||||
transDestroyBuffer(&conn->readBuf);
|
||||
(void)transDestroyBuffer(&conn->readBuf);
|
||||
taosMemoryFree(conn);
|
||||
|
||||
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
|
||||
|
@ -1578,7 +1578,7 @@ void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd) {
|
|||
if (!transQueuePush(&conn->srvMsgs, msg)) {
|
||||
return;
|
||||
}
|
||||
transQueuePop(&conn->srvMsgs);
|
||||
(void)transQueuePop(&conn->srvMsgs);
|
||||
|
||||
if (conn->regArg.init) {
|
||||
transFreeMsg(conn->regArg.msg.pCont);
|
||||
|
@ -1640,7 +1640,7 @@ void destroyWorkThrd(SWorkThrd* pThrd) {
|
|||
if (pThrd == NULL) {
|
||||
return;
|
||||
}
|
||||
taosThreadJoin(pThrd->thread, NULL);
|
||||
(void)taosThreadJoin(pThrd->thread, NULL);
|
||||
SRV_RELEASE_UV(pThrd->loop);
|
||||
TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsgWrapper, NULL);
|
||||
transAsyncPoolDestroy(pThrd->asyncPool);
|
||||
|
@ -1655,7 +1655,7 @@ void sendQuitToWorkThrd(SWorkThrd* pThrd) {
|
|||
SSvrMsg* msg = taosMemoryCalloc(1, sizeof(SSvrMsg));
|
||||
msg->type = Quit;
|
||||
tDebug("server send quit msg to work thread");
|
||||
transAsyncSend(pThrd->asyncPool, &msg->q);
|
||||
(void)transAsyncSend(pThrd->asyncPool, &msg->q);
|
||||
}
|
||||
|
||||
void transCloseServer(void* arg) {
|
||||
|
@ -1664,8 +1664,8 @@ void transCloseServer(void* arg) {
|
|||
|
||||
if (srv->inited) {
|
||||
tDebug("send quit msg to accept thread");
|
||||
uv_async_send(srv->pAcceptAsync);
|
||||
taosThreadJoin(srv->thread, NULL);
|
||||
(void)uv_async_send(srv->pAcceptAsync);
|
||||
(void)taosThreadJoin(srv->thread, NULL);
|
||||
SRV_RELEASE_UV(srv->loop);
|
||||
|
||||
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||
|
@ -1732,15 +1732,15 @@ int transReleaseSrvHandle(void* handle) {
|
|||
tDebug("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle);
|
||||
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
|
||||
destroySmsg(m);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
}
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return 0;
|
||||
_return1:
|
||||
tDebug("handle %p failed to send to release handle", exh);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
_return2:
|
||||
tDebug("handle %p failed to send to release handle", exh);
|
||||
|
@ -1783,17 +1783,17 @@ int transSendResponse(const STransMsg* msg) {
|
|||
tGDebug("conn %p start to send resp (1/2)", exh->handle);
|
||||
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
|
||||
destroySmsg(m);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
}
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return 0;
|
||||
|
||||
_return1:
|
||||
tDebug("handle %p failed to send resp", exh);
|
||||
rpcFreeCont(msg->pCont);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
_return2:
|
||||
tDebug("handle %p failed to send resp", exh);
|
||||
|
@ -1828,17 +1828,17 @@ int transRegisterMsg(const STransMsg* msg) {
|
|||
tDebug("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle);
|
||||
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
|
||||
destroySmsg(m);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
}
|
||||
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return 0;
|
||||
|
||||
_return1:
|
||||
tDebug("handle %p failed to register brokenlink", exh);
|
||||
rpcFreeCont(msg->pCont);
|
||||
transReleaseExHandle(transGetRefMgt(), refId);
|
||||
(void)transReleaseExHandle(transGetRefMgt(), refId);
|
||||
return code;
|
||||
_return2:
|
||||
tDebug("handle %p failed to register brokenlink", exh);
|
||||
|
@ -1883,7 +1883,7 @@ int32_t transSetIpWhiteList(void* thandle, void* arg, FilteFunc* func) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
transReleaseExHandle(transGetInstMgt(), (int64_t)thandle);
|
||||
(void)transReleaseExHandle(transGetInstMgt(), (int64_t)thandle);
|
||||
|
||||
if (code != 0) {
|
||||
tError("ip-white-list update failed since %s", tstrerror(code));
|
||||
|
|
Loading…
Reference in New Issue