From 7c82b1221f69fdfcc36bf36bac0a2be849400585 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 16 Aug 2022 17:04:35 +0800 Subject: [PATCH] fix: return error if stable's name duplicate with child table --- source/dnode/vnode/src/meta/metaTable.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index e56b8ad939..079c89cc36 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -176,6 +176,15 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { // validate req metaReaderInit(&mr, pMeta, 0); if (metaGetTableEntryByName(&mr, pReq->name) == 0) { + if (mr.me.type == TSDB_SUPER_TABLE) { + metaReaderClear(&mr); + return 0; + } else { + terrno = TSDB_CODE_TDB_STB_ALREADY_EXIST; + metaReaderClear(&mr); + return -1; + } + /* // TODO: just for pass case #if 0 terrno = TSDB_CODE_TDB_STB_ALREADY_EXIST; @@ -185,6 +194,7 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { metaReaderClear(&mr); return 0; #endif + */ } metaReaderClear(&mr); -- GitLab