Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f88dbe2
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看板
提交
3f88dbe2
编写于
11月 18, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: refact client server messages
上级
1b0c9843
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
8 deletion
+66
-8
include/common/tmsg.h
include/common/tmsg.h
+3
-0
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+37
-0
source/libs/qworker/src/qwMsg.c
source/libs/qworker/src/qwMsg.c
+25
-7
未找到文件。
include/common/tmsg.h
浏览文件 @
3f88dbe2
...
...
@@ -1741,6 +1741,9 @@ typedef struct {
int32_t
tSerializeSTaskDropReq
(
void
*
buf
,
int32_t
bufLen
,
STaskDropReq
*
pReq
);
int32_t
tDeserializeSTaskDropReq
(
void
*
buf
,
int32_t
bufLen
,
STaskDropReq
*
pReq
);
int32_t
tSerializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
);
int32_t
tDeserializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
);
typedef
struct
{
int32_t
code
;
...
...
source/client/src/clientTmq.c
浏览文件 @
3f88dbe2
...
...
@@ -756,7 +756,7 @@ void tmqSendHbReq(void* param, void* tmrId) {
}
sendInfo
->
msgInfo
=
(
SDataBuf
){
.
pData
=
pReq
,
.
len
=
sizeof
(
SMqHbReq
)
,
.
len
=
tlen
,
.
handle
=
NULL
,
};
...
...
source/common/src/tmsg.c
浏览文件 @
3f88dbe2
...
...
@@ -4778,6 +4778,43 @@ int32_t tDeserializeSTaskDropReq(void *buf, int32_t bufLen, STaskDropReq *pReq)
return
0
;
}
int32_t
tSerializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
tbFName
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
sversion
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
tversion
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
affectedRows
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSQueryTableRsp
(
void
*
buf
,
int32_t
bufLen
,
SQueryTableRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
(
char
*
)
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
code
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
tbFName
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
sversion
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
tversion
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pRsp
->
affectedRows
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSSchedulerHbReq
(
void
*
buf
,
int32_t
bufLen
,
SSchedulerHbReq
*
pReq
)
{
int32_t
headLen
=
sizeof
(
SMsgHead
);
...
...
source/libs/qworker/src/qwMsg.c
浏览文件 @
3f88dbe2
...
...
@@ -65,19 +65,37 @@ int32_t qwBuildAndSendErrorRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t c
int32_t
qwBuildAndSendQueryRsp
(
int32_t
rspType
,
SRpcHandleInfo
*
pConn
,
int32_t
code
,
SQWTaskCtx
*
ctx
)
{
STbVerInfo
*
tbInfo
=
ctx
?
&
ctx
->
tbInfo
:
NULL
;
int64_t
affectedRows
=
ctx
?
ctx
->
affectedRows
:
0
;
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
sizeof
(
SQueryTableRsp
));
pRsp
->
code
=
htonl
(
code
);
pRsp
->
affectedRows
=
htobe64
(
affectedRows
);
SQueryTableRsp
rsp
=
{
0
};
rsp
.
code
=
code
;
rsp
.
affectedRows
=
affectedRows
;
if
(
tbInfo
)
{
strcpy
(
pRsp
->
tbFName
,
tbInfo
->
tbFName
);
pRsp
->
sversion
=
htonl
(
tbInfo
->
sversion
);
pRsp
->
tversion
=
htonl
(
tbInfo
->
tversion
);
strcpy
(
rsp
.
tbFName
,
tbInfo
->
tbFName
);
rsp
.
sversion
=
tbInfo
->
sversion
;
rsp
.
tversion
=
tbInfo
->
tversion
;
}
int32_t
msgSize
=
tSerializeSQueryTableRsp
(
NULL
,
0
,
&
rsp
);
if
(
msgSize
<
0
)
{
qError
(
"tSerializeSQueryTableRsp failed"
);
QW_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
void
*
pRsp
=
rpcMallocCont
(
msgSize
);
if
(
NULL
==
pRsp
)
{
qError
(
"rpcMallocCont %d failed"
,
msgSize
);
QW_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
if
(
tSerializeSQueryTableRsp
(
pRsp
,
msgSize
,
&
rsp
)
<
0
)
{
qError
(
"tSerializeSQueryTableRsp %d failed"
,
msgSize
);
QW_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
SRpcMsg
rpcRsp
=
{
.
msgType
=
rspType
,
.
pCont
=
pRsp
,
.
contLen
=
sizeof
(
*
pRsp
)
,
.
contLen
=
msgSize
,
.
code
=
code
,
.
info
=
*
pConn
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录