fix unit test

This commit is contained in:
yihaoDeng 2024-08-30 18:34:09 +08:00
parent a1db09a360
commit 0417c8facc
3 changed files with 12 additions and 6 deletions

View File

@ -569,10 +569,11 @@ static int32_t idxMayMergeTempToFinalRslt(SArray* result, TFileValue* tfv, SIdxT
indexFatal("failed to merge result since %s", tstrerror(code));
}
} else {
return TSDB_CODE_INVALID_PARA;
return 0;
}
} else {
if (taosArrayPush(result, &tfv) == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
return code;
@ -736,6 +737,9 @@ _exception:
idxPost(sIdx);
}
idxReleaseRef(sIdx->refId);
if (code != 0) {
indexError("failed to merge since %s", tstrerror(code));
}
return code;
}

View File

@ -133,9 +133,10 @@ TFileCache* tfileCacheCreate(SIndex* idx, const char* path) {
int32_t sz = idxSerialCacheKey(&key, buf);
code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
if (code != 0) {
tfileReaderRef(reader);
tfileReaderDestroy(reader);
goto End;
}
tfileReaderRef(reader);
}
taosArrayDestroyEx(files, tfileDestroyFileName);
return tcache;
@ -172,6 +173,7 @@ TFileReader* tfileCacheGet(TFileCache* tcache, ICacheKey* key) {
return *reader;
}
int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
int32_t code = 0;
@ -192,9 +194,7 @@ int32_t tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
}
code = taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
if (code == 0) {
tfileReaderRef(reader);
}
tfileReaderRef(reader);
return code;
}
int32_t tfileReaderCreate(IFileCtx* ctx, TFileReader** pReader) {

View File

@ -214,7 +214,9 @@ int32_t idxTRsltMergeTo(SIdxTRslt *tr, SArray *result) {
if (taosArrayGetSize(tr->total) == 0 || taosArrayGetSize(tr->add) == 0) {
SArray *t = taosArrayGetSize(tr->total) == 0 ? tr->add : tr->total;
(void)taosArrayAddAll(result, t);
if (taosArrayAddAll(result, t) == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
} else {
SArray *arrs = taosArrayInit(2, sizeof(void *));
if (arrs == NULL) {