refact: remove the return value of function taosCloseRef

This commit is contained in:
Shengliang Guan 2024-08-19 17:30:10 +08:00
parent 55f7b7d771
commit 5ce7bcad1e
14 changed files with 19 additions and 25 deletions

1
.gitignore vendored
View File

@ -134,3 +134,4 @@ tags
.clangd
*CMakeCache*
*CMakeFiles*
.history/

View File

@ -29,8 +29,7 @@ typedef void (*RefFp)(void *);
int32_t taosOpenRef(int32_t max, RefFp fp);
// close the reference set, refId is the return value by taosOpenRef
// return 0 if success. On error, -1 is returned, and terrno is set appropriately
int32_t taosCloseRef(int32_t rsetId);
void taosCloseRef(int32_t rsetId);
// add ref, p is the pointer to resource or pointer ID
// return Reference ID(rid) allocated. On error, -1 is returned, and terrno is set appropriately

View File

@ -74,15 +74,11 @@ void taos_cleanup(void) {
int32_t id = clientReqRefPool;
clientReqRefPool = -1;
if (TSDB_CODE_SUCCESS != taosCloseRef(id)) {
tscWarn("failed to close clientReqRefPool");
}
taosCloseRef(id);
id = clientConnRefPool;
clientConnRefPool = -1;
if (TSDB_CODE_SUCCESS != taosCloseRef(id)) {
tscWarn("failed to close clientReqRefPool");
}
taosCloseRef(id);
nodesDestroyAllocatorSet();
cleanupAppInfo();

View File

@ -1184,7 +1184,7 @@ void tmqMgmtClose(void) {
}
if (tmqMgmt.rsetId >= 0) {
(void)taosCloseRef(tmqMgmt.rsetId);
taosCloseRef(tmqMgmt.rsetId);
tmqMgmt.rsetId = -1;
}
}

View File

@ -69,7 +69,7 @@ int32_t smaInit() {
if (!smaMgmt.refHash || !smaMgmt.tmrHandle) {
code = terrno;
(void)taosCloseRef(smaMgmt.rsetId);
taosCloseRef(smaMgmt.rsetId);
if (smaMgmt.refHash) {
taosHashCleanup(smaMgmt.refHash);
smaMgmt.refHash = NULL;
@ -103,7 +103,7 @@ void smaCleanUp() {
}
if (old == 1) {
(void)taosCloseRef(smaMgmt.rsetId);
taosCloseRef(smaMgmt.rsetId);
taosHashCleanup(smaMgmt.refHash);
smaMgmt.refHash = NULL;
taosTmrCleanUp(smaMgmt.tmrHandle);

View File

@ -31,7 +31,7 @@ int32_t exchangeObjRefPool = -1;
static void cleanupRefPool() {
int32_t ref = atomic_val_compare_exchange_32(&exchangeObjRefPool, exchangeObjRefPool, 0);
(void)taosCloseRef(ref);
taosCloseRef(ref);
}
static void initRefPool() {

View File

@ -74,7 +74,7 @@ void indexCleanup() {
// refacto later
taosCleanUpScheduler(indexQhandle);
taosMemoryFreeClear(indexQhandle);
(void)taosCloseRef(indexRefMgt);
taosCloseRef(indexRefMgt);
}
typedef struct SIdxColInfo {

View File

@ -238,7 +238,7 @@ void nodesDestroyAllocatorSet() {
(void)taosRemoveRef(g_allocatorReqRefPool, refId);
pAllocator = taosIterateRef(g_allocatorReqRefPool, refId);
}
(void)taosCloseRef(g_allocatorReqRefPool);
taosCloseRef(g_allocatorReqRefPool);
}
}

View File

@ -564,7 +564,7 @@ int32_t qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx) {
void qwCloseRef(void) {
taosWLockLatch(&gQwMgmt.lock);
if (atomic_load_32(&gQwMgmt.qwNum) <= 0 && gQwMgmt.qwRef >= 0) {
(void)taosCloseRef(gQwMgmt.qwRef); // ignore error
taosCloseRef(gQwMgmt.qwRef); // ignore error
gQwMgmt.qwRef = -1;
}
taosWUnLockLatch(&gQwMgmt.lock);

View File

@ -273,7 +273,7 @@ void schCloseJobRef(void) {
}
if (schMgmt.jobRef >= 0) {
(void)taosCloseRef(schMgmt.jobRef);
taosCloseRef(schMgmt.jobRef);
schMgmt.jobRef = -1;
}
}

View File

@ -65,9 +65,9 @@ static void streamMetaEnvInit() {
void streamMetaInit() { (void)taosThreadOnce(&streamMetaModuleInit, streamMetaEnvInit); }
void streamMetaCleanup() {
(void)taosCloseRef(streamBackendId);
(void)taosCloseRef(streamBackendCfWrapperId);
(void)taosCloseRef(streamMetaId);
taosCloseRef(streamBackendId);
taosCloseRef(streamBackendCfWrapperId);
taosCloseRef(streamMetaId);
metaRefMgtCleanup();
streamTimerCleanUp();

View File

@ -736,7 +736,7 @@ int32_t transOpenRefMgt(int size, void (*func)(void*)) {
}
void transCloseRefMgt(int32_t mgt) {
// close ref
(void)taosCloseRef(mgt);
taosCloseRef(mgt);
}
int64_t transAddExHandle(int32_t refMgt, void* p) {
// acquire extern handle

View File

@ -75,7 +75,7 @@ void walCleanUp() {
if (old == 1) {
walStopThread();
TAOS_UNUSED(taosCloseRef(tsWal.refSetId));
taosCloseRef(tsWal.refSetId);
wInfo("wal module is cleaned up");
atomic_store_8(&tsWal.inited, 0);
}

View File

@ -110,13 +110,13 @@ int32_t taosOpenRef(int32_t max, RefFp fp) {
return rsetId;
}
int32_t taosCloseRef(int32_t rsetId) {
void taosCloseRef(int32_t rsetId) {
SRefSet *pSet;
int32_t deleted = 0;
if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
uTrace("rsetId:%d is invalid, out of range", rsetId);
return terrno = TSDB_CODE_REF_INVALID_ID;
return;
}
pSet = tsRefSetList + rsetId;
@ -134,8 +134,6 @@ int32_t taosCloseRef(int32_t rsetId) {
(void)taosThreadMutexUnlock(&tsRefMutex);
if (deleted) taosDecRsetCount(pSet);
return 0;
}
int64_t taosAddRef(int32_t rsetId, void *p) {