[TD-225]fix bug found in regression test.
This commit is contained in:
parent
e356b17b55
commit
b9f6714ca7
|
@ -63,17 +63,6 @@ typedef struct SNewVgroupInfo {
|
||||||
SEpAddrMsg ep[TSDB_MAX_REPLICA];
|
SEpAddrMsg ep[TSDB_MAX_REPLICA];
|
||||||
} SNewVgroupInfo;
|
} 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 {
|
typedef struct CChildTableMeta {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
STableId id;
|
STableId id;
|
||||||
|
|
|
@ -116,9 +116,15 @@ static void tscDumpEpSetFromVgroupInfo(SRpcEpSet *pEpSet, SNewVgroupInfo *pVgrou
|
||||||
static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) {
|
static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) {
|
||||||
SSqlCmd *pCmd = &pObj->cmd;
|
SSqlCmd *pCmd = &pObj->cmd;
|
||||||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
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;
|
int32_t vgId = pTableMetaInfo->pTableMeta->vgId;
|
||||||
|
if (pTableMetaInfo->pTableMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
|
assert(vgId == 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SNewVgroupInfo vgroupInfo = {.vgId = -1};
|
SNewVgroupInfo vgroupInfo = {.vgId = -1};
|
||||||
taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo));
|
taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo));
|
||||||
|
@ -1855,15 +1861,19 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the vgroupInfo if needed
|
// update the vgroupInfo if needed
|
||||||
int32_t vgId = pTableMeta->vgId;
|
if (pTableMeta->vgId > 0) {
|
||||||
SNewVgroupInfo vgroupInfo = {.inUse = -1};
|
int32_t vgId = pTableMeta->vgId;
|
||||||
taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo));
|
assert(pTableMeta->tableType != TSDB_SUPER_TABLE);
|
||||||
|
|
||||||
if (((vgroupInfo.inUse >= 0) && !vgroupInfoIdentical(&vgroupInfo, &pMetaMsg->vgroup)) ||
|
SNewVgroupInfo vgroupInfo = {.inUse = -1};
|
||||||
(vgroupInfo.inUse < 0)) { // vgroup info exists, compare with it
|
taosHashGetClone(tscVgroupMap, &vgId, sizeof(vgId), NULL, &vgroupInfo, sizeof(SNewVgroupInfo));
|
||||||
vgroupInfo = createNewVgroupInfo(&pMetaMsg->vgroup);
|
|
||||||
taosHashPut(tscVgroupMap, &vgId, sizeof(vgId), &vgroupInfo, sizeof(vgroupInfo));
|
if (((vgroupInfo.inUse >= 0) && !vgroupInfoIdentical(&vgroupInfo, &pMetaMsg->vgroup)) ||
|
||||||
tscDebug("add new VgroupInfo, vgId:%d, total:%d", vgId, (int32_t) taosHashGetSize(tscVgroupMap));
|
(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);
|
tscDebug("%p recv table meta, uid:%"PRId64 ", tid:%d, name:%s", pSql, pTableMeta->id.uid, pTableMeta->id.tid, pTableMetaInfo->name);
|
||||||
|
|
Loading…
Reference in New Issue