From 9d024fe48634d0f4b86b1c1c9150b8fbef73a2a8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 17 Mar 2021 10:34:13 +0800 Subject: [PATCH] TD-3334 --- src/vnode/src/vnodeMain.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index d81347d2f2..42b9c024c9 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -119,6 +119,8 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { if (code != TSDB_CODE_SUCCESS) { pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; return code; } @@ -126,6 +128,8 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { if (code != TSDB_CODE_SUCCESS) { pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; return code; } @@ -133,12 +137,16 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { if (code != TSDB_CODE_SUCCESS) { pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; return code; } bool tsdbCfgChanged = (memcmp(&tsdbCfg, &pVnode->tsdbCfg, sizeof(STsdbCfg)) != 0); bool syncCfgChanged = (memcmp(&syncCfg, &pVnode->syncCfg, sizeof(SSyncCfg)) != 0); + vDebug("vgId:%d, tsdbchanged:%d syncchanged:%d while alter vnode", pVnode->vgId, tsdbCfgChanged, syncCfgChanged); + if (tsdbCfgChanged || syncCfgChanged) { // vnode in non-ready state and still needs to return success instead of TSDB_CODE_VND_INVALID_STATUS // dbCfgVersion can be corrected by status msg @@ -146,6 +154,8 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { vDebug("vgId:%d, vnode is not ready, do alter operation later", pVnode->vgId); pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; return TSDB_CODE_SUCCESS; } @@ -153,6 +163,8 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { if (code != TSDB_CODE_SUCCESS) { pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; vnodeSetReadyStatus(pVnode); return code; } @@ -162,6 +174,8 @@ static int32_t vnodeAlterImp(SVnodeObj *pVnode, SCreateVnodeMsg *pVnodeCfg) { if (code != TSDB_CODE_SUCCESS) { pVnode->dbCfgVersion = dbCfgVersion; pVnode->vgCfgVersion = vgCfgVersion; + pVnode->syncCfg = syncCfg; + pVnode->tsdbCfg = tsdbCfg; vnodeSetReadyStatus(pVnode); return code; } -- GitLab