Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ea1777d5
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ea1777d5
编写于
6月 28, 2021
作者:
sangshuduo
提交者:
GitHub
6月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4918]<fix>: taosdemo subscribe endAfterResume. (#6654)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
159d3203
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
139 addition
and
130 deletion
+139
-130
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+139
-130
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
ea1777d5
...
@@ -4408,14 +4408,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
...
@@ -4408,14 +4408,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON
*
resubAfterConsume
=
cJSON
*
resubAfterConsume
=
cJSON_GetObjectItem
(
specifiedQuery
,
"resubAfterConsume"
);
cJSON_GetObjectItem
(
specifiedQuery
,
"resubAfterConsume"
);
g_queryInfo
.
specifiedQueryInfo
.
resubAfterConsume
[
j
]
=
-
1
;
if
((
resubAfterConsume
)
if
((
resubAfterConsume
)
&&
(
resubAfterConsume
->
type
==
cJSON_Number
)
&&
(
resubAfterConsume
->
type
==
cJSON_Number
)
&&
(
resubAfterConsume
->
valueint
>=
0
))
{
&&
(
resubAfterConsume
->
valueint
>=
0
))
{
g_queryInfo
.
specifiedQueryInfo
.
resubAfterConsume
[
j
]
g_queryInfo
.
specifiedQueryInfo
.
resubAfterConsume
[
j
]
=
resubAfterConsume
->
valueint
;
=
resubAfterConsume
->
valueint
;
}
else
if
(
!
resubAfterConsume
)
{
// default value is -1, which mean do not resub
g_queryInfo
.
specifiedQueryInfo
.
resubAfterConsume
[
j
]
=
-
1
;
}
}
cJSON
*
result
=
cJSON_GetObjectItem
(
sql
,
"result"
);
cJSON
*
result
=
cJSON_GetObjectItem
(
sql
,
"result"
);
...
@@ -4572,14 +4570,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
...
@@ -4572,14 +4570,12 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON
*
superResubAfterConsume
=
cJSON
*
superResubAfterConsume
=
cJSON_GetObjectItem
(
superQuery
,
"resubAfterConsume"
);
cJSON_GetObjectItem
(
superQuery
,
"resubAfterConsume"
);
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
=
-
1
;
if
((
superResubAfterConsume
)
if
((
superResubAfterConsume
)
&&
(
superResubAfterConsume
->
type
==
cJSON_Number
)
&&
(
superResubAfterConsume
->
type
==
cJSON_Number
)
&&
(
superResubAfterConsume
->
valueint
>=
0
))
{
&&
(
superResubAfterConsume
->
valueint
>=
0
))
{
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
=
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
=
superResubAfterConsume
->
valueint
;
superResubAfterConsume
->
valueint
;
}
else
if
(
!
superResubAfterConsume
)
{
// default value is -1, which mean do not resub
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
=
-
1
;
}
}
// supert table sqls
// supert table sqls
...
@@ -7222,7 +7218,7 @@ static TAOS_SUB* subscribeImpl(
...
@@ -7222,7 +7218,7 @@ static TAOS_SUB* subscribeImpl(
}
}
if
(
tsub
==
NULL
)
{
if
(
tsub
==
NULL
)
{
printf
(
"failed to create subscription. topic:%s, sql:%s
\n
"
,
topic
,
sql
);
errorPrint
(
"failed to create subscription. topic:%s, sql:%s
\n
"
,
topic
,
sql
);
return
NULL
;
return
NULL
;
}
}
...
@@ -7237,8 +7233,7 @@ static void *superSubscribe(void *sarg) {
...
@@ -7237,8 +7233,7 @@ static void *superSubscribe(void *sarg) {
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
if
(
pThreadInfo
->
ntables
>
MAX_QUERY_SQL_COUNT
)
{
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
errorPrint
(
"The table number(%"
PRId64
") of the thread is more than max query sql count: %d
\n
"
,
pThreadInfo
->
ntables
,
pThreadInfo
->
ntables
,
MAX_QUERY_SQL_COUNT
);
MAX_QUERY_SQL_COUNT
);
exit
(
-
1
);
exit
(
-
1
);
}
}
...
@@ -7267,7 +7262,6 @@ static void *superSubscribe(void *sarg) {
...
@@ -7267,7 +7262,6 @@ static void *superSubscribe(void *sarg) {
char
topic
[
32
]
=
{
0
};
char
topic
[
32
]
=
{
0
};
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
tsubSeq
=
i
-
pThreadInfo
->
start_table_from
;
tsubSeq
=
i
-
pThreadInfo
->
start_table_from
;
verbosePrint
(
"%s() LN%d, [%d], start=%"
PRId64
" end=%"
PRId64
" i=%"
PRIu64
"
\n
"
,
verbosePrint
(
"%s() LN%d, [%d], start=%"
PRId64
" end=%"
PRId64
" i=%"
PRIu64
"
\n
"
,
__func__
,
__LINE__
,
__func__
,
__LINE__
,
...
@@ -7309,9 +7303,14 @@ static void *superSubscribe(void *sarg) {
...
@@ -7309,9 +7303,14 @@ static void *superSubscribe(void *sarg) {
uint64_t
st
=
0
,
et
=
0
;
uint64_t
st
=
0
,
et
=
0
;
while
((
g_queryInfo
.
superQueryInfo
.
endAfterConsume
==
-
1
)
while
((
g_queryInfo
.
superQueryInfo
.
endAfterConsume
==
-
1
)
||
(
g_queryInfo
.
superQueryInfo
.
endAfterConsume
<
||
(
g_queryInfo
.
superQueryInfo
.
endAfterConsume
>
consumed
[
pThreadInfo
->
end_table_to
-
pThreadInfo
->
start_table_from
]))
{
consumed
[
pThreadInfo
->
end_table_to
-
pThreadInfo
->
start_table_from
]))
{
verbosePrint
(
"super endAfterConsume: %d, consumed: %d
\n
"
,
g_queryInfo
.
superQueryInfo
.
endAfterConsume
,
consumed
[
pThreadInfo
->
end_table_to
-
pThreadInfo
->
start_table_from
]);
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
i
<=
pThreadInfo
->
end_table_to
;
i
++
)
{
tsubSeq
=
i
-
pThreadInfo
->
start_table_from
;
tsubSeq
=
i
-
pThreadInfo
->
start_table_from
;
...
@@ -7337,7 +7336,8 @@ static void *superSubscribe(void *sarg) {
...
@@ -7337,7 +7336,8 @@ static void *superSubscribe(void *sarg) {
if
((
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
!=
-
1
)
if
((
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
!=
-
1
)
&&
(
consumed
[
tsubSeq
]
>=
&&
(
consumed
[
tsubSeq
]
>=
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
))
{
g_queryInfo
.
superQueryInfo
.
resubAfterConsume
))
{
printf
(
"keepProgress:%d, resub super table query: %"
PRIu64
"
\n
"
,
verbosePrint
(
"%s() LN%d, keepProgress:%d, resub super table query: %"
PRIu64
"
\n
"
,
__func__
,
__LINE__
,
g_queryInfo
.
superQueryInfo
.
subscribeKeepProgress
,
g_queryInfo
.
superQueryInfo
.
subscribeKeepProgress
,
pThreadInfo
->
querySeq
);
pThreadInfo
->
querySeq
);
taos_unsubscribe
(
tsub
[
tsubSeq
],
taos_unsubscribe
(
tsub
[
tsubSeq
],
...
@@ -7357,6 +7357,10 @@ static void *superSubscribe(void *sarg) {
...
@@ -7357,6 +7357,10 @@ static void *superSubscribe(void *sarg) {
}
}
}
}
}
}
verbosePrint
(
"%s() LN%d, super endAfterConsume: %d, consumed: %d
\n
"
,
__func__
,
__LINE__
,
g_queryInfo
.
superQueryInfo
.
endAfterConsume
,
consumed
[
pThreadInfo
->
end_table_to
-
pThreadInfo
->
start_table_from
]);
taos_free_result
(
res
);
taos_free_result
(
res
);
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
for
(
uint64_t
i
=
pThreadInfo
->
start_table_from
;
...
@@ -7420,6 +7424,11 @@ static void *specifiedSubscribe(void *sarg) {
...
@@ -7420,6 +7424,11 @@ static void *specifiedSubscribe(void *sarg) {
||
(
g_queryInfo
.
specifiedQueryInfo
.
consumed
[
pThreadInfo
->
threadID
]
<
||
(
g_queryInfo
.
specifiedQueryInfo
.
consumed
[
pThreadInfo
->
threadID
]
<
g_queryInfo
.
specifiedQueryInfo
.
endAfterConsume
[
pThreadInfo
->
querySeq
]))
{
g_queryInfo
.
specifiedQueryInfo
.
endAfterConsume
[
pThreadInfo
->
querySeq
]))
{
printf
(
"consumed[%d]: %d, endAfterConsum[%"
PRId64
"]: %d
\n
"
,
pThreadInfo
->
threadID
,
g_queryInfo
.
specifiedQueryInfo
.
consumed
[
pThreadInfo
->
threadID
],
pThreadInfo
->
querySeq
,
g_queryInfo
.
specifiedQueryInfo
.
endAfterConsume
[
pThreadInfo
->
querySeq
]);
if
(
ASYNC_MODE
==
g_queryInfo
.
specifiedQueryInfo
.
asyncMode
)
{
if
(
ASYNC_MODE
==
g_queryInfo
.
specifiedQueryInfo
.
asyncMode
)
{
continue
;
continue
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录