Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a9edf4bd
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a9edf4bd
编写于
5月 21, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/TD-4034' into feature/TD-3950
上级
5507e887
4beb0b4d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
31 deletion
+17
-31
src/tsdb/inc/tsdbMeta.h
src/tsdb/inc/tsdbMeta.h
+1
-0
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+8
-19
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+4
-12
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+4
-0
未找到文件。
src/tsdb/inc/tsdbMeta.h
浏览文件 @
a9edf4bd
...
...
@@ -89,6 +89,7 @@ void tsdbOrgMeta(STsdbRepo* pRepo);
int
tsdbInitColIdCacheWithSchema
(
STable
*
pTable
,
STSchema
*
pSchema
);
int16_t
tsdbGetLastColumnsIndexByColId
(
STable
*
pTable
,
int16_t
colId
);
int
tsdbUpdateLastColSchema
(
STable
*
pTable
,
STSchema
*
pNewSchema
);
STSchema
*
tsdbGetTableLatestSchema
(
STable
*
pTable
);
static
FORCE_INLINE
int
tsdbCompareSchemaVersion
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
int16_t
*
)
key1
<
schemaVersion
(
*
(
STSchema
**
)
key2
))
{
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
a9edf4bd
...
...
@@ -26,6 +26,7 @@ static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH);
static
void
tsdbFreeRepo
(
STsdbRepo
*
pRepo
);
static
void
tsdbStartStream
(
STsdbRepo
*
pRepo
);
static
void
tsdbStopStream
(
STsdbRepo
*
pRepo
);
static
int
tsdbRestoreLastColumns
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
SReadH
*
pReadh
);
// Function declaration
int32_t
tsdbCreateRepo
(
int
repoid
)
{
...
...
@@ -616,24 +617,12 @@ 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
)
{
tsdbDebug
(
"getTableLatestSchema of table %s from super table %s"
,
pTable
->
name
->
data
,
pTable
->
pSuper
->
name
->
data
);
return
pTable
->
pSuper
->
schema
[
pTable
->
pSuper
->
numOfSchemas
-
1
];
}
}
return
NULL
;
}
static
int
tsdbRestoreLastColumns
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
SReadH
*
pReadh
)
{
//tsdbInfo("tsdbRestoreLastColumns of table %s", pTable->name->data);
static
int
restoreLastColumns
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
SReadH
*
pReadh
)
{
STSchema
*
pSchema
=
getTableLatestSchema
(
pTable
);
STSchema
*
pSchema
=
tsdbGetTableLatestSchema
(
pTable
);
if
(
pSchema
==
NULL
)
{
tsdbError
(
"
g
etTableLatestSchema of table %s fail"
,
pTable
->
name
->
data
);
tsdbError
(
"
tsdbG
etTableLatestSchema of table %s fail"
,
pTable
->
name
->
data
);
return
0
;
}
...
...
@@ -728,7 +717,7 @@ static int restoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pReadh)
int16_t
idx
=
tsdbGetLastColumnsIndexByColId
(
pTable
,
pCol
->
colId
);
if
(
idx
==
-
1
)
{
tsdbError
(
"
r
estoreLastColumns restore vgId:%d,table:%s cache column %d fail"
,
REPO_ID
(
pRepo
),
pTable
->
name
->
data
,
pCol
->
colId
);
tsdbError
(
"
tsdbR
estoreLastColumns restore vgId:%d,table:%s cache column %d fail"
,
REPO_ID
(
pRepo
),
pTable
->
name
->
data
,
pCol
->
colId
);
continue
;
}
// save not-null column
...
...
@@ -746,7 +735,7 @@ static int restoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pReadh)
pTable
->
maxColumnNum
+=
1
;
tsdbInfo
(
"
r
estoreLastColumns restore vgId:%d,table:%s cache column %d, %"
PRId64
,
REPO_ID
(
pRepo
),
pTable
->
name
->
data
,
pLastCol
->
colId
,
pLastCol
->
ts
);
tsdbInfo
(
"
tsdbR
estoreLastColumns restore vgId:%d,table:%s cache column %d, %"
PRId64
,
REPO_ID
(
pRepo
),
pTable
->
name
->
data
,
pLastCol
->
colId
,
pLastCol
->
ts
);
break
;
}
}
...
...
@@ -843,7 +832,7 @@ int tsdbRestoreInfo(STsdbRepo *pRepo) {
// restore NULL columns
if
(
pIdx
&&
CACHE_LAST_NULL_COLUMN
(
pCfg
))
{
if
(
r
estoreLastColumns
(
pRepo
,
pTable
,
&
readh
)
!=
0
)
{
if
(
tsdbR
estoreLastColumns
(
pRepo
,
pTable
,
&
readh
)
!=
0
)
{
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
a9edf4bd
...
...
@@ -965,23 +965,15 @@ static void tsdbFreeRows(STsdbRepo *pRepo, void **rows, int rowCounter) {
}
static
void
updateTableLatestColumn
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
SDataRow
row
)
{
//tsdbInfo("vgId:%d updateTableLatestColumn, row version:%d", REPO_ID(pRepo)
, dataRowVersion(row));
tsdbInfo
(
"vgId:%d updateTableLatestColumn, %s row version:%d"
,
REPO_ID
(
pRepo
),
pTable
->
name
->
data
,
dataRowVersion
(
row
));
if
(
pTable
->
numOfSchemas
<=
0
)
{
return
;
}
STSchema
*
pSchema
=
pTable
->
schema
[
pTable
->
numOfSchemas
-
1
];
STSchema
*
pSchema
=
tsdbGetTableLatestSchema
(
pTable
);
if
(
tsdbUpdateLastColSchema
(
pTable
,
pSchema
)
<
0
)
{
return
;
}
int16_t
i
=
pTable
->
numOfSchemas
-
1
;
while
((
pSchema
==
NULL
||
pSchema
->
version
!=
dataRowVersion
(
row
))
&&
i
>=
0
)
{
i
-=
1
;
pSchema
=
pTable
->
schema
[
i
];
}
if
(
pSchema
==
NULL
||
pSchema
->
version
!=
dataRowVersion
(
row
))
{
pSchema
=
tsdbGetTableSchemaByVersion
(
pTable
,
dataRowVersion
(
row
));
if
(
pSchema
==
NULL
)
{
return
;
}
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
a9edf4bd
...
...
@@ -645,6 +645,10 @@ int tsdbInitColIdCacheWithSchema(STable* pTable, STSchema* pSchema) {
return
0
;
}
STSchema
*
tsdbGetTableLatestSchema
(
STable
*
pTable
)
{
return
tsdbGetTableSchemaByVersion
(
pTable
,
-
1
);
}
int
tsdbUpdateLastColSchema
(
STable
*
pTable
,
STSchema
*
pNewSchema
)
{
if
(
pTable
->
lastColSVersion
==
schemaVersion
(
pNewSchema
))
{
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录