From 46138ef49256de45bc263e825bfc0ade5ca19211 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 3 Jun 2020 02:37:16 +0000 Subject: [PATCH] errr while config table --- src/mnode/src/mnodeTable.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 84a1f659d5..c37dd8d382 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -1352,11 +1352,13 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO int32_t tagDataLen = 0; int32_t totalCols = 0; int32_t contLen = 0; - if (pTable->info.type == TSDB_CHILD_TABLE && pMsg != NULL) { - pTagData = (STagData*)pMsg->schema; - tagDataLen = ntohl(pTagData->dataLen); + if (pTable->info.type == TSDB_CHILD_TABLE) { totalCols = pTable->superTable->numOfColumns + pTable->superTable->numOfTags; contLen = sizeof(SMDCreateTableMsg) + totalCols * sizeof(SSchema) + tagDataLen + pTable->sqlLen; + if (pMsg != NULL) { + pTagData = (STagData *)pMsg->schema; + tagDataLen = ntohl(pTagData->dataLen); + } } else { totalCols = pTable->numOfColumns; contLen = sizeof(SMDCreateTableMsg) + totalCols * sizeof(SSchema) + pTable->sqlLen; @@ -1406,11 +1408,11 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO pSchema++; } - if (pTable->info.type == TSDB_CHILD_TABLE && pMsg != NULL) { + if (pTable->info.type == TSDB_CHILD_TABLE && pTagData != NULL) { memcpy(pCreate->data + totalCols * sizeof(SSchema), pTagData->data, tagDataLen); } - if (pTable->info.type == TSDB_STREAM_TABLE && pMsg != NULL) { + if (pTable->info.type == TSDB_STREAM_TABLE) { memcpy(pCreate->data + totalCols * sizeof(SSchema), pTable->sql, pTable->sqlLen); }