diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index dd6dc52242695ce43fbd553af0662a7dd36bcdfb..5f3ea93afb6d3e82dbef1f8c350b5c002266175f 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -345,7 +345,6 @@ typedef struct { } SMDDropTableMsg; typedef struct { - int32_t contLen; int32_t vgId; int64_t uid; char tableId[TSDB_TABLE_ID_LEN + 1]; diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 0edb11972497b760042965f71f5ddf711d79d85c..1813be6522c1791e96746da7620334ff9bc83729 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -756,8 +756,26 @@ static void mgmtProcessCreateSuperTableMsg(SQueuedMsg *pMsg) { static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable; if (pStable->numOfTables != 0) { - mError("stable:%s, numOfTables:%d not 0", pStable->info.tableId, pStable->numOfTables); - mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_OTHERS); + mgmtDropAllChildTablesInStable(pStable); + for (int32_t vg = 0; vg < pTable->vgLen; ++vg) { + int32_t vgId = pTable->vgList[vg]; + if (vgId == 0) break; + + SMDDropSTableMsg *pDrop = rpcMalloc(sizeof(SMDDropSTableMsg)); + pDrop->vgId = htonl(vgId); + pDrop->uid = htobe64(pStable->uid); + mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); + + SVgObj *pVgroup = mgmtGetVgroup(vgId); + if (pVgroup != NULL) { + SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); + SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; + mgmtSendMsgToDnode(&ipSet, &rpcMsg); + mgmtDecVgroupRef(pVgroup); + } + } + //mError("stable:%s, numOfTables:%d not 0", pStable->info.tableId, pStable->numOfTables); + //mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_OTHERS); } else { SSdbOper oper = { .type = SDB_OPER_GLOBAL, diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 81cba7b6fac6fa366ef67797ed12415a17c34298..26808f2e4e5b360cc5fa23c18036ae068dfd8aaf 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -224,11 +224,10 @@ static int32_t vnodeProcessDropStableMsg(SVnodeObj *pVnode, void *pCont, SRspRet int32_t code = 0; dTrace("pVnode:%p vgId:%d, stable:%s, start to drop", pVnode, pVnode->vgId, pTable->tableId); - // int64_t uid = htobe64(pTable->uid); - // TODO: drop stable in vvnode + //int64_t uid = htobe64(pTable->uid); //void *pTsdb = dnodeGetVnodeTsdb(pMsg->pVnode); - //rpcRsp.code = tsdbDropSTable(pTsdb, pTable->uid); + //rpcRsp.code = tsdbDropTable(pTsdb, pTable->uid); code = TSDB_CODE_SUCCESS; dTrace("pVnode:%p vgId:%d, stable:%s, drop stable result:%x", pVnode, pTable->tableId, code);