提交 e51fd4bf 编写于 作者: L lichuang

[TD-4034]get latest schema from super table

上级 61b2473b
......@@ -616,17 +616,34 @@ static void tsdbStopStream(STsdbRepo *pRepo) {
}
}
static STSchema* getTableLatestSchema(STable *pTable) {
if (pTable->numOfSchemas > 0) {
return pTable->schema[pTable->numOfSchemas - 1];
}
if (pTable->type == TSDB_CHILD_TABLE) {
if (pTable->pSuper && pTable->pSuper->numOfSchemas) {
tsdbInfo("getTableLatestSchema of table %s from super table", pTable->name->data);
return pTable->pSuper->schema[pTable->pSuper->numOfSchemas - 1];
}
}
return NULL;
}
static int restoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pReadh) {
if (pTable->numOfSchemas == 0) {
STSchema *pSchema = getTableLatestSchema(pTable);
if (pSchema == NULL) {
tsdbError("getTableLatestSchema of table %s fail", pTable->name->data);
return 0;
}
SBlock* pBlock;
int numColumns;
int32_t blockIdx;
SDataStatis* pBlockStatis = NULL;
SDataRow row = NULL;
// restore last column data with last schema
STSchema *pSchema = pTable->schema[pTable->numOfSchemas - 1];
int err = 0;
numColumns = schemaNCols(pSchema);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册