Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7fba094c
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,发现更多精彩内容 >>
未验证
提交
7fba094c
编写于
1月 20, 2022
作者:
L
Liu Jicong
提交者:
GitHub
1月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9915 from taosdata/feature/tq
add msg for vnode consume
上级
ef6583e3
5d77fab5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
99 addition
and
23 deletion
+99
-23
include/common/tmsg.h
include/common/tmsg.h
+19
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+5
-2
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-0
source/dnode/vnode/inc/tq.h
source/dnode/vnode/inc/tq.h
+42
-18
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+2
-0
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+28
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
7fba094c
...
...
@@ -1552,6 +1552,25 @@ static FORCE_INLINE void* tDecodeSMqSetCVgReq(void* buf, SMqSetCVgReq* pReq) {
return
buf
;
}
typedef
struct
SMqCVConsumeReq
{
int64_t
reqId
;
int64_t
offset
;
int64_t
clientId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cgroup
[
TSDB_CONSUMER_GROUP_LEN
];
}
SMqCVConsumeReq
;
typedef
struct
SMqCVConsumeRsp
{
int64_t
reqId
;
int64_t
clientId
;
int64_t
committedOffset
;
int64_t
receiveOffset
;
int64_t
rspOffset
;
int32_t
skipLogNum
;
int32_t
bodyLen
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
body
[];
}
SMqCvConsumeRsp
;
#ifdef __cplusplus
}
...
...
include/common/tmsgdef.h
浏览文件 @
7fba094c
...
...
@@ -175,6 +175,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_SCHEDULE_DATA_SINK
,
"vnode-schedule-data-sink"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBSCRIBE
,
"vnode-subscribe"
,
SMVSubscribeReq
,
SMVSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CONSUME
,
"vnode-consume"
,
SMqCVConsumeReq
,
SMqCVConsumeRsp
)
// Requests handled by QNODE
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
7fba094c
...
...
@@ -464,7 +464,7 @@ static int32_t mndProcessSubscribeReq(SMnodeMsg *pMsg) {
}
taosArrayPush
(
pSub
->
availConsumer
,
&
consumerId
);
//TODO: no need
//
TODO: no need
SMqConsumerTopic
*
pConsumerTopic
=
tNewConsumerTopic
(
consumerId
,
pTopic
,
pSub
);
taosArrayPush
(
pConsumer
->
topics
,
pConsumerTopic
);
...
...
@@ -542,7 +542,10 @@ static int32_t mndProcessSubscribeReq(SMnodeMsg *pMsg) {
return
0
;
}
static
int32_t
mndProcessSubscribeInternalRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessSubscribeInternalRsp
(
SMnodeMsg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
static
int32_t
mndProcessConsumerMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
...
...
source/dnode/vnode/CMakeLists.txt
浏览文件 @
7fba094c
...
...
@@ -25,6 +25,7 @@ target_link_libraries(
PUBLIC bdb
PUBLIC tfs
PUBLIC wal
PUBLIC scheduler
PUBLIC qworker
)
...
...
source/dnode/vnode/inc/tq.h
浏览文件 @
7fba094c
...
...
@@ -18,14 +18,15 @@
#include "common.h"
#include "mallocator.h"
#include "meta.h"
#include "os.h"
#include "scheduler.h"
#include "taoserror.h"
#include "tmsg.h"
#include "tlist.h"
#include "tmsg.h"
#include "trpc.h"
#include "ttimer.h"
#include "tutil.h"
#include "meta.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -150,15 +151,40 @@ typedef struct STqListHandle {
}
STqList
;
typedef
struct
STqGroup
{
int64_t
clientId
;
int64_t
cgId
;
void
*
ahandle
;
int32_t
topicNum
;
int64_t
clientId
;
int64_t
cgId
;
void
*
ahandle
;
int32_t
topicNum
;
STqList
*
head
;
SList
*
topicList
;
// SList<STqTopic>
STqRspHandle
rspHandle
;
}
STqGroup
;
typedef
struct
STqTaskItem
{
int32_t
status
;
void
*
dst
;
SSubQueryMsg
*
pMsg
;
}
STqTaskItem
;
// new version
typedef
struct
STqBuffer
{
int64_t
firstOffset
;
int64_t
lastOffset
;
STqTaskItem
output
[
TQ_BUFFER_SIZE
];
}
STqBuffer
;
typedef
struct
STqClientHandle
{
int64_t
clientId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cGroup
[
TSDB_TOPIC_FNAME_LEN
];
char
*
sql
;
char
*
logicalPlan
;
char
*
physicalPlan
;
int64_t
committedOffset
;
int64_t
currentOffset
;
STqBuffer
buffer
;
}
STqClientHandle
;
typedef
struct
STqQueryMsg
{
STqMsgItem
*
item
;
struct
STqQueryMsg
*
next
;
...
...
@@ -253,7 +279,7 @@ typedef struct STqMetaStore {
// a table head
STqMetaList
*
unpersistHead
;
// topics that are not connectted
STqMetaList
*
unconnectTopic
;
STqMetaList
*
unconnectTopic
;
// TODO:temporaral use, to be replaced by unified tfile
int
fileFd
;
...
...
@@ -316,24 +342,22 @@ const void* tqDeserializeGroup(const STqSerializedHead*, STqGroup**);
static
int
tqQueryExecuting
(
int32_t
status
)
{
return
status
;
}
typedef
struct
STqReadHandle
{
int64_t
ver
;
SSubmitMsg
*
pMsg
;
SSubmitBlk
*
pBlock
;
int64_t
ver
;
SSubmitMsg
*
pMsg
;
SSubmitBlk
*
pBlock
;
SSubmitMsgIter
msgIter
;
SSubmitBlkIter
blkIter
;
SMeta
*
pMeta
;
SMeta
*
pMeta
;
}
STqReadHandle
;
typedef
struct
SSubmitBlkScanInfo
{
}
SSubmitBlkScanInfo
;
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
,
SSubmitMsg
*
pMsg
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
);
//return SArray<SColumnInfoData>
SArray
*
tqRetrieveDataBlock
(
STqReadHandle
*
pHandle
,
SArray
*
pColumnIdList
);
//int tqLoadDataBlock(SExecTaskInfo* pTaskInfo, SSubmitBlkScanInfo* pSubmitBlkScanInfo, SSDataBlock* pBlock, uint32_t status);
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
,
SSubmitMsg
*
pMsg
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
);
// return SArray<SColumnInfoData>
SArray
*
tqRetrieveDataBlock
(
STqReadHandle
*
pHandle
,
SArray
*
pColumnIdList
);
#ifdef __cplusplus
}
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
7fba094c
...
...
@@ -177,4 +177,4 @@ bool vmaIsFull(SVMemAllocator* pVMA);
}
#endif
#endif
/*_TD_VNODE_DEF_H_*/
\ No newline at end of file
#endif
/*_TD_VNODE_DEF_H_*/
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
7fba094c
...
...
@@ -57,6 +57,8 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
// return qWorkerProcessShowFetchMsg(pVnode->pMeta, pVnode->pQuery, pMsg);
case
TDMT_VND_TABLE_META
:
return
vnodeGetTableMeta
(
pVnode
,
pMsg
,
pRsp
);
case
TDMT_VND_CONSUME
:
return
0
;
default:
vError
(
"unknown msg type:%d in fetch queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_VND_APP_ERROR
;
...
...
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
7fba094c
...
...
@@ -14,6 +14,7 @@
*/
#include "vnd.h"
#include "tq.h"
int
vnodeProcessNoWalWMsgs
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
switch
(
pMsg
->
msgType
)
{
...
...
@@ -111,9 +112,34 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
case
TDMT_VND_MQ_SET_CONN
:
{
char
*
reqStr
=
ptr
;
SMqSetCVgReq
req
;
/*tDecodeSMqSetCVgReq(reqStr, &req);*/
// create topic if not exist
tDecodeSMqSetCVgReq
(
reqStr
,
&
req
);
STqClientHandle
*
pHandle
=
calloc
(
sizeof
(
STqClientHandle
),
1
);
if
(
pHandle
==
NULL
)
{
// TODO: handle error
}
strcpy
(
pHandle
->
topicName
,
req
.
topicName
);
strcpy
(
pHandle
->
cGroup
,
req
.
cGroup
);
strcpy
(
pHandle
->
sql
,
req
.
sql
);
strcpy
(
pHandle
->
logicalPlan
,
req
.
logicalPlan
);
strcpy
(
pHandle
->
physicalPlan
,
req
.
physicalPlan
);
SArray
*
pArray
;
//TODO: deserialize to SQueryDag
SQueryDag
*
pDag
;
// convert to task
if
(
schedulerConvertDagToTaskList
(
pDag
,
&
pArray
)
<
0
)
{
// TODO: handle error
}
ASSERT
(
taosArrayGetSize
(
pArray
)
==
0
);
STaskInfo
*
pInfo
=
taosArrayGet
(
pArray
,
0
);
SArray
*
pTasks
;
schedulerCopyTask
(
pInfo
,
&
pTasks
,
TQ_BUFFER_SIZE
);
pHandle
->
buffer
.
firstOffset
=
-
1
;
pHandle
->
buffer
.
lastOffset
=
-
1
;
for
(
int
i
=
0
;
i
<
TQ_BUFFER_SIZE
;
i
++
)
{
SSubQueryMsg
*
pMsg
=
taosArrayGet
(
pTasks
,
i
);
pHandle
->
buffer
.
output
[
i
].
pMsg
=
pMsg
;
pHandle
->
buffer
.
output
[
i
].
status
=
0
;
}
// write mq meta
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录