Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b1b85c3d
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b1b85c3d
编写于
5月 10, 2023
作者:
H
Hui Li
提交者:
GitHub
5月 10, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21227 from taosdata/fix/TD-24058
fix:[TD-24058]send poll result to client if no data 5 times to avoid …
上级
7d1a6e0e
587f750c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
14 deletion
+21
-14
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+1
-0
source/dnode/vnode/src/tq/tqUtil.c
source/dnode/vnode/src/tq/tqUtil.c
+13
-6
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+7
-8
未找到文件。
source/dnode/vnode/src/inc/tq.h
浏览文件 @
b1b85c3d
...
...
@@ -101,6 +101,7 @@ typedef struct {
STqPushHandle
pushHandle
;
// push
STqExecHandle
execHandle
;
// exec
SRpcMsg
*
msg
;
int32_t
noDataPollCnt
;
}
STqHandle
;
typedef
struct
{
...
...
source/dnode/vnode/src/tq/tqUtil.c
浏览文件 @
b1b85c3d
...
...
@@ -16,6 +16,7 @@
#include "tq.h"
#define IS_OFFSET_RESET_TYPE(_t) ((_t) < 0)
#define NO_POLL_CNT 5
static
int32_t
tqSendMetaPollRsp
(
STQ
*
pTq
,
const
SRpcMsg
*
pMsg
,
const
SMqPollReq
*
pReq
,
const
SMqMetaRsp
*
pRsp
);
...
...
@@ -185,12 +186,18 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
// till now, all data has been transferred to consumer, new data needs to push client once arrived.
if
(
dataRsp
.
blockNum
==
0
&&
dataRsp
.
reqOffset
.
type
==
TMQ_OFFSET__LOG
&&
dataRsp
.
reqOffset
.
version
==
dataRsp
.
rspOffset
.
version
&&
pHandle
->
consumerId
==
pRequest
->
consumerId
)
{
// lock
taosWLockLatch
(
&
pTq
->
lock
);
code
=
tqRegisterPushHandle
(
pTq
,
pHandle
,
pMsg
);
taosWUnLockLatch
(
&
pTq
->
lock
);
tDeleteSMqDataRsp
(
&
dataRsp
);
return
code
;
if
(
pHandle
->
noDataPollCnt
>=
NO_POLL_CNT
){
// send poll result to client if no data 5 times to avoid lost data
pHandle
->
noDataPollCnt
=
0
;
// lock
taosWLockLatch
(
&
pTq
->
lock
);
code
=
tqRegisterPushHandle
(
pTq
,
pHandle
,
pMsg
);
taosWUnLockLatch
(
&
pTq
->
lock
);
tDeleteSMqDataRsp
(
&
dataRsp
);
return
code
;
}
else
{
pHandle
->
noDataPollCnt
++
;
}
}
...
...
source/libs/wal/src/walRead.c
浏览文件 @
b1b85c3d
...
...
@@ -74,18 +74,17 @@ int32_t walNextValidMsg(SWalReader *pReader) {
int64_t
lastVer
=
walGetLastVer
(
pReader
->
pWal
);
int64_t
committedVer
=
walGetCommittedVer
(
pReader
->
pWal
);
int64_t
appliedVer
=
walGetAppliedVer
(
pReader
->
pWal
);
while
(
appliedVer
<
committedVer
){
// wait apply ver equal to commit ver, otherwise may lost data when consume data [TD-24010]
wDebug
(
"vgId:%d, wal apply ver:%"
PRId64
" smaller than commit ver:%"
PRId64
", so sleep 1ms"
,
pReader
->
pWal
->
cfg
.
vgId
,
appliedVer
,
committedVer
);
taosMsleep
(
1
);
appliedVer
=
walGetAppliedVer
(
pReader
->
pWal
);
if
(
appliedVer
<
committedVer
){
// wait apply ver equal to commit ver, otherwise may lost data when consume data [TD-24010]
wDebug
(
"vgId:%d, wal apply ver:%"
PRId64
" smaller than commit ver:%"
PRId64
,
pReader
->
pWal
->
cfg
.
vgId
,
appliedVer
,
committedVer
);
// taosMsleep(10);
}
// int64_t endVer = pReader->cond.scanUncommited ? lastVer : committedVer;
// endVer = TMIN(appliedVer, en
dVer);
int64_t
endVer
=
TMIN
(
appliedVer
,
committe
dVer
);
wDebug
(
"vgId:%d, wal start to fetch, index:%"
PRId64
", last index:%"
PRId64
" commit index:%"
PRId64
", applied index:%"
PRId64
,
pReader
->
pWal
->
cfg
.
vgId
,
fetchVer
,
lastVer
,
committedVer
,
appliedVer
);
while
(
fetchVer
<=
committe
dVer
)
{
", applied index:%"
PRId64
", end index:%"
PRId64
,
pReader
->
pWal
->
cfg
.
vgId
,
fetchVer
,
lastVer
,
committedVer
,
appliedVer
,
endVer
);
while
(
fetchVer
<=
en
dVer
)
{
if
(
walFetchHeadNew
(
pReader
,
fetchVer
)
<
0
)
{
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录