From dbdee1152c52b64c43deccb43fa6a5b9298941cd Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Sat, 23 Jul 2022 16:56:26 +0800 Subject: [PATCH] fix: super table not exists if suid expired --- source/dnode/vnode/src/meta/metaTable.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index fc55c642e5..7178f4f503 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -358,6 +358,14 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) { goto _err; } + if (pReq->type == TSDB_CHILD_TABLE) { + tb_uid_t suid = metaGetTableEntryUidByName(pMeta, pReq->ctb.name); + if (suid != pReq->ctb.suid) { + terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; + return -1; + } + } + // validate req metaReaderInit(&mr, pMeta, 0); if (metaGetTableEntryByName(&mr, pReq->name) == 0) { @@ -371,13 +379,6 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) { } metaReaderClear(&mr); - if (pReq->type == TSDB_CHILD_TABLE) { - tb_uid_t suid = metaGetTableEntryUidByName(pMeta, pReq->ctb.name); - if (suid == 0) { - terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; - return -1; - } - } // build SMetaEntry me.version = version; me.type = pReq->type; @@ -442,7 +443,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) { if (ret != 0) { return ret; } - if (taosArrayGetSize(tbUids) == 0){ + if (taosArrayGetSize(tbUids) == 0) { return 0; } -- GitLab