[TD-147] fix invalid write in drop vgroup

This commit is contained in:
slguan 2020-04-30 23:27:32 +08:00
parent 993cce6d79
commit 364ff96347
2 changed files with 21 additions and 5 deletions

View File

@ -351,8 +351,27 @@ bool mgmtCheckIsMonitorDB(char *db, char *monitordb) {
return (strncasecmp(dbName, monitordb, len) == 0 && len == strlen(monitordb));
}
#if 0
void mgmtPrintVgroups(SDbObj *pDb, char *oper) {
mPrint("db:%s, vgroup link from head, oper:%s", pDb->name, oper);
SVgObj *pVgroup = pDb->pHead;
while (pVgroup != NULL) {
mPrint("vgId:%d", pVgroup->vgId);
pVgroup = pVgroup->next;
}
mPrint("db:%s, vgroup link from tail", pDb->name, pDb->numOfVgroups);
pVgroup = pDb->pTail;
while (pVgroup != NULL) {
mPrint("vgId:%d", pVgroup->vgId);
pVgroup = pVgroup->prev;
}
}
#endif
void mgmtAddVgroupIntoDb(SVgObj *pVgroup) {
SDbObj *pDb = pVgroup->pDb;
pVgroup->next = pDb->pHead;
pVgroup->prev = NULL;

View File

@ -516,7 +516,7 @@ void mgmtAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
}
if (pVgroup->numOfTables >= pVgroup->pDb->cfg.maxTables) {
mgmtAddVgroupIntoDbTail(pVgroup);
mgmtMoveVgroupToTail(pVgroup);
}
mgmtIncVgroupRef(pVgroup);
@ -529,10 +529,7 @@ void mgmtRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
pVgroup->numOfTables--;
}
if (pVgroup->numOfTables == 0) {
mgmtRemoveVgroupFromDb(pVgroup);
}
mgmtMoveVgroupToHead(pVgroup);
mgmtDecVgroupRef(pVgroup);
}