Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8fc2d7eb
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看板
未验证
提交
8fc2d7eb
编写于
9月 14, 2022
作者:
D
dapan1121
提交者:
GitHub
9月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16843 from taosdata/fix/TD-19057
fix: fix task retry and qnode fetch thread number issue
上级
a34c6852
45dfa1c1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
34 addition
and
21 deletion
+34
-21
source/common/src/tglobal.c
source/common/src/tglobal.c
+9
-5
source/libs/scheduler/inc/schInt.h
source/libs/scheduler/inc/schInt.h
+2
-1
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+1
-1
source/libs/scheduler/src/schTask.c
source/libs/scheduler/src/schTask.c
+22
-14
未找到文件。
source/common/src/tglobal.c
浏览文件 @
8fc2d7eb
...
...
@@ -63,7 +63,7 @@ int32_t tsNumOfVnodeWriteThreads = 2;
int32_t
tsNumOfVnodeSyncThreads
=
2
;
int32_t
tsNumOfVnodeRsmaThreads
=
2
;
int32_t
tsNumOfQnodeQueryThreads
=
4
;
int32_t
tsNumOfQnodeFetchThreads
=
4
;
int32_t
tsNumOfQnodeFetchThreads
=
1
;
int32_t
tsNumOfSnodeSharedThreads
=
2
;
int32_t
tsNumOfSnodeUniqueThreads
=
2
;
...
...
@@ -385,9 +385,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
tsNumOfQnodeQueryThreads
=
TMAX
(
tsNumOfQnodeQueryThreads
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfQnodeQueryThreads"
,
tsNumOfQnodeQueryThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfQnodeFetchThreads
=
tsNumOfCores
/
2
;
tsNumOfQnodeFetchThreads
=
TMAX
(
tsNumOfQnodeFetchThreads
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfQnodeFetchThreads"
,
tsNumOfQnodeFetchThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
//
tsNumOfQnodeFetchThreads = tsNumOfCores / 2;
//
tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4);
//
if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1;
tsNumOfSnodeSharedThreads
=
tsNumOfCores
/
4
;
tsNumOfSnodeSharedThreads
=
TRANGE
(
tsNumOfSnodeSharedThreads
,
2
,
4
);
...
...
@@ -527,6 +527,7 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem
->
stype
=
stype
;
}
/*
pItem = cfgGetItem(tsCfg, "numOfQnodeFetchThreads");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsNumOfQnodeFetchThreads = numOfCores / 2;
...
...
@@ -534,6 +535,7 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem->i32 = tsNumOfQnodeFetchThreads;
pItem->stype = stype;
}
*/
pItem
=
cfgGetItem
(
tsCfg
,
"numOfSnodeSharedThreads"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
...
...
@@ -691,7 +693,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsNumOfVnodeSyncThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeSyncThreads"
)
->
i32
;
tsNumOfVnodeRsmaThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeRsmaThreads"
)
->
i32
;
tsNumOfQnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeQueryThreads"
)
->
i32
;
tsNumOfQnodeFetchThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeFetchThreads"
)
->
i32
;
//
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
tsNumOfSnodeSharedThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
tsNumOfSnodeUniqueThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
tsRpcQueueMemoryAllowed
=
cfgGetItem
(
pCfg
,
"rpcQueueMemoryAllowed"
)
->
i64
;
...
...
@@ -939,8 +941,10 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsNumOfVnodeRsmaThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeRsmaThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfQnodeQueryThreads"
,
name
)
==
0
)
{
tsNumOfQnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeQueryThreads"
)
->
i32
;
/*
} else if (strcasecmp("numOfQnodeFetchThreads", name) == 0) {
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
*/
}
else
if
(
strcasecmp
(
"numOfSnodeSharedThreads"
,
name
)
==
0
)
{
tsNumOfSnodeSharedThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfSnodeUniqueThreads"
,
name
)
==
0
)
{
...
...
source/libs/scheduler/inc/schInt.h
浏览文件 @
8fc2d7eb
...
...
@@ -285,6 +285,7 @@ typedef struct SSchJob {
typedef
struct
SSchTaskCtx
{
int64_t
jobRid
;
SSchTask
*
pTask
;
bool
asyncLaunch
;
}
SSchTaskCtx
;
extern
SSchedulerMgmt
schMgmt
;
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
8fc2d7eb
source/libs/scheduler/src/schTask.c
浏览文件 @
8fc2d7eb
...
...
@@ -138,12 +138,6 @@ int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int3
return
TSDB_CODE_SUCCESS
;
}
if
((
execId
!=
pTask
->
execId
)
||
pTask
->
waitRetry
)
{
// ignore it
SCH_TASK_DLOG
(
"handle not updated since execId %d is already not current execId %d, waitRetry %d"
,
execId
,
pTask
->
execId
,
pTask
->
waitRetry
);
return
TSDB_CODE_SUCCESS
;
}
SSchNodeInfo
*
nodeInfo
=
taosHashGet
(
pTask
->
execNodes
,
&
execId
,
sizeof
(
execId
));
if
(
NULL
==
nodeInfo
)
{
// ignore it
SCH_TASK_DLOG
(
"handle not updated since execId %d already not exist, current execId %d, waitRetry %d"
,
execId
,
...
...
@@ -163,10 +157,15 @@ int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, v
SCH_RET
(
schDropTaskExecNode
(
pJob
,
pTask
,
handle
,
execId
));
}
SCH_SET_TASK_HANDLE
(
pTask
,
handle
);
schUpdateTaskExecNode
(
pJob
,
pTask
,
handle
,
execId
);
if
((
execId
!=
pTask
->
execId
)
||
pTask
->
waitRetry
)
{
// ignore it
SCH_TASK_DLOG
(
"handle not updated since execId %d is already not current execId %d, waitRetry %d"
,
execId
,
pTask
->
execId
,
pTask
->
waitRetry
);
SCH_ERR_RET
(
TSDB_CODE_SCH_IGNORE_ERROR
);
}
SCH_SET_TASK_HANDLE
(
pTask
,
handle
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -352,7 +351,7 @@ int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32
pTask
->
waitRetry
=
true
;
schDropTaskOnExecNode
(
pJob
,
pTask
);
taosHashClear
(
pTask
->
execNodes
);
SCH_ERR_JRET
(
schRemoveTaskFromExecList
(
pJob
,
pTask
)
);
schRemoveTaskFromExecList
(
pJob
,
pTask
);
schDeregisterTaskHb
(
pJob
,
pTask
);
atomic_sub_fetch_32
(
&
pTask
->
level
->
taskLaunchedNum
,
1
);
taosMemoryFreeClear
(
pTask
->
msg
);
...
...
@@ -599,7 +598,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo
int32_t
schHandleTaskRetry
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
atomic_sub_fetch_32
(
&
pTask
->
level
->
taskLaunchedNum
,
1
);
SCH_ERR_RET
(
schRemoveTaskFromExecList
(
pJob
,
pTask
)
);
schRemoveTaskFromExecList
(
pJob
,
pTask
);
SCH_SET_TASK_STATUS
(
pTask
,
JOB_TASK_STATUS_INIT
);
if
(
SCH_TASK_NEED_FLOW_CTRL
(
pJob
,
pTask
))
{
...
...
@@ -746,8 +745,7 @@ _return:
int32_t
schRemoveTaskFromExecList
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
int32_t
code
=
taosHashRemove
(
pJob
->
execTasks
,
&
pTask
->
taskId
,
sizeof
(
pTask
->
taskId
));
if
(
code
)
{
SCH_TASK_ELOG
(
"task failed to rm from execTask list, code:%x"
,
code
);
SCH_ERR_RET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
SCH_TASK_WLOG
(
"task already not in execTask list, code:%x"
,
code
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -836,6 +834,11 @@ int32_t schLaunchTaskImpl(void *param) {
}
SSchTask
*
pTask
=
pCtx
->
pTask
;
if
(
pCtx
->
asyncLaunch
)
{
SCH_LOCK_TASK
(
pTask
);
}
int8_t
status
=
0
;
int32_t
code
=
0
;
...
...
@@ -882,8 +885,6 @@ int32_t schLaunchTaskImpl(void *param) {
_return:
taosMemoryFree
(
param
);
if
(
pJob
->
taskNum
>=
SCH_MIN_AYSNC_EXEC_NUM
)
{
if
(
code
)
{
code
=
schProcessOnTaskFailure
(
pJob
,
pTask
,
code
);
...
...
@@ -893,8 +894,14 @@ _return:
}
}
if
(
pCtx
->
asyncLaunch
)
{
SCH_UNLOCK_TASK
(
pTask
);
}
schReleaseJob
(
pJob
->
refId
);
taosMemoryFree
(
param
);
SCH_RET
(
code
);
}
...
...
@@ -908,6 +915,7 @@ int32_t schAsyncLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) {
param
->
pTask
=
pTask
;
if
(
pJob
->
taskNum
>=
SCH_MIN_AYSNC_EXEC_NUM
)
{
param
->
asyncLaunch
=
true
;
taosAsyncExec
(
schLaunchTaskImpl
,
param
,
NULL
);
}
else
{
SCH_ERR_RET
(
schLaunchTaskImpl
(
param
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录