[TD-4199]<feature> enhance performance
This commit is contained in:
parent
93245c12f9
commit
7c3e84b7e1
|
@ -2844,15 +2844,11 @@ int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool
|
|||
tNameExtractFullName(&pTableMetaInfo->name, 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);
|
||||
|
||||
// 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;
|
||||
if (pMeta && pMeta->id.uid > 0) {
|
||||
// in case of child table, here only get the
|
||||
|
|
|
@ -4460,17 +4460,19 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
|
|||
// 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.
|
||||
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 = (pChild->tableInfo.numOfColumns + pChild->tableInfo.numOfTags) * sizeof(SSchema);
|
||||
int32_t totalBytes = (p->tableInfo.numOfColumns + p->tableInfo.numOfTags) * sizeof(SSchema);
|
||||
int32_t tableMetaSize = sizeof(STableMeta) + totalBytes;
|
||||
if (*tableMetaCapacity < tableMetaSize) {
|
||||
pChild = realloc(pChild, 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);
|
||||
|
||||
*ppChild = pChild;
|
||||
tfree(p);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue