Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
af80d94a
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
af80d94a
编写于
8月 22, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
e6b49b45
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
26 deletion
+29
-26
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+6
-1
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+1
-1
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+8
-5
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+6
-16
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+0
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+1
-1
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+6
-0
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+1
-1
未找到文件。
include/libs/stream/tstream.h
浏览文件 @
af80d94a
...
...
@@ -97,6 +97,11 @@ enum {
STREAM_QUEUE__PROCESSING
,
};
enum
{
STREAM_META_WILL_STOP
=
1
,
STREAM_META_OK_TO_STOP
=
2
,
};
typedef
struct
{
int8_t
type
;
}
SStreamQueueItem
;
...
...
@@ -389,8 +394,8 @@ typedef struct SStreamMeta {
SHashObj
*
pTaskBackendUnique
;
TdThreadMutex
backendMutex
;
tmr_h
hbTmr
;
// SMgmtInfo mgmtInfo;
int32_t
killed
;
int32_t
closedTask
;
int32_t
chkptNotReadyTasks
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
af80d94a
...
...
@@ -738,7 +738,7 @@ SArray *vmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE
,
vmPutMsgToStreamQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE_RSP
,
vmPutMsgToStreamQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_SCAN_HISTORY_FINISH
,
vmPutMsgToStreamQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP
,
vmPutMsgTo
Write
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_SCAN_HISTORY_FINISH_RSP
,
vmPutMsgTo
Stream
Queue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TASK_CHECK
,
vmPutMsgToStreamQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TASK_CHECK_RSP
,
vmPutMsgToStreamQueue
,
0
)
==
NULL
)
goto
_OVER
;
// if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToStreamQueue, 0) == NULL) goto _OVER;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
af80d94a
...
...
@@ -2088,7 +2088,7 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange
mDebug
(
"stream:0x%"
PRIx64
" involved node changed, create update trans"
,
pStream
->
uid
);
int32_t
code
=
createStreamUpdateTrans
(
pMnode
,
pStream
,
pChangeInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// todo
return
code
;
}
}
...
...
@@ -2160,6 +2160,7 @@ static void doExtractTasksFromStream(SMnode *pMnode) {
// this function runs by only one thread, so it is not multi-thread safe
static
int32_t
mndProcessNodeCheckReq
(
SRpcMsg
*
pMsg
)
{
int32_t
code
=
0
;
int32_t
old
=
atomic_val_compare_exchange_32
(
&
mndNodeCheckSentinel
,
0
,
1
);
if
(
old
!=
0
)
{
mDebug
(
"still in checking node change"
);
...
...
@@ -2189,16 +2190,18 @@ static int32_t mndProcessNodeCheckReq(SRpcMsg *pMsg) {
SVgroupChangeInfo
changeInfo
=
mndFindChangedNodeInfo
(
pMnode
,
execNodeList
.
pNodeEntryList
,
pNodeSnapshot
);
if
(
taosArrayGetSize
(
changeInfo
.
pUpdateNodeList
)
>
0
)
{
mndProcessVgroupChange
(
pMnode
,
&
changeInfo
);
code
=
mndProcessVgroupChange
(
pMnode
,
&
changeInfo
);
}
taosArrayDestroy
(
changeInfo
.
pUpdateNodeList
);
taosHashCleanup
(
changeInfo
.
pDBMap
);
// keep the new vnode snapshot
taosArrayDestroy
(
execNodeList
.
pNodeEntryList
);
execNodeList
.
pNodeEntryList
=
pNodeSnapshot
;
execNodeList
.
ts
=
ts
;
if
(
code
==
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
execNodeList
.
pNodeEntryList
);
execNodeList
.
pNodeEntryList
=
pNodeSnapshot
;
execNodeList
.
ts
=
ts
;
}
mDebug
(
"end to do stream task node change checking"
);
atomic_store_32
(
&
mndNodeCheckSentinel
,
0
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
af80d94a
...
...
@@ -190,7 +190,6 @@ static bool hasStreamTaskInTimer(SStreamMeta* pMeta) {
}
taosWUnLockLatch
(
&
pMeta
->
lock
);
return
inTimer
;
}
...
...
@@ -219,6 +218,12 @@ void tqNotifyClose(STQ* pTq) {
taosWUnLockLatch
(
&
pMeta
->
lock
);
pMeta
->
killed
=
STREAM_META_WILL_STOP
;
while
(
pMeta
->
killed
!=
STREAM_META_OK_TO_STOP
)
{
taosMsleep
(
100
);
tqDebug
(
"vgId:%d wait for meta to stop timer"
,
pMeta
->
vgId
);
}
tqDebug
(
"vgId:%d start to check all tasks"
,
vgId
);
int64_t
st
=
taosGetTimestampMs
();
...
...
@@ -1432,7 +1437,6 @@ int32_t tqProcessTaskScanHistoryFinishReq(STQ* pTq, SRpcMsg* pMsg) {
return
code
;
}
// NOTE: the rsp msg should be kept in WAL file.
int32_t
tqProcessTaskScanHistoryFinishRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
char
*
msg
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
msgLen
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
...
...
@@ -1461,20 +1465,6 @@ int32_t tqProcessTaskScanHistoryFinishRsp(STQ* pTq, SRpcMsg* pMsg) {
"s-task:%s scan-history finish rsp received from downstream task:0x%x, all downstream tasks rsp scan-history "
"completed msg"
,
pTask
->
id
.
idStr
,
req
.
downstreamId
);
// the scan-history finish status should be recorded in the WAL files. So the transfer of the task status from
// scan-history
// to normal should be executed by write thread of each vnode.
// void* buf = NULL;
// int32_t tlen = 0;
// // encodeCreateChildTableForRPC(pReqs, TD_VID(pVnode), &buf, &tlen);
//
// SRpcMsg msg = {.msgType = TDMT_VND_CREATE_TABLE, .pCont = buf, .contLen = tlen};
// if (tmsgPutToQueue(&pTq->pVnode->msgCb, WRITE_QUEUE, &msg) != 0) {
// tqError("failed to put into write-queue since %s", terrstr());
// }
streamProcessScanHistoryFinishRsp
(
pTask
);
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
af80d94a
...
...
@@ -691,7 +691,6 @@ int32_t vnodeProcessStreamMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo)
}
void
smaHandleRes
(
void
*
pVnode
,
int64_t
smaId
,
const
SArray
*
data
)
{
// blockDebugShowDataBlocks(data, __func__);
tdProcessTSmaInsert
(((
SVnode
*
)
pVnode
)
->
pSma
,
smaId
,
(
const
char
*
)
data
);
}
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
af80d94a
...
...
@@ -362,7 +362,7 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
streamTaskEnablePause
(
pStreamTask
);
if
(
taosQueueEmpty
(
pStreamTask
->
inputQueue
->
queue
))
{
SStreamRefDataBlock
*
pItem
=
taosAllocateQitem
(
sizeof
(
SStreamRefDataBlock
),
DEF_QITEM
,
0
);
;
SSDataBlock
*
pDelBlock
=
createSpecialDataBlock
(
STREAM_DELETE_DATA
);
pDelBlock
->
info
.
rows
=
0
;
pDelBlock
->
info
.
version
=
0
;
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
af80d94a
...
...
@@ -607,6 +607,12 @@ void metaHbToMnode(void* param, void* tmrId) {
SStreamMeta
*
pMeta
=
param
;
SStreamHbMsg
hbMsg
=
{
0
};
if
(
pMeta
->
killed
==
STREAM_META_WILL_STOP
)
{
pMeta
->
killed
=
STREAM_META_OK_TO_STOP
;
qDebug
(
"vgId:%d jump out of meta timer"
,
pMeta
->
vgId
);
return
;
}
taosRLockLatch
(
&
pMeta
->
lock
);
int32_t
numOfTasks
=
streamMetaGetNumOfTasks
(
pMeta
);
...
...
source/libs/stream/src/streamTask.c
浏览文件 @
af80d94a
...
...
@@ -477,7 +477,7 @@ int32_t streamTaskStop(SStreamTask* pTask) {
pTask
->
status
.
taskStatus
=
TASK_STATUS__STOP
;
qKillTask
(
pTask
->
exec
.
pExecutor
,
TSDB_CODE_SUCCESS
);
while
(
pTask
->
status
.
schedStatus
!=
TASK_SCHED_STATUS__INACTIVE
)
{
while
(
/*pTask->status.schedStatus != TASK_SCHED_STATUS__INACTIVE */
!
streamTaskIsIdle
(
pTask
)
)
{
qDebug
(
"s-task:%s level:%d wait for task to be idle, check again in 100ms"
,
id
,
pTask
->
info
.
taskLevel
);
taosMsleep
(
100
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录