From 856990c64b0a9d0392fa2c86e2da86fc3ac5c4b6 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 5 Jul 2022 10:40:14 +0800 Subject: [PATCH] fix tag error --- source/libs/index/src/index.c | 27 +++++++-------------------- source/libs/index/src/indexFilter.c | 1 + 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index 9244e1c30c..26c47aab93 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -63,7 +63,7 @@ static void indexDestroy(void* sIdx); void indexInit() { // refactor later indexQhandle = taosInitScheduler(INDEX_QUEUE_SIZE, INDEX_NUM_OF_THREADS, "index"); - indexRefMgt = taosOpenRef(10, indexDestroy); + indexRefMgt = taosOpenRef(1000, indexDestroy); } void indexCleanUp() { // refacto later @@ -100,15 +100,16 @@ static void indexWait(void* idx) { } int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) { + int ret = TSDB_CODE_SUCCESS; taosThreadOnce(&isInit, indexInit); SIndex* sIdx = taosMemoryCalloc(1, sizeof(SIndex)); if (sIdx == NULL) { - return -1; + return TSDB_CODE_OUT_OF_MEMORY; } - // sIdx->cache = (void*)idxCacheCreate(sIdx); sIdx->tindex = idxTFileCreate(path); if (sIdx->tindex == NULL) { + ret = TSDB_CODE_OUT_OF_MEMORY; goto END; } @@ -122,14 +123,14 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) { idxAcquireRef(sIdx->refId); *index = sIdx; - return 0; + return ret; END: if (sIdx != NULL) { indexClose(sIdx); } *index = NULL; - return -1; + return ret; } void indexDestroy(void* handle) { @@ -272,18 +273,6 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy tm->operType = oper; tm->colType = colType; -#if 0 - tm->colName = (char*)taosMemoryCalloc(1, nColName + 1); - memcpy(tm->colName, colName, nColName); - tm->nColName = nColName; - - tm->colVal = (char*)taosMemoryCalloc(1, nColVal + 1); - memcpy(tm->colVal, colVal, nColVal); - tm->nColVal = nColVal; -#endif - -#if 1 - tm->colName = (char*)taosMemoryCalloc(1, nColName + 1); memcpy(tm->colName, colName, nColName); tm->nColName = nColName; @@ -295,8 +284,6 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy tm->colVal = buf; tm->nColVal = len; -#endif - return tm; } @@ -325,7 +312,7 @@ void indexMultiTermDestroy(SIndexMultiTerm* terms) { */ static void idxSchedRebuildIdx(SSchedMsg* msg) { - // TODO + // TODO, no need rebuild index SIndex* idx = msg->ahandle; int8_t st = kFinished; diff --git a/source/libs/index/src/indexFilter.c b/source/libs/index/src/indexFilter.c index c12c776cef..0b29c8d704 100644 --- a/source/libs/index/src/indexFilter.c +++ b/source/libs/index/src/indexFilter.c @@ -752,6 +752,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result, taosArrayAddAll(result, param.result); sifFreeParam(¶m); + *status = st; return TSDB_CODE_SUCCESS; } -- GitLab