Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
844a2322
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
844a2322
编写于
6月 14, 2023
作者:
H
Haojun Liao
提交者:
GitHub
6月 14, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21600 from taosdata/mark/tmq
fix:check wal not exist again before register to push & move push log…
上级
2a5a4fb7
8070223a
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
57 addition
and
46 deletion
+57
-46
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+1
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+30
-1
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+9
-28
source/dnode/vnode/src/tq/tqUtil.c
source/dnode/vnode/src/tq/tqUtil.c
+10
-14
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+5
-3
未找到文件。
include/common/tmsgdef.h
浏览文件 @
844a2322
...
...
@@ -310,6 +310,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_ADD_CHECKINFO
,
"vnode-tmq-add-checkinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_DEL_CHECKINFO
,
"vnode-del-checkinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_CONSUME
,
"vnode-tmq-consume"
,
SMqPollReq
,
SMqDataBlkRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_CONSUME_PUSH
,
"vnode-tmq-consume-push"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_VG_WALINFO
,
"vnode-tmq-vg-walinfo"
,
SMqPollReq
,
SMqDataBlkRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TMQ_MAX_MSG
,
"vnd-tmq-max"
,
NULL
,
NULL
)
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
844a2322
...
...
@@ -712,6 +712,7 @@ SArray *vmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TMQ_ADD_CHECKINFO
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TMQ_DEL_CHECKINFO
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TMQ_CONSUME
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TMQ_CONSUME_PUSH
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TMQ_VG_WALINFO
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DELETE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_BATCH_DEL
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
844a2322
...
...
@@ -226,6 +226,7 @@ int32_t tqProcessDeleteSubReq(STQ* pTq, int64_t version, char* msg, int32_t msgL
int32_t
tqProcessOffsetCommitReq
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessSeekReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessPollPush
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessVgWalInfoReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
// tq-stream
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
844a2322
...
...
@@ -264,7 +264,7 @@ int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq*
tFormatOffset
(
buf1
,
80
,
&
pRsp
->
reqOffset
);
tFormatOffset
(
buf2
,
80
,
&
pRsp
->
rspOffset
);
tqDebug
(
"vgId:%d consumer:0x%"
PRIx64
" (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%"
PRIx64
,
vgId
,
tqDebug
(
"
tmq poll
vgId:%d consumer:0x%"
PRIx64
" (epoch %d) send rsp, block num:%d, req:%s, rsp:%s, reqId:0x%"
PRIx64
,
vgId
,
pReq
->
consumerId
,
pReq
->
epoch
,
pRsp
->
blockNum
,
buf1
,
buf2
,
pReq
->
reqId
);
return
0
;
...
...
@@ -421,6 +421,35 @@ int32_t tqCheckColModifiable(STQ* pTq, int64_t tbUid, int32_t colId) {
return
0
;
}
int32_t
tqProcessPollPush
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
taosWLockLatch
(
&
pTq
->
lock
);
if
(
taosHashGetSize
(
pTq
->
pPushMgr
)
>
0
)
{
void
*
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
NULL
);
while
(
pIter
)
{
STqHandle
*
pHandle
=
*
(
STqHandle
**
)
pIter
;
tqDebug
(
"vgId:%d start set submit for pHandle:%p, consumer:0x%"
PRIx64
,
vgId
,
pHandle
,
pHandle
->
consumerId
);
if
(
ASSERT
(
pHandle
->
msg
!=
NULL
))
{
tqError
(
"pHandle->msg should not be null"
);
break
;
}
else
{
SRpcMsg
msg
=
{.
msgType
=
TDMT_VND_TMQ_CONSUME
,
.
pCont
=
pHandle
->
msg
->
pCont
,
.
contLen
=
pHandle
->
msg
->
contLen
,
.
info
=
pHandle
->
msg
->
info
};
tmsgPutToQueue
(
&
pTq
->
pVnode
->
msgCb
,
QUERY_QUEUE
,
&
msg
);
taosMemoryFree
(
pHandle
->
msg
);
pHandle
->
msg
=
NULL
;
}
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
pIter
);
}
taosHashClear
(
pTq
->
pPushMgr
);
}
taosWUnLockLatch
(
&
pTq
->
lock
);
return
0
;
}
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SMqPollReq
req
=
{
0
};
int
code
=
0
;
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
844a2322
...
...
@@ -17,35 +17,16 @@
#include "vnd.h"
int32_t
tqProcessSubmitReqForSubscribe
(
STQ
*
pTq
)
{
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
taosWLockLatch
(
&
pTq
->
lock
);
if
(
taosHashGetSize
(
pTq
->
pPushMgr
)
>
0
)
{
void
*
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
NULL
);
while
(
pIter
)
{
STqHandle
*
pHandle
=
*
(
STqHandle
**
)
pIter
;
tqDebug
(
"vgId:%d start set submit for pHandle:%p, consumer:0x%"
PRIx64
,
vgId
,
pHandle
,
pHandle
->
consumerId
);
if
(
ASSERT
(
pHandle
->
msg
!=
NULL
))
{
tqError
(
"pHandle->msg should not be null"
);
break
;
}
else
{
SRpcMsg
msg
=
{.
msgType
=
TDMT_VND_TMQ_CONSUME
,
.
pCont
=
pHandle
->
msg
->
pCont
,
.
contLen
=
pHandle
->
msg
->
contLen
,
.
info
=
pHandle
->
msg
->
info
};
tmsgPutToQueue
(
&
pTq
->
pVnode
->
msgCb
,
QUERY_QUEUE
,
&
msg
);
taosMemoryFree
(
pHandle
->
msg
);
pHandle
->
msg
=
NULL
;
}
pIter
=
taosHashIterate
(
pTq
->
pPushMgr
,
pIter
);
}
taosHashClear
(
pTq
->
pPushMgr
);
if
(
taosHashGetSize
(
pTq
->
pPushMgr
)
<=
0
)
{
return
0
;
}
// unlock
taosWUnLockLatch
(
&
pTq
->
lock
);
SRpcMsg
msg
=
{.
msgType
=
TDMT_VND_TMQ_CONSUME_PUSH
};
msg
.
pCont
=
rpcMallocCont
(
sizeof
(
SMsgHead
));
msg
.
contLen
=
sizeof
(
SMsgHead
);
SMsgHead
*
pHead
=
msg
.
pCont
;
pHead
->
vgId
=
TD_VID
(
pTq
->
pVnode
);
pHead
->
contLen
=
msg
.
contLen
;
tmsgPutToQueue
(
&
pTq
->
pVnode
->
msgCb
,
QUERY_QUEUE
,
&
msg
);
return
0
;
}
...
...
source/dnode/vnode/src/tq/tqUtil.c
浏览文件 @
844a2322
...
...
@@ -176,24 +176,20 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
if
(
terrno
==
TSDB_CODE_WAL_LOG_NOT_EXIST
&&
dataRsp
.
blockNum
==
0
)
{
// lock
taosWLockLatch
(
&
pTq
->
lock
);
int64_t
ver
=
walGetCommittedVer
(
pTq
->
pVnode
->
pWal
);
if
(
pOffset
->
version
>=
ver
||
dataRsp
.
rspOffset
.
version
>=
ver
){
//check if there are data again to avoid lost data
code
=
tqRegisterPushHandle
(
pTq
,
pHandle
,
pMsg
);
taosWUnLockLatch
(
&
pTq
->
lock
);
tDeleteMqDataRsp
(
&
dataRsp
);
return
code
;
goto
end
;
}
else
{
taosWUnLockLatch
(
&
pTq
->
lock
);
}
}
// NOTE: this pHandle->consumerId may have been changed already.
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
dataRsp
,
TMQ_MSG_TYPE__POLL_RSP
,
vgId
);
end
:
{
char
buf
[
80
]
=
{
0
};
tFormatOffset
(
buf
,
80
,
&
dataRsp
.
rspOffset
);
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
", subkey %s, vgId:%d, rsp block:%d, rsp offset type:%s, reqId:0x%"
PRIx64
" code:%d"
,
consumerId
,
pHandle
->
subKey
,
vgId
,
dataRsp
.
blockNum
,
buf
,
pRequest
->
reqId
,
code
);
end
:
tDeleteMqDataRsp
(
&
dataRsp
);
}
return
code
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
844a2322
...
...
@@ -509,7 +509,7 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
int32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vTrace
(
"message in vnode query queue is processing"
);
if
((
pMsg
->
msgType
==
TDMT_SCH_QUERY
||
pMsg
->
msgType
==
TDMT_VND_TMQ_CONSUME
)
&&
!
syncIsReadyForRead
(
pVnode
->
sync
))
{
if
((
pMsg
->
msgType
==
TDMT_SCH_QUERY
||
pMsg
->
msgType
==
TDMT_VND_TMQ_CONSUME
||
pMsg
->
msgType
==
TDMT_VND_TMQ_CONSUME_PUSH
)
&&
!
syncIsReadyForRead
(
pVnode
->
sync
))
{
vnodeRedirectRpcMsg
(
pVnode
,
pMsg
,
terrno
);
return
0
;
}
...
...
@@ -530,6 +530,8 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
return
qWorkerProcessCQueryMsg
(
&
handle
,
pVnode
->
pQuery
,
pMsg
,
0
);
case
TDMT_VND_TMQ_CONSUME
:
return
tqProcessPollReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_VND_TMQ_CONSUME_PUSH
:
return
tqProcessPollPush
(
pVnode
->
pTq
,
pMsg
);
default:
vError
(
"unknown msg type:%d in query queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -563,8 +565,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return
vnodeGetTableCfg
(
pVnode
,
pMsg
,
true
);
case
TDMT_VND_BATCH_META
:
return
vnodeGetBatchMeta
(
pVnode
,
pMsg
);
case
TDMT_VND_TMQ_CONSUME
:
return
tqProcessPollReq
(
pVnode
->
pTq
,
pMsg
);
//
case TDMT_VND_TMQ_CONSUME:
//
return tqProcessPollReq(pVnode->pTq, pMsg);
case
TDMT_VND_TMQ_VG_WALINFO
:
return
tqProcessVgWalInfoReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_RUN
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录