Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a4d4cd2a
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看板
提交
a4d4cd2a
编写于
4月 29, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stmt query
上级
18b6c99e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
9 deletion
+38
-9
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+9
-1
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+2
-0
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+27
-8
未找到文件。
source/libs/scalar/src/scalar.c
浏览文件 @
a4d4cd2a
...
...
@@ -75,7 +75,15 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
if
(
valueNode
->
node
.
resType
.
type
!=
type
)
{
out
.
columnData
->
info
.
type
=
type
;
out
.
columnData
->
info
.
bytes
=
tDataTypes
[
type
].
bytes
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
IS_VAR_DATA_TYPE
(
valueNode
->
node
.
resType
.
type
))
{
out
.
columnData
->
info
.
bytes
=
valueNode
->
node
.
resType
.
bytes
*
TSDB_NCHAR_SIZE
;
}
else
{
out
.
columnData
->
info
.
bytes
=
64
*
TSDB_NCHAR_SIZE
;
}
}
else
{
out
.
columnData
->
info
.
bytes
=
tDataTypes
[
type
].
bytes
;
}
code
=
doConvertDataType
(
valueNode
,
&
out
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
a4d4cd2a
...
...
@@ -85,7 +85,9 @@ typedef struct SSchedulerMgmt {
uint64_t
taskId
;
// sequential taksId
uint64_t
sId
;
// schedulerId
SSchedulerCfg
cfg
;
SRWLatch
lock
;
int32_t
jobRef
;
int32_t
jobNum
;
SSchedulerStat
stat
;
SHashObj
*
hbConnections
;
}
SSchedulerMgmt
;
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
a4d4cd2a
...
...
@@ -21,7 +21,9 @@
#include "tref.h"
#include "trpc.h"
SSchedulerMgmt
schMgmt
=
{
0
};
SSchedulerMgmt
schMgmt
=
{
.
jobRef
=
-
1
,
};
FORCE_INLINE
SSchJob
*
schAcquireJob
(
int64_t
refId
)
{
return
(
SSchJob
*
)
taosAcquireRef
(
schMgmt
.
jobRef
,
refId
);
}
...
...
@@ -70,6 +72,7 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *
int32_t
schInitJob
(
SSchJob
**
pSchJob
,
SQueryPlan
*
pDag
,
void
*
transport
,
SArray
*
pNodeList
,
const
char
*
sql
,
int64_t
startTs
,
bool
syncSchedule
)
{
int32_t
code
=
0
;
int64_t
refId
=
-
1
;
SSchJob
*
pJob
=
taosMemoryCalloc
(
1
,
sizeof
(
SSchJob
));
if
(
NULL
==
pJob
)
{
qError
(
"QID:%"
PRIx64
" calloc %d failed"
,
pDag
->
queryId
,
(
int32_t
)
sizeof
(
SSchJob
));
...
...
@@ -114,15 +117,17 @@ int32_t schInitJob(SSchJob **pSchJob, SQueryPlan *pDag, void *transport, SArray
tsem_init
(
&
pJob
->
rspSem
,
0
,
0
);
int64_t
refId
=
taosAddRef
(
schMgmt
.
jobRef
,
pJob
);
refId
=
taosAddRef
(
schMgmt
.
jobRef
,
pJob
);
if
(
refId
<
0
)
{
SCH_JOB_ELOG
(
"taosAddRef job failed, error:%s"
,
tstrerror
(
terrno
));
SCH_ERR_JRET
(
terrno
);
}
atomic_add_fetch_32
(
&
schMgmt
.
jobNum
,
1
);
if
(
NULL
==
schAcquireJob
(
refId
))
{
SCH_JOB_ELOG
(
"schAcquireJob job failed, refId:%"
PRIx64
,
refId
);
SCH_RET
(
TSDB_CODE_SCH_STATUS_ERROR
);
SCH_
ERR_J
RET
(
TSDB_CODE_SCH_STATUS_ERROR
);
}
pJob
->
refId
=
refId
;
...
...
@@ -137,7 +142,11 @@ int32_t schInitJob(SSchJob **pSchJob, SQueryPlan *pDag, void *transport, SArray
_return:
schFreeJobImpl
(
pJob
);
if
(
refId
<
0
)
{
schFreeJobImpl
(
pJob
);
}
else
{
taosRemoveRef
(
schMgmt
.
jobRef
,
refId
);
}
SCH_RET
(
code
);
}
...
...
@@ -2239,6 +2248,15 @@ int32_t schCancelJob(SSchJob *pJob) {
// TODO MOVE ALL TASKS FROM EXEC LIST TO FAIL LIST
}
void
schCloseJobRef
(
void
)
{
SCH_LOCK
(
SCH_WRITE
,
&
schMgmt
.
lock
);
if
(
atomic_load_32
(
&
schMgmt
.
jobNum
)
<=
0
&&
schMgmt
.
jobRef
>=
0
)
{
taosCloseRef
(
schMgmt
.
jobRef
);
schMgmt
.
jobRef
=
-
1
;
}
SCH_UNLOCK
(
SCH_WRITE
,
&
schMgmt
.
lock
);
}
void
schFreeJobImpl
(
void
*
job
)
{
if
(
NULL
==
job
)
{
return
;
...
...
@@ -2284,6 +2302,10 @@ void schFreeJobImpl(void *job) {
taosMemoryFreeClear
(
pJob
);
qDebug
(
"QID:0x%"
PRIx64
" job freed, refId:%"
PRIx64
", pointer:%p"
,
queryId
,
refId
,
pJob
);
atomic_sub_fetch_32
(
&
schMgmt
.
jobNum
,
1
);
schCloseJobRef
();
}
static
int32_t
schExecJobImpl
(
void
*
transport
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
int64_t
*
job
,
const
char
*
sql
,
...
...
@@ -2732,7 +2754,7 @@ void schedulerFreeTaskList(SArray *taskList) {
}
void
schedulerDestroy
(
void
)
{
if
(
schMgmt
.
jobRef
)
{
if
(
schMgmt
.
jobRef
>=
0
)
{
SSchJob
*
pJob
=
taosIterateRef
(
schMgmt
.
jobRef
,
0
);
int64_t
refId
=
0
;
...
...
@@ -2745,9 +2767,6 @@ void schedulerDestroy(void) {
pJob
=
taosIterateRef
(
schMgmt
.
jobRef
,
refId
);
}
taosCloseRef
(
schMgmt
.
jobRef
);
schMgmt
.
jobRef
=
0
;
}
if
(
schMgmt
.
hbConnections
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录