opt sys index
This commit is contained in:
parent
1421268479
commit
afb309c557
|
@ -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
|
||||||
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
|
||||||
|
|
||||||
entry.version = version;
|
entry.version = version;
|
||||||
|
|
||||||
|
metaDeleteNcolIdx(pMeta, &oldEntry);
|
||||||
|
metaUpdateNcolIdx(pMeta, &entry);
|
||||||
|
|
||||||
// do actual write
|
// do actual write
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue