Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3a59c538
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
3a59c538
编写于
12月 03, 2022
作者:
K
kailixu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact: tsma code optimization
上级
614462b8
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
26 addition
and
39 deletion
+26
-39
include/common/tmsg.h
include/common/tmsg.h
+0
-3
include/os/osMemory.h
include/os/osMemory.h
+0
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+0
-28
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-1
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+25
-4
未找到文件。
include/common/tmsg.h
浏览文件 @
3a59c538
...
...
@@ -3264,9 +3264,6 @@ void tDestroySSubmitRsp2(SSubmitRsp2* pRsp, int32_t flag);
#define TSDB_MSG_FLG_ENCODE 0x1
#define TSDB_MSG_FLG_DECODE 0x2
int32_t
tBuildSubmitReq
(
int32_t
vgId
,
SSubmitReq2
*
pReq
,
void
**
pData
,
uint32_t
*
pLen
,
__tmalloc_fn_t
fp
,
__tfree_fn_t
ff
);
#pragma pack(pop)
#ifdef __cplusplus
...
...
include/os/osMemory.h
浏览文件 @
3a59c538
...
...
@@ -47,9 +47,6 @@ void *taosMemoryMallocAlign(uint32_t alignment, int64_t size);
} \
} while (0)
typedef
void
*
(
*
__tmalloc_fn_t
)(
int64_t
);
typedef
void
(
*
__tfree_fn_t
)(
void
*
);
#ifdef __cplusplus
}
#endif
...
...
source/common/src/tmsg.c
浏览文件 @
3a59c538
...
...
@@ -7000,31 +7000,3 @@ void tDestroySSubmitRsp2(SSubmitRsp2 *pRsp, int32_t flag) {
}
}
}
int32_t
tBuildSubmitReq
(
int32_t
vgId
,
SSubmitReq2
*
pReq
,
void
**
pData
,
uint32_t
*
pLen
,
__tmalloc_fn_t
fp
,
__tfree_fn_t
ff
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
uint32_t
len
=
0
;
void
*
pBuf
=
NULL
;
tEncodeSize
(
tEncodeSSubmitReq2
,
pReq
,
len
,
code
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SEncoder
encoder
;
len
+=
sizeof
(
SMsgHead
);
pBuf
=
(
*
fp
)(
len
);
if
(
NULL
==
pBuf
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
((
SMsgHead
*
)
pBuf
)
->
vgId
=
htonl
(
vgId
);
((
SMsgHead
*
)
pBuf
)
->
contLen
=
htonl
(
len
);
tEncoderInit
(
&
encoder
,
POINTER_SHIFT
(
pBuf
,
sizeof
(
SMsgHead
)),
len
-
sizeof
(
SMsgHead
));
code
=
tEncodeSSubmitReq2
(
&
encoder
,
pReq
);
tEncoderClear
(
&
encoder
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pData
=
pBuf
;
*
pLen
=
len
;
}
else
{
(
*
ff
)(
pBuf
);
}
return
code
;
}
\ No newline at end of file
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
3a59c538
...
...
@@ -199,7 +199,7 @@ int32_t tqProcessTaskRecoverFinishRsp(STQ* pTq, SRpcMsg* pMsg);
int32_t
tqBlockToSubmit
(
SVnode
*
pVnode
,
const
SArray
*
pBlocks
,
const
STSchema
*
pSchema
,
SSchemaWrapper
*
pTagSchemaWrapper
,
bool
createTb
,
int64_t
suid
,
const
char
*
stbFullName
,
SBatchDeleteReq
*
pDeleteReq
,
void
*
ppData
,
int32_t
*
pLen
);
SBatchDeleteReq
*
pDeleteReq
,
void
*
*
ppData
,
int32_t
*
pLen
);
// sma
int32_t
smaInit
();
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
3a59c538
...
...
@@ -304,7 +304,9 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
int32_t
tqBlockToSubmit
(
SVnode
*
pVnode
,
const
SArray
*
pBlocks
,
const
STSchema
*
pTSchema
,
SSchemaWrapper
*
pTagSchemaWrapper
,
bool
createTb
,
int64_t
suid
,
const
char
*
stbFullName
,
SBatchDeleteReq
*
pDeleteReq
,
void
*
ppData
,
int32_t
*
pLen
)
{
SBatchDeleteReq
*
pDeleteReq
,
void
**
ppData
,
int32_t
*
pLen
)
{
void
*
pBuf
=
NULL
;
int32_t
len
=
0
;
SSubmitReq2
*
pReq
=
NULL
;
SArray
*
tagArray
=
NULL
;
SArray
*
createTbArray
=
NULL
;
...
...
@@ -463,17 +465,36 @@ int32_t tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchema* p
taosArrayPush
(
pReq
->
aSubmitTbData
,
pTbData
);
}
terrno
=
tBuildSubmitReq
(
TD_VID
(
pVnode
),
pReq
,
ppData
,
pLen
,
rpcMallocCont
,
rpcFreeCont
);
// encode
tEncodeSize
(
tEncodeSSubmitReq2
,
pReq
,
len
,
terrno
);
if
(
TSDB_CODE_SUCCESS
==
terrno
)
{
SEncoder
encoder
;
len
+=
sizeof
(
SMsgHead
);
pBuf
=
rpcMallocCont
(
len
);
if
(
NULL
==
pBuf
)
{
goto
_end
;
}
((
SMsgHead
*
)
pBuf
)
->
vgId
=
htonl
(
TD_VID
(
pVnode
));
((
SMsgHead
*
)
pBuf
)
->
contLen
=
htonl
(
len
);
tEncoderInit
(
&
encoder
,
POINTER_SHIFT
(
pBuf
,
sizeof
(
SMsgHead
)),
len
-
sizeof
(
SMsgHead
));
if
(
tEncodeSSubmitReq2
(
&
encoder
,
pReq
)
<
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tqError
(
"failed to encode submit req since %s"
,
terrstr
());
}
tEncoderClear
(
&
encoder
);
}
_end:
taosArrayDestroy
(
tagArray
);
taosArrayDestroy
(
pVals
);
tDestroySSubmitReq2
(
pReq
,
TSDB_MSG_FLG_ENCODE
);
if
(
terrno
!=
0
)
{
rpcFreeCont
(
pBuf
);
taosArrayDestroy
(
pDeleteReq
->
deleteReqs
);
return
TSDB_CODE_FAILED
;
}
if
(
ppData
)
*
ppData
=
pBuf
;
if
(
pLen
)
*
pLen
=
len
;
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录