TD-90
This commit is contained in:
parent
f81120e352
commit
26c291aba4
|
@ -509,6 +509,10 @@ 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(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg);
|
int tsdbUpdateTable(STsdbMeta *pMeta, STable *pTable, STableCfg *pCfg);
|
||||||
|
int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
|
int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
|
|
||||||
|
#define DEFAULT_TAG_INDEX_COLUMN 0 // skip list built based on the first column of tags
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,14 +445,23 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) {
|
||||||
rpcFreeCont(msg);
|
rpcFreeCont(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schemaVersion(tsdbGetTableTagSchema(pMeta, pTable)) > tversion) {
|
STSchema *pTagSchema = tsdbGetTableTagSchema(pMeta, pTable);
|
||||||
|
|
||||||
|
if (schemaVersion(pTagSchema) > tversion) {
|
||||||
tsdbError(
|
tsdbError(
|
||||||
"vgId:%d failed to update tag value of table %s since version out of date, client tag version:%d server tag "
|
"vgId:%d failed to update tag value of table %s since version out of date, client tag version:%d server tag "
|
||||||
"version:%d",
|
"version:%d",
|
||||||
pRepo->config.tsdbId, varDataVal(pTable->name), tversion, schemaVersion(pTable->tagSchema));
|
pRepo->config.tsdbId, varDataVal(pTable->name), tversion, schemaVersion(pTable->tagSchema));
|
||||||
return TSDB_CODE_TAG_VER_OUT_OF_DATE;
|
return TSDB_CODE_TAG_VER_OUT_OF_DATE;
|
||||||
}
|
}
|
||||||
|
if (schemaColAt(pTagSchema, DEFAULT_TAG_INDEX_COLUMN)->colId == htons(pMsg->colId)) {
|
||||||
|
tsdbRemoveTableFromIndex(pMeta, pTable);
|
||||||
|
}
|
||||||
|
// TODO: remove table from index if it is the first column of tag
|
||||||
tdSetKVRowDataOfCol(&pTable->tagVal, htons(pMsg->colId), htons(pMsg->type), pMsg->data);
|
tdSetKVRowDataOfCol(&pTable->tagVal, htons(pMsg->colId), htons(pMsg->type), pMsg->data);
|
||||||
|
if (schemaColAt(pTagSchema, DEFAULT_TAG_INDEX_COLUMN)->colId == htons(pMsg->colId)) {
|
||||||
|
tsdbAddTableIntoIndex(pMeta, pTable);
|
||||||
|
}
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,10 @@
|
||||||
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
|
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
|
||||||
// #define TSDB_META_FILE_NAME "META"
|
// #define TSDB_META_FILE_NAME "META"
|
||||||
|
|
||||||
const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags
|
|
||||||
|
|
||||||
static int tsdbFreeTable(STable *pTable);
|
static int tsdbFreeTable(STable *pTable);
|
||||||
static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
|
static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
|
||||||
static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx);
|
static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx);
|
||||||
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
|
||||||
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
|
||||||
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx);
|
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -719,7 +716,7 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFrom
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) {
|
int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) {
|
||||||
assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL);
|
assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL);
|
||||||
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
|
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
|
||||||
assert(pSTable != NULL);
|
assert(pSTable != NULL);
|
||||||
|
@ -744,7 +741,7 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
|
int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
|
||||||
assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL);
|
assert(pTable->type == TSDB_CHILD_TABLE && pTable != NULL);
|
||||||
|
|
||||||
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
|
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
|
||||||
|
|
Loading…
Reference in New Issue