Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5fa27b27
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看板
提交
5fa27b27
编写于
5月 30, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: support fetching specific schema version from table
上级
882f4f38
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
21 addition
and
11 deletion
+21
-11
source/common/src/trow.c
source/common/src/trow.c
+4
-0
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+10
-6
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+1
-1
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+5
-3
未找到文件。
source/common/src/trow.c
浏览文件 @
5fa27b27
...
...
@@ -605,6 +605,10 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
* @param pCols
*/
int32_t
tdAppendSTSRowToDataCol
(
STSRow
*
pRow
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
isMerge
)
{
#ifdef TD_DEBUG_PRINT_TSDB_LOAD_DCOLS
printf
(
"%s:%d ts: %"
PRIi64
" sver:%d maxCols:%"
PRIi16
" nCols:%"
PRIi16
", nRows:%d
\n
"
,
__func__
,
__LINE__
,
TD_ROW_KEY
(
pRow
),
TD_ROW_SVER
(
pRow
),
pCols
->
maxCols
,
pCols
->
numOfCols
,
pCols
->
numOfRows
);
#endif
if
(
TD_IS_TP_ROW
(
pRow
))
{
return
tdAppendTpRowToDataCol
(
pRow
,
pSchema
,
pCols
,
isMerge
);
}
else
if
(
TD_IS_KV_ROW
(
pRow
))
{
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
5fa27b27
...
...
@@ -79,7 +79,8 @@ struct STsdb {
struct
STable
{
uint64_t
tid
;
uint64_t
uid
;
STSchema
*
pSchema
;
STSchema
*
pSchema
;
// latest schema
STSchema
*
pCacheSchema
;
// cached cache
};
#define TABLE_TID(t) (t)->tid
...
...
@@ -181,12 +182,15 @@ int tsdbUnlockRepo(STsdb *pTsdb);
static
FORCE_INLINE
STSchema
*
tsdbGetTableSchemaImpl
(
STsdb
*
pTsdb
,
STable
*
pTable
,
bool
lock
,
bool
copy
,
int32_t
version
)
{
if
((
version
!=
-
1
)
&&
(
schemaVersion
(
pTable
->
pSchema
)
!=
version
))
{
taosMemoryFreeClear
(
pTable
->
pSchema
);
pTable
->
pSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pTable
->
uid
,
version
);
if
(
version
<
0
)
{
return
pTable
->
pSchema
;
}
return
pTable
->
pSchema
;
if
(
!
pTable
->
pCacheSchema
||
(
schemaVersion
(
pTable
->
pCacheSchema
)
!=
version
))
{
taosMemoryFreeClear
(
pTable
->
pCacheSchema
);
pTable
->
pCacheSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pTable
->
uid
,
version
);
}
return
pTable
->
pCacheSchema
;
}
// tsdbMemTable.h
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
5fa27b27
...
...
@@ -300,7 +300,7 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) {
pSW
=
metaGetTableSchema
(
pMeta
,
quid
,
sver
,
0
);
if
(
!
pSW
)
return
NULL
;
tdInitTSchemaBuilder
(
&
sb
,
sver
);
tdInitTSchemaBuilder
(
&
sb
,
pSW
->
version
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
tdAddColToSchema
(
&
sb
,
pSchema
->
type
,
pSchema
->
flags
,
pSchema
->
colId
,
pSchema
->
bytes
);
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
5fa27b27
...
...
@@ -441,7 +441,7 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
if
(
inputType
==
STREAM_DATA_TYPE_SUBMIT_BLOCK
)
{
// TODO: use the proper schema instead of 0, and cache STSchema in cache
STSchema
*
pTSchema
=
metaGetTbTSchema
(
SMA_META
(
pSma
),
suid
,
1
);
STSchema
*
pTSchema
=
metaGetTbTSchema
(
SMA_META
(
pSma
),
suid
,
-
1
);
if
(
!
pTSchema
)
{
terrno
=
TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION
;
return
TSDB_CODE_FAILED
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
5fa27b27
...
...
@@ -466,7 +466,7 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pTbData
=
(
STbData
*
)
pNode
->
pData
;
pCommitIter
=
pCommith
->
iters
+
i
;
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pRepo
),
pTbData
->
uid
,
-
1
);
// TODO: schema version
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pRepo
),
pTbData
->
uid
,
-
1
);
if
(
pTSchema
)
{
pCommitIter
->
pIter
=
tSkipListCreateIter
(
pTbData
->
pData
);
...
...
@@ -475,7 +475,8 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pCommitIter
->
pTable
=
(
STable
*
)
taosMemoryMalloc
(
sizeof
(
STable
));
pCommitIter
->
pTable
->
uid
=
pTbData
->
uid
;
pCommitIter
->
pTable
->
tid
=
pTbData
->
uid
;
pCommitIter
->
pTable
->
pSchema
=
pTSchema
;
// metaGetTbTSchema(REPO_META(pRepo), pTbData->uid, 0);
pCommitIter
->
pTable
->
pSchema
=
pTSchema
;
pCommitIter
->
pTable
->
pCacheSchema
=
NULL
;
}
}
tSkipListDestroyIter
(
pSlIter
);
...
...
@@ -490,6 +491,7 @@ static void tsdbDestroyCommitIters(SCommitH *pCommith) {
tSkipListDestroyIter
(
pCommith
->
iters
[
i
].
pIter
);
if
(
pCommith
->
iters
[
i
].
pTable
)
{
tdFreeSchema
(
pCommith
->
iters
[
i
].
pTable
->
pSchema
);
tdFreeSchema
(
pCommith
->
iters
[
i
].
pTable
->
pCacheSchema
);
taosMemoryFreeClear
(
pCommith
->
iters
[
i
].
pTable
);
}
}
...
...
@@ -914,7 +916,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
while
(
bidx
<
nBlocks
)
{
if
(
!
pTSchema
&&
!
tsdbCommitIsSameFile
(
pCommith
,
bidx
))
{
// Set commit table
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pIdx
->
uid
,
1
);
// TODO: schema version
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pIdx
->
uid
,
-
1
);
// TODO: schema version
if
(
!
pTSchema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录