Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7d443b16
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
未验证
提交
7d443b16
编写于
11月 15, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18174 from taosdata/feature/stream
refactor: stream meta ref count
上级
53167df7
a9bf05bc
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
103 addition
and
23 deletion
+103
-23
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+6
-1
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-0
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+16
-7
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+35
-13
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-0
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+41
-0
source/libs/wal/src/walRef.c
source/libs/wal/src/walRef.c
+2
-2
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
7d443b16
...
...
@@ -338,7 +338,7 @@ typedef struct SStreamTask {
int32_t
recoverWaitingUpstream
;
int64_t
checkReqId
;
SArray
*
checkReqIds
;
// shuffle
int32_t
refCnt
;
}
SStreamTask
;
int32_t
tEncodeStreamEpInfo
(
SEncoder
*
pEncoder
,
const
SStreamChildEpInfo
*
pInfo
);
...
...
@@ -565,6 +565,7 @@ typedef struct SStreamMeta {
TXN
txn
;
FTaskExpand
*
expandFunc
;
int32_t
vgId
;
SRWLatch
lock
;
}
SStreamMeta
;
SStreamMeta
*
streamMetaOpen
(
const
char
*
path
,
void
*
ahandle
,
FTaskExpand
expandFunc
,
int32_t
vgId
);
...
...
@@ -575,6 +576,10 @@ int32_t streamMetaAddSerializedTask(SStreamMeta* pMeta, int64_t startVer, c
int32_t
streamMetaRemoveTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
SStreamTask
*
streamMetaGetTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
SStreamTask
*
streamMetaAcquireTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
void
streamMetaReleaseTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
);
void
streamMetaRemoveTask1
(
SStreamMeta
*
pMeta
,
int32_t
taskId
);
int32_t
streamMetaBegin
(
SStreamMeta
*
pMeta
);
int32_t
streamMetaCommit
(
SStreamMeta
*
pMeta
);
int32_t
streamMetaRollBack
(
SStreamMeta
*
pMeta
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
7d443b16
...
...
@@ -738,6 +738,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
}
sdbRelease
(
pMnode
->
pSdb
,
pStream
);
mndTransDrop
(
pTrans
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
}
...
...
source/dnode/snode/src/snode.c
浏览文件 @
7d443b16
...
...
@@ -36,13 +36,14 @@ void sndEnqueueStreamDispatch(SSnode *pSnode, SRpcMsg *pMsg) {
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
false
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
return
;
...
...
@@ -63,6 +64,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t ver) {
ASSERT
(
pTask
->
taskLevel
==
TASK_LEVEL__AGG
);
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
pTask
->
refCnt
=
1
;
pTask
->
schedStatus
=
TASK_SCHED_STATUS__INACTIVE
;
pTask
->
inputQueue
=
streamQueueOpen
();
pTask
->
outputQueue
=
streamQueueOpen
();
...
...
@@ -166,15 +168,17 @@ int32_t sndProcessTaskDeployReq(SSnode *pSnode, char *msg, int32_t msgLen) {
int32_t
sndProcessTaskDropReq
(
SSnode
*
pSnode
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
return
streamMetaRemoveTask
(
pSnode
->
pMeta
,
pReq
->
taskId
);
streamMetaRemoveTask1
(
pSnode
->
pMeta
,
pReq
->
taskId
);
return
0
;
}
int32_t
sndProcessTaskRunReq
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
streamProcessRunReq
(
pTask
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -191,13 +195,14 @@ int32_t sndProcessTaskDispatchReq(SSnode *pSnode, SRpcMsg *pMsg, bool exec) {
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
);
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
exec
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -215,13 +220,14 @@ int32_t sndProcessTaskRetrieveReq(SSnode *pSnode, SRpcMsg *pMsg) {
tDecodeStreamRetrieveReq
(
&
decoder
,
&
req
);
tDecoderClear
(
&
decoder
);
int32_t
taskId
=
req
.
dstTaskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessRetrieveReq
(
pTask
,
&
req
,
&
rsp
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
tDeleteStreamRetrieveReq
(
&
req
);
return
0
;
}
else
{
...
...
@@ -232,9 +238,10 @@ int32_t sndProcessTaskRetrieveReq(SSnode *pSnode, SRpcMsg *pMsg) {
int32_t
sndProcessTaskDispatchRsp
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
ntohl
(
pRsp
->
upstreamTaskId
);
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
streamProcessDispatchRsp
(
pTask
,
pRsp
,
pMsg
->
code
);
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -274,15 +281,17 @@ int32_t sndProcessTaskRecoverFinishReq(SSnode *pSnode, SRpcMsg *pMsg) {
tDecoderClear
(
&
decoder
);
// find task
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pSnode
->
pMeta
,
req
.
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pSnode
->
pMeta
,
req
.
taskId
);
if
(
pTask
==
NULL
)
{
return
-
1
;
}
// do process request
if
(
streamProcessRecoverFinishReq
(
pTask
,
req
.
childId
)
<
0
)
{
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
-
1
;
}
streamMetaReleaseTask
(
pSnode
->
pMeta
,
pTask
);
return
0
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
7d443b16
...
...
@@ -882,6 +882,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
}
pTask
->
refCnt
=
1
;
pTask
->
schedStatus
=
TASK_SCHED_STATUS__INACTIVE
;
pTask
->
inputQueue
=
streamQueueOpen
();
...
...
@@ -975,13 +976,15 @@ int32_t tqProcessStreamTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) {
.
upstreamNodeId
=
req
.
upstreamNodeId
,
.
upstreamTaskId
=
req
.
upstreamTaskId
,
};
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
&&
atomic_load_8
(
&
pTask
->
taskStatus
)
==
TASK_STATUS__NORMAL
)
{
rsp
.
status
=
1
;
}
else
{
rsp
.
status
=
0
;
}
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
tqDebug
(
"tq recv task check req(reqId: %"
PRId64
") %d at node %d check req from task %d at node %d, status %d"
,
rsp
.
reqId
,
rsp
.
downstreamTaskId
,
rsp
.
downstreamNodeId
,
rsp
.
upstreamTaskId
,
rsp
.
upstreamNodeId
,
rsp
.
status
);
...
...
@@ -1027,12 +1030,14 @@ int32_t tqProcessStreamTaskCheckRsp(STQ* pTq, int64_t version, char* msg, int32_
tqDebug
(
"tq recv task check rsp(reqId: %"
PRId64
") %d at node %d check req from task %d at node %d, status %d"
,
rsp
.
reqId
,
rsp
.
downstreamTaskId
,
rsp
.
downstreamNodeId
,
rsp
.
upstreamTaskId
,
rsp
.
upstreamNodeId
,
rsp
.
status
);
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
rsp
.
upstreamTaskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
rsp
.
upstreamTaskId
);
if
(
pTask
==
NULL
)
{
return
-
1
;
}
return
streamProcessTaskCheckRsp
(
pTask
,
&
rsp
,
version
);
code
=
streamProcessTaskCheckRsp
(
pTask
,
&
rsp
,
version
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
code
;
}
int32_t
tqProcessTaskDeployReq
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
)
{
...
...
@@ -1077,15 +1082,17 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
int32_t
msgLen
=
pMsg
->
contLen
;
SStreamRecoverStep1Req
*
pReq
=
(
SStreamRecoverStep1Req
*
)
msg
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
if
(
pTask
==
NULL
)
{
return
-
1
;
}
ASSERT
(
pReq
->
taskId
==
pTask
->
taskId
);
// check param
int64_t
fillVer1
=
pTask
->
startVer
;
if
(
fillVer1
<=
0
)
{
ASSERT
(
0
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
...
...
@@ -1096,10 +1103,11 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
SStreamRecoverStep2Req
req
;
code
=
streamBuildSourceRecover2Req
(
pTask
,
&
req
);
if
(
code
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
ASSERT
(
pReq
->
taskId
==
pTask
->
taskId
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
// serialize msg
int32_t
len
=
sizeof
(
SStreamRecoverStep1Req
);
...
...
@@ -1127,7 +1135,7 @@ int32_t tqProcessTaskRecover1Req(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskRecover2Req
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
code
;
SStreamRecoverStep2Req
*
pReq
=
(
SStreamRecoverStep2Req
*
)
msg
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
if
(
pTask
==
NULL
)
{
return
-
1
;
}
...
...
@@ -1135,27 +1143,33 @@ int32_t tqProcessTaskRecover2Req(STQ* pTq, int64_t version, char* msg, int32_t m
// do recovery step 2
code
=
streamSourceRecoverScanStep2
(
pTask
,
version
);
if
(
code
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
// restore param
code
=
streamRestoreParam
(
pTask
);
if
(
code
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
// set status normal
code
=
streamSetStatusNormal
(
pTask
);
if
(
code
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
// dispatch recover finish req to all related downstream task
code
=
streamDispatchRecoverFinishReq
(
pTask
);
if
(
code
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
...
...
@@ -1172,15 +1186,17 @@ int32_t tqProcessTaskRecoverFinishReq(STQ* pTq, SRpcMsg* pMsg) {
tDecoderClear
(
&
decoder
);
// find task
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
req
.
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
req
.
taskId
);
if
(
pTask
==
NULL
)
{
return
-
1
;
}
// do process request
if
(
streamProcessRecoverFinishReq
(
pTask
,
req
.
childId
)
<
0
)
{
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
-
1
;
}
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
...
...
@@ -1354,9 +1370,10 @@ int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
int32_t
tqProcessTaskRunReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
)
{
streamProcessRunReq
(
pTask
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -1373,13 +1390,14 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
);
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
exec
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -1389,10 +1407,11 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg, bool exec) {
int32_t
tqProcessTaskDispatchRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
ntohl
(
pRsp
->
upstreamTaskId
);
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
tqDebug
(
"recv dispatch rsp, code: %x"
,
pMsg
->
code
);
if
(
pTask
)
{
streamProcessDispatchRsp
(
pTask
,
pRsp
,
pMsg
->
code
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
return
0
;
}
else
{
return
-
1
;
...
...
@@ -1401,7 +1420,8 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
return
streamMetaRemoveTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
streamMetaRemoveTask1
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
return
0
;
}
int32_t
tqProcessTaskRetrieveReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
...
...
@@ -1414,13 +1434,14 @@ int32_t tqProcessTaskRetrieveReq(STQ* pTq, SRpcMsg* pMsg) {
tDecodeStreamRetrieveReq
(
&
decoder
,
&
req
);
tDecoderClear
(
&
decoder
);
int32_t
taskId
=
req
.
dstTaskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessRetrieveReq
(
pTask
,
&
req
,
&
rsp
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
tDeleteStreamRetrieveReq
(
&
req
);
return
0
;
}
else
{
...
...
@@ -1452,13 +1473,14 @@ int32_t vnodeEnqueueStreamMsg(SVnode* pVnode, SRpcMsg* pMsg) {
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMeta
Get
Task
(
pTq
->
pStreamMeta
,
taskId
);
SStreamTask
*
pTask
=
streamMeta
Acquire
Task
(
pTq
->
pStreamMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
false
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
return
0
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
7d443b16
...
...
@@ -2385,6 +2385,8 @@ static void destroyStreamScanOperatorInfo(void* param) {
taosMemoryFree
(
pStreamScan
->
pPseudoExpr
);
}
cleanupExprSupp
(
&
pStreamScan
->
tbnameCalSup
);
updateInfoDestroy
(
pStreamScan
->
pUpdateInfo
);
blockDataDestroy
(
pStreamScan
->
pRes
);
blockDataDestroy
(
pStreamScan
->
pUpdateRes
);
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
7d443b16
...
...
@@ -169,6 +169,47 @@ SStreamTask* streamMetaGetTask(SStreamMeta* pMeta, int32_t taskId) {
}
}
SStreamTask
*
streamMetaAcquireTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
)
{
taosRLockLatch
(
&
pMeta
->
lock
);
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
if
(
ppTask
)
{
SStreamTask
*
pTask
=
*
ppTask
;
if
(
atomic_load_8
(
&
pTask
->
taskStatus
)
!=
TASK_STATUS__DROPPING
)
{
atomic_add_fetch_32
(
&
pTask
->
refCnt
,
1
);
taosRUnLockLatch
(
&
pMeta
->
lock
);
return
pTask
;
}
else
{
taosRUnLockLatch
(
&
pMeta
->
lock
);
return
NULL
;
}
}
taosRUnLockLatch
(
&
pMeta
->
lock
);
return
NULL
;
}
void
streamMetaReleaseTask
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
)
{
int32_t
left
=
atomic_sub_fetch_32
(
&
pTask
->
refCnt
,
1
);
ASSERT
(
left
>=
0
);
if
(
left
==
0
)
{
ASSERT
(
atomic_load_8
(
&
pTask
->
taskStatus
)
==
TASK_STATUS__DROPPING
);
tFreeSStreamTask
(
pTask
);
}
}
void
streamMetaRemoveTask1
(
SStreamMeta
*
pMeta
,
int32_t
taskId
)
{
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
if
(
ppTask
)
{
SStreamTask
*
pTask
=
*
ppTask
;
taosHashRemove
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
atomic_store_8
(
&
pTask
->
taskStatus
,
TASK_STATUS__DROPPING
);
taosWLockLatch
(
&
pMeta
->
lock
);
streamMetaReleaseTask
(
pMeta
,
pTask
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
}
}
int32_t
streamMetaRemoveTask
(
SStreamMeta
*
pMeta
,
int32_t
taskId
)
{
SStreamTask
**
ppTask
=
(
SStreamTask
**
)
taosHashGet
(
pMeta
->
pTasks
,
&
taskId
,
sizeof
(
int32_t
));
if
(
ppTask
)
{
...
...
source/libs/wal/src/walRef.c
浏览文件 @
7d443b16
...
...
@@ -32,7 +32,7 @@ SWalRef *walOpenRef(SWal *pWal) {
return
pRef
;
}
#if
0
#if
1
void
walCloseRef
(
SWal
*
pWal
,
int64_t
refId
)
{
SWalRef
**
ppRef
=
taosHashGet
(
pWal
->
pRefHash
,
&
refId
,
sizeof
(
int64_t
));
if
(
ppRef
==
NULL
)
return
;
...
...
@@ -67,7 +67,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
return
0
;
}
#if
0
#if
1
void
walUnrefVer
(
SWalRef
*
pRef
)
{
pRef
->
refId
=
-
1
;
pRef
->
refFile
=
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录