From 0201008c9faa09a8b24bba274d8c707d8a356cc5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 17 Jun 2020 08:31:29 +0000 Subject: [PATCH] [TD-669] incomplete update while alter vgroup --- src/mnode/src/mnodeTable.c | 7 ++++++- src/mnode/src/mnodeVgroup.c | 13 ++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index a30b359970..93ee96a674 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -182,14 +182,19 @@ static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) { SChildTableObj *pNew = pOper->pObj; SChildTableObj *pTable = mnodeGetChildTable(pNew->info.tableId); if (pTable != pNew) { - void *oldTableId = pTable->info.tableId; + void *oldTableId = pTable->info.tableId; void *oldSql = pTable->sql; void *oldSchema = pTable->schema; + void *oldSTable = pTable->superTable; int32_t oldRefCount = pTable->refCount; + memcpy(pTable, pNew, sizeof(SChildTableObj)); + pTable->refCount = oldRefCount; pTable->sql = pNew->sql; pTable->schema = pNew->schema; + pTable->superTable = oldSTable; + free(pNew); free(oldSql); free(oldSchema); diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index efa823d531..10dfb2a28a 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -149,17 +149,8 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) { } } - void *idPool = pVgroup->idPool; - void *tableList = pVgroup->tableList; - int32_t oldRefCount = pVgroup->refCount; - - memcpy(pVgroup, pNew, sizeof(SVgObj)); - - free(pNew); - pVgroup->refCount = oldRefCount; - pVgroup->idPool = idPool; - pVgroup->tableList = tableList; - + memcpy(pVgroup, pNew, tsVgUpdateSize); + for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SDnodeObj *pDnode = mnodeGetDnode(pVgroup->vnodeGid[i].dnodeId); pVgroup->vnodeGid[i].pDnode = pDnode; -- GitLab