Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d4cc6c1f
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
d4cc6c1f
编写于
3月 23, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add bSma/rSma param
上级
273faa10
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
166 addition
and
11 deletion
+166
-11
include/common/tmsg.h
include/common/tmsg.h
+28
-8
source/common/src/tmsg.c
source/common/src/tmsg.c
+82
-2
source/dnode/vnode/src/meta/metaBDBImpl.c
source/dnode/vnode/src/meta/metaBDBImpl.c
+1
-1
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+55
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
d4cc6c1f
...
...
@@ -1363,28 +1363,48 @@ typedef struct {
int64_t
tuid
;
}
SDDropTopicReq
;
typedef
struct
{
float
xFilesFactor
;
int8_t
delayUnit
;
int8_t
nFuncIds
;
int32_t
*
pFuncIds
;
int64_t
delay
;
}
SRSmaParam
;
typedef
struct
SVCreateTbReq
{
int64_t
ver
;
// use a general definition
char
*
dbFName
;
char
*
name
;
uint32_t
ttl
;
uint32_t
keep
;
uint8_t
type
;
union
{
uint8_t
info
;
struct
{
tb_uid_t
suid
;
uint32_t
nCols
;
SSchema
*
pSchema
;
uint32_t
nTagCols
;
SSchema
*
pTagSchema
;
uint8_t
rollup
:
1
;
// 1 means rollup sma
uint8_t
type
:
7
;
};
};
union
{
struct
{
tb_uid_t
suid
;
uint32_t
nCols
;
SSchema
*
pSchema
;
uint32_t
nTagCols
;
SSchema
*
pTagSchema
;
col_id_t
nBSmaCols
;
col_id_t
*
pBSmaCols
;
SRSmaParam
*
pRSmaParam
;
}
stbCfg
;
struct
{
tb_uid_t
suid
;
SKVRow
pTag
;
}
ctbCfg
;
struct
{
uint32_t
nCols
;
SSchema
*
pSchema
;
uint32_t
nCols
;
SSchema
*
pSchema
;
col_id_t
nBSmaCols
;
col_id_t
*
pBSmaCols
;
SRSmaParam
*
pRSmaParam
;
}
ntbCfg
;
};
}
SVCreateTbReq
,
SVUpdateTbReq
;
...
...
source/common/src/tmsg.c
浏览文件 @
d4cc6c1f
...
...
@@ -290,7 +290,7 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pReq
->
ttl
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pReq
->
keep
);
tlen
+=
taosEncodeFixedU8
(
buf
,
pReq
->
type
);
tlen
+=
taosEncodeFixedU8
(
buf
,
pReq
->
info
);
switch
(
pReq
->
type
)
{
case
TD_SUPER_TABLE
:
...
...
@@ -309,6 +309,20 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
bytes
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
name
);
}
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nBSmaCols
;
++
i
)
{
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pBSmaCols
[
i
]);
}
if
(
pReq
->
rollup
&&
NULL
!=
pReq
->
stbCfg
.
pRSmaParam
)
{
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
tlen
+=
taosEncodeFixedU32
(
buf
,
(
uint32_t
)
param
->
xFilesFactor
);
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
delayUnit
);
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
nFuncIds
);
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
pFuncIds
[
i
]);
}
tlen
+=
taosEncodeFixedI64
(
buf
,
param
->
delay
);
}
break
;
case
TD_CHILD_TABLE
:
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
ctbCfg
.
suid
);
...
...
@@ -322,6 +336,20 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
bytes
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
name
);
}
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nBSmaCols
;
++
i
)
{
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pBSmaCols
[
i
]);
}
if
(
pReq
->
rollup
&&
NULL
!=
pReq
->
stbCfg
.
pRSmaParam
)
{
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
tlen
+=
taosEncodeFixedU32
(
buf
,
(
uint32_t
)
param
->
xFilesFactor
);
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
delayUnit
);
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
nFuncIds
);
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
pFuncIds
[
i
]);
}
tlen
+=
taosEncodeFixedI64
(
buf
,
param
->
delay
);
}
break
;
default:
ASSERT
(
0
);
...
...
@@ -335,7 +363,7 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pReq
->
ttl
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pReq
->
keep
));
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pReq
->
type
));
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pReq
->
info
));
switch
(
pReq
->
type
)
{
case
TD_SUPER_TABLE
:
...
...
@@ -356,6 +384,32 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
stbCfg
.
pTagSchema
[
i
].
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
name
);
}
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nBSmaCols
));
if
(
pReq
->
stbCfg
.
nBSmaCols
>
0
)
{
pReq
->
stbCfg
.
pBSmaCols
=
(
col_id_t
*
)
malloc
(
pReq
->
stbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nBSmaCols
;
++
i
)
{
buf
=
taosDecodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pBSmaCols
+
i
);
}
}
else
{
pReq
->
stbCfg
.
pBSmaCols
=
NULL
;
}
if
(
pReq
->
rollup
)
{
pReq
->
stbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
malloc
(
sizeof
(
SRSmaParam
));
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
buf
=
taosDecodeFixedU32
(
buf
,
(
uint32_t
*
)
&
param
->
xFilesFactor
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
delayUnit
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
nFuncIds
);
if
(
param
->
nFuncIds
>
0
)
{
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
buf
=
taosDecodeFixedI32
(
buf
,
param
->
pFuncIds
+
i
);
}
}
else
{
param
->
pFuncIds
=
NULL
;
}
buf
=
taosDecodeFixedI64
(
buf
,
&
param
->
delay
);
}
else
{
pReq
->
stbCfg
.
pRSmaParam
=
NULL
;
}
break
;
case
TD_CHILD_TABLE
:
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
ctbCfg
.
suid
);
...
...
@@ -370,6 +424,32 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
ntbCfg
.
pSchema
[
i
].
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
name
);
}
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nBSmaCols
));
if
(
pReq
->
stbCfg
.
nBSmaCols
>
0
)
{
pReq
->
stbCfg
.
pBSmaCols
=
(
col_id_t
*
)
malloc
(
pReq
->
stbCfg
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nBSmaCols
;
++
i
)
{
buf
=
taosDecodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pBSmaCols
+
i
);
}
}
else
{
pReq
->
stbCfg
.
pBSmaCols
=
NULL
;
}
if
(
pReq
->
rollup
)
{
pReq
->
stbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
malloc
(
sizeof
(
SRSmaParam
));
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
buf
=
taosDecodeFixedU32
(
buf
,
(
uint32_t
*
)
&
param
->
xFilesFactor
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
delayUnit
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
nFuncIds
);
if
(
param
->
nFuncIds
>
0
)
{
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
buf
=
taosDecodeFixedI32
(
buf
,
param
->
pFuncIds
+
i
);
}
}
else
{
param
->
pFuncIds
=
NULL
;
}
buf
=
taosDecodeFixedI64
(
buf
,
&
param
->
delay
);
}
else
{
pReq
->
stbCfg
.
pRSmaParam
=
NULL
;
}
break
;
default:
ASSERT
(
0
);
...
...
source/dnode/vnode/src/meta/metaBDBImpl.c
浏览文件 @
d4cc6c1f
...
...
@@ -527,7 +527,7 @@ static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg) {
buf
=
taosDecodeString
(
buf
,
&
(
pTbCfg
->
name
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pTbCfg
->
ttl
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pTbCfg
->
keep
));
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pTbCfg
->
type
));
buf
=
taosDecodeFixedU8
(
buf
,
&
(
pTbCfg
->
info
));
if
(
pTbCfg
->
type
==
META_SUPER_TABLE
)
{
SSchemaWrapper
sw
;
...
...
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
d4cc6c1f
...
...
@@ -33,6 +33,61 @@ int main(int argc, char **argv) {
return
RUN_ALL_TESTS
();
}
TEST
(
testCase
,
unionEncodeDecodeTest
)
{
typedef
struct
{
union
{
uint8_t
info
;
struct
{
uint8_t
rollup
:
1
;
// 1 means rollup sma
uint8_t
type
:
7
;
};
};
col_id_t
nBSmaCols
;
col_id_t
*
pBSmaCols
;
}
SUnionTest
;
SUnionTest
sut
=
{
0
};
sut
.
rollup
=
1
;
sut
.
type
=
1
;
sut
.
nBSmaCols
=
2
;
sut
.
pBSmaCols
=
(
col_id_t
*
)
malloc
(
sut
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
sut
.
nBSmaCols
;
++
i
)
{
sut
.
pBSmaCols
[
i
]
=
i
+
100
;
}
void
*
buf
=
malloc
(
1024
);
void
*
pBuf
=
buf
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedU8
(
&
buf
,
sut
.
info
);
tlen
+=
taosEncodeFixedI16
(
&
buf
,
sut
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
sut
.
nBSmaCols
;
++
i
)
{
tlen
+=
taosEncodeFixedI16
(
&
buf
,
sut
.
pBSmaCols
[
i
]);
}
SUnionTest
dut
=
{
0
};
pBuf
=
taosDecodeFixedU8
(
pBuf
,
&
dut
.
info
);
pBuf
=
taosDecodeFixedI16
(
pBuf
,
&
dut
.
nBSmaCols
);
if
(
dut
.
nBSmaCols
>
0
)
{
dut
.
pBSmaCols
=
(
col_id_t
*
)
malloc
(
dut
.
nBSmaCols
*
sizeof
(
col_id_t
));
for
(
col_id_t
i
=
0
;
i
<
dut
.
nBSmaCols
;
++
i
)
{
pBuf
=
taosDecodeFixedI16
(
pBuf
,
dut
.
pBSmaCols
+
i
);
}
}
else
{
dut
.
pBSmaCols
=
NULL
;
}
printf
(
"sut.rollup=%"
PRIu8
", type=%"
PRIu8
", info=%"
PRIu8
"
\n
"
,
sut
.
rollup
,
sut
.
type
,
sut
.
info
);
printf
(
"dut.rollup=%"
PRIu8
", type=%"
PRIu8
", info=%"
PRIu8
"
\n
"
,
dut
.
rollup
,
dut
.
type
,
dut
.
info
);
ASSERT_EQ
(
sut
.
rollup
,
dut
.
rollup
);
ASSERT_EQ
(
sut
.
type
,
dut
.
type
);
ASSERT_EQ
(
sut
.
nBSmaCols
,
dut
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
sut
.
nBSmaCols
;
++
i
)
{
ASSERT_EQ
(
*
(
col_id_t
*
)(
sut
.
pBSmaCols
+
i
),
sut
.
pBSmaCols
[
i
]);
ASSERT_EQ
(
*
(
col_id_t
*
)(
sut
.
pBSmaCols
+
i
),
dut
.
pBSmaCols
[
i
]);
}
}
#if 1
TEST
(
testCase
,
tSma_Meta_Encode_Decode_Test
)
{
// encode
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录