chore: code optimization for fs destroy

This commit is contained in:
Cary Xu 2022-09-23 17:27:48 +08:00
parent e792c66307
commit 797b9376e7
3 changed files with 8 additions and 5 deletions

View File

@ -322,6 +322,7 @@ struct STsdbFS {
struct STsdbTrimHdl {
volatile int8_t state; // 0 idle 1 in use
volatile int8_t limitSpeed; // 0 no limit, 1 with limit
volatile int32_t maxRetentFid;
volatile int32_t minCommitFid;
};

View File

@ -250,7 +250,7 @@ _err:
void tsdbFSDestroy(STsdbFS *pFS) {
if (pFS->pDelFile) {
taosMemoryFree(pFS->pDelFile);
taosMemoryFreeClear(pFS->pDelFile);
}
for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->aDFileSet); iSet++) {
@ -263,7 +263,7 @@ void tsdbFSDestroy(STsdbFS *pFS) {
}
}
taosArrayDestroy(pFS->aDFileSet);
pFS->aDFileSet = taosArrayDestroy(pFS->aDFileSet);
}
static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {

View File

@ -174,6 +174,8 @@ _migrate_loop:
// reset
maxFid = INT32_MIN;
fSize = 0;
tsdbFSDestroy(&fs);
tsdbFSDestroy(&fsLatest);
code = tsdbFSCopy(pTsdb, &fs);
if (code) goto _exit;
@ -275,9 +277,9 @@ _merge_fs:
}
taosThreadRwlockUnlock(&pTsdb->rwLock);
tsdbFSDestroy(&fs);
_exit:
tsdbFSDestroy(&fs);
tsdbFSDestroy(&fsLatest);
if (code != 0) {
tsdbError("vgId:%d, tsdb do retention(migrate) failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
ASSERT(0);