Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e124a54d
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看板
提交
e124a54d
编写于
11月 04, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The length of submit message used to insert data to server is incorrect #673
上级
afb33efc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
5 deletion
+21
-5
src/client/src/tscServer.c
src/client/src/tscServer.c
+7
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+14
-3
未找到文件。
src/client/src/tscServer.c
浏览文件 @
e124a54d
...
@@ -217,14 +217,19 @@ int tscSendMsgToServer(SSqlObj *pSql) {
...
@@ -217,14 +217,19 @@ int tscSendMsgToServer(SSqlObj *pSql) {
int32_t
totalMsgLen
=
pSql
->
cmd
.
payloadLen
+
tsRpcHeadSize
+
sizeof
(
STaosDigest
);
int32_t
totalMsgLen
=
pSql
->
cmd
.
payloadLen
+
tsRpcHeadSize
+
sizeof
(
STaosDigest
);
// the memory will be released by taosProcessResponse, so no memory leak here
// the memory will be released by taosProcessResponse, so no memory leak here
char
*
buf
=
malloc
(
totalMsgLen
);
char
*
buf
=
malloc
(
totalMsgLen
);
memcpy
(
buf
,
pSql
->
cmd
.
payload
,
totalMsgLen
);
if
(
NULL
==
buf
)
{
tscError
(
"%p msg:%s malloc fail"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
memcpy
(
buf
,
pSql
->
cmd
.
payload
,
(
size_t
)
totalMsgLen
);
tscTrace
(
"%p msg:%s is sent to server"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
tscTrace
(
"%p msg:%s is sent to server"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
char
*
pStart
=
taosBuildReqHeader
(
pSql
->
thandle
,
pSql
->
cmd
.
msgType
,
buf
);
char
*
pStart
=
taosBuildReqHeader
(
pSql
->
thandle
,
pSql
->
cmd
.
msgType
,
buf
);
if
(
pStart
)
{
if
(
pStart
)
{
if
(
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])
(
*
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])(
pSql
,
buf
);
if
(
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])
(
*
tscUpdateVnodeMsg
[
pSql
->
cmd
.
command
])(
pSql
,
buf
);
int
ret
=
taosSendMsgToPeerH
(
pSql
->
thandle
,
pStart
,
pSql
->
cmd
.
payloadLen
,
pSql
);
int
ret
=
taosSendMsgToPeerH
(
pSql
->
thandle
,
pStart
,
pSql
->
cmd
.
payloadLen
,
pSql
);
if
(
ret
>=
0
)
code
=
0
;
if
(
ret
>=
0
)
code
=
0
;
tscTrace
(
"%p send msg ret:%d code:%d sig:%p"
,
pSql
,
ret
,
code
,
pSql
->
signature
);
tscTrace
(
"%p send msg ret:%d code:%d sig:%p"
,
pSql
,
ret
,
code
,
pSql
->
signature
);
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
e124a54d
...
@@ -384,11 +384,22 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
...
@@ -384,11 +384,22 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
pCmd
->
count
=
pDataBlock
->
numOfMeters
;
pCmd
->
count
=
pDataBlock
->
numOfMeters
;
strncpy
(
pCmd
->
name
,
pDataBlock
->
meterId
,
TSDB_METER_ID_LEN
);
strncpy
(
pCmd
->
name
,
pDataBlock
->
meterId
,
TSDB_METER_ID_LEN
);
tscAllocPayloadWithSize
(
pCmd
,
pDataBlock
->
nAllocSize
);
/*
* the submit message consists of : [RPC header|message body|digest]
* the dataBlock only includes the RPC Header buffer and actual submit messsage body, space for digest needs
* additional space.
*/
int
ret
=
tscAllocPayloadWithSize
(
pCmd
,
pDataBlock
->
nAllocSize
+
sizeof
(
STaosDigest
));
if
(
TSDB_CODE_SUCCESS
!=
ret
)
return
ret
;
memcpy
(
pCmd
->
payload
,
pDataBlock
->
pData
,
pDataBlock
->
nAllocSize
);
memcpy
(
pCmd
->
payload
,
pDataBlock
->
pData
,
pDataBlock
->
nAllocSize
);
// set the message length
/*
pCmd
->
payloadLen
=
pDataBlock
->
nAllocSize
;
* the payloadLen should be actual message body size
* the old value of payloadLen is the allocated payload size
*/
pCmd
->
payloadLen
=
pDataBlock
->
nAllocSize
-
tsRpcHeadSize
;
assert
(
pCmd
->
allocSize
>=
pCmd
->
payloadLen
+
tsRpcHeadSize
+
sizeof
(
STaosDigest
));
return
tscGetMeterMeta
(
pSql
,
pCmd
->
name
);
return
tscGetMeterMeta
(
pSql
,
pCmd
->
name
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录