[td-225]fix bug found by regression test.

This commit is contained in:
Haojun Liao 2021-07-26 13:39:39 +08:00
parent cbbb059385
commit 2b99aa162f
3 changed files with 32 additions and 5 deletions

View File

@ -2337,14 +2337,18 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
SSqlCmd* pCmd = &parent->cmd; SSqlCmd* pCmd = &parent->cmd;
SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd);
char fName[TSDB_TABLE_FNAME_LEN] = {0};
for(int32_t i = 0; i < pStableVgroup->numOfTables; ++i) { for(int32_t i = 0; i < pStableVgroup->numOfTables; ++i) {
char* name = pMsg; char* name = pMsg;
pMsg += TSDB_TABLE_NAME_LEN; pMsg += TSDB_TABLE_FNAME_LEN;
STableMetaInfo *pInfo = NULL; STableMetaInfo *pInfo = NULL;
for(int32_t j = 0; j < pQueryInfo->numOfTables; ++j) { for(int32_t j = 0; j < pQueryInfo->numOfTables; ++j) {
STableMetaInfo *pInfo1 = tscGetTableMetaInfoFromCmd(pCmd, j); STableMetaInfo *pInfo1 = tscGetTableMetaInfoFromCmd(pCmd, j);
if (strcmp(name, tNameGetTableName(&pInfo1->name)) != 0) { memset(fName, 0, tListLen(fName));
tNameExtractFullName(&pInfo1->name, fName);
if (strcmp(name, fName) != 0) {
continue; continue;
} }
@ -2504,11 +2508,14 @@ int tscProcessUseDbRsp(SSqlObj *pSql) {
return ret; return ret;
} }
//todo only invalid the buffered data that belongs to dropped databases
int tscProcessDropDbRsp(SSqlObj *pSql) { int tscProcessDropDbRsp(SSqlObj *pSql) {
//TODO LOCK DB WHEN MODIFY IT //TODO LOCK DB WHEN MODIFY IT
//pSql->pTscObj->db[0] = 0; //pSql->pTscObj->db[0] = 0;
taosHashClear(tscTableMetaMap); taosHashClear(tscTableMetaMap);
taosHashClear(tscVgroupMap);
taosCacheEmpty(tscVgroupListBuf);
return 0; return 0;
} }
@ -2892,6 +2899,10 @@ int32_t tscGetUdfFromNode(SSqlObj *pSql, SQueryInfo* pQueryInfo) {
return code; return code;
} }
static void freeElem(void* p) {
tfree(*(char**)p);
}
/** /**
* retrieve table meta from mnode, and then update the local table meta hashmap. * retrieve table meta from mnode, and then update the local table meta hashmap.
* @param pSql sql object * @param pSql sql object
@ -2921,7 +2932,23 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
size_t len = strlen(name); size_t len = strlen(name);
taosHashRemove(tscTableMetaMap, name, len); taosHashRemove(tscTableMetaMap, name, len);
return getTableMetaFromMnode(pSql, pTableMetaInfo, false); if (pTableMeta->tableType == TSDB_SUPER_TABLE) {
void* pv = taosCacheAcquireByKey(tscVgroupListBuf, name, len);
if (pv != NULL) {
taosCacheRelease(tscVgroupListBuf, &pv, true);
}
}
SArray* pNameList = taosArrayInit(1, POINTER_BYTES);
SArray* vgroupList = taosArrayInit(1, POINTER_BYTES);
char* n = strdup(name);
taosArrayPush(pNameList, &n);
code = getMultiTableMetaFromMnode(pSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true);
taosArrayDestroyEx(pNameList, freeElem);
taosArrayDestroyEx(vgroupList, freeElem);
return code;
} }
static bool allVgroupInfoRetrieved(SQueryInfo* pQueryInfo) { static bool allVgroupInfoRetrieved(SQueryInfo* pQueryInfo) {

View File

@ -809,7 +809,7 @@ typedef struct SMultiTableMeta {
int32_t contLen; int32_t contLen;
uint8_t compressed; // denote if compressed or not uint8_t compressed; // denote if compressed or not
uint32_t rawLen; // size before compress uint32_t rawLen; // size before compress
uint8_t metaClone; // make meta clone after retrieve meta from mnode uint8_t metaClone; // make meta clone after retrieve meta from mnode
char meta[]; char meta[];
} SMultiTableMeta; } SMultiTableMeta;

View File

@ -1009,7 +1009,7 @@ int main(int argc, char *argv[]) {
info = taos_get_client_info(taos); info = taos_get_client_info(taos);
printf("client info: %s\n", info); printf("client info: %s\n", info);
printf("************ verify shemaless *************\n"); printf("************ verify schema-less *************\n");
verify_schema_less(taos); verify_schema_less(taos);