Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9fc55aa7
T
TDengine
项目概览
taosdata
/
TDengine
接近 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9fc55aa7
编写于
4月 19, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: vnode
上级
0d89d937
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
83 addition
and
42 deletion
+83
-42
include/common/tmsg.h
include/common/tmsg.h
+7
-7
source/common/src/tmsg.c
source/common/src/tmsg.c
+74
-30
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+0
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+0
-4
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
9fc55aa7
...
...
@@ -1444,10 +1444,9 @@ typedef struct SVCreateTbReq {
union
{
struct
{
tb_uid_t
suid
;
col_id_t
nCols
;
col_id_t
nBSmaCols
;
int16_t
nCols
;
SSchema
*
pSchema
;
col_id_t
nTagCols
;
int16_t
nTagCols
;
SSchema
*
pTagSchema
;
SRSmaParam
*
pRSmaParam
;
}
stbCfg
;
...
...
@@ -1456,14 +1455,15 @@ typedef struct SVCreateTbReq {
SKVRow
pTag
;
}
ctbCfg
;
struct
{
col_id_t
nCols
;
col_id_t
nBSmaCols
;
SSchema
*
pSchema
;
SRSmaParam
*
pRSmaParam
;
int16_t
nCols
;
SSchema
*
pSchema
;
}
ntbCfg
;
};
}
SVCreateTbReq
,
SVUpdateTbReq
;
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
);
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
);
typedef
struct
{
int32_t
code
;
}
SVCreateTbRsp
,
SVUpdateTbRsp
;
...
...
source/common/src/tmsg.c
浏览文件 @
9fc55aa7
...
...
@@ -394,6 +394,80 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR
return
0
;
}
int
tEncodeSVCreateTbReq
(
SCoder
*
pCoder
,
const
SVCreateTbReq
*
pReq
)
{
#if 0
if (tStartEncode(pCoder) < 0) return -1;
if (tEncodeCStr(pCoder, pReq->name) < 0) return -1;
if (tEncodeU32v(pCoder, pReq->ttl) < 0) return -1;
if (tEncodeU32v(pCoder, pReq->keep) < 0) return -1;
if (tEncodeI8(pCoder, pReq->type) < 0) return -1;
if (pReq->type == TSDB_SUPER_TABLE) {
if (tEncodeI64(pCoder, pReq->stbCfg.suid) < 0) return -1;
if (tEncodeI16v(pCoder, pReq->stbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
if (tEncodeI16v(pCoder, pReq->stbCfg.nTagCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nTagCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pTagSchema + i) < 0) return -1;
}
} else if (pReq->type == TSDB_CHILD_TABLE) {
if (tEncodeI64(pCoder, pReq->ctbCfg.suid) < 0) return -1;
// TODO: encode SKVRow
} else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tEncodeI16v(pCoder, pReq->ntbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->ntbCfg.nCols; i++) {
if (tEncodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
} else {
ASSERT(0);
}
tEndEncode(pCoder);
#endif
return
0
;
}
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
#if 0
if (tStartDecode(pCoder) < 0) return -1;
if (tDecodeCStr(pCoder, &pReq->name) < 0) return -1;
if (tDecodeU32v(pCoder, &pReq->ttl) < 0) return -1;
if (tDecodeU32v(pCoder, &pReq->keep) < 0) return -1;
if (tDecodeI8(pCoder, &pReq->type) < 0) return -1;
if (pReq->type == TSDB_SUPER_TABLE) {
if (tDecodeI64(pCoder, &pReq->stbCfg.suid) < 0) return -1;
if (tDecodeI16v(pCoder, &pReq->stbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nCols; i++) {
if (tDecodeSSchema(pCoder, &pReq->stbCfg.pSchema + i) < 0) return -1;
}
if (tDecodeI16v(pCoder, pReq->stbCfg.nTagCols) < 0) return -1;
for (int i = 0; i < pReq->stbCfg.nTagCols; i++) {
if (tDecodeSSchema(pCoder, pReq->stbCfg.pTagSchema + i) < 0) return -1;
}
} else if (pReq->type == TSDB_CHILD_TABLE) {
if (tDecodeI64(pCoder, pReq->ctbCfg.suid) < 0) return -1;
// TODO: decode SKVRow
} else if (pReq->type == TSDB_NORMAL_TABLE) {
if (tDecodeI16v(pCoder, pReq->ntbCfg.nCols) < 0) return -1;
for (int i = 0; i < pReq->ntbCfg.nCols; i++) {
if (tDecodeSSchema(pCoder, pReq->stbCfg.pSchema + i) < 0) return -1;
}
} else {
ASSERT(0);
}
tEndDecode(pCoder);
#endif
return
0
;
}
int32_t
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
)
{
int32_t
tlen
=
0
;
...
...
@@ -406,7 +480,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
case
TD_SUPER_TABLE
:
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
stbCfg
.
suid
);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nCols
);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nCols
;
++
i
)
{
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
type
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
flags
);
...
...
@@ -438,7 +511,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
break
;
case
TD_NORMAL_TABLE
:
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
ntbCfg
.
nCols
);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
ntbCfg
.
nBSmaCols
);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
ntbCfg
.
nCols
;
++
i
)
{
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
type
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
flags
);
...
...
@@ -446,15 +518,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
bytes
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
name
);
}
if
(
pReq
->
rollup
&&
pReq
->
ntbCfg
.
pRSmaParam
)
{
SRSmaParam
*
param
=
pReq
->
ntbCfg
.
pRSmaParam
;
tlen
+=
taosEncodeBinary
(
buf
,
(
const
void
*
)
&
param
->
xFilesFactor
,
sizeof
(
param
->
xFilesFactor
));
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
delay
);
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
nFuncIds
);
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
pFuncIds
[
i
]);
}
}
break
;
default:
ASSERT
(
0
);
...
...
@@ -473,7 +536,6 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
case
TD_SUPER_TABLE
:
buf
=
taosDecodeFixedI64
(
buf
,
&
(
pReq
->
stbCfg
.
suid
));
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nCols
));
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nBSmaCols
));
pReq
->
stbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
pReq
->
stbCfg
.
nCols
*
sizeof
(
SSchema
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nCols
;
++
i
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
type
));
...
...
@@ -515,7 +577,6 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
break
;
case
TD_NORMAL_TABLE
:
buf
=
taosDecodeFixedI16
(
buf
,
&
pReq
->
ntbCfg
.
nCols
);
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
ntbCfg
.
nBSmaCols
));
pReq
->
ntbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
pReq
->
ntbCfg
.
nCols
*
sizeof
(
SSchema
));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
ntbCfg
.
nCols
;
++
i
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
ntbCfg
.
pSchema
[
i
].
type
);
...
...
@@ -524,23 +585,6 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
ntbCfg
.
pSchema
[
i
].
bytes
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
ntbCfg
.
pSchema
[
i
].
name
);
}
if
(
pReq
->
rollup
)
{
pReq
->
ntbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
taosMemoryMalloc
(
sizeof
(
SRSmaParam
));
SRSmaParam
*
param
=
pReq
->
ntbCfg
.
pRSmaParam
;
buf
=
taosDecodeBinaryTo
(
buf
,
(
void
*
)
&
param
->
xFilesFactor
,
sizeof
(
param
->
xFilesFactor
));
buf
=
taosDecodeFixedI32
(
buf
,
&
param
->
delay
);
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
nFuncIds
);
if
(
param
->
nFuncIds
>
0
)
{
param
->
pFuncIds
=
(
func_id_t
*
)
taosMemoryMalloc
(
param
->
nFuncIds
*
sizeof
(
func_id_t
));
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
buf
=
taosDecodeFixedI32
(
buf
,
param
->
pFuncIds
+
i
);
}
}
else
{
param
->
pFuncIds
=
NULL
;
}
}
else
{
pReq
->
ntbCfg
.
pRSmaParam
=
NULL
;
}
break
;
default:
ASSERT
(
0
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
9fc55aa7
...
...
@@ -357,7 +357,6 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req
.
stbCfg
.
nCols
=
pStb
->
numOfColumns
;
req
.
stbCfg
.
nTagCols
=
pStb
->
numOfTags
;
req
.
stbCfg
.
pTagSchema
=
pStb
->
pTags
;
req
.
stbCfg
.
nBSmaCols
=
pStb
->
numOfSmas
;
req
.
stbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pStb
->
numOfColumns
,
sizeof
(
SSchema
));
if
(
req
.
stbCfg
.
pSchema
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
9fc55aa7
...
...
@@ -253,10 +253,6 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, SRpcMsg *pMsg, void *pReq, SR
taosMemoryFree
(
pCreateTbReq
->
ctbCfg
.
pTag
);
}
else
{
taosMemoryFree
(
pCreateTbReq
->
ntbCfg
.
pSchema
);
if
(
pCreateTbReq
->
ntbCfg
.
pRSmaParam
)
{
taosMemoryFree
(
pCreateTbReq
->
ntbCfg
.
pRSmaParam
->
pFuncIds
);
taosMemoryFree
(
pCreateTbReq
->
ntbCfg
.
pRSmaParam
);
}
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
9fc55aa7
...
...
@@ -2756,6 +2756,7 @@ static int32_t buildSmaParam(STableOptions* pOptions, SVCreateTbReq* pReq) {
return
TSDB_CODE_SUCCESS
;
}
#if 0
pReq->ntbCfg.pRSmaParam = taosMemoryCalloc(1, sizeof(SRSmaParam));
if (NULL == pReq->ntbCfg.pRSmaParam) {
return TSDB_CODE_OUT_OF_MEMORY;
...
...
@@ -2770,6 +2771,7 @@ static int32_t buildSmaParam(STableOptions* pOptions, SVCreateTbReq* pReq) {
int32_t index = 0;
SNode* pFunc = NULL;
FOREACH(pFunc, pOptions->pFuncs) { pReq->ntbCfg.pRSmaParam->pFuncIds[index++] = ((SFunctionNode*)pFunc)->funcId; }
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录