chore: code optimization for fs destroy
This commit is contained in:
parent
e792c66307
commit
797b9376e7
|
@ -321,7 +321,8 @@ struct STsdbFS {
|
|||
};
|
||||
|
||||
struct STsdbTrimHdl {
|
||||
volatile int8_t state; // 0 idle 1 in use
|
||||
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;
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue