more code
This commit is contained in:
parent
2acfc81c8b
commit
61cfacd8c2
|
@ -388,7 +388,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
|
||||||
SLastFile fLast;
|
SLastFile fLast;
|
||||||
SDFileSet wSet = {0};
|
SDFileSet wSet = {0};
|
||||||
if (pRSet) {
|
if (pRSet) {
|
||||||
ASSERT(pRSet->nLastF < pCommitter->maxLast);
|
ASSERT(pCommitter->maxLast == 1 || pRSet->nLastF < pCommitter->maxLast);
|
||||||
|
|
||||||
fHead = (SHeadFile){.commitID = pCommitter->commitID};
|
fHead = (SHeadFile){.commitID = pCommitter->commitID};
|
||||||
fData = *pRSet->pDataF;
|
fData = *pRSet->pDataF;
|
||||||
|
|
|
@ -650,7 +650,9 @@ int32_t tsdbFSUpsertFSet(STsdbFS *pFS, SDFileSet *pSet) {
|
||||||
*pDFileSet->aLastF[0] = *pSet->aLastF[0];
|
*pDFileSet->aLastF[0] = *pSet->aLastF[0];
|
||||||
pDFileSet->nLastF = 1;
|
pDFileSet->nLastF = 1;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(0);
|
for (int32_t iLast = 0; iLast < pSet->nLastF; iLast++) {
|
||||||
|
*pDFileSet->aLastF[iLast] = *pSet->aLastF[iLast];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goto _exit;
|
goto _exit;
|
||||||
|
@ -892,7 +894,23 @@ int32_t tsdbFSCommit2(STsdb *pTsdb, STsdbFS *pFSNew) {
|
||||||
*pSetOld->aLastF[0] = *pSetNew->aLastF[0];
|
*pSetOld->aLastF[0] = *pSetNew->aLastF[0];
|
||||||
pSetOld->aLastF[0]->nRef = 1;
|
pSetOld->aLastF[0]->nRef = 1;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(0);
|
for (int32_t iLast = 0; iLast < pSetOld->nLastF; iLast++) {
|
||||||
|
SLastFile *pLastFile = pSetOld->aLastF[iLast];
|
||||||
|
nRef = atomic_sub_fetch_32(&pLastFile->nRef, 1);
|
||||||
|
if (nRef == 0) {
|
||||||
|
tsdbLastFileName(pTsdb, pSetOld->diskId, pSetOld->fid, pLastFile, fname);
|
||||||
|
taosRemoveFile(fname);
|
||||||
|
taosMemoryFree(pLastFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
pSetOld->aLastF[iLast] = (SLastFile *)taosMemoryMalloc(sizeof(SLastFile));
|
||||||
|
if (pSetOld->aLastF[iLast] == NULL) {
|
||||||
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
*pSetOld->aLastF[iLast] = *pSetNew->aLastF[iLast];
|
||||||
|
pSetOld->aLastF[iLast]->nRef = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT(pSetOld->nLastF == pSetNew->nLastF);
|
ASSERT(pSetOld->nLastF == pSetNew->nLastF);
|
||||||
|
|
Loading…
Reference in New Issue