more refact

This commit is contained in:
Hongze Cheng 2022-04-24 09:14:37 +00:00
parent d08e55762f
commit 98fc272ac8
2 changed files with 6 additions and 1 deletions

View File

@ -193,12 +193,14 @@ int vnodeCommit(SVnode *pVnode) {
SVnodeInfo info; SVnodeInfo info;
char dir[TSDB_FILENAME_LEN]; char dir[TSDB_FILENAME_LEN];
vInfo("vgId:%d start to commit, version: %" PRId64, TD_VID(pVnode), pVnode->state.applied);
pVnode->onCommit = pVnode->inUse; pVnode->onCommit = pVnode->inUse;
pVnode->inUse = NULL; pVnode->inUse = NULL;
// save info // save info
info.config = pVnode->config; info.config = pVnode->config;
info.state.committed = pVnode->state.processed; info.state.committed = pVnode->state.applied;
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);
@ -232,6 +234,8 @@ int vnodeCommit(SVnode *pVnode) {
pVnode->pPool = pVnode->onCommit; pVnode->pPool = pVnode->onCommit;
pVnode->onCommit = NULL; pVnode->onCommit = NULL;
vInfo("vgId:%d commit over", TD_VID(pVnode));
return 0; return 0;
} }

View File

@ -138,6 +138,7 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
// commit if need // commit if need
if (vnodeShouldCommit(pVnode)) { if (vnodeShouldCommit(pVnode)) {
vInfo("vgId:%d commit at version %" PRId64, TD_VID(pVnode), version);
// commit current change // commit current change
vnodeCommit(pVnode); vnodeCommit(pVnode);