enh: support drop stable with uid
This commit is contained in:
parent
964ee72932
commit
7471b9506d
|
@ -2031,9 +2031,6 @@ static int32_t ctgHandleGetTbNamesRsp(SCtgTaskReq* tReq, int32_t reqType, const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (CTG_IS_META_BOTH(pOut->metaType)) {
|
|
||||||
// TSWAP(pMsgCtx->lastOut, pMsgCtx->out);
|
|
||||||
// }
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -2062,7 +2059,6 @@ static int32_t ctgHandleGetTbNamesRsp(SCtgTaskReq* tReq, int32_t reqType, const
|
||||||
}
|
}
|
||||||
|
|
||||||
_return:
|
_return:
|
||||||
|
|
||||||
if (dbCache) {
|
if (dbCache) {
|
||||||
ctgReleaseVgInfoToCache(pCtg, dbCache);
|
ctgReleaseVgInfoToCache(pCtg, dbCache);
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,7 +409,19 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) {
|
static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) {
|
||||||
if (pStmt->withOpt) return TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
if (pStmt->withOpt) {
|
||||||
|
code = reserveTableUidInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
|
||||||
|
#if 0
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return code;
|
||||||
|
}
|
||||||
return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
|
return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName,
|
||||||
AUTH_TYPE_WRITE, pCxt->pMetaCache);
|
AUTH_TYPE_WRITE, pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14636,6 +14636,31 @@ static int32_t rewriteDropTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
return rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
|
return rewriteToVnodeModifyOpStmt(pQuery, pBufArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t rewriteDropSuperTablewithOpt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
SDropSuperTableStmt* pStmt = (SDropSuperTableStmt*)pQuery->pRoot;
|
||||||
|
if (!pStmt->withOpt) return code;
|
||||||
|
pCxt->withOpt = true;
|
||||||
|
|
||||||
|
char pTableName[TSDB_TABLE_NAME_LEN] = {0};
|
||||||
|
SName name = {0};
|
||||||
|
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name);
|
||||||
|
code = getTargetName(pCxt, &name, pTableName);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, code, "Super table uid does not exist: '%s'", pStmt->tableName);
|
||||||
|
}
|
||||||
|
tstrncpy(pStmt->tableName, pTableName, TSDB_TABLE_NAME_LEN); // rewrite table uid to table name
|
||||||
|
|
||||||
|
code = rewriteDropTableWithMetaCache(pCxt);
|
||||||
|
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t rewriteDropSuperTable(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
|
TAOS_CHECK_RETURN(rewriteDropSuperTablewithOpt(pCxt, pQuery));
|
||||||
|
TAOS_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta,
|
||||||
SVAlterTbReq* pReq) {
|
SVAlterTbReq* pReq) {
|
||||||
SName tbName = {0};
|
SName tbName = {0};
|
||||||
|
@ -15707,6 +15732,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_DROP_TABLE_STMT:
|
case QUERY_NODE_DROP_TABLE_STMT:
|
||||||
code = rewriteDropTable(pCxt, pQuery);
|
code = rewriteDropTable(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
case QUERY_NODE_DROP_SUPER_TABLE_STMT:
|
||||||
|
code = rewriteDropSuperTable(pCxt, pQuery);
|
||||||
|
break;
|
||||||
case QUERY_NODE_ALTER_TABLE_STMT:
|
case QUERY_NODE_ALTER_TABLE_STMT:
|
||||||
code = rewriteAlterTable(pCxt, pQuery);
|
code = rewriteAlterTable(pCxt, pQuery);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue