more work

This commit is contained in:
Hongze Cheng 2022-06-25 03:46:05 +00:00
parent 21062f72d1
commit e0deddc817
4 changed files with 4 additions and 8 deletions

View File

@ -522,7 +522,7 @@ int32_t tsdbFSBegin(STsdbFS *pFS) {
for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->cState->aDFileSet); iSet++) {
SDFileSet *pDFileSet = (SDFileSet *)taosArrayGet(pFS->cState->aDFileSet, iSet);
if (taosArrayPush(pFS->nState->aDFileSet, &pDFileSet) == NULL) {
if (taosArrayPush(pFS->nState->aDFileSet, pDFileSet) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}

View File

@ -88,12 +88,10 @@ _err:
int tsdbClose(STsdb **pTsdb) {
if (*pTsdb) {
// TODO: destroy mem/imem
taosThreadMutexDestroy(&(*pTsdb)->mutex);
tsdbFSClose((*pTsdb)->fs);
// tsdbFreeFS((*pTsdb)->fs);
taosMemoryFreeClear(*pTsdb);
tsdbCloseCache((*pTsdb)->lruCache);
taosMemoryFreeClear(*pTsdb);
}
return 0;
}

View File

@ -924,7 +924,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SMapData *mBlockIdx, uint8_t **
// build
n = 0;
n += tPutU32(*ppBuf + n, TSDB_FILE_DLMT);
n += tPutMapData(*ppBuf, mBlockIdx);
n += tPutMapData(*ppBuf + n, mBlockIdx);
taosCalcChecksumAppend(0, *ppBuf, size);
ASSERT(n + sizeof(TSCKSUM) == size);

View File

@ -215,6 +215,7 @@ int vnodeCommit(SVnode *pVnode) {
// save info
info.config = pVnode->config;
info.state.committed = pVnode->state.applied;
info.state.commitID = pVnode->state.commitID;
snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path);
if (vnodeSaveInfo(dir, &info) < 0) {
ASSERT(0);
@ -298,7 +299,6 @@ static int vnodeEncodeState(const void *pObj, SJson *pJson) {
const SVState *pState = (SVState *)pObj;
if (tjsonAddIntegerToObject(pJson, "commit version", pState->committed) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "applied version", pState->applied) < 0) return -1;
if (tjsonAddIntegerToObject(pJson, "commit ID", pState->commitID) < 0) return -1;
return 0;
@ -310,8 +310,6 @@ static int vnodeDecodeState(const SJson *pJson, void *pObj) {
int32_t code;
tjsonGetNumberValue(pJson, "commit version", pState->committed, code);
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "applied version", pState->applied, code);
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "commit ID", pState->commitID, code);
if (code < 0) return -1;