chore: fs merge optimization for data migrate
This commit is contained in:
parent
b78a39ced1
commit
d3c335a06e
|
@ -221,22 +221,31 @@ _commit_conflict_check:
|
||||||
_merge_fs:
|
_merge_fs:
|
||||||
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
taosThreadRwlockWrlock(&pTsdb->rwLock);
|
||||||
|
|
||||||
if ((code = tsdbFSCopy(pTsdb, &fsLatest))) {
|
// 1) prepare fs, merge tsdbFSNew and pTsdb->fs if needed
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
STsdbFS *pTsdbFS = &fs;
|
||||||
goto _exit;
|
ASSERT(fs.version <= pTsdb->fs.version);
|
||||||
}
|
|
||||||
// 1) merge tsdbFSNew and pTsdb->fs
|
if (fs.version < pTsdb->fs.version) {
|
||||||
if ((code = tsdbFSUpdDel(pTsdb, &fsLatest, &fs, maxFid))) {
|
if ((code = tsdbFSCopy(pTsdb, &fsLatest))) {
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((code = tsdbFSUpdDel(pTsdb, &fsLatest, &fs, maxFid))) {
|
||||||
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
pTsdbFS = &fsLatest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) save CURRENT
|
// 2) save CURRENT
|
||||||
if ((code = tsdbFSCommit1(pTsdb, &fsLatest))) {
|
if ((code = tsdbFSCommit1(pTsdb, pTsdbFS))) {
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) apply the tsdbFS to pTsdb->fs
|
// 3) apply the tsdbFS to pTsdb->fs
|
||||||
if ((code = tsdbFSCommit2(pTsdb, &fsLatest))) {
|
if ((code = tsdbFSCommit2(pTsdb, pTsdbFS))) {
|
||||||
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
taosThreadRwlockUnlock(&pTsdb->rwLock);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue