fix show create table crash
This commit is contained in:
parent
5c67a67363
commit
3c11dc4ec1
|
@ -88,7 +88,6 @@ int32_t mndBuildInsTableSchema(SMnode *pMnode, const char *dbFName, const char *
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
*pRsp = *pMeta;
|
||||
|
||||
pRsp->pSchemas = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchema));
|
||||
|
@ -130,6 +129,8 @@ int32_t mndBuildInsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbN
|
|||
}
|
||||
|
||||
memcpy(pRsp->pSchemas, pMeta->pSchemas, pMeta->numOfColumns * sizeof(SSchema));
|
||||
|
||||
pRsp->pSchemaExt = taosMemoryCalloc(pMeta->numOfColumns, sizeof(SSchemaExt));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2039,7 +2039,15 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
|||
if (pStb->numOfFuncs > 0) {
|
||||
pRsp->pFuncs = taosArrayDup(pStb->pFuncs, NULL);
|
||||
}
|
||||
|
||||
|
||||
pRsp->pSchemaExt = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchemaExt));
|
||||
for (int32_t i = 0; i < pStb->numOfColumns; i++) {
|
||||
SCmprObj *pCmpr = &pStb->pCmpr[i];
|
||||
|
||||
SSchemaExt *pSchExt = &pRsp->pSchemaExt[i];
|
||||
pSchExt->colId = pCmpr->colId;
|
||||
pSchExt->compress = pCmpr->cmprAlg;
|
||||
}
|
||||
|
||||
taosRUnLockLatch(&pStb->lock);
|
||||
return 0;
|
||||
|
|
|
@ -247,12 +247,23 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
|||
cfgRsp.numOfTags = schemaTag.nCols;
|
||||
cfgRsp.numOfColumns = schema.nCols;
|
||||
cfgRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (cfgRsp.numOfColumns + cfgRsp.numOfTags));
|
||||
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
|
||||
|
||||
memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
||||
if (schemaTag.nCols) {
|
||||
memcpy(cfgRsp.pSchemas + schema.nCols, schemaTag.pSchema, sizeof(SSchema) * schemaTag.nCols);
|
||||
}
|
||||
|
||||
if (useCompress(cfgRsp.tableType)) {
|
||||
SColCmprWrapper *pColCmpr = &mer1.me.colCmpr;
|
||||
for (int32_t i = 0; i < cfgRsp.numOfColumns; i++) {
|
||||
SColCmpr *pCmpr = &pColCmpr->pColCmpr[i];
|
||||
SSchemaExt *pSchExt = cfgRsp.pSchemaExt + i;
|
||||
pSchExt->colId = pCmpr->id;
|
||||
pSchExt->compress = pCmpr->alg;
|
||||
}
|
||||
}
|
||||
|
||||
// encode and send response
|
||||
rspLen = tSerializeSTableCfgRsp(NULL, 0, &cfgRsp);
|
||||
if (rspLen < 0) {
|
||||
|
|
Loading…
Reference in New Issue