TD-90
This commit is contained in:
parent
fc0cfd875b
commit
9915d130ad
|
@ -506,7 +506,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks);
|
|||
void tsdbAdjustCacheBlocks(STsdbCache *pCache);
|
||||
int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
|
||||
int tsdbUpdateFileHeader(SFile *pFile, uint32_t version);
|
||||
int tsdbUpdateTable(STable *pTable, STableCfg *pCfg);
|
||||
int tsdbUpdateTable(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) {
|
|||
STable *super = tsdbGetTableByUid(pMeta, pTableCfg->superUid);
|
||||
ASSERT(super != NULL);
|
||||
|
||||
int32_t code = tsdbUpdateTable(super, pTableCfg);
|
||||
int32_t code = tsdbUpdateTable(pMeta, super, pTableCfg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -370,19 +370,29 @@ static int tsdbUpdateTableTagSchema(STable *pTable, STSchema *newSchema) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int tsdbUpdateTable(STable *pTable, STableCfg *pCfg) {
|
||||
int tsdbUpdateTable(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg) {
|
||||
ASSERT(pTable->type != TSDB_CHILD_TABLE);
|
||||
bool isChanged = false;
|
||||
|
||||
if (pTable->type == TSDB_SUPER_TABLE) {
|
||||
if (schemaVersion(pTable->tagSchema) < schemaVersion(pCfg->tagSchema)) {
|
||||
int32_t code = tsdbUpdateTableTagSchema(pTable, pCfg->tagSchema);
|
||||
if (code != TSDB_CODE_SUCCESS) return code;
|
||||
}
|
||||
isChanged = true;
|
||||
}
|
||||
|
||||
{
|
||||
// TODO: try to update the data schema
|
||||
}
|
||||
if (isChanged) {
|
||||
char *buf = malloc(1024 * 1024);
|
||||
int bufLen = 0;
|
||||
tsdbEncodeTable(pTable, buf, &bufLen);
|
||||
tsdbInsertMetaRecord(pMeta->mfh, pTable->tableId.uid, buf, bufLen);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -411,7 +421,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
|
|||
} else {
|
||||
if (super->type != TSDB_SUPER_TABLE) return -1;
|
||||
if (super->tableId.uid != pCfg->superUid) return -1;
|
||||
tsdbUpdateTable(super, pCfg);
|
||||
tsdbUpdateTable(pMeta, super, pCfg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue