Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ac8c6e06
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看板
提交
ac8c6e06
编写于
8月 04, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some coverity issues
also enhance telemetry report interval
上级
d9c8642d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
21 deletion
+29
-21
src/client/src/tscStream.c
src/client/src/tscStream.c
+8
-7
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-0
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+20
-14
未找到文件。
src/client/src/tscStream.c
浏览文件 @
ac8c6e06
...
...
@@ -220,15 +220,16 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
if
(
numOfRows
>
0
)
{
// when reaching here the first execution of stream computing is successful.
pStream
->
numOfRes
+=
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
TAOS_ROW
row
=
taos_fetch_row
(
res
);
tscDebug
(
"%p stream:%p fetch result"
,
pSql
,
pStream
);
tscStreamFillTimeGap
(
pStream
,
*
(
TSKEY
*
)
row
[
0
]);
pStream
->
stime
=
*
(
TSKEY
*
)
row
[
0
];
// user callback function
(
*
pStream
->
fp
)(
pStream
->
param
,
res
,
row
);
if
(
row
!=
NULL
)
{
tscDebug
(
"%p stream:%p fetch result"
,
pSql
,
pStream
);
tscStreamFillTimeGap
(
pStream
,
*
(
TSKEY
*
)
row
[
0
]);
pStream
->
stime
=
*
(
TSKEY
*
)
row
[
0
];
// user callback function
(
*
pStream
->
fp
)(
pStream
->
param
,
res
,
row
);
pStream
->
numOfRes
++
;
}
}
if
(
!
pStream
->
isProject
)
{
...
...
src/client/src/tscSub.c
浏览文件 @
ac8c6e06
...
...
@@ -203,6 +203,7 @@ static void tscProcessSubscriptionTimer(void *handle, void *tmrId) {
static
SArray
*
getTableList
(
SSqlObj
*
pSql
)
{
const
char
*
p
=
strstr
(
pSql
->
sqlstr
,
" from "
);
assert
(
p
!=
NULL
);
// we are sure this is a 'select' statement
char
*
sql
=
alloca
(
strlen
(
p
)
+
32
);
sprintf
(
sql
,
"select tbid(tbname)%s"
,
p
);
...
...
src/dnode/src/dnodeTelemetry.c
浏览文件 @
ac8c6e06
...
...
@@ -33,7 +33,7 @@ static pthread_t tsTelemetryThread;
#define TELEMETRY_SERVER "telemetry.taosdata.com"
#define TELEMETRY_PORT 80
#define REPORT_INTERVAL 86400
#define REPORT_INTERVAL 86400
static
void
beginObject
(
SBufferWriter
*
bw
)
{
tbufWriteChar
(
bw
,
'{'
);
...
...
@@ -220,28 +220,34 @@ static void sendTelemetryReport() {
taosWriteSocket
(
fd
,
tbufGetData
(
&
bw
,
false
),
contLen
);
tbufCloseWriter
(
&
bw
);
taosReadSocket
(
fd
,
buf
,
10
);
// read something to avoid nginx error 499
// read something to avoid nginx error 499
if
(
taosReadSocket
(
fd
,
buf
,
10
)
<
0
)
{
dTrace
(
"failed to receive response, reason:%s"
,
strerror
(
errno
));
}
taosCloseSocket
(
fd
);
}
static
void
*
telemetryThread
(
void
*
param
)
{
int
timeToWait
=
0
;
struct
timespec
end
=
{
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
end
);
end
.
tv_sec
+=
300
;
// wait 5 minutes to send first report
while
(
1
)
{
if
(
timeToWait
<=
0
)
{
if
(
sdbIsMaster
())
{
sendTelemetryReport
();
while
(
1
)
{
if
(
sem_timedwait
(
&
tsExitSem
,
&
end
)
==
0
)
{
return
NULL
;
}
struct
timespec
now
=
{
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
now
);
if
(
now
.
tv_sec
>
end
.
tv_sec
||
(
now
.
tv_sec
==
end
.
tv_sec
&&
now
.
tv_nsec
>=
end
.
tv_nsec
))
{
break
;
}
timeToWait
=
REPORT_INTERVAL
;
}
int
startAt
=
taosGetTimestampSec
();
struct
timespec
timeout
=
{.
tv_sec
=
0
,
.
tv_nsec
=
0
};
clock_gettime
(
CLOCK_REALTIME
,
&
timeout
);
timeout
.
tv_sec
+=
timeToWait
;
if
(
sem_timedwait
(
&
tsExitSem
,
&
timeout
)
==
0
)
{
break
;
if
(
sdbIsMaster
())
{
sendTelemetryReport
();
}
timeToWait
-=
(
taosGetTimestampSec
()
-
startAt
)
;
end
.
tv_sec
+=
REPORT_INTERVAL
;
}
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录