提交 7c3e84b7 编写于 作者: Y yihaoDeng

[TD-4199]<feature> enhance performance

上级 93245c12
...@@ -2844,15 +2844,11 @@ int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool ...@@ -2844,15 +2844,11 @@ int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool
tNameExtractFullName(&pTableMetaInfo->name, name); tNameExtractFullName(&pTableMetaInfo->name, name);
size_t len = strlen(name); size_t len = strlen(name);
if (pTableMetaInfo->tableMetaCapacity != 0) {
memset(pTableMetaInfo->pTableMeta, 0, pTableMetaInfo->tableMetaCapacity);
}
taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&(pTableMetaInfo->pTableMeta), &pTableMetaInfo->tableMetaCapacity); taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&(pTableMetaInfo->pTableMeta), &pTableMetaInfo->tableMetaCapacity);
// TODO resize the tableMeta
//assert(size < 80 * TSDB_MAX_COLUMNS);
//if (!pSql->pBuf) {
// if (NULL == (pSql->pBuf = tcalloc(1, 80 * TSDB_MAX_COLUMNS))) {
// return TSDB_CODE_TSC_OUT_OF_MEMORY;
// }
//}
STableMeta* pMeta = pTableMetaInfo->pTableMeta; STableMeta* pMeta = pTableMetaInfo->pTableMeta;
if (pMeta && pMeta->id.uid > 0) { if (pMeta && pMeta->id.uid > 0) {
// in case of child table, here only get the // in case of child table, here only get the
......
...@@ -4460,17 +4460,19 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name, ...@@ -4460,17 +4460,19 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
// tableMeta exists, build child table meta according to the super table meta // tableMeta exists, build child table meta according to the super table meta
// the uid need to be checked in addition to the general name of the super table. // the uid need to be checked in addition to the general name of the super table.
if (p && p->id.uid > 0 && pChild->suid == p->id.uid) { if (p && p->id.uid > 0 && pChild->suid == p->id.uid) {
pChild->sversion = p->sversion;
pChild->tversion = p->tversion;
memcpy(&pChild->tableInfo, &p->tableInfo, sizeof(STableComInfo)); int32_t totalBytes = (p->tableInfo.numOfColumns + p->tableInfo.numOfTags) * sizeof(SSchema);
int32_t totalBytes = (pChild->tableInfo.numOfColumns + pChild->tableInfo.numOfTags) * sizeof(SSchema);
int32_t tableMetaSize = sizeof(STableMeta) + totalBytes; int32_t tableMetaSize = sizeof(STableMeta) + totalBytes;
if (*tableMetaCapacity < tableMetaSize) { if (*tableMetaCapacity < tableMetaSize) {
pChild = realloc(pChild, tableMetaSize); pChild = realloc(pChild, tableMetaSize);
*tableMetaCapacity = (size_t)tableMetaSize; *tableMetaCapacity = (size_t)tableMetaSize;
} }
pChild->sversion = p->sversion;
pChild->tversion = p->tversion;
memcpy(&pChild->tableInfo, &p->tableInfo, sizeof(STableComInfo));
memcpy(pChild->schema, p->schema, totalBytes); memcpy(pChild->schema, p->schema, totalBytes);
*ppChild = pChild; *ppChild = pChild;
tfree(p); tfree(p);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册