提交 afb309c5 编写于 作者: dengyihao's avatar dengyihao

opt sys index

上级 14212684
...@@ -572,8 +572,12 @@ static int metaBuildCtimeIdxKey(SCtimeIdxKey *ctimeKey, const SMetaEntry *pME) { ...@@ -572,8 +572,12 @@ static int metaBuildCtimeIdxKey(SCtimeIdxKey *ctimeKey, const SMetaEntry *pME) {
} }
static int metaBuildNColIdxKey(SNcolIdxKey *ncolKey, const SMetaEntry *pME) { static int metaBuildNColIdxKey(SNcolIdxKey *ncolKey, const SMetaEntry *pME) {
ncolKey->ncol = pME->ntbEntry.schemaRow.nCols; if (pME->type == TSDB_NORMAL_TABLE) {
ncolKey->uid = pME->uid; ncolKey->ncol = pME->ntbEntry.schemaRow.nCols;
ncolKey->uid = pME->uid;
} else {
return -1;
}
return 0; return 0;
} }
...@@ -778,6 +782,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl ...@@ -778,6 +782,10 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
goto _err; goto _err;
} }
// save old entry
SMetaEntry oldEntry = {.type = TSDB_NORMAL_TABLE, .uid = entry.uid};
oldEntry.ntbEntry.schemaRow.nCols = pSchema->nCols;
// search the column to add/drop/update // search the column to add/drop/update
pSchema = &entry.ntbEntry.schemaRow; pSchema = &entry.ntbEntry.schemaRow;
int32_t iCol = 0; int32_t iCol = 0;
...@@ -868,6 +876,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl ...@@ -868,6 +876,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
entry.version = version; entry.version = version;
metaDeleteNcolIdx(pMeta, &oldEntry);
metaUpdateNcolIdx(pMeta, &entry);
// do actual write // do actual write
metaWLock(pMeta); metaWLock(pMeta);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册