chore: code optimization for fs destroy
This commit is contained in:
parent
e792c66307
commit
797b9376e7
|
@ -322,6 +322,7 @@ struct STsdbFS {
|
||||||
|
|
||||||
struct STsdbTrimHdl {
|
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 maxRetentFid;
|
||||||
volatile int32_t minCommitFid;
|
volatile int32_t minCommitFid;
|
||||||
};
|
};
|
||||||
|
|
|
@ -250,7 +250,7 @@ _err:
|
||||||
|
|
||||||
void tsdbFSDestroy(STsdbFS *pFS) {
|
void tsdbFSDestroy(STsdbFS *pFS) {
|
||||||
if (pFS->pDelFile) {
|
if (pFS->pDelFile) {
|
||||||
taosMemoryFree(pFS->pDelFile);
|
taosMemoryFreeClear(pFS->pDelFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->aDFileSet); iSet++) {
|
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) {
|
static int32_t tsdbScanAndTryFixFS(STsdb *pTsdb) {
|
||||||
|
|
|
@ -174,6 +174,8 @@ _migrate_loop:
|
||||||
// reset
|
// reset
|
||||||
maxFid = INT32_MIN;
|
maxFid = INT32_MIN;
|
||||||
fSize = 0;
|
fSize = 0;
|
||||||
|
tsdbFSDestroy(&fs);
|
||||||
|
tsdbFSDestroy(&fsLatest);
|
||||||
|
|
||||||
code = tsdbFSCopy(pTsdb, &fs);
|
code = tsdbFSCopy(pTsdb, &fs);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
|
@ -275,9 +277,9 @@ _merge_fs:
|
||||||
}
|
}
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
|
|
||||||
tsdbFSDestroy(&fs);
|
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
tsdbFSDestroy(&fs);
|
||||||
|
tsdbFSDestroy(&fsLatest);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
tsdbError("vgId:%d, tsdb do retention(migrate) failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
tsdbError("vgId:%d, tsdb do retention(migrate) failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
|
|
Loading…
Reference in New Issue