Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
015c00aa
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
015c00aa
编写于
11月 16, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): timer refer stream task
上级
6478fcb2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
4 deletion
+20
-4
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+3
-0
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+9
-0
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+8
-4
未找到文件。
source/libs/stream/src/stream.c
浏览文件 @
015c00aa
...
@@ -51,6 +51,7 @@ void streamSchedByTimer(void* param, void* tmrId) {
...
@@ -51,6 +51,7 @@ void streamSchedByTimer(void* param, void* tmrId) {
SStreamTask
*
pTask
=
(
void
*
)
param
;
SStreamTask
*
pTask
=
(
void
*
)
param
;
if
(
atomic_load_8
(
&
pTask
->
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
if
(
atomic_load_8
(
&
pTask
->
taskStatus
)
==
TASK_STATUS__DROPPING
)
{
streamMetaReleaseTask
(
NULL
,
pTask
);
return
;
return
;
}
}
...
@@ -80,6 +81,8 @@ void streamSchedByTimer(void* param, void* tmrId) {
...
@@ -80,6 +81,8 @@ void streamSchedByTimer(void* param, void* tmrId) {
int32_t
streamSetupTrigger
(
SStreamTask
*
pTask
)
{
int32_t
streamSetupTrigger
(
SStreamTask
*
pTask
)
{
if
(
pTask
->
triggerParam
!=
0
)
{
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
);
pTask
->
timer
=
taosTmrStart
(
streamSchedByTimer
,
(
int32_t
)
pTask
->
triggerParam
,
pTask
,
streamEnv
.
timer
);
pTask
->
triggerStatus
=
TASK_TRIGGER_STATUS__INACTIVE
;
pTask
->
triggerStatus
=
TASK_TRIGGER_STATUS__INACTIVE
;
}
}
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
015c00aa
...
@@ -80,7 +80,12 @@ void streamMetaClose(SStreamMeta* pMeta) {
...
@@ -80,7 +80,12 @@ void streamMetaClose(SStreamMeta* pMeta) {
pIter
=
taosHashIterate
(
pMeta
->
pTasks
,
pIter
);
pIter
=
taosHashIterate
(
pMeta
->
pTasks
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
pIter
;
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
pIter
;
if
(
pTask
->
timer
)
{
taosTmrStop
(
pTask
->
timer
);
pTask
->
timer
=
NULL
;
}
tFreeSStreamTask
(
pTask
);
tFreeSStreamTask
(
pTask
);
/*streamMetaReleaseTask(pMeta, pTask);*/
}
}
taosHashCleanup
(
pMeta
->
pTasks
);
taosHashCleanup
(
pMeta
->
pTasks
);
taosMemoryFree
(
pMeta
->
path
);
taosMemoryFree
(
pMeta
->
path
);
...
@@ -202,6 +207,10 @@ void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId) {
...
@@ -202,6 +207,10 @@ void streamMetaRemoveTask1(SStreamMeta* pMeta, int32_t taskId) {
if
(
ppTask
)
{
if
(
ppTask
)
{
SStreamTask
*
pTask
=
*
ppTask
;
SStreamTask
*
pTask
=
*
ppTask
;
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
/*if (pTask->timer) {
* taosTmrStop(pTask->timer);*/
/*pTask->timer = NULL;*/
/*}*/
atomic_store_8
(
&
pTask
->
taskStatus
,
TASK_STATUS__DROPPING
);
atomic_store_8
(
&
pTask
->
taskStatus
,
TASK_STATUS__DROPPING
);
taosWLockLatch
(
&
pMeta
->
lock
);
taosWLockLatch
(
&
pMeta
->
lock
);
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
015c00aa
...
@@ -102,6 +102,7 @@ int32_t walCommit(SWal *pWal, int64_t ver) {
...
@@ -102,6 +102,7 @@ int32_t walCommit(SWal *pWal, int64_t ver) {
int32_t
walRollback
(
SWal
*
pWal
,
int64_t
ver
)
{
int32_t
walRollback
(
SWal
*
pWal
,
int64_t
ver
)
{
taosThreadMutexLock
(
&
pWal
->
mutex
);
taosThreadMutexLock
(
&
pWal
->
mutex
);
wInfo
(
"vgId:%d, wal rollback for version %"
PRId64
,
pWal
->
cfg
.
vgId
,
ver
);
int64_t
code
;
int64_t
code
;
char
fnameStr
[
WAL_FILE_LEN
];
char
fnameStr
[
WAL_FILE_LEN
];
if
(
ver
>
pWal
->
vers
.
lastVer
||
ver
<
pWal
->
vers
.
commitVer
||
ver
<=
pWal
->
vers
.
snapshotVer
)
{
if
(
ver
>
pWal
->
vers
.
lastVer
||
ver
<
pWal
->
vers
.
commitVer
||
ver
<=
pWal
->
vers
.
snapshotVer
)
{
...
@@ -123,8 +124,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
...
@@ -123,8 +124,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
int
fileSetSize
=
taosArrayGetSize
(
pWal
->
fileInfoSet
);
int
fileSetSize
=
taosArrayGetSize
(
pWal
->
fileInfoSet
);
for
(
int
i
=
pWal
->
writeCur
+
1
;
i
<
fileSetSize
;
i
++
)
{
for
(
int
i
=
pWal
->
writeCur
+
1
;
i
<
fileSetSize
;
i
++
)
{
walBuildLogName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
walBuildLogName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
wDebug
(
"vgId:%d, wal remove file %s for rollback"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
taosRemoveFile
(
fnameStr
);
taosRemoveFile
(
fnameStr
);
walBuildIdxName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
walBuildIdxName
(
pWal
,
((
SWalFileInfo
*
)
taosArrayGet
(
pWal
->
fileInfoSet
,
i
))
->
firstVer
,
fnameStr
);
wDebug
(
"vgId:%d, wal remove file %s for rollback"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
taosRemoveFile
(
fnameStr
);
taosRemoveFile
(
fnameStr
);
}
}
// pop from fileInfoSet
// pop from fileInfoSet
...
@@ -157,6 +160,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
...
@@ -157,6 +160,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
walBuildLogName
(
pWal
,
walGetCurFileFirstVer
(
pWal
),
fnameStr
);
walBuildLogName
(
pWal
,
walGetCurFileFirstVer
(
pWal
),
fnameStr
);
TdFilePtr
pLogFile
=
taosOpenFile
(
fnameStr
,
TD_FILE_WRITE
|
TD_FILE_READ
|
TD_FILE_APPEND
);
TdFilePtr
pLogFile
=
taosOpenFile
(
fnameStr
,
TD_FILE_WRITE
|
TD_FILE_READ
|
TD_FILE_APPEND
);
wDebug
(
"vgId:%d, wal truncate file %s"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
if
(
pLogFile
==
NULL
)
{
if
(
pLogFile
==
NULL
)
{
// TODO
// TODO
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
...
@@ -324,9 +328,9 @@ int32_t walEndSnapshot(SWal *pWal) {
...
@@ -324,9 +328,9 @@ int32_t walEndSnapshot(SWal *pWal) {
pInfo
++
;
pInfo
++
;
}
}
if
(
POINTER_DISTANCE
(
pInfo
,
pWal
->
fileInfoSet
->
pData
)
>
0
)
{
if
(
POINTER_DISTANCE
(
pInfo
,
pWal
->
fileInfoSet
->
pData
)
>
0
)
{
wDebug
(
"vgId:%d,
begin
remove from %"
PRId64
,
pWal
->
cfg
.
vgId
,
pInfo
->
firstVer
);
wDebug
(
"vgId:%d,
wal end
remove from %"
PRId64
,
pWal
->
cfg
.
vgId
,
pInfo
->
firstVer
);
}
else
{
}
else
{
wDebug
(
"vgId:%d, no remove"
,
pWal
->
cfg
.
vgId
);
wDebug
(
"vgId:%d,
wal
no remove"
,
pWal
->
cfg
.
vgId
);
}
}
// iterate files, until the searched result
// iterate files, until the searched result
for
(
SWalFileInfo
*
iter
=
pWal
->
fileInfoSet
->
pData
;
iter
<
pInfo
;
iter
++
)
{
for
(
SWalFileInfo
*
iter
=
pWal
->
fileInfoSet
->
pData
;
iter
<
pInfo
;
iter
++
)
{
...
@@ -343,12 +347,12 @@ int32_t walEndSnapshot(SWal *pWal) {
...
@@ -343,12 +347,12 @@ int32_t walEndSnapshot(SWal *pWal) {
for
(
int
i
=
0
;
i
<
deleteCnt
;
i
++
)
{
for
(
int
i
=
0
;
i
<
deleteCnt
;
i
++
)
{
pInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
i
);
pInfo
=
taosArrayGet
(
pWal
->
fileInfoSet
,
i
);
walBuildLogName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
walBuildLogName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
wDebug
(
"vgId:%d, remove file %s"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
wDebug
(
"vgId:%d,
wal
remove file %s"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
if
(
taosRemoveFile
(
fnameStr
)
<
0
)
{
if
(
taosRemoveFile
(
fnameStr
)
<
0
)
{
goto
UPDATE_META
;
goto
UPDATE_META
;
}
}
walBuildIdxName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
walBuildIdxName
(
pWal
,
pInfo
->
firstVer
,
fnameStr
);
wDebug
(
"vgId:%d, remove file %s"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
wDebug
(
"vgId:%d,
wal
remove file %s"
,
pWal
->
cfg
.
vgId
,
fnameStr
);
if
(
taosRemoveFile
(
fnameStr
)
<
0
)
{
if
(
taosRemoveFile
(
fnameStr
)
<
0
)
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录