From b9f6714ca71dd61eaec17f173efe041932f5e7fb Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 2 Jan 2021 22:49:58 +0800 Subject: [PATCH] [TD-225]fix bug found in regression test. --- src/client/inc/tsclient.h | 11 ----------- src/client/src/tscServer.c | 30 ++++++++++++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 99b722e660..25a299d098 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -63,17 +63,6 @@ typedef struct SNewVgroupInfo { SEpAddrMsg ep[TSDB_MAX_REPLICA]; } SNewVgroupInfo; -typedef struct CSuperTableMeta { - STableComInfo tableInfo; - uint8_t tableType; - int16_t sversion; - int16_t tversion; - char sTableName[TSDB_TABLE_FNAME_LEN]; - STableId id; - int32_t childList; - SSchema schema[]; // if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info -} CSuperTableMeta; - typedef struct CChildTableMeta { int32_t vgId; STableId id; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index baad6a82b7..4949aa9b9d 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -116,9 +116,15 @@ static void tscDumpEpSetFromVgroupInfo(SRpcEpSet *pEpSet, SNewVgroupInfo *pVgrou static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) { SSqlCmd *pCmd = &pObj->cmd; STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); - if (pTableMetaInfo == NULL || pTableMetaInfo->pTableMeta == NULL) { return;} + if (pTableMetaInfo == NULL || pTableMetaInfo->pTableMeta == NULL) { + return; + } int32_t vgId = pTableMetaInfo->pTableMeta->vgId; + if (pTableMetaInfo->pTableMeta->tableType == TSDB_SUPER_TABLE) { + assert(vgId == 0); + return; + } SNewVgroupInfo vgroupInfo = {.vgId = -1}; taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo)); @@ -1855,15 +1861,19 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { } // update the vgroupInfo if needed - int32_t vgId = pTableMeta->vgId; - SNewVgroupInfo vgroupInfo = {.inUse = -1}; - taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo)); - - if (((vgroupInfo.inUse >= 0) && !vgroupInfoIdentical(&vgroupInfo, &pMetaMsg->vgroup)) || - (vgroupInfo.inUse < 0)) { // vgroup info exists, compare with it - vgroupInfo = createNewVgroupInfo(&pMetaMsg->vgroup); - taosHashPut(tscVgroupMap, &vgId, sizeof(vgId), &vgroupInfo, sizeof(vgroupInfo)); - tscDebug("add new VgroupInfo, vgId:%d, total:%d", vgId, (int32_t) taosHashGetSize(tscVgroupMap)); + if (pTableMeta->vgId > 0) { + int32_t vgId = pTableMeta->vgId; + assert(pTableMeta->tableType != TSDB_SUPER_TABLE); + + SNewVgroupInfo vgroupInfo = {.inUse = -1}; + taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo)); + + if (((vgroupInfo.inUse >= 0) && !vgroupInfoIdentical(&vgroupInfo, &pMetaMsg->vgroup)) || + (vgroupInfo.inUse < 0)) { // vgroup info exists, compare with it + vgroupInfo = createNewVgroupInfo(&pMetaMsg->vgroup); + taosHashPut(tscVgroupMap, &vgId, sizeof(vgId), &vgroupInfo, sizeof(vgroupInfo)); + tscDebug("add new VgroupInfo, vgId:%d, total:%d", vgId, (int32_t) taosHashGetSize(tscVgroupMap)); + } } tscDebug("%p recv table meta, uid:%"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->id.uid, pTableMeta->id.tid, pTableMetaInfo->name); -- GitLab