提交 b78a39ce 编写于 作者: C Cary Xu

fix: resource release when end commit

上级 0841442d
...@@ -1000,26 +1000,26 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) { ...@@ -1000,26 +1000,26 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) {
if (pCommitter->fs.version < pTsdb->fs.version) { if (pCommitter->fs.version < pTsdb->fs.version) {
if ((code = tsdbFSCopy(pTsdb, &fsLatest))) { if ((code = tsdbFSCopy(pTsdb, &fsLatest))) {
taosThreadRwlockUnlock(&pTsdb->rwLock); taosThreadRwlockUnlock(&pTsdb->rwLock);
goto _err; goto _exit;
} }
if ((code = tsdbFSUpdDel(pTsdb, &pCommitter->fs, &fsLatest, pTsdb->trimHdl.minCommitFid - 1))) { if ((code = tsdbFSUpdDel(pTsdb, &pCommitter->fs, &fsLatest, pTsdb->trimHdl.minCommitFid - 1))) {
taosThreadRwlockUnlock(&pTsdb->rwLock); taosThreadRwlockUnlock(&pTsdb->rwLock);
goto _err; goto _exit;
} }
} }
code = tsdbFSCommit1(pTsdb, &pCommitter->fs); code = tsdbFSCommit1(pTsdb, &pCommitter->fs);
if (code) { if (code) {
taosThreadRwlockUnlock(&pTsdb->rwLock); taosThreadRwlockUnlock(&pTsdb->rwLock);
goto _err; goto _exit;
} }
// commit or rollback // commit or rollback
code = tsdbFSCommit2(pTsdb, &pCommitter->fs); code = tsdbFSCommit2(pTsdb, &pCommitter->fs);
if (code) { if (code) {
taosThreadRwlockUnlock(&pTsdb->rwLock); taosThreadRwlockUnlock(&pTsdb->rwLock);
goto _err; goto _exit;
} }
pTsdb->imem = NULL; pTsdb->imem = NULL;
...@@ -1027,8 +1027,10 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) { ...@@ -1027,8 +1027,10 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) {
// unlock // unlock
taosThreadRwlockUnlock(&pTsdb->rwLock); taosThreadRwlockUnlock(&pTsdb->rwLock);
_exit:
tsdbUnrefMemTable(pMemTable); tsdbUnrefMemTable(pMemTable);
tsdbFSDestroy(&pCommitter->fs); tsdbFSDestroy(&pCommitter->fs);
tsdbFSDestroy(&fsLatest);
taosArrayDestroy(pCommitter->aTbDataP); taosArrayDestroy(pCommitter->aTbDataP);
atomic_store_32(&pTsdb->trimHdl.minCommitFid, INT32_MAX); atomic_store_32(&pTsdb->trimHdl.minCommitFid, INT32_MAX);
...@@ -1036,13 +1038,12 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) { ...@@ -1036,13 +1038,12 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) {
// code = tsdbMerge(pTsdb); // code = tsdbMerge(pTsdb);
// if (code) goto _err; // if (code) goto _err;
// } // }
if(code == 0) {
tsdbInfo("vgId:%d, tsdb end commit", TD_VID(pTsdb->pVnode)); tsdbInfo("vgId:%d, tsdb end commit", TD_VID(pTsdb->pVnode));
return code; } else {
tsdbError("vgId:%d, tsdb end commit failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
_err: }
atomic_store_32(&pTsdb->trimHdl.minCommitFid, INT32_MAX);
tsdbError("vgId:%d, tsdb end commit failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
return code; return code;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册