提交 364ff963 编写于 作者: S slguan

[TD-147] fix invalid write in drop vgroup

上级 993cce6d
...@@ -351,8 +351,27 @@ bool mgmtCheckIsMonitorDB(char *db, char *monitordb) { ...@@ -351,8 +351,27 @@ bool mgmtCheckIsMonitorDB(char *db, char *monitordb) {
return (strncasecmp(dbName, monitordb, len) == 0 && len == strlen(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) { void mgmtAddVgroupIntoDb(SVgObj *pVgroup) {
SDbObj *pDb = pVgroup->pDb; SDbObj *pDb = pVgroup->pDb;
pVgroup->next = pDb->pHead; pVgroup->next = pDb->pHead;
pVgroup->prev = NULL; pVgroup->prev = NULL;
......
...@@ -516,7 +516,7 @@ void mgmtAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { ...@@ -516,7 +516,7 @@ void mgmtAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
} }
if (pVgroup->numOfTables >= pVgroup->pDb->cfg.maxTables) { if (pVgroup->numOfTables >= pVgroup->pDb->cfg.maxTables) {
mgmtAddVgroupIntoDbTail(pVgroup); mgmtMoveVgroupToTail(pVgroup);
} }
mgmtIncVgroupRef(pVgroup); mgmtIncVgroupRef(pVgroup);
...@@ -529,10 +529,7 @@ void mgmtRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { ...@@ -529,10 +529,7 @@ void mgmtRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
pVgroup->numOfTables--; pVgroup->numOfTables--;
} }
if (pVgroup->numOfTables == 0) { mgmtMoveVgroupToHead(pVgroup);
mgmtRemoveVgroupFromDb(pVgroup);
}
mgmtDecVgroupRef(pVgroup); mgmtDecVgroupRef(pVgroup);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册