Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57fcd553
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看板
提交
57fcd553
编写于
6月 28, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
3710ea4a
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
27 deletion
+47
-27
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+3
-2
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+6
-3
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+18
-7
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+1
-1
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+8
-3
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+9
-9
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
57fcd553
...
...
@@ -333,7 +333,8 @@ struct SStreamTask {
// trigger
int8_t
triggerStatus
;
int64_t
triggerParam
;
void
*
timer
;
void
*
schedTimer
;
void
*
launchTaskTimer
;
SMsgCb
*
pMsgCb
;
// msg handle
SStreamState
*
pState
;
// state backend
...
...
@@ -550,7 +551,7 @@ int32_t tInitStreamDispatchReq(SStreamDispatchReq* pReq, const SStreamTask* pTas
int64_t
dstTaskId
);
void
tDeleteStreamDispatchReq
(
SStreamDispatchReq
*
pReq
);
int32_t
streamSetupTrigger
(
SStreamTask
*
pTask
);
int32_t
streamSetup
Schedule
Trigger
(
SStreamTask
*
pTask
);
int32_t
streamProcessRunReq
(
SStreamTask
*
pTask
);
int32_t
streamProcessDispatchMsg
(
SStreamTask
*
pTask
,
SStreamDispatchReq
*
pReq
,
SRpcMsg
*
pMsg
,
bool
exec
);
...
...
source/dnode/snode/src/snode.c
浏览文件 @
57fcd553
...
...
@@ -90,7 +90,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
pTask
->
exec
.
pExecutor
=
qCreateStreamExecTaskInfo
(
pTask
->
exec
.
qmsg
,
&
handle
,
0
);
ASSERT
(
pTask
->
exec
.
pExecutor
);
streamSetupTrigger
(
pTask
);
streamSetup
Schedule
Trigger
(
pTask
);
qDebug
(
"snode:%d expand stream task on snode, s-task:%s, checkpoint ver:%"
PRId64
" child id:%d, level:%d"
,
SNODE_HANDLE
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
version
,
pTask
->
info
.
selfChildId
,
pTask
->
info
.
taskLevel
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
57fcd553
...
...
@@ -889,11 +889,12 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask
->
exec
.
pWalReader
=
walOpenReader
(
pTq
->
pVnode
->
pWal
,
&
cond
);
}
streamSetupTrigger
(
pTask
);
streamSetup
Schedule
Trigger
(
pTask
);
tqInfo
(
"vgId:%d expand stream task, s-task:%s, checkpoint ver:%"
PRId64
" child id:%d, level:%d, scan-history:%d"
,
tqInfo
(
"vgId:%d expand stream task, s-task:%s, checkpoint ver:%"
PRId64
" child id:%d, level:%d, scan-history:%d, trigger:%"
PRId64
" ms"
,
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
version
,
pTask
->
info
.
selfChildId
,
pTask
->
info
.
taskLevel
,
pTask
->
info
.
fillHistory
);
pTask
->
info
.
fillHistory
,
pTask
->
triggerParam
);
// next valid version will add one
pTask
->
chkInfo
.
version
+=
1
;
...
...
@@ -1189,9 +1190,11 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
streamMetaReleaseTask
(
pMeta
,
pTask
);
streamMetaReleaseTask
(
pMeta
,
pStreamTask
);
taosWLockLatch
(
&
pMeta
->
lock
);
if
(
streamMetaCommit
(
pTask
->
pMeta
)
<
0
)
{
// persist to disk
}
taosWUnLockLatch
(
&
pMeta
->
lock
);
}
else
{
// todo update the chkInfo version for current task.
// this task has an associated history stream task, so we need to scan wal from the end version of
...
...
source/libs/stream/src/stream.c
浏览文件 @
57fcd553
...
...
@@ -64,14 +64,21 @@ char* createStreamTaskIdStr(int64_t streamId, int32_t taskId) {
void
streamSchedByTimer
(
void
*
param
,
void
*
tmrId
)
{
SStreamTask
*
pTask
=
(
void
*
)
param
;
int8_t
status
=
atomic_load_8
(
&
pTask
->
triggerStatus
);
qDebug
(
"s-task:%s in scheduler timer, trigger status:%d"
,
pTask
->
id
.
idStr
,
status
);
if
(
streamTaskShouldStop
(
&
pTask
->
status
)
||
streamTaskShouldPause
(
&
pTask
->
status
))
{
streamMetaReleaseTask
(
NULL
,
pTask
);
qDebug
(
"s-task:%s jump out of schedTimer"
,
pTask
->
id
.
idStr
);
return
;
}
if
(
atomic_load_8
(
&
pTask
->
triggerStatus
)
==
TASK_TRIGGER_STATUS__ACTIVE
)
{
if
(
status
==
TASK_TRIGGER_STATUS__ACTIVE
)
{
SStreamTrigger
*
trigger
=
taosAllocateQitem
(
sizeof
(
SStreamTrigger
),
DEF_QITEM
,
0
);
if
(
trigger
==
NULL
)
return
;
if
(
trigger
==
NULL
)
{
return
;
}
trigger
->
type
=
STREAM_INPUT__GET_RES
;
trigger
->
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
if
(
trigger
->
pBlock
==
NULL
)
{
...
...
@@ -84,23 +91,27 @@ void streamSchedByTimer(void* param, void* tmrId) {
if
(
tAppendDataToInputQueue
(
pTask
,
(
SStreamQueueItem
*
)
trigger
)
<
0
)
{
taosFreeQitem
(
trigger
);
taosTmrReset
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
t
imer
);
taosTmrReset
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
schedT
imer
);
return
;
}
streamSchedExec
(
pTask
);
}
taosTmrReset
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
t
imer
);
taosTmrReset
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
schedT
imer
);
}
int32_t
streamSetupTrigger
(
SStreamTask
*
pTask
)
{
int32_t
streamSetup
Schedule
Trigger
(
SStreamTask
*
pTask
)
{
if
(
pTask
->
triggerParam
!=
0
)
{
int32_t
ref
=
atomic_add_fetch_32
(
&
pTask
->
refCnt
,
1
);
ASSERT
(
ref
==
2
);
pTask
->
timer
=
taosTmrStart
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
);
ASSERT
(
ref
==
2
&&
pTask
->
schedTimer
==
NULL
);
qDebug
(
"s-task:%s setup scheduler trigger, delay:%d ms"
,
pTask
->
id
.
idStr
,
pTask
->
triggerParam
);
pTask
->
schedTimer
=
taosTmrStart
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
);
pTask
->
triggerStatus
=
TASK_TRIGGER_STATUS__INACTIVE
;
}
return
0
;
}
...
...
source/libs/stream/src/streamDispatch.c
浏览文件 @
57fcd553
...
...
@@ -557,7 +557,7 @@ static void doRetryDispatchData(void* param, void* tmrId) {
void
streamRetryDispatchStreamBlock
(
SStreamTask
*
pTask
,
int64_t
waitDuration
)
{
qError
(
"s-task:%s dispatch data in %"
PRId64
"ms"
,
pTask
->
id
.
idStr
,
waitDuration
);
taosTmrReset
(
doRetryDispatchData
,
waitDuration
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
t
imer
);
taosTmrReset
(
doRetryDispatchData
,
waitDuration
,
pTask
,
streamEnv
.
timer
,
&
pTask
->
launchTaskT
imer
);
}
int32_t
streamDispatchStreamBlock
(
SStreamTask
*
pTask
)
{
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
57fcd553
...
...
@@ -139,9 +139,14 @@ void streamMetaClose(SStreamMeta* pMeta) {
}
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
pIter
;
if
(
pTask
->
timer
)
{
taosTmrStop
(
pTask
->
timer
);
pTask
->
timer
=
NULL
;
if
(
pTask
->
schedTimer
)
{
taosTmrStop
(
pTask
->
schedTimer
);
pTask
->
schedTimer
=
NULL
;
}
if
(
pTask
->
launchTaskTimer
)
{
taosTmrStop
(
pTask
->
launchTaskTimer
);
pTask
->
launchTaskTimer
=
NULL
;
}
tFreeStreamTask
(
pTask
);
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
57fcd553
...
...
@@ -441,7 +441,7 @@ static void tryLaunchHistoryTask(void* param, void* tmrId) {
SStreamTaskRetryInfo
*
pInfo
=
param
;
SStreamMeta
*
pMeta
=
pInfo
->
pMeta
;
qDebug
(
"s-task:0x%x in timer to launch history task"
,
pInfo
->
taskId
);
qDebug
(
"s-task:0x%x in timer to launch
related
history task"
,
pInfo
->
taskId
);
taosWLockLatch
(
&
pMeta
->
lock
);
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
pInfo
->
taskId
,
sizeof
(
int32_t
));
...
...
@@ -472,7 +472,7 @@ static void tryLaunchHistoryTask(void* param, void* tmrId) {
"destroyed, or should stop exec"
,
pTask
->
id
.
idStr
,
pMeta
->
vgId
,
pStatus
,
pTask
->
historyTaskId
.
taskId
);
taosTmrReset
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
,
&
pTask
->
t
imer
);
taosTmrReset
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
,
&
pTask
->
launchTaskT
imer
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
;
}
...
...
@@ -486,7 +486,7 @@ static void tryLaunchHistoryTask(void* param, void* tmrId) {
pTask
->
status
.
timerActive
=
0
;
streamMetaReleaseTask
(
pMeta
,
pTask
);
}
else
{
qError
(
"s-task:0x%x failed to load task, it may have been dest
or
yed"
,
pInfo
->
taskId
);
qError
(
"s-task:0x%x failed to load task, it may have been dest
ro
yed"
,
pInfo
->
taskId
);
}
taosMemoryFree
(
pInfo
);
...
...
@@ -508,18 +508,18 @@ int32_t streamCheckHistoryTaskDownstrem(SStreamTask* pTask) {
pInfo
->
taskId
=
pTask
->
id
.
taskId
;
pInfo
->
pMeta
=
pTask
->
pMeta
;
if
(
pTask
->
t
imer
==
NULL
)
{
pTask
->
t
imer
=
taosTmrStart
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
);
if
(
pTask
->
t
imer
==
NULL
)
{
if
(
pTask
->
launchTaskT
imer
==
NULL
)
{
pTask
->
launchTaskT
imer
=
taosTmrStart
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
);
if
(
pTask
->
launchTaskT
imer
==
NULL
)
{
// todo failed to create timer
}
else
{
pTask
->
status
.
timerActive
=
1
;
// timer is active
qDebug
(
"s-task:%s set time active flag"
,
pTask
->
id
.
idStr
);
qDebug
(
"s-task:%s set time
r
active flag"
,
pTask
->
id
.
idStr
);
}
}
else
{
// timer exists
pTask
->
status
.
timerActive
=
1
;
qDebug
(
"s-task:%s set time
active flag
"
,
pTask
->
id
.
idStr
);
taosTmrReset
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
,
&
pTask
->
t
imer
);
qDebug
(
"s-task:%s set time
r active flag, task timer not null
"
,
pTask
->
id
.
idStr
);
taosTmrReset
(
tryLaunchHistoryTask
,
100
,
pInfo
,
streamEnv
.
timer
,
&
pTask
->
launchTaskT
imer
);
}
// try again in 500ms
...
...
tests/script/sh/deploy.sh
浏览文件 @
57fcd553
...
...
@@ -118,7 +118,7 @@ echo "statusInterval 1" >> $TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag 0"
>>
$TAOS_CFG
echo
"tmrDebugFlag 1
31
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"uDebugFlag 143"
>>
$TAOS_CFG
echo
"rpcDebugFlag 143"
>>
$TAOS_CFG
echo
"jniDebugFlag 143"
>>
$TAOS_CFG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录