Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33d6df87
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
33d6df87
编写于
5月 19, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:set task status killed when vnode receive subscribe msg from mnode
上级
c7c255e9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
18 addition
and
11 deletion
+18
-11
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+18
-11
未找到文件。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
33d6df87
...
@@ -367,6 +367,20 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -367,6 +367,20 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
return
-
1
;
return
-
1
;
}
}
// 3. update the epoch value
int32_t
savedEpoch
=
pHandle
->
epoch
;
if
(
savedEpoch
<=
reqEpoch
)
{
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
" epoch update from %d to %d by poll req"
,
consumerId
,
savedEpoch
,
reqEpoch
);
pHandle
->
epoch
=
reqEpoch
;
}
else
{
tqDebug
(
"ERROR tmq poll: consumer:0x%"
PRIx64
" vgId:%d, subkey %s, savedEpoch:%d > reqEpoch:%d "
,
consumerId
,
TD_VID
(
pTq
->
pVnode
),
req
.
subKey
,
savedEpoch
,
reqEpoch
);
terrno
=
TSDB_CODE_TMQ_CONSUMER_MISMATCH
;
taosWUnLockLatch
(
&
pTq
->
lock
);
return
-
1
;
}
bool
exec
=
tqIsHandleExec
(
pHandle
);
bool
exec
=
tqIsHandleExec
(
pHandle
);
if
(
!
exec
)
{
if
(
!
exec
)
{
tqSetHandleExec
(
pHandle
);
tqSetHandleExec
(
pHandle
);
...
@@ -381,14 +395,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -381,14 +395,6 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
taosMsleep
(
10
);
taosMsleep
(
10
);
}
}
// 3. update the epoch value
int32_t
savedEpoch
=
pHandle
->
epoch
;
if
(
savedEpoch
<
reqEpoch
)
{
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
" epoch update from %d to %d by poll req"
,
consumerId
,
savedEpoch
,
reqEpoch
);
pHandle
->
epoch
=
reqEpoch
;
}
char
buf
[
80
];
char
buf
[
80
];
tFormatOffset
(
buf
,
80
,
&
reqOffset
);
tFormatOffset
(
buf
,
80
,
&
reqOffset
);
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
" (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%"
PRIx64
,
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
" (epoch %d), subkey %s, recv poll req vgId:%d, req:%s, reqId:0x%"
PRIx64
,
...
@@ -396,6 +402,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -396,6 +402,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
code
=
tqExtractDataForMq
(
pTq
,
pHandle
,
&
req
,
pMsg
);
code
=
tqExtractDataForMq
(
pTq
,
pHandle
,
&
req
,
pMsg
);
tqSetHandleIdle
(
pHandle
);
tqSetHandleIdle
(
pHandle
);
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
"vgId:%d, topic:%s, , set handle idle, pHandle:%p"
,
consumerId
,
vgId
,
req
.
subKey
,
pHandle
);
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
"vgId:%d, topic:%s, , set handle idle, pHandle:%p"
,
consumerId
,
vgId
,
req
.
subKey
,
pHandle
);
return
code
;
return
code
;
}
}
...
@@ -561,17 +568,17 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
...
@@ -561,17 +568,17 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
ret
=
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
);
ret
=
tqMetaSaveHandle
(
pTq
,
req
.
subKey
,
pHandle
);
goto
end
;
goto
end
;
}
else
{
}
else
{
taosWLockLatch
(
&
pTq
->
lock
);
if
(
pHandle
->
consumerId
==
req
.
newConsumerId
)
{
// do nothing
if
(
pHandle
->
consumerId
==
req
.
newConsumerId
)
{
// do nothing
tqInfo
(
"vgId:%d consumer:0x%"
PRIx64
" remains, no switch occurs, should not reach here"
,
req
.
vgId
,
req
.
newConsumerId
);
tqInfo
(
"vgId:%d consumer:0x%"
PRIx64
" remains, no switch occurs, should not reach here"
,
req
.
vgId
,
req
.
newConsumerId
);
// atomic_add_fetch_32(&pHandle->epoch, 1);
}
else
{
}
else
{
tqInfo
(
"vgId:%d switch consumer from Id:0x%"
PRIx64
" to Id:0x%"
PRIx64
,
req
.
vgId
,
pHandle
->
consumerId
,
tqInfo
(
"vgId:%d switch consumer from Id:0x%"
PRIx64
" to Id:0x%"
PRIx64
,
req
.
vgId
,
pHandle
->
consumerId
,
req
.
newConsumerId
);
req
.
newConsumerId
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
atomic_store_64
(
&
pHandle
->
consumerId
,
req
.
newConsumerId
);
// atomic_store_32(&pHandle->epoch, 0);
}
}
atomic_add_fetch_32
(
&
pHandle
->
epoch
,
1
);
taosWLockLatch
(
&
pTq
->
lock
);
// kill executing task
// kill executing task
if
(
tqIsHandleExec
(
pHandle
))
{
if
(
tqIsHandleExec
(
pHandle
))
{
qTaskInfo_t
pTaskInfo
=
pHandle
->
execHandle
.
task
;
qTaskInfo_t
pTaskInfo
=
pHandle
->
execHandle
.
task
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录