Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
01c94a77
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
01c94a77
编写于
9月 28, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(tmq): push optimization
上级
1ad4d163
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
19 deletion
+34
-19
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+9
-9
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-0
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+2
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+7
-1
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+6
-6
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+7
-3
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-0
未找到文件。
source/client/src/clientTmq.c
浏览文件 @
01c94a77
...
...
@@ -515,7 +515,7 @@ int32_t tmqCommitMsgImpl(tmq_t* tmq, const TAOS_RES* msg, int8_t async, tmq_comm
SMqMetaRspObj
*
pMetaRspObj
=
(
SMqMetaRspObj
*
)
msg
;
topic
=
pMetaRspObj
->
topic
;
vgId
=
pMetaRspObj
->
vgId
;
}
else
if
(
TD_RES_TMQ_METADATA
(
msg
))
{
}
else
if
(
TD_RES_TMQ_METADATA
(
msg
))
{
SMqTaosxRspObj
*
pRspObj
=
(
SMqTaosxRspObj
*
)
msg
;
topic
=
pRspObj
->
topic
;
vgId
=
pRspObj
->
vgId
;
...
...
@@ -715,7 +715,7 @@ void tmqSendHbReq(void* param, void* tmrId) {
int32_t
epoch
=
tmq
->
epoch
;
SMqHbReq
*
pReq
=
taosMemoryMalloc
(
sizeof
(
SMqHbReq
));
if
(
pReq
==
NULL
)
goto
OVER
;
pReq
->
consumerId
=
consumerId
;
pReq
->
consumerId
=
htobe64
(
consumerId
)
;
pReq
->
epoch
=
epoch
;
SMsgSendInfo
*
sendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
...
...
@@ -1661,9 +1661,9 @@ void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
// build rsp
void
*
pRsp
=
NULL
;
if
(
pollRspWrapper
->
taosxRsp
.
createTableNum
==
0
)
{
if
(
pollRspWrapper
->
taosxRsp
.
createTableNum
==
0
)
{
pRsp
=
tmqBuildRspFromWrapper
(
pollRspWrapper
);
}
else
{
}
else
{
pRsp
=
tmqBuildTaosxRspFromWrapper
(
pollRspWrapper
);
}
taosFreeQitem
(
pollRspWrapper
);
...
...
@@ -1850,12 +1850,12 @@ const char* tmq_get_table_name(TAOS_RES* res) {
return
(
const
char
*
)
taosArrayGetP
(
pRspObj
->
rsp
.
blockTbName
,
pRspObj
->
resIter
);
}
else
if
(
TD_RES_TMQ_METADATA
(
res
))
{
SMqTaosxRspObj
*
pRspObj
=
(
SMqTaosxRspObj
*
)
res
;
if
(
!
pRspObj
->
rsp
.
withTbName
||
pRspObj
->
rsp
.
blockTbName
==
NULL
||
pRspObj
->
resIter
<
0
||
pRspObj
->
resIter
>=
pRspObj
->
rsp
.
blockNum
)
{
return
NULL
;
}
return
(
const
char
*
)
taosArrayGetP
(
pRspObj
->
rsp
.
blockTbName
,
pRspObj
->
resIter
);
if
(
!
pRspObj
->
rsp
.
withTbName
||
pRspObj
->
rsp
.
blockTbName
==
NULL
||
pRspObj
->
resIter
<
0
||
pRspObj
->
resIter
>=
pRspObj
->
rsp
.
blockNum
)
{
return
NULL
;
}
return
(
const
char
*
)
taosArrayGetP
(
pRspObj
->
rsp
.
blockTbName
,
pRspObj
->
resIter
);
}
return
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
01c94a77
...
...
@@ -272,6 +272,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
SMqConsumerObj
*
pConsumer
=
mndAcquireConsumer
(
pMnode
,
consumerId
);
if
(
pConsumer
==
NULL
)
{
mError
(
"consumer %ld not exist"
,
consumerId
);
terrno
=
TSDB_CODE_MND_CONSUMER_NOT_EXIST
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
01c94a77
...
...
@@ -379,6 +379,8 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
topicObj
.
ast
=
strdup
(
pCreate
->
ast
);
topicObj
.
astLen
=
strlen
(
pCreate
->
ast
)
+
1
;
qDebugL
(
"ast %s"
,
topicObj
.
ast
);
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pCreate
->
ast
,
&
pAst
)
!=
0
)
{
taosMemoryFree
(
topicObj
.
ast
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
01c94a77
...
...
@@ -65,6 +65,11 @@ static void destroySTqHandle(void* data) {
}
}
static
void
tqPushEntryFree
(
void
*
data
)
{
void
*
p
=
*
(
void
**
)
data
;
taosMemoryFree
(
p
);
}
STQ
*
tqOpen
(
const
char
*
path
,
SVnode
*
pVnode
)
{
STQ
*
pTq
=
taosMemoryCalloc
(
1
,
sizeof
(
STQ
));
if
(
pTq
==
NULL
)
{
...
...
@@ -80,7 +85,7 @@ STQ* tqOpen(const char* path, SVnode* pVnode) {
taosInitRWLatch
(
&
pTq
->
pushLock
);
pTq
->
pPushMgr
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_NO_LOCK
);
taosHashSetFreeFp
(
pTq
->
pPushMgr
,
t
aosMemo
ryFree
);
taosHashSetFreeFp
(
pTq
->
pPushMgr
,
t
qPushEnt
ryFree
);
pTq
->
pCheckInfo
=
taosHashInit
(
64
,
MurmurHash3_32
,
true
,
HASH_ENTRY_LOCK
);
...
...
@@ -548,6 +553,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
if
(
pPushEntry
!=
NULL
)
{
pPushEntry
->
pHandle
=
pHandle
;
pPushEntry
->
pInfo
=
pMsg
->
info
;
dataRsp
.
withTbName
=
0
;
memcpy
(
&
pPushEntry
->
dataRsp
,
&
dataRsp
,
sizeof
(
SMqDataRsp
));
pPushEntry
->
rspHead
.
consumerId
=
consumerId
;
pPushEntry
->
rspHead
.
epoch
=
reqEpoch
;
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
01c94a77
...
...
@@ -245,7 +245,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
if
(
qExecTask
(
task
,
NULL
,
&
ts
)
<
0
)
{
if
(
qExecTask
(
task
,
&
pDataBlock
,
&
ts
)
<
0
)
{
ASSERT
(
0
);
}
...
...
@@ -256,21 +256,19 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
,
pExec
->
numOfCols
);
pRsp
->
blockNum
++
;
}
if
(
pRsp
->
blockNum
>
0
)
{
// set offset
tqOffsetResetToLog
(
&
pRsp
->
rspOffset
,
ver
);
// remove from hash
size_t
kLen
;
void
*
key
=
taosHashGetKey
(
p
PushEntry
,
&
kLen
);
void
*
key
=
taosHashGetKey
(
p
Iter
,
&
kLen
);
void
*
keyCopy
=
taosMemoryMalloc
(
kLen
);
memcpy
(
keyCopy
,
key
,
kLen
);
taosArrayPush
(
cachedKeys
,
&
keyCopy
);
taosArrayPush
(
cachedKeyLens
,
&
kLen
);
if
(
taosHashRemove
(
pTq
->
pPushMgr
,
key
,
kLen
)
!=
0
)
{
ASSERT
(
0
);
}
tqPushDataRsp
(
pTq
,
pPushEntry
);
}
}
...
...
@@ -278,7 +276,9 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
cachedKeys
);
i
++
)
{
void
*
key
=
taosArrayGetP
(
cachedKeys
,
i
);
size_t
kLen
=
*
(
size_t
*
)
taosArrayGet
(
cachedKeyLens
,
i
);
taosHashRemove
(
pTq
->
pPushMgr
,
key
,
kLen
);
if
(
taosHashRemove
(
pTq
->
pPushMgr
,
key
,
kLen
)
!=
0
)
{
ASSERT
(
0
);
}
}
taosArrayDestroyP
(
cachedKeys
,
(
FDelete
)
taosMemoryFree
);
taosArrayDestroy
(
cachedKeyLens
);
...
...
source/libs/executor/src/projectoperator.c
浏览文件 @
01c94a77
...
...
@@ -53,7 +53,7 @@ static void destroyIndefinitOperatorInfo(void* param) {
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SProjectPhysiNode
*
pProjPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SProjectOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SProjectOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
...
@@ -184,7 +184,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
if
(
pLimitInfo
->
limit
.
limit
>=
0
&&
pLimitInfo
->
numOfOutputRows
+
pBlock
->
info
.
rows
>=
pLimitInfo
->
limit
.
limit
)
{
int32_t
keepRows
=
(
int32_t
)(
pLimitInfo
->
limit
.
limit
-
pLimitInfo
->
numOfOutputRows
);
blockDataKeepFirstNRows
(
pBlock
,
keepRows
);
//TODO: optimize it later when partition by + limit
//
TODO: optimize it later when partition by + limit
if
((
pLimitInfo
->
slimit
.
limit
==
-
1
&&
pLimitInfo
->
currentGroupId
==
0
)
||
(
pLimitInfo
->
slimit
.
limit
>
0
&&
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
doSetOperatorCompleted
(
pOperator
);
...
...
@@ -206,6 +206,10 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
blockDataCleanup
(
pFinalRes
);
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
if
(
pTaskInfo
->
streamInfo
.
pReq
)
{
pOperator
->
status
=
OP_OPENED
;
}
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
if
(
pTaskInfo
->
execModel
==
OPTR_EXEC_MODEL_QUEUE
)
{
pOperator
->
status
=
OP_OPENED
;
...
...
@@ -254,7 +258,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
}
setInfoForNewGroup
(
pBlock
,
pLimitInfo
,
pOperator
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
if
(
p
TaskInfo
->
execModel
==
OPTR_EXEC_MODEL_BATCH
&&
p
Operator
->
status
==
OP_EXEC_DONE
)
{
break
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
01c94a77
...
...
@@ -1443,6 +1443,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
if
(
tqReaderSetDataMsg
(
pInfo
->
tqReader
,
pSubmit
,
0
)
<
0
)
{
qError
(
"submit msg messed up when initing stream submit block %p"
,
pSubmit
);
pInfo
->
tqReader
->
pMsg
=
NULL
;
pTaskInfo
->
streamInfo
.
pReq
=
NULL
;
ASSERT
(
0
);
}
}
...
...
@@ -1468,6 +1469,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
pInfo
->
tqReader
->
pMsg
=
NULL
;
pTaskInfo
->
streamInfo
.
pReq
=
NULL
;
return
NULL
;
}
if
(
pTaskInfo
->
streamInfo
.
prepareStatus
.
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录