Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
24db3339
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看板
提交
24db3339
编写于
8月 05, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]fix concurrent issue during building the heartbeat message.
上级
c0d80b87
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
22 deletion
+24
-22
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+23
-22
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-0
未找到文件。
src/client/src/tscProfile.c
浏览文件 @
24db3339
...
@@ -227,16 +227,16 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
...
@@ -227,16 +227,16 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
int
tscBuildQueryStreamDesc
(
void
*
pMsg
,
STscObj
*
pObj
)
{
int
tscBuildQueryStreamDesc
(
void
*
pMsg
,
STscObj
*
pObj
)
{
SHeartBeatMsg
*
pHeartbeat
=
pMsg
;
SHeartBeatMsg
*
pHeartbeat
=
pMsg
;
int
allocedQueriesNum
=
pHeartbeat
->
numOfQueries
;
int
allocedQueriesNum
=
pHeartbeat
->
numOfQueries
;
int
allocedStreamsNum
=
pHeartbeat
->
numOfStreams
;
int
allocedStreamsNum
=
pHeartbeat
->
numOfStreams
;
pHeartbeat
->
numOfQueries
=
0
;
pHeartbeat
->
numOfQueries
=
0
;
SQueryDesc
*
pQdesc
=
(
SQueryDesc
*
)
pHeartbeat
->
pData
;
SQueryDesc
*
pQdesc
=
(
SQueryDesc
*
)
pHeartbeat
->
pData
;
// We extract the lock to tscBuildHeartBeatMsg function.
int64_t
now
=
taosGetTimestampMs
();
int64_t
now
=
taosGetTimestampMs
();
SSqlObj
*
pSql
=
pObj
->
sqlList
;
SSqlObj
*
pSql
=
pObj
->
sqlList
;
while
(
pSql
)
{
while
(
pSql
)
{
/*
/*
* avoid sqlobj may not be correctly removed from sql list
* avoid sqlobj may not be correctly removed from sql list
...
@@ -248,45 +248,46 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
...
@@ -248,45 +248,46 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
}
}
tstrncpy
(
pQdesc
->
sql
,
pSql
->
sqlstr
,
sizeof
(
pQdesc
->
sql
));
tstrncpy
(
pQdesc
->
sql
,
pSql
->
sqlstr
,
sizeof
(
pQdesc
->
sql
));
pQdesc
->
stime
=
htobe64
(
pSql
->
stime
);
pQdesc
->
stime
=
htobe64
(
pSql
->
stime
);
pQdesc
->
queryId
=
htonl
(
pSql
->
queryId
);
pQdesc
->
queryId
=
htonl
(
pSql
->
queryId
);
//pQdesc->useconds = htobe64(pSql->res.useconds);
pQdesc
->
useconds
=
htobe64
(
now
-
pSql
->
stime
);
pQdesc
->
useconds
=
htobe64
(
now
-
pSql
->
stime
);
pQdesc
->
qId
=
htobe64
(
pSql
->
res
.
qId
);
pQdesc
->
qId
=
htobe64
(
pSql
->
res
.
qId
);
pQdesc
->
sqlObjId
=
htobe64
(
pSql
->
self
);
pQdesc
->
sqlObjId
=
htobe64
(
pSql
->
self
);
pQdesc
->
pid
=
pHeartbeat
->
pid
;
pQdesc
->
pid
=
pHeartbeat
->
pid
;
pQdesc
->
stableQuery
=
pSql
->
cmd
.
pQueryInfo
->
stableQuery
;
pQdesc
->
numOfSub
=
pSql
->
subState
.
numOfSub
;
pQdesc
->
numOfSub
=
pSql
->
subState
.
numOfSub
;
pQdesc
->
stableQuery
=
pSql
->
cmd
.
pQueryInfo
->
stableQuery
;
char
*
p
=
pQdesc
->
subSqlInfo
;
char
*
p
=
pQdesc
->
subSqlInfo
;
int32_t
remainLen
=
sizeof
(
pQdesc
->
subSqlInfo
);
int32_t
remainLen
=
sizeof
(
pQdesc
->
subSqlInfo
);
if
(
pQdesc
->
numOfSub
==
0
)
{
if
(
pQdesc
->
numOfSub
==
0
)
{
snprintf
(
p
,
remainLen
,
"N/A"
);
snprintf
(
p
,
remainLen
,
"N/A"
);
}
else
{
}
else
{
int32_t
len
;
if
(
pSql
->
pSubs
!=
NULL
&&
pSql
->
subState
.
states
!=
NULL
)
{
if
(
pSql
->
pSubs
!=
NULL
&&
pSql
->
subState
.
states
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pQdesc
->
numOfSub
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQdesc
->
numOfSub
;
++
i
)
{
SSqlObj
*
psub
=
pSql
->
pSubs
[
i
];
SSqlObj
*
psub
=
pSql
->
pSubs
[
i
];
int64_t
self
=
(
psub
!=
NULL
)
?
psub
->
self
:
0
;
int64_t
self
=
(
psub
!=
NULL
)
?
psub
->
self
:
0
;
len
=
snprintf
(
p
,
remainLen
,
"[%d]0x%"
PRIx64
"(%c) "
,
i
,
self
,
int32_t
len
=
snprintf
(
p
,
remainLen
,
"[%d]0x%"
PRIx64
"(%c) "
,
i
,
self
,
pSql
->
subState
.
states
[
i
]
?
'C'
:
'I'
);
pSql
->
subState
.
states
[
i
]
?
'C'
:
'I'
);
if
(
len
>
remainLen
)
{
if
(
len
>
remainLen
)
{
break
;
break
;
}
remainLen
-=
len
;
p
+=
len
;
}
}
remainLen
-=
len
;
p
+=
len
;
}
}
}
}
}
pQdesc
->
numOfSub
=
htonl
(
pQdesc
->
numOfSub
);
pQdesc
->
numOfSub
=
htonl
(
pQdesc
->
numOfSub
);
taosGetFqdn
(
pQdesc
->
fqdn
);
taosGetFqdn
(
pQdesc
->
fqdn
);
pHeartbeat
->
numOfQueries
++
;
pHeartbeat
->
numOfQueries
++
;
pQdesc
++
;
pQdesc
++
;
pSql
=
pSql
->
next
;
pSql
=
pSql
->
next
;
if
(
pHeartbeat
->
numOfQueries
>=
allocedQueriesNum
)
break
;
if
(
pHeartbeat
->
numOfQueries
>=
allocedQueriesNum
)
{
break
;
}
}
}
pHeartbeat
->
numOfStreams
=
0
;
pHeartbeat
->
numOfStreams
=
0
;
...
...
src/client/src/tscUtil.c
浏览文件 @
24db3339
...
@@ -1490,6 +1490,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
...
@@ -1490,6 +1490,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
}
}
tscFreeSubobj
(
pSql
);
tscFreeSubobj
(
pSql
);
pSql
->
signature
=
NULL
;
pSql
->
signature
=
NULL
;
pSql
->
fp
=
NULL
;
pSql
->
fp
=
NULL
;
tfree
(
pSql
->
sqlstr
);
tfree
(
pSql
->
sqlstr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录