Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
96328779
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看板
提交
96328779
编写于
8月 17, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(mnode): drop stream task
上级
853e6e29
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
24 deletion
+47
-24
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+0
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+6
-1
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+22
-20
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+8
-0
source/libs/stream/src/streamQueue.c
source/libs/stream/src/streamQueue.c
+3
-2
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+8
-0
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
96328779
...
...
@@ -216,7 +216,6 @@ typedef struct {
void
*
vnode
;
FTbSink
*
tbSinkFunc
;
STSchema
*
pTSchema
;
SHashObj
*
pHash
;
// groupId to tbuid
}
STaskSinkTb
;
typedef
void
FSmaSink
(
void
*
vnode
,
int64_t
smaId
,
const
SArray
*
data
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
96328779
...
...
@@ -2044,7 +2044,12 @@ static int32_t mndCheckDropStbForStream(SMnode *pMnode, const char *stbFullName,
pIter
=
sdbFetch
(
pSdb
,
SDB_STREAM
,
pIter
,
(
void
**
)
&
pStream
);
if
(
pIter
==
NULL
)
break
;
if
(
pStream
->
smaId
==
0
&&
pStream
->
targetStbUid
==
suid
)
{
if
(
pStream
->
smaId
!=
0
)
{
sdbRelease
(
pSdb
,
pStream
);
continue
;
}
if
(
pStream
->
targetStbUid
==
suid
)
{
sdbRelease
(
pSdb
,
pStream
);
return
-
1
;
}
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
96328779
...
...
@@ -231,34 +231,35 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data) {
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
SSubmitReq
*
p
Req
=
tqBlockToSubmit
(
pVnode
,
pRes
,
pTask
->
tbSink
.
pTSchema
,
true
,
pTask
->
tbSink
.
stbUid
,
pTask
->
tbSink
.
stbFullName
,
&
deleteReq
);
SSubmitReq
*
submit
Req
=
tqBlockToSubmit
(
pVnode
,
pRes
,
pTask
->
tbSink
.
pTSchema
,
true
,
pTask
->
tbSink
.
stbUid
,
pTask
->
tbSink
.
stbFullName
,
&
deleteReq
);
tqDebug
(
"vgId:%d, task %d convert blocks over, put into write-queue"
,
TD_VID
(
pVnode
),
pTask
->
taskId
);
int32_t
code
;
int32_t
len
;
tEncodeSize
(
tEncodeSBatchDeleteReq
,
&
deleteReq
,
len
,
code
);
if
(
code
<
0
)
{
//
ASSERT
(
0
);
}
SEncoder
encoder
;
void
*
buf
=
rpcMallocCont
(
len
+
sizeof
(
SMsgHead
));
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
abuf
,
len
);
tEncodeSBatchDeleteReq
(
&
encoder
,
&
deleteReq
);
tEncoderClear
(
&
encoder
);
if
(
taosArrayGetSize
(
deleteReq
.
deleteReqs
)
!=
0
)
{
int32_t
code
;
int32_t
len
;
tEncodeSize
(
tEncodeSBatchDeleteReq
,
&
deleteReq
,
len
,
code
);
if
(
code
<
0
)
{
//
ASSERT
(
0
);
}
SEncoder
encoder
;
void
*
serializedDeleteReq
=
rpcMallocCont
(
len
+
sizeof
(
SMsgHead
));
void
*
abuf
=
POINTER_SHIFT
(
serializedDeleteReq
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
abuf
,
len
);
tEncodeSBatchDeleteReq
(
&
encoder
,
&
deleteReq
);
tEncoderClear
(
&
encoder
);
((
SMsgHead
*
)
buf
)
->
vgId
=
pVnode
->
config
.
vgId
;
((
SMsgHead
*
)
serializedDeleteReq
)
->
vgId
=
pVnode
->
config
.
vgId
;
if
(
taosArrayGetSize
(
deleteReq
.
deleteReqs
)
!=
0
)
{
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_BATCH_DEL
,
.
pCont
=
buf
,
.
pCont
=
serializedDeleteReq
,
.
contLen
=
len
+
sizeof
(
SMsgHead
),
};
if
(
tmsgPutToQueue
(
&
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
msg
)
!=
0
)
{
rpcFreeCont
(
serializedDeleteReq
);
tqDebug
(
"failed to put into write-queue since %s"
,
terrstr
());
}
}
...
...
@@ -268,11 +269,12 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data) {
// build write msg
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_SUBMIT
,
.
pCont
=
p
Req
,
.
contLen
=
ntohl
(
p
Req
->
length
),
.
pCont
=
submit
Req
,
.
contLen
=
ntohl
(
submit
Req
->
length
),
};
if
(
tmsgPutToQueue
(
&
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
msg
)
!=
0
)
{
rpcFreeCont
(
submitReq
);
tqDebug
(
"failed to put into write-queue since %s"
,
terrstr
());
}
}
source/libs/stream/src/streamMeta.c
浏览文件 @
96328779
...
...
@@ -15,6 +15,7 @@
#include "executor.h"
#include "tstream.h"
#include "ttimer.h"
SStreamMeta
*
streamMetaOpen
(
const
char
*
path
,
void
*
ahandle
,
FTaskExpand
expandFunc
)
{
SStreamMeta
*
pMeta
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamMeta
));
...
...
@@ -166,13 +167,20 @@ int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
/*return -1;*/
}
if
(
pTask
->
triggerParam
!=
0
)
{
taosTmrStop
(
pTask
->
timer
);
}
while
(
1
)
{
int8_t
schedStatus
=
atomic_val_compare_exchange_8
(
&
pTask
->
schedStatus
,
TASK_SCHED_STATUS__INACTIVE
,
TASK_SCHED_STATUS__DROPPING
);
if
(
schedStatus
==
TASK_SCHED_STATUS__INACTIVE
)
{
tFreeSStreamTask
(
pTask
);
break
;
}
else
if
(
schedStatus
==
TASK_SCHED_STATUS__DROPPING
)
{
break
;
}
taosMsleep
(
10
);
}
}
...
...
source/libs/stream/src/streamQueue.c
浏览文件 @
96328779
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
tstream
.h"
#include "
streamInc
.h"
SStreamQueue
*
streamQueueOpen
()
{
SStreamQueue
*
pQueue
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamQueue
));
...
...
@@ -36,11 +36,12 @@ void streamQueueClose(SStreamQueue* queue) {
while
(
1
)
{
void
*
qItem
=
streamQueueNextItem
(
queue
);
if
(
qItem
)
{
taos
FreeQitem
(
qItem
);
stream
FreeQitem
(
qItem
);
}
else
{
break
;
}
}
taosFreeQall
(
queue
->
qall
);
taosCloseQueue
(
queue
->
queue
);
taosMemoryFree
(
queue
);
}
source/libs/stream/src/streamTask.c
浏览文件 @
96328779
...
...
@@ -156,5 +156,13 @@ void tFreeSStreamTask(SStreamTask* pTask) {
if
(
pTask
->
outputQueue
)
streamQueueClose
(
pTask
->
outputQueue
);
if
(
pTask
->
exec
.
qmsg
)
taosMemoryFree
(
pTask
->
exec
.
qmsg
);
if
(
pTask
->
exec
.
executor
)
qDestroyTask
(
pTask
->
exec
.
executor
);
taosArrayDestroy
(
pTask
->
childEpInfo
);
if
(
pTask
->
outputType
==
TASK_OUTPUT__TABLE
)
{
tDeleteSSchemaWrapper
(
pTask
->
tbSink
.
pSchemaWrapper
);
taosMemoryFree
(
pTask
->
tbSink
.
pTSchema
);
}
if
(
pTask
->
outputType
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
taosArrayDestroy
(
pTask
->
shuffleDispatcher
.
dbInfo
.
pVgroupInfos
);
}
taosMemoryFree
(
pTask
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录