提交 e0deddc8 编写于 作者: H Hongze Cheng

more work

上级 21062f72
...@@ -522,7 +522,7 @@ int32_t tsdbFSBegin(STsdbFS *pFS) { ...@@ -522,7 +522,7 @@ int32_t tsdbFSBegin(STsdbFS *pFS) {
for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->cState->aDFileSet); iSet++) { for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->cState->aDFileSet); iSet++) {
SDFileSet *pDFileSet = (SDFileSet *)taosArrayGet(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; code = TSDB_CODE_OUT_OF_MEMORY;
goto _err; goto _err;
} }
......
...@@ -88,12 +88,10 @@ _err: ...@@ -88,12 +88,10 @@ _err:
int tsdbClose(STsdb **pTsdb) { int tsdbClose(STsdb **pTsdb) {
if (*pTsdb) { if (*pTsdb) {
// TODO: destroy mem/imem
taosThreadMutexDestroy(&(*pTsdb)->mutex); taosThreadMutexDestroy(&(*pTsdb)->mutex);
tsdbFSClose((*pTsdb)->fs); tsdbFSClose((*pTsdb)->fs);
// tsdbFreeFS((*pTsdb)->fs);
taosMemoryFreeClear(*pTsdb);
tsdbCloseCache((*pTsdb)->lruCache); tsdbCloseCache((*pTsdb)->lruCache);
taosMemoryFreeClear(*pTsdb);
} }
return 0; return 0;
} }
......
...@@ -924,7 +924,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SMapData *mBlockIdx, uint8_t ** ...@@ -924,7 +924,7 @@ int32_t tsdbWriteBlockIdx(SDataFWriter *pWriter, SMapData *mBlockIdx, uint8_t **
// build // build
n = 0; n = 0;
n += tPutU32(*ppBuf + n, TSDB_FILE_DLMT); n += tPutU32(*ppBuf + n, TSDB_FILE_DLMT);
n += tPutMapData(*ppBuf, mBlockIdx); n += tPutMapData(*ppBuf + n, mBlockIdx);
taosCalcChecksumAppend(0, *ppBuf, size); taosCalcChecksumAppend(0, *ppBuf, size);
ASSERT(n + sizeof(TSCKSUM) == size); ASSERT(n + sizeof(TSCKSUM) == size);
......
...@@ -215,6 +215,7 @@ int vnodeCommit(SVnode *pVnode) { ...@@ -215,6 +215,7 @@ int vnodeCommit(SVnode *pVnode) {
// save info // save info
info.config = pVnode->config; info.config = pVnode->config;
info.state.committed = pVnode->state.applied; 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); snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pVnode->pTfs), TD_DIRSEP, pVnode->path);
if (vnodeSaveInfo(dir, &info) < 0) { if (vnodeSaveInfo(dir, &info) < 0) {
ASSERT(0); ASSERT(0);
...@@ -298,7 +299,6 @@ static int vnodeEncodeState(const void *pObj, SJson *pJson) { ...@@ -298,7 +299,6 @@ static int vnodeEncodeState(const void *pObj, SJson *pJson) {
const SVState *pState = (SVState *)pObj; const SVState *pState = (SVState *)pObj;
if (tjsonAddIntegerToObject(pJson, "commit version", pState->committed) < 0) return -1; 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; if (tjsonAddIntegerToObject(pJson, "commit ID", pState->commitID) < 0) return -1;
return 0; return 0;
...@@ -310,8 +310,6 @@ static int vnodeDecodeState(const SJson *pJson, void *pObj) { ...@@ -310,8 +310,6 @@ static int vnodeDecodeState(const SJson *pJson, void *pObj) {
int32_t code; int32_t code;
tjsonGetNumberValue(pJson, "commit version", pState->committed, code); tjsonGetNumberValue(pJson, "commit version", pState->committed, code);
if (code < 0) return -1; if (code < 0) return -1;
tjsonGetNumberValue(pJson, "applied version", pState->applied, code);
if (code < 0) return -1;
tjsonGetNumberValue(pJson, "commit ID", pState->commitID, code); tjsonGetNumberValue(pJson, "commit ID", pState->commitID, code);
if (code < 0) return -1; if (code < 0) return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册