提交 61cfacd8 编写于 作者: H Hongze Cheng

more code

上级 2acfc81c
...@@ -388,7 +388,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { ...@@ -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) { ...@@ -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) { ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册