fix: upgrade error when has tomb data

This commit is contained in:
Hongze Cheng 2023-09-26 09:23:22 +08:00
parent 01618a4862
commit 03456ce443
3 changed files with 5 additions and 0 deletions

View File

@ -165,6 +165,8 @@ static FORCE_INLINE int32_t tarray2SortInsert(void *arr, const void *elePtr, int
#define TARRAY2_FOREACH_PTR_REVERSE(a, ep) \
for (int32_t __i = (a)->size - 1; __i >= 0 && ((ep) = &(a)->data[__i], 1); __i--)
#define TARRAY2_SORT(a, cmp) taosSort((a)->data, (a)->size, sizeof((a)->data[0]), (__compar_fn_t)cmp)
#ifdef __cplusplus
}
#endif

View File

@ -236,6 +236,7 @@ static int32_t load_fs(STsdb *pTsdb, const char *fname, TFileSetArray *arr) {
code = TARRAY2_APPEND(arr, fset);
TSDB_CHECK_CODE(code, lino, _exit);
}
TARRAY2_SORT(arr, tsdbTFileSetCmprFn);
} else {
code = TSDB_CODE_FILE_CORRUPTED;
TSDB_CHECK_CODE(code, lino, _exit);

View File

@ -189,6 +189,7 @@ static int32_t tsdbJsonToSttLvl(STsdb *pTsdb, const cJSON *json, SSttLvl **lvl)
code = TARRAY2_APPEND(lvl[0]->fobjArr, fobj);
if (code) return code;
}
TARRAY2_SORT(lvl[0]->fobjArr, tsdbTFileObjCmpr);
return 0;
}
@ -268,6 +269,7 @@ int32_t tsdbJsonToTFileSet(STsdb *pTsdb, const cJSON *json, STFileSet **fset) {
code = TARRAY2_APPEND((*fset)->lvlArr, lvl);
if (code) return code;
}
TARRAY2_SORT((*fset)->lvlArr, tsdbSttLvlCmprFn);
} else {
return TSDB_CODE_FILE_CORRUPTED;
}