Merge pull request #12666 from taosdata/fix/hzcheng_3.0
fix: alter table coredump
This commit is contained in:
commit
86d202b9fc
|
@ -442,7 +442,8 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.version = version;
|
entry.version = version;
|
||||||
int tlen;
|
int tlen;
|
||||||
|
SSchema *pNewSchema = NULL;
|
||||||
switch (pAlterTbReq->action) {
|
switch (pAlterTbReq->action) {
|
||||||
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
case TSDB_ALTER_TABLE_ADD_COLUMN:
|
||||||
if (pColumn) {
|
if (pColumn) {
|
||||||
|
@ -451,8 +452,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
}
|
}
|
||||||
pSchema->sver++;
|
pSchema->sver++;
|
||||||
pSchema->nCols++;
|
pSchema->nCols++;
|
||||||
pSchema->pSchema =
|
pNewSchema = taosMemoryMalloc(sizeof(SSchema) * pSchema->nCols);
|
||||||
taosMemoryRealloc(entry.ntbEntry.schema.pSchema, sizeof(SSchema) * entry.ntbEntry.schema.nCols);
|
memcpy(pNewSchema, pSchema->pSchema, sizeof(SSchema) * (pSchema->nCols - 1));
|
||||||
|
pSchema->pSchema = pNewSchema;
|
||||||
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].bytes = pAlterTbReq->bytes;
|
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].bytes = pAlterTbReq->bytes;
|
||||||
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].type = pAlterTbReq->type;
|
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].type = pAlterTbReq->type;
|
||||||
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].flags = pAlterTbReq->flags;
|
pSchema->pSchema[entry.ntbEntry.schema.nCols - 1].flags = pAlterTbReq->flags;
|
||||||
|
@ -511,6 +513,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
|
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
|
if (pNewSchema) taosMemoryFree(pNewSchema);
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
|
|
Loading…
Reference in New Issue