TD-90
This commit is contained in:
parent
46138ef492
commit
fc0cfd875b
|
@ -506,6 +506,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks);
|
||||||
void tsdbAdjustCacheBlocks(STsdbCache *pCache);
|
void tsdbAdjustCacheBlocks(STsdbCache *pCache);
|
||||||
int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
|
int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
|
||||||
int tsdbUpdateFileHeader(SFile *pFile, uint32_t version);
|
int tsdbUpdateFileHeader(SFile *pFile, uint32_t version);
|
||||||
|
int tsdbUpdateTable(STable *pTable, STableCfg *pCfg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,10 +429,20 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) {
|
||||||
tsdbTrace("vgId:%d server tag version %d is older than client tag version %d, try to config", pRepo->config.tsdbId,
|
tsdbTrace("vgId:%d server tag version %d is older than client tag version %d, try to config", pRepo->config.tsdbId,
|
||||||
schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)), tversion);
|
schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)), tversion);
|
||||||
void *msg = (*pRepo->appH.configFunc)(pRepo->config.tsdbId, htonl(pMsg->tid));
|
void *msg = (*pRepo->appH.configFunc)(pRepo->config.tsdbId, htonl(pMsg->tid));
|
||||||
|
if (msg == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
// Deal with error her
|
// Deal with error her
|
||||||
STableCfg *pTableCfg = tsdbCreateTableCfgFromMsg(msg);
|
STableCfg *pTableCfg = tsdbCreateTableCfgFromMsg(msg);
|
||||||
|
STable *super = tsdbGetTableByUid(pMeta, pTableCfg->superUid);
|
||||||
|
ASSERT(super != NULL);
|
||||||
|
|
||||||
ASSERT(pTableCfg != NULL);
|
int32_t code = tsdbUpdateTable(super, pTableCfg);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
tsdbClearTableCfg(pTableCfg);
|
||||||
|
rpcFreeCont(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) > tversion) {
|
if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) > tversion) {
|
||||||
|
@ -595,12 +605,15 @@ int tsdbTableSetStreamSql(STableCfg *config, char *sql, bool dup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void tsdbClearTableCfg(STableCfg *config) {
|
void tsdbClearTableCfg(STableCfg *config) {
|
||||||
if (config->schema) tdFreeSchema(config->schema);
|
if (config) {
|
||||||
if (config->tagSchema) tdFreeSchema(config->tagSchema);
|
if (config->schema) tdFreeSchema(config->schema);
|
||||||
if (config->tagValues) kvRowFree(config->tagValues);
|
if (config->tagSchema) tdFreeSchema(config->tagSchema);
|
||||||
tfree(config->name);
|
if (config->tagValues) kvRowFree(config->tagValues);
|
||||||
tfree(config->sname);
|
tfree(config->name);
|
||||||
tfree(config->sql);
|
tfree(config->sname);
|
||||||
|
tfree(config->sql);
|
||||||
|
free(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter) {
|
int tsdbInitSubmitBlkIter(SSubmitBlk *pBlock, SSubmitBlkIter *pIter) {
|
||||||
|
|
|
@ -370,7 +370,7 @@ static int tsdbUpdateTableTagSchema(STable *pTable, STSchema *newSchema) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbCheckAndUpdateTable(STable *pTable, STableCfg *pCfg) {
|
int tsdbUpdateTable(STable *pTable, STableCfg *pCfg) {
|
||||||
ASSERT(pTable->type != TSDB_CHILD_TABLE);
|
ASSERT(pTable->type != TSDB_CHILD_TABLE);
|
||||||
|
|
||||||
if (pTable->type == TSDB_SUPER_TABLE) {
|
if (pTable->type == TSDB_SUPER_TABLE) {
|
||||||
|
@ -411,7 +411,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
|
||||||
} else {
|
} else {
|
||||||
if (super->type != TSDB_SUPER_TABLE) return -1;
|
if (super->type != TSDB_SUPER_TABLE) return -1;
|
||||||
if (super->tableId.uid != pCfg->superUid) return -1;
|
if (super->tableId.uid != pCfg->superUid) return -1;
|
||||||
tsdbCheckAndUpdateTable(super, pCfg);
|
tsdbUpdateTable(super, pCfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue