Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f7726ce8
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
提交
f7726ce8
编写于
1月 20, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tq process consumer msg
上级
5d77fab5
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
59 addition
and
19 deletion
+59
-19
include/common/tmsg.h
include/common/tmsg.h
+8
-1
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-1
include/libs/wal/wal.h
include/libs/wal/wal.h
+2
-2
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-1
source/dnode/vnode/inc/tq.h
source/dnode/vnode/inc/tq.h
+8
-13
source/dnode/vnode/src/inc/tqInt.h
source/dnode/vnode/src/inc/tqInt.h
+3
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+34
-0
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-1
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+1
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
f7726ce8
...
...
@@ -1527,7 +1527,6 @@ typedef struct SMqSetCVgReq {
SArray
*
tasks
;
// SArray<SSubQueryMsg>
}
SMqSetCVgReq
;
static
FORCE_INLINE
int32_t
tEncodeSMqSetCVgReq
(
void
**
buf
,
const
SMqSetCVgReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
vgId
);
...
...
@@ -1552,10 +1551,18 @@ static FORCE_INLINE void* tDecodeSMqSetCVgReq(void* buf, SMqSetCVgReq* pReq) {
return
buf
;
}
typedef
struct
SMqSetCVgRsp
{
int32_t
vgId
;
int64_t
consumerId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cGroup
[
TSDB_CONSUMER_GROUP_LEN
];
}
SMqSetCVgRsp
;
typedef
struct
SMqCVConsumeReq
{
int64_t
reqId
;
int64_t
offset
;
int64_t
clientId
;
int64_t
blockingTime
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cgroup
[
TSDB_CONSUMER_GROUP_LEN
];
}
SMqCVConsumeReq
;
...
...
include/common/tmsgdef.h
浏览文件 @
f7726ce8
...
...
@@ -160,7 +160,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_QUERY
,
"vnode-mq-query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_CONNECT
,
"vnode-mq-connect"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_DISCONNECT
,
"vnode-mq-disconnect"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CONN
,
"vnode-mq-set-conn"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CONN
,
"vnode-mq-set-conn"
,
SMqSetCVgReq
,
SMqSetCVgRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_MQ_SET_CUR
,
"vnode-mq-set-cur"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_RES_READY
,
"vnode-res-ready"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TASKS_STATUS
,
"vnode-tasks-status"
,
NULL
,
NULL
)
...
...
include/libs/wal/wal.h
浏览文件 @
f7726ce8
...
...
@@ -80,8 +80,8 @@ typedef enum { TAOS_WAL_NOLOG = 0, TAOS_WAL_WRITE = 1, TAOS_WAL_FSYNC = 2 } EWal
typedef
struct
SWalReadHead
{
int8_t
headVer
;
uint8
_t
msgType
;
int8_t
reserved
[
2
]
;
int16
_t
msgType
;
int8_t
reserved
;
int32_t
len
;
int64_t
ingestTs
;
// not implemented
int64_t
version
;
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
f7726ce8
...
...
@@ -95,7 +95,7 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
SMqConsumerEp
*
pCEp
=
taosArrayPop
(
pSub
->
unassignedVg
);
pCEp
->
consumerId
=
consumerId
;
taosArrayPush
(
pSub
->
assigned
,
pCEp
);
pSub
->
nextConsumerIdx
++
;
pSub
->
nextConsumerIdx
=
(
pSub
->
nextConsumerIdx
+
1
)
%
taosArrayGetSize
(
pSub
->
availConsumer
)
;
// build msg
SMqSetCVgReq
req
=
{
...
...
source/dnode/vnode/inc/tq.h
浏览文件 @
f7726ce8
...
...
@@ -27,6 +27,7 @@
#include "trpc.h"
#include "ttimer.h"
#include "tutil.h"
#include "wal.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -161,7 +162,8 @@ typedef struct STqGroup {
}
STqGroup
;
typedef
struct
STqTaskItem
{
int32_t
status
;
int8_t
status
;
int64_t
offset
;
void
*
dst
;
SSubQueryMsg
*
pMsg
;
}
STqTaskItem
;
...
...
@@ -183,6 +185,7 @@ typedef struct STqClientHandle {
int64_t
committedOffset
;
int64_t
currentOffset
;
STqBuffer
buffer
;
SWalReadHandle
*
pReadhandle
;
}
STqClientHandle
;
typedef
struct
STqQueryMsg
{
...
...
@@ -321,25 +324,20 @@ void tqClose(STQ*);
// void* will be replace by a msg type
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int64_t
version
);
int
tqCommit
(
STQ
*
);
int
tqConsume
(
STQ
*
,
SRpcMsg
*
pReq
,
SRpcMsg
**
pRsp
);
#if 0
int tqConsume(STQ*, SRpcMsg* pReq, SRpcMsg** pRsp);
int tqSetCursor(STQ*, STqSetCurReq* pMsg);
int tqBufferSetOffset(STqTopic*, int64_t offset);
STqTopic* tqFindTopic(STqGroup*, int64_t topicId);
STqGroup* tqGetGroup(STQ*, int64_t clientId);
STqGroup* tqOpenGroup(STQ*, int64_t topicId, int64_t cgId, int64_t cId);
int tqCloseGroup(STQ*, int64_t topicId, int64_t cgId, int64_t cId);
int tqRegisterContext(STqGroup*, void* ahandle);
int tqSendLaunchQuery(STqMsgItem*, int64_t offset);
#endif
int
tqSerializeGroup
(
const
STqGroup
*
,
STqSerializedHead
**
);
const
void
*
tqDeserializeGroup
(
const
STqSerializedHead
*
,
STqGroup
**
);
static
int
tqQueryExecuting
(
int32_t
status
)
{
return
status
;
}
int32_t
tqProcessConsume
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
ppRsp
);
typedef
struct
STqReadHandle
{
int64_t
ver
;
...
...
@@ -350,9 +348,6 @@ typedef struct STqReadHandle {
SMeta
*
pMeta
;
}
STqReadHandle
;
typedef
struct
SSubmitBlkScanInfo
{
}
SSubmitBlkScanInfo
;
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
,
SSubmitMsg
*
pMsg
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
);
...
...
source/dnode/vnode/src/inc/tqInt.h
浏览文件 @
f7726ce8
...
...
@@ -43,6 +43,9 @@ extern int32_t tqDebugFlag;
// delete persistent storage for meta info
// int tqDropTCGroup(STQ*, const char* topic, int cgId);
int
tqSerializeGroup
(
const
STqGroup
*
,
STqSerializedHead
**
);
const
void
*
tqDeserializeGroup
(
const
STqSerializedHead
*
pHead
,
STqGroup
**
ppGroup
);
static
int
FORCE_INLINE
tqQueryExecuting
(
int32_t
status
)
{
return
status
;
}
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
f7726ce8
...
...
@@ -608,6 +608,40 @@ int tqItemSSize() {
return
0
;
}
int32_t
tqProcessConsume
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
ppRsp
)
{
SMqCVConsumeReq
*
pReq
=
pMsg
->
pCont
;
int64_t
reqId
=
pReq
->
reqId
;
int64_t
clientId
=
pReq
->
clientId
;
int64_t
offset
=
pReq
->
offset
;
int64_t
blockingTime
=
pReq
->
blockingTime
;
STqClientHandle
*
pHandle
=
tqHandleGet
(
pTq
->
tqMeta
,
clientId
);
int8_t
pos
=
offset
%
TQ_BUFFER_SIZE
;
int8_t
old
=
atomic_val_compare_exchange_8
(
&
pHandle
->
buffer
.
output
[
pos
].
status
,
0
,
1
);
if
(
old
==
1
)
{
// do nothing
}
if
(
walReadWithHandle
(
pHandle
->
pReadhandle
,
offset
)
<
0
)
{
//TODO
}
SWalHead
*
pHead
=
pHandle
->
pReadhandle
->
pHead
;
while
(
pHead
->
head
.
msgType
!=
TDMT_VND_SUBMIT
)
{
// read until find TDMT_VND_SUBMIT
}
SSubmitMsg
*
pCont
=
(
SSubmitMsg
*
)
&
pHead
->
head
.
body
;
SSubQueryMsg
*
pQueryMsg
=
pHandle
->
buffer
.
output
[
pos
].
pMsg
;
void
*
outputData
;
atomic_store_8
(
&
pHandle
->
buffer
.
output
[
pos
].
status
,
1
);
// launch query
// get result
// put into
SMqCvConsumeRsp
*
pRsp
;
return
0
;
}
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
,
SSubmitMsg
*
pMsg
)
{
STqReadHandle
*
pReadHandle
=
malloc
(
sizeof
(
STqReadHandle
));
if
(
pReadHandle
==
NULL
)
{
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
f7726ce8
...
...
@@ -58,7 +58,7 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
case
TDMT_VND_TABLE_META
:
return
vnodeGetTableMeta
(
pVnode
,
pMsg
,
pRsp
);
case
TDMT_VND_CONSUME
:
return
0
;
return
tqProcessConsume
(
pVnode
->
pTq
,
pMsg
,
pRsp
)
;
default:
vError
(
"unknown msg type:%d in fetch queue"
,
pMsg
->
msgType
);
return
TSDB_CODE_VND_APP_ERROR
;
...
...
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
f7726ce8
...
...
@@ -110,6 +110,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
break
;
case
TDMT_VND_MQ_SET_CONN
:
{
//TODO: wrap in a function
char
*
reqStr
=
ptr
;
SMqSetCVgReq
req
;
tDecodeSMqSetCVgReq
(
reqStr
,
&
req
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录