Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7361019e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
7361019e
编写于
1月 21, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
put createStreamExecTaskInfo into right place
上级
7280794c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
58 addition
and
58 deletion
+58
-58
include/libs/executor/executor.h
include/libs/executor/executor.h
+8
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+3
-3
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+9
-20
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-0
source/dnode/vnode/inc/tq.h
source/dnode/vnode/inc/tq.h
+2
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-32
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+33
-1
未找到文件。
include/libs/executor/executor.h
浏览文件 @
7361019e
...
...
@@ -26,6 +26,13 @@ typedef void* qTaskInfo_t;
typedef
void
*
DataSinkHandle
;
struct
SSubplan
;
/**
* Create the exec task for streaming mode
* @param pMsg
* @param pStreamBlockReadHandle
* @return
*/
qTaskInfo_t
createStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
pStreamBlockReadHandle
);
/**
* Create the exec task object according to task json
...
...
@@ -203,4 +210,4 @@ void** qDeregisterQInfo(void* pMgmt, void* pQInfo);
}
#endif
#endif
/*_TD_EXECUTOR_H_*/
\ No newline at end of file
#endif
/*_TD_EXECUTOR_H_*/
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
7361019e
...
...
@@ -328,7 +328,7 @@ typedef struct SMqTopicConsumer {
typedef
struct
SMqConsumerEp
{
int32_t
vgId
;
// -1 for unassigned
SEpSet
ep
s
et
;
SEpSet
ep
S
et
;
int64_t
consumerId
;
// -1 for unassigned
int64_t
lastConsumerHbTs
;
int64_t
lastVgHbTs
;
...
...
@@ -339,7 +339,7 @@ typedef struct SMqConsumerEp {
static
FORCE_INLINE
int32_t
tEncodeSMqConsumerEp
(
void
**
buf
,
SMqConsumerEp
*
pConsumerEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumerEp
->
vgId
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pConsumerEp
->
ep
s
et
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pConsumerEp
->
ep
S
et
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumerEp
->
consumerId
);
tlen
+=
tEncodeSSubQueryMsg
(
buf
,
&
pConsumerEp
->
qExec
);
return
tlen
;
...
...
@@ -347,7 +347,7 @@ static FORCE_INLINE int32_t tEncodeSMqConsumerEp(void** buf, SMqConsumerEp* pCon
static
FORCE_INLINE
void
*
tDecodeSMqConsumerEp
(
void
**
buf
,
SMqConsumerEp
*
pConsumerEp
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumerEp
->
vgId
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pConsumerEp
->
ep
s
et
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pConsumerEp
->
ep
S
et
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumerEp
->
consumerId
);
buf
=
tDecodeSSubQueryMsg
(
buf
,
&
pConsumerEp
->
qExec
);
pConsumerEp
->
execLen
=
sizeof
(
SSubQueryMsg
)
+
pConsumerEp
->
qExec
.
contentLen
;
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
7361019e
...
...
@@ -117,7 +117,7 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
// persist msg
STransAction
action
=
{
0
};
action
.
epSet
=
pCEp
->
ep
s
et
;
action
.
epSet
=
pCEp
->
ep
S
et
;
action
.
pCont
=
reqStr
;
action
.
contLen
=
tlen
;
action
.
msgType
=
TDMT_VND_MQ_SET_CONN
;
...
...
@@ -142,36 +142,25 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
}
static
int
mndInitUnassignedVg
(
SMnode
*
pMnode
,
SMqTopicObj
*
pTopic
,
SArray
*
unassignedVg
)
{
SMqConsumerEp
CEp
;
CEp
.
lastConsumerHbTs
=
CEp
.
lastVgHbTs
=
-
1
;
//convert phyplan to dag
SQueryDag
*
pDag
=
qStringToDag
(
pTopic
->
physicalPlan
);
SArray
*
pArray
;
if
(
schedulerConvertDagToTaskList
(
pDag
,
&
pArray
)
<
0
)
{
return
-
1
;
}
int32_t
sz
=
taosArrayGetSize
(
pArray
);
//convert dag to msg
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqConsumerEp
CEp
;
CEp
.
lastConsumerHbTs
=
CEp
.
lastVgHbTs
=
-
1
;
STaskInfo
*
pTaskInfo
=
taosArrayGet
(
pArray
,
i
);
int32_t
vgId
=
pTaskInfo
->
addr
.
nodeId
;
SEpSet
epSet
;
t
ConvertQueryAddrToEpSet
(
&
epSet
,
&
pTaskInfo
->
addr
);
tConvertQueryAddrToEpSet
(
&
CEp
.
epSet
,
&
pTaskInfo
->
addr
)
;
CEp
.
vgId
=
pTaskInfo
->
addr
.
nodeId
;
t
aosArrayPush
(
unassignedVg
,
&
CEp
);
}
/*pTopic->physicalPlan;*/
SVgObj
*
pVgroup
=
NULL
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
NULL
,
(
void
**
)
&
pVgroup
);
while
(
pIter
!=
NULL
)
{
if
(
pVgroup
->
dbUid
==
pTopic
->
dbUid
)
{
CEp
.
epset
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
CEp
.
vgId
=
pVgroup
->
vgId
;
taosArrayPush
(
unassignedVg
,
&
CEp
);
}
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
}
return
0
;
qDestroyQueryDag
(
pDag
);
return
0
;
}
static
int
mndBuildMqSetConsumerVgReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqConsumerObj
*
pConsumer
,
...
...
source/dnode/vnode/CMakeLists.txt
浏览文件 @
7361019e
...
...
@@ -26,6 +26,7 @@ target_link_libraries(
PUBLIC tfs
PUBLIC wal
PUBLIC scheduler
PUBLIC executor
PUBLIC qworker
)
...
...
source/dnode/vnode/inc/tq.h
浏览文件 @
7361019e
...
...
@@ -21,6 +21,7 @@
#include "meta.h"
#include "os.h"
#include "scheduler.h"
#include "executor.h"
#include "taoserror.h"
#include "tlist.h"
#include "tmsg.h"
...
...
@@ -165,7 +166,7 @@ typedef struct STqTaskItem {
int8_t
status
;
int64_t
offset
;
void
*
dst
;
SSubQueryMsg
*
pMsg
;
qTaskInfo_t
task
;
}
STqTaskItem
;
// new version
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
7361019e
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../../../../include/libs/executor/executor.h"
#include "tqInt.h"
#include "tqMetaStore.h"
...
...
@@ -635,7 +634,7 @@ int32_t tqProcessConsumeReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg** ppRsp) {
}
SSubmitMsg
*
pCont
=
(
SSubmitMsg
*
)
&
pHead
->
head
.
body
;
SSubQueryMsg
*
pQueryMsg
=
pHandle
->
buffer
.
output
[
pos
].
pMsg
;
/*SSubQueryMsg* pQueryMsg = pHandle->buffer.output[pos].pMsg;*/
// TODO: launch query and get output data
void
*
outputData
;
...
...
@@ -689,8 +688,8 @@ int32_t tqProcessSetConnReq(STQ* pTq, SMqSetCVgReq* pReq) {
pTopic
->
buffer
.
lastOffset
=
-
1
;
for
(
int
i
=
0
;
i
<
TQ_BUFFER_SIZE
;
i
++
)
{
SSubQueryMsg
*
pMsg
=
taosArrayGet
(
pTasks
,
i
);
pTopic
->
buffer
.
output
[
i
].
pMsg
=
pMsg
;
pTopic
->
buffer
.
output
[
i
].
status
=
0
;
pTopic
->
buffer
.
output
[
i
].
task
=
createStreamExecTaskInfo
(
pMsg
,
NULL
);
}
pTopic
->
pReadhandle
=
walOpenReadHandle
(
pTq
->
pWal
);
// write mq meta
...
...
@@ -763,32 +762,3 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
taosArrayPush
(
pArray
,
&
colInfo
);
return
pArray
;
}
static
qTaskInfo_t
createExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
pStreamBlockReadHandle
)
{
if
(
pMsg
==
NULL
||
pStreamBlockReadHandle
==
NULL
)
{
return
NULL
;
}
// print those info into log
pMsg
->
sId
=
be64toh
(
pMsg
->
sId
);
pMsg
->
queryId
=
be64toh
(
pMsg
->
queryId
);
pMsg
->
taskId
=
be64toh
(
pMsg
->
taskId
);
pMsg
->
contentLen
=
ntohl
(
pMsg
->
contentLen
);
struct
SSubplan
*
plan
=
NULL
;
int32_t
code
=
qStringToSubplan
(
pMsg
->
msg
,
&
plan
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
NULL
;
}
qTaskInfo_t
pTaskInfo
=
NULL
;
code
=
qCreateExecTask
(
pStreamBlockReadHandle
,
0
,
plan
,
&
pTaskInfo
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// TODO: destroy SSubplan & pTaskInfo
terrno
=
code
;
return
NULL
;
}
return
pTaskInfo
;
}
\ No newline at end of file
source/libs/executor/src/executor.c
浏览文件 @
7361019e
...
...
@@ -11,4 +11,36 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
\ No newline at end of file
*/
#include "planner.h"
#include "executor.h"
qTaskInfo_t
createStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
pStreamBlockReadHandle
)
{
if
(
pMsg
==
NULL
||
pStreamBlockReadHandle
==
NULL
)
{
return
NULL
;
}
// print those info into log
pMsg
->
sId
=
be64toh
(
pMsg
->
sId
);
pMsg
->
queryId
=
be64toh
(
pMsg
->
queryId
);
pMsg
->
taskId
=
be64toh
(
pMsg
->
taskId
);
pMsg
->
contentLen
=
ntohl
(
pMsg
->
contentLen
);
struct
SSubplan
*
plan
=
NULL
;
int32_t
code
=
qStringToSubplan
(
pMsg
->
msg
,
&
plan
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
NULL
;
}
qTaskInfo_t
pTaskInfo
=
NULL
;
code
=
qCreateExecTask
(
pStreamBlockReadHandle
,
0
,
plan
,
&
pTaskInfo
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// TODO: destroy SSubplan & pTaskInfo
terrno
=
code
;
return
NULL
;
}
return
pTaskInfo
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录