From a84c2770d02f2b70951e55d54d8934a6bb56fe2d Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Tue, 4 Jan 2022 14:36:32 +0800 Subject: [PATCH] [TS-983](connector,query,insert,other):create subtable to specific vgroups by _taos_meta_sync_table_name_taos_ --- src/mnode/src/mnodeTable.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index d468739e48..93660432ce 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -2238,22 +2238,13 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { int32_t vgId = 0; if (tsMetaSyncOption) { - char tbName[TSDB_TABLE_NAME_LEN] = "\0"; - strncpy(tbName, pCreate->tableName, TSDB_TABLE_NAME_LEN); - char *pTbName = strtok(tbName, "."); - if (pTbName) { - pTbName = strtok(NULL, "."); - if (pTbName) { - pTbName = strtok(NULL, "."); - if (pTbName) { - if (0 == strncmp(META_SYNC_TABLE_NAME, pTbName, META_SYNC_TABLE_NAME_LEN)) { - vgId = atoi(pTbName + META_SYNC_TABLE_NAME_LEN); - } - } + char *pTbName = strchr(pCreate->tableName, '.'); + if (pTbName && (pTbName = strchr(pTbName + 1, '.'))) { + if (0 == strncmp(META_SYNC_TABLE_NAME, ++pTbName, META_SYNC_TABLE_NAME_LEN)) { + vgId = atoi(pTbName + META_SYNC_TABLE_NAME_LEN); } } } - code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &tid, vgId); if (code != TSDB_CODE_SUCCESS) { mError("msg:%p, app:%p table:%s, failed to get available vgroup, reason:%s", pMsg, pMsg->rpcMsg.ahandle, -- GitLab