fix: upgrade error when has tomb data
This commit is contained in:
parent
01618a4862
commit
03456ce443
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue