Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9ab51149
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9ab51149
编写于
12月 25, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
fea6562a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
9 deletion
+33
-9
source/dnode/vnode/meta/src/metaBDBImpl.c
source/dnode/vnode/meta/src/metaBDBImpl.c
+33
-9
未找到文件。
source/dnode/vnode/meta/src/metaBDBImpl.c
浏览文件 @
9ab51149
...
...
@@ -125,11 +125,11 @@ void metaCloseDB(SMeta *pMeta) {
}
int
metaSaveTableToDB
(
SMeta
*
pMeta
,
STbCfg
*
pTbCfg
)
{
tb_uid_t
uid
;
char
buf
[
512
];
void
*
pBuf
;
DBT
key
,
value
;
S
T
Schema
*
pSchema
=
NULL
;
tb_uid_t
uid
;
char
buf
[
512
];
void
*
pBuf
;
DBT
key
,
value
;
SSchema
*
pSchema
=
NULL
;
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
uid
=
pTbCfg
->
stbCfg
.
suid
;
...
...
@@ -156,9 +156,12 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
}
// save schema
uint32_t
ncols
;
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
ncols
=
pTbCfg
->
stbCfg
.
nCols
;
pSchema
=
pTbCfg
->
stbCfg
.
pSchema
;
}
else
if
(
pTbCfg
->
type
==
META_NORMAL_TABLE
)
{
ncols
=
pTbCfg
->
ntbCfg
.
nCols
;
pSchema
=
pTbCfg
->
ntbCfg
.
pSchema
;
}
...
...
@@ -166,12 +169,18 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) {
pBuf
=
buf
;
memset
(
&
key
,
0
,
sizeof
(
key
));
memset
(
&
value
,
0
,
sizeof
(
key
));
SSchemaKey
schemaKey
=
{
uid
,
schemaVersion
(
pSchema
)
};
SSchemaKey
schemaKey
=
{
uid
,
0
/*TODO*/
};
key
.
data
=
&
schemaKey
;
key
.
size
=
sizeof
(
schemaKey
);
tdEncodeSchema
(
&
pBuf
,
pSchema
);
taosEncodeFixedU32
(
&
pBuf
,
ncols
);
for
(
size_t
i
=
0
;
i
<
ncols
;
i
++
)
{
taosEncodeFixedI8
(
&
pBuf
,
pSchema
[
i
].
type
);
taosEncodeFixedI32
(
&
pBuf
,
pSchema
[
i
].
colId
);
taosEncodeFixedI32
(
&
pBuf
,
pSchema
[
i
].
bytes
);
taosEncodeString
(
&
pBuf
,
pSchema
[
i
].
name
);
}
value
.
data
=
buf
;
value
.
size
=
POINTER_DISTANCE
(
pBuf
,
buf
);
...
...
@@ -367,7 +376,15 @@ static int metaEncodeTbInfo(void **buf, STbCfg *pTbCfg) {
tsize
+=
taosEncodeFixedU8
(
buf
,
pTbCfg
->
type
);
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
tsize
+=
tdEncodeSchema
(
buf
,
pTbCfg
->
stbCfg
.
pTagSchema
);
tsize
+=
taosEncodeVariantU32
(
buf
,
pTbCfg
->
stbCfg
.
nTagCols
);
for
(
uint32_t
i
=
0
;
i
<
pTbCfg
->
stbCfg
.
nTagCols
;
i
++
)
{
tsize
+=
taosEncodeFixedI8
(
buf
,
pTbCfg
->
stbCfg
.
pSchema
[
i
].
type
);
tsize
+=
taosEncodeFixedI32
(
buf
,
pTbCfg
->
stbCfg
.
pSchema
[
i
].
colId
);
tsize
+=
taosEncodeFixedI32
(
buf
,
pTbCfg
->
stbCfg
.
pSchema
[
i
].
bytes
);
tsize
+=
taosEncodeString
(
buf
,
pTbCfg
->
stbCfg
.
pSchema
[
i
].
name
);
}
// tsize += tdEncodeSchema(buf, pTbCfg->stbCfg.pTagSchema);
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
tsize
+=
taosEncodeFixedU64
(
buf
,
pTbCfg
->
ctbCfg
.
suid
);
tsize
+=
tdEncodeKVRow
(
buf
,
pTbCfg
->
ctbCfg
.
pTag
);
...
...
@@ -386,7 +403,14 @@ static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg) {
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pTbCfg
->
type
));
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
buf
=
tdDecodeSchema
(
buf
,
&
(
pTbCfg
->
stbCfg
.
pTagSchema
));
buf
=
taosDecodeVariantU32
(
buf
,
pTbCfg
->
stbCfg
.
nTagCols
);
pTbCfg
->
stbCfg
.
pTagSchema
=
(
SSchema
*
)
malloc
(
sizeof
(
SSchema
)
*
pTbCfg
->
stbCfg
.
nTagCols
);
for
(
uint32_t
i
=
0
;
i
<
pTbCfg
->
stbCfg
.
nTagCols
;
i
++
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pTbCfg
->
stbCfg
.
pSchema
[
i
].
type
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pTbCfg
->
stbCfg
.
pSchema
[
i
].
colId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pTbCfg
->
stbCfg
.
pSchema
[
i
].
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pTbCfg
->
stbCfg
.
pSchema
[
i
].
name
);
}
}
else
if
(
pTbCfg
->
type
==
META_CHILD_TABLE
)
{
buf
=
taosDecodeFixedU64
(
buf
,
&
(
pTbCfg
->
ctbCfg
.
suid
));
buf
=
tdDecodeKVRow
(
buf
,
&
(
pTbCfg
->
ctbCfg
.
pTag
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录