Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
963fb9b9
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
963fb9b9
编写于
1月 27, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix mq rebalance
上级
8a180a33
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
8 deletion
+45
-8
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+8
-2
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+16
-5
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+14
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+7
-1
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
963fb9b9
...
...
@@ -628,6 +628,10 @@ struct tmq_message_t {
};
int32_t
tmq_poll_cb_inner
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
if
(
code
==
-
1
)
{
printf
(
"discard
\n
"
);
return
0
;
}
SMqClientVg
*
pVg
=
(
SMqClientVg
*
)
param
;
SMqConsumeRsp
rsp
;
tDecodeSMqConsumeRsp
(
pMsg
->
pData
,
&
rsp
);
...
...
@@ -680,6 +684,8 @@ int32_t tmq_ask_ep_cb(void* param, const SDataBuf* pMsg, int32_t code) {
SMqAskEpCbParam
*
pParam
=
(
SMqAskEpCbParam
*
)
param
;
tmq_t
*
tmq
=
pParam
->
tmq
;
if
(
code
!=
0
)
{
printf
(
"exit wait %d
\n
"
,
pParam
->
wait
);
if
(
pParam
->
wait
)
{
tsem_post
(
&
tmq
->
rspSem
);
}
...
...
@@ -691,9 +697,9 @@ int32_t tmq_ask_ep_cb(void* param, const SDataBuf* pMsg, int32_t code) {
tDecodeSMqCMGetSubEpRsp
(
pMsg
->
pData
,
&
rsp
);
int32_t
sz
=
taosArrayGetSize
(
rsp
.
topics
);
// TODO: lock
printf
(
"rsp epoch %ld sz %ld
\n
"
,
rsp
.
epoch
,
rsp
.
topics
->
size
);
printf
(
"tmq epoch %ld sz %ld
\n
"
,
tmq
->
epoch
,
tmq
->
clientTopics
->
size
);
if
(
rsp
.
epoch
!=
tmq
->
epoch
)
{
/*printf("rsp epoch %ld", rsp.epoch);*/
/*printf("tmq epoch %ld", tmq->epoch);*/
//TODO
if
(
tmq
->
clientTopics
)
taosArrayDestroy
(
tmq
->
clientTopics
);
tmq
->
clientTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqClientTopic
));
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
963fb9b9
...
...
@@ -104,9 +104,6 @@ static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
if
(
found
==
0
)
{
taosArrayPush
(
pSub
->
availConsumer
,
&
consumerId
);
}
SSdbRaw
*
pRaw
=
mndSubActionEncode
(
pSub
);
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
sdbWriteNotFree
(
pMnode
->
pSdb
,
pRaw
);
int32_t
assignedSz
=
taosArrayGetSize
(
pSub
->
assigned
);
topicEp
.
vgs
=
taosArrayInit
(
assignedSz
,
sizeof
(
SMqSubVgEp
));
...
...
@@ -126,7 +123,9 @@ static int32_t mndProcessGetSubEpReq(SMnodeMsg *pMsg) {
taosArrayPush
(
rsp
.
topics
,
&
topicEp
);
}
if
(
changed
||
found
)
{
SSdbRaw
*
pRaw
=
mndSubActionEncode
(
pSub
);
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
sdbWriteNotFree
(
pMnode
->
pSdb
,
pRaw
);
}
mndReleaseSubscribe
(
pMnode
,
pSub
);
}
...
...
@@ -183,12 +182,15 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
}
// TODO: acquire consumer, set status to unavail
}
#if 0
SMqConsumerObj* pConsumer = mndAcquireConsumer(pMnode, consumerId);
pConsumer->epoch++;
printf("current epoch %ld size %ld", pConsumer->epoch, pConsumer->topics->size);
SSdbRaw* pRaw = mndConsumerActionEncode(pConsumer);
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
sdbWriteNotFree(pMnode->pSdb, pRaw);
mndReleaseConsumer(pMnode, pConsumer);
#endif
}
}
if
((
sz
=
taosArrayGetSize
(
pSub
->
unassignedVg
))
>
0
&&
taosArrayGetSize
(
pSub
->
availConsumer
)
>
0
)
{
...
...
@@ -207,6 +209,13 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
taosArrayPush
(
pSub
->
assigned
,
pCEp
);
pSub
->
nextConsumerIdx
=
(
pSub
->
nextConsumerIdx
+
1
)
%
taosArrayGetSize
(
pSub
->
availConsumer
);
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
pConsumer
->
epoch
++
;
/*SSdbRaw* pConsumerRaw = mndConsumerActionEncode(pConsumer);*/
/*sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);*/
/*sdbWriteNotFree(pMnode->pSdb, pConsumerRaw);*/
mndReleaseConsumer
(
pMnode
,
pConsumer
);
// build msg
SMqSetCVgReq
req
=
{
0
};
...
...
@@ -216,8 +225,9 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
req
.
logicalPlan
=
pTopic
->
logicalPlan
;
req
.
physicalPlan
=
pTopic
->
physicalPlan
;
req
.
qmsg
=
pCEp
->
qmsg
;
req
.
newConsumerId
=
consumerId
;
int32_t
tlen
=
tEncodeSMqSetCVgReq
(
NULL
,
&
req
);
void
*
buf
=
malloc
(
tlen
);
void
*
buf
=
malloc
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
...
...
@@ -262,6 +272,7 @@ static int mndInitUnassignedVg(SMnode *pMnode, SMqTopicObj *pTopic, SArray *unas
SArray
*
pArray
;
SArray
*
inner
=
taosArrayGet
(
pDag
->
pSubplans
,
0
);
SSubplan
*
plan
=
taosArrayGetP
(
inner
,
0
);
plan
->
execNode
.
inUse
=
0
;
strcpy
(
plan
->
execNode
.
epAddr
[
0
].
fqdn
,
"localhost"
);
plan
->
execNode
.
epAddr
[
0
].
port
=
6030
;
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
963fb9b9
...
...
@@ -71,6 +71,7 @@ typedef struct {
typedef
struct
STqReadHandle
{
int64_t
ver
;
uint64_t
tbUid
;
SHashObj
*
tbIdHash
;
SSubmitMsg
*
pMsg
;
SSubmitBlk
*
pBlock
;
SSubmitMsgIter
msgIter
;
...
...
@@ -211,6 +212,19 @@ static FORCE_INLINE void tqReadHandleSetTbUid(STqReadHandle* pHandle, uint64_t t
pHandle
->
tbUid
=
tbUid
;
}
static
FORCE_INLINE
int
tqReadHandleSetTbUidList
(
STqReadHandle
*
pHandle
,
SArray
*
tbUidList
)
{
pHandle
->
tbIdHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
true
,
HASH_NO_LOCK
);
if
(
pHandle
->
tbIdHash
==
NULL
)
{
return
-
1
;
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUidList
);
i
++
)
{
int64_t
*
pKey
=
(
int64_t
*
)
taosArrayGet
(
tbUidList
,
i
);
taosHashPut
(
pHandle
->
tbIdHash
,
pKey
,
sizeof
(
int64_t
),
NULL
,
0
);
//pHandle->tbUid = tbUid;
}
return
0
;
}
void
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitMsg
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
963fb9b9
...
...
@@ -679,7 +679,13 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg) {
SMqConsumeRsp
rsp
=
{.
consumerId
=
consumerId
,
.
numOfTopics
=
0
,
.
pBlockData
=
NULL
};
STqConsumerHandle
*
pConsumer
=
tqHandleGet
(
pTq
->
tqMeta
,
consumerId
);
ASSERT
(
pConsumer
);
if
(
pConsumer
==
NULL
)
{
pMsg
->
pCont
=
NULL
;
pMsg
->
contLen
=
0
;
pMsg
->
code
=
-
1
;
rpcSendResponse
(
pMsg
);
return
0
;
}
int
sz
=
taosArrayGetSize
(
pConsumer
->
topics
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录