Merge pull request #3902 from taosdata/feature/os
[TD-1743]<fix>: When deleting a database, tables in other databases may be deleted by mistake
This commit is contained in:
commit
05ee7d7b4c
|
@ -2224,16 +2224,20 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
|
|||
void mnodeDropAllChildTables(SDbObj *pDropDb) {
|
||||
void * pIter = NULL;
|
||||
int32_t numOfTables = 0;
|
||||
int32_t dbNameLen = strlen(pDropDb->name);
|
||||
SChildTableObj *pTable = NULL;
|
||||
|
||||
char prefix[64] = {0};
|
||||
tstrncpy(prefix, pDropDb->name, 64);
|
||||
strcat(prefix, TS_PATH_DELIMITER);
|
||||
int32_t prefixLen = strlen(prefix);
|
||||
|
||||
mInfo("db:%s, all child tables will be dropped from sdb", pDropDb->name);
|
||||
|
||||
while (1) {
|
||||
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
||||
if (pTable == NULL) break;
|
||||
|
||||
if (strncmp(pDropDb->name, pTable->info.tableId, dbNameLen) == 0) {
|
||||
if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) {
|
||||
SSdbOper oper = {
|
||||
.type = SDB_OPER_LOCAL,
|
||||
.table = tsChildTableSdb,
|
||||
|
|
Loading…
Reference in New Issue