Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1e8579e8
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看板
提交
1e8579e8
编写于
8月 09, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): fix other cases.
上级
4c929973
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
22 addition
and
53 deletion
+22
-53
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+1
-1
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
+2
-2
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-2
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+12
-45
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+5
-2
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
1e8579e8
...
...
@@ -644,7 +644,7 @@ void streamMetaClose(SStreamMeta* streamMeta);
int32_t
streamMetaSaveTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
int32_t
streamMetaRemoveTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
int32_t
streamMetaRegisterTask
(
SStreamMeta
*
pMeta
,
int64_t
ver
,
SStreamTask
*
pTask
,
bool
*
pAdded
);
int32_t
streamMetaUnregisterTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
int32_t
streamMetaUnregisterTask
(
SStreamMeta
*
pMeta
,
int
64_t
streamId
,
int
32_t
taskId
);
int32_t
streamMetaGetNumOfTasks
(
SStreamMeta
*
pMeta
);
// todo remove it
SStreamTask
*
streamMetaAcquireTask
(
SStreamMeta
*
pMeta
,
int64_t
streamId
,
int32_t
taskId
);
void
streamMetaReleaseTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
...
...
source/dnode/snode/src/snode.c
浏览文件 @
1e8579e8
...
...
@@ -185,7 +185,7 @@ int32_t sndProcessTaskDropReq(SSnode *pSnode, char *msg, int32_t msgLen) {
return
0
;
}
streamMetaUnregisterTask
(
pSnode
->
pMeta
,
pReq
->
taskId
);
streamMetaUnregisterTask
(
pSnode
->
pMeta
,
pReq
->
streamId
,
pReq
->
taskId
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
0
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
1e8579e8
...
...
@@ -1242,7 +1242,7 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
tqDebug
(
"s-task:%s fill-history task set status to be dropping"
,
id
);
streamMetaUnregisterTask
(
pMeta
,
pTask
->
id
.
taskId
);
streamMetaUnregisterTask
(
pMeta
,
pTask
->
id
.
streamId
,
pTask
->
id
.
taskId
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
return
-
1
;
}
...
...
@@ -1575,7 +1575,7 @@ int32_t tqProcessTaskDropReq(STQ* pTq, int64_t sversion, char* msg, int32_t msgL
return
0
;
}
streamMetaUnregisterTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
streamMetaUnregisterTask
(
pTq
->
pStreamMeta
,
pReq
->
streamId
,
pReq
->
taskId
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
1e8579e8
...
...
@@ -350,10 +350,9 @@ static int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
streamTaskResumeFromHalt
(
pStreamTask
);
qDebug
(
"s-task:%s fill-history task set status to be dropping, save the state into disk"
,
pTask
->
id
.
idStr
);
int32_t
taskId
=
pTask
->
id
.
taskId
;
// 5. free it and remove fill-history task from disk meta-store
streamMetaUnregisterTask
(
pMeta
,
taskId
);
streamMetaUnregisterTask
(
pMeta
,
pTask
->
id
.
streamId
,
pTask
->
id
.
taskId
);
// 6. save to disk
taosWLockLatch
(
&
pMeta
->
lock
);
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
1e8579e8
...
...
@@ -161,43 +161,6 @@ void streamMetaClose(SStreamMeta* pMeta) {
taosMemoryFree
(
pMeta
);
}
#if 0
int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t ver, char* msg, int32_t msgLen) {
SStreamTask* pTask = taosMemoryCalloc(1, sizeof(SStreamTask));
if (pTask == NULL) {
return -1;
}
SDecoder decoder;
tDecoderInit(&decoder, (uint8_t*)msg, msgLen);
if (tDecodeStreamTask(&decoder, pTask) < 0) {
tDecoderClear(&decoder);
goto FAIL;
}
tDecoderClear(&decoder);
if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) {
ASSERT(0);
goto FAIL;
}
if (taosHashPut(pMeta->pTasks, &pTask->id.taskId, sizeof(int32_t), &pTask, sizeof(void*)) < 0) {
goto FAIL;
}
if (tdbTbUpsert(pMeta->pTaskDb, &pTask->id.taskId, sizeof(int32_t), msg, msgLen, pMeta->txn) < 0) {
taosHashRemove(pMeta->pTasks, &pTask->id.taskId, sizeof(int32_t));
ASSERT(0);
goto FAIL;
}
return 0;
FAIL:
if (pTask) tFreeStreamTask(pTask);
return -1;
}
#endif
int32_t
streamMetaSaveTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
)
{
void
*
buf
=
NULL
;
int32_t
len
;
...
...
@@ -241,7 +204,8 @@ int32_t streamMetaRemoveTask(SStreamMeta* pMeta, int32_t taskId) {
int32_t
streamMetaRegisterTask
(
SStreamMeta
*
pMeta
,
int64_t
ver
,
SStreamTask
*
pTask
,
bool
*
pAdded
)
{
*
pAdded
=
false
;
void
*
p
=
taosHashGet
(
pMeta
->
pTasks
,
&
pTask
->
id
.
taskId
,
sizeof
(
pTask
->
id
.
taskId
));
int64_t
keys
[
2
]
=
{
pTask
->
id
.
streamId
,
pTask
->
id
.
taskId
};
void
*
p
=
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
p
==
NULL
)
{
if
(
pMeta
->
expandFunc
(
pMeta
->
ahandle
,
pTask
,
ver
)
<
0
)
{
tFreeStreamTask
(
pTask
);
...
...
@@ -263,7 +227,7 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa
return
0
;
}
taosHashPut
(
pMeta
->
pTasks
,
&
pTask
->
id
.
taskId
,
sizeof
(
pTask
->
id
.
taskId
),
&
pTask
,
POINTER_BYTES
);
taosHashPut
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
),
&
pTask
,
POINTER_BYTES
);
*
pAdded
=
true
;
return
0
;
}
...
...
@@ -315,12 +279,14 @@ static void doRemoveIdFromList(SStreamMeta* pMeta, int32_t num, SStreamId* id) {
}
}
int32_t
streamMetaUnregisterTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
)
{
int32_t
streamMetaUnregisterTask
(
SStreamMeta
*
pMeta
,
int
64_t
streamId
,
int
32_t
taskId
)
{
SStreamTask
*
pTask
=
NULL
;
// pre-delete operation
taosWLockLatch
(
&
pMeta
->
lock
);
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
int64_t
keys
[
2
]
=
{
streamId
,
taskId
};
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
ppTask
)
{
pTask
=
*
ppTask
;
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__DROPPING
);
...
...
@@ -336,7 +302,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int32_t taskId) {
while
(
1
)
{
taosRLockLatch
(
&
pMeta
->
lock
);
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
ppTask
)
{
if
((
*
ppTask
)
->
status
.
timerActive
==
0
)
{
...
...
@@ -355,7 +321,7 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int32_t taskId) {
// let's do delete of stream task
taosWLockLatch
(
&
pMeta
->
lock
);
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
ppTask
)
{
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__DROPPING
);
...
...
@@ -472,7 +438,8 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
}
// do duplicate task check.
void
*
p
=
taosHashGet
(
pMeta
->
pTasks
,
&
pTask
->
id
.
taskId
,
sizeof
(
pTask
->
id
.
taskId
));
int64_t
keys
[
2
]
=
{
pTask
->
id
.
streamId
,
pTask
->
id
.
taskId
};
void
*
p
=
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
p
==
NULL
)
{
if
(
pMeta
->
expandFunc
(
pMeta
->
ahandle
,
pTask
,
pTask
->
chkInfo
.
version
)
<
0
)
{
tdbFree
(
pKey
);
...
...
@@ -492,7 +459,7 @@ int32_t streamLoadTasks(SStreamMeta* pMeta, int64_t ver) {
continue
;
}
if
(
taosHashPut
(
pMeta
->
pTasks
,
&
pTask
->
id
.
taskId
,
sizeof
(
pTask
->
id
.
taskId
),
&
pTask
,
sizeof
(
void
*
))
<
0
)
{
if
(
taosHashPut
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
),
&
pTask
,
sizeof
(
void
*
))
<
0
)
{
tdbFree
(
pKey
);
tdbFree
(
pVal
);
tdbTbcClose
(
pCur
);
...
...
source/libs/stream/src/streamRecover.c
浏览文件 @
1e8579e8
...
...
@@ -541,7 +541,9 @@ static void tryLaunchHistoryTask(void* param, void* tmrId) {
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
));
int64_t
keys
[
2
]
=
{
pInfo
->
streamId
,
pInfo
->
taskId
};
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
ppTask
)
{
ASSERT
((
*
ppTask
)
->
status
.
timerActive
==
1
);
...
...
@@ -596,8 +598,9 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) {
SStreamMeta
*
pMeta
=
pTask
->
pMeta
;
int32_t
hTaskId
=
pTask
->
historyTaskId
.
taskId
;
int64_t
keys
[
2
]
=
{
pTask
->
historyTaskId
.
streamId
,
pTask
->
historyTaskId
.
taskId
};
// Set the execute conditions, including the query time window and the version range
SStreamTask
**
pHTask
=
taosHashGet
(
pMeta
->
pTasks
,
&
hTaskId
,
sizeof
(
hTaskId
));
SStreamTask
**
pHTask
=
taosHashGet
(
pMeta
->
pTasks
,
keys
,
sizeof
(
keys
));
if
(
pHTask
==
NULL
)
{
qWarn
(
"s-task:%s vgId:%d failed to launch history task:0x%x, since it is not built yet"
,
pTask
->
id
.
idStr
,
pMeta
->
vgId
,
hTaskId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录