Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
179709f8
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
179709f8
编写于
7月 19, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): assign the subplan to belong to task struct
上级
79b0240a
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
55 addition
and
64 deletion
+55
-64
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+28
-27
source/libs/executor/src/cachescanoperator.c
source/libs/executor/src/cachescanoperator.c
+3
-3
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+7
-9
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+17
-14
source/libs/qworker/inc/qwInt.h
source/libs/qworker/inc/qwInt.h
+0
-1
source/libs/qworker/src/qwUtil.c
source/libs/qworker/src/qwUtil.c
+0
-6
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+0
-4
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
179709f8
...
...
@@ -159,6 +159,13 @@ typedef struct {
int64_t
recoverEndVer
;
}
SStreamTaskInfo
;
typedef
struct
{
char
*
tablename
;
char
*
dbname
;
int32_t
tversion
;
SSchemaWrapper
*
sw
;
}
SSchemaInfo
;
typedef
struct
SExecTaskInfo
{
STaskIdInfo
id
;
uint32_t
status
;
...
...
@@ -168,18 +175,12 @@ typedef struct SExecTaskInfo {
int32_t
code
;
SStreamTaskInfo
streamInfo
;
struct
{
char
*
tablename
;
char
*
dbname
;
int32_t
tversion
;
SSchemaWrapper
*
sw
;
}
schemaVer
;
SSchemaInfo
schemaInfo
;
STableListInfo
tableqinfoList
;
// this is a table list
const
char
*
sql
;
// query sql string
jmp_buf
env
;
// jump to this position when error happens.
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
SSubplan
*
pSubplan
;
struct
SOperatorInfo
*
pRoot
;
}
SExecTaskInfo
;
...
...
source/libs/executor/src/cachescanoperator.c
浏览文件 @
179709f8
...
...
@@ -227,14 +227,14 @@ int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInf
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchInfo
*
pColMatch
=
taosArrayGet
(
pColMatchInfo
,
i
);
for
(
int32_t
j
=
0
;
j
<
pTaskInfo
->
schema
Ver
.
sw
->
nCols
;
++
j
)
{
if
(
pColMatch
->
colId
==
pTaskInfo
->
schema
Ver
.
sw
->
pSchema
[
j
].
colId
&&
for
(
int32_t
j
=
0
;
j
<
pTaskInfo
->
schema
Info
.
sw
->
nCols
;
++
j
)
{
if
(
pColMatch
->
colId
==
pTaskInfo
->
schema
Info
.
sw
->
pSchema
[
j
].
colId
&&
pColMatch
->
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
(
*
pSlotIds
)[
pColMatch
->
targetSlotId
]
=
-
1
;
break
;
}
if
(
pColMatch
->
colId
==
pTaskInfo
->
schema
Ver
.
sw
->
pSchema
[
j
].
colId
)
{
if
(
pColMatch
->
colId
==
pTaskInfo
->
schema
Info
.
sw
->
pSchema
[
j
].
colId
)
{
(
*
pSlotIds
)[
pColMatch
->
targetSlotId
]
=
j
;
break
;
}
...
...
source/libs/executor/src/executor.c
浏览文件 @
179709f8
...
...
@@ -138,7 +138,6 @@ qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* n
}
}
nodesDestroyNode
((
SNode
*
)
pPlan
);
return
pTaskInfo
;
}
...
...
@@ -165,7 +164,6 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers) {
return
NULL
;
}
nodesDestroyNode
((
SNode
*
)
pPlan
);
return
pTaskInfo
;
}
...
...
@@ -243,19 +241,19 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table
ASSERT
(
tinfo
!=
NULL
&&
dbName
!=
NULL
&&
tableName
!=
NULL
);
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
if
(
pTaskInfo
->
schema
Ver
.
sw
==
NULL
)
{
if
(
pTaskInfo
->
schema
Info
.
sw
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
}
*
sversion
=
pTaskInfo
->
schema
Ver
.
sw
->
version
;
*
tversion
=
pTaskInfo
->
schema
Ver
.
tversion
;
if
(
pTaskInfo
->
schema
Ver
.
dbname
)
{
strcpy
(
dbName
,
pTaskInfo
->
schema
Ver
.
dbname
);
*
sversion
=
pTaskInfo
->
schema
Info
.
sw
->
version
;
*
tversion
=
pTaskInfo
->
schema
Info
.
tversion
;
if
(
pTaskInfo
->
schema
Info
.
dbname
)
{
strcpy
(
dbName
,
pTaskInfo
->
schema
Info
.
dbname
);
}
else
{
dbName
[
0
]
=
0
;
}
if
(
pTaskInfo
->
schema
Ver
.
tablename
)
{
strcpy
(
tableName
,
pTaskInfo
->
schema
Ver
.
tablename
);
if
(
pTaskInfo
->
schema
Info
.
tablename
)
{
strcpy
(
tableName
,
pTaskInfo
->
schema
Info
.
tablename
);
}
else
{
tableName
[
0
]
=
0
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
179709f8
...
...
@@ -4127,7 +4127,7 @@ static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPT
SExecTaskInfo
*
pTaskInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SExecTaskInfo
));
setTaskStatus
(
pTaskInfo
,
TASK_NOT_COMPLETED
);
pTaskInfo
->
schema
Ver
.
dbname
=
strdup
(
dbFName
);
pTaskInfo
->
schema
Info
.
dbname
=
strdup
(
dbFName
);
pTaskInfo
->
cost
.
created
=
taosGetTimestampMs
();
pTaskInfo
->
id
.
queryId
=
queryId
;
pTaskInfo
->
execModel
=
model
;
...
...
@@ -4153,35 +4153,35 @@ int32_t extractTableSchemaInfo(SReadHandle* pHandle, uint64_t uid, SExecTaskInfo
return
terrno
;
}
pTaskInfo
->
schema
Ver
.
tablename
=
strdup
(
mr
.
me
.
name
);
pTaskInfo
->
schema
Info
.
tablename
=
strdup
(
mr
.
me
.
name
);
if
(
mr
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
pTaskInfo
->
schema
Ver
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pTaskInfo
->
schema
Ver
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
pTaskInfo
->
schema
Info
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pTaskInfo
->
schema
Info
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
tDecoderClear
(
&
mr
.
coder
);
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
metaGetTableEntryByUid
(
&
mr
,
suid
);
pTaskInfo
->
schema
Ver
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pTaskInfo
->
schema
Ver
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
pTaskInfo
->
schema
Info
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
stbEntry
.
schemaRow
);
pTaskInfo
->
schema
Info
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
{
pTaskInfo
->
schema
Ver
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
ntbEntry
.
schemaRow
);
pTaskInfo
->
schema
Info
.
sw
=
tCloneSSchemaWrapper
(
&
mr
.
me
.
ntbEntry
.
schemaRow
);
}
metaReaderClear
(
&
mr
);
return
TSDB_CODE_SUCCESS
;
}
static
void
cleanupTableSchemaInfo
(
S
ExecTaskInfo
*
pTask
Info
)
{
taosMemoryFreeClear
(
p
TaskInfo
->
schemaVer
.
dbname
);
if
(
p
TaskInfo
->
schemaVer
.
sw
==
NULL
)
{
static
void
cleanupTableSchemaInfo
(
S
SchemaInfo
*
pSchema
Info
)
{
taosMemoryFreeClear
(
p
SchemaInfo
->
dbname
);
if
(
p
SchemaInfo
->
sw
==
NULL
)
{
return
;
}
taosMemoryFree
(
p
TaskInfo
->
schemaVer
.
sw
->
pSchema
);
taosMemoryFree
(
p
TaskInfo
->
schemaVer
.
sw
);
taosMemoryFree
(
p
TaskInfo
->
schemaVer
.
tablename
);
taosMemoryFree
(
p
SchemaInfo
->
tablename
);
taosMemoryFree
(
p
SchemaInfo
->
sw
->
pSchema
);
taosMemoryFree
(
p
SchemaInfo
->
sw
);
}
static
int32_t
sortTableGroup
(
STableListInfo
*
pTableListInfo
,
int32_t
groupNum
)
{
...
...
@@ -4939,6 +4939,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
}
(
*
pTaskInfo
)
->
sql
=
sql
;
(
*
pTaskInfo
)
->
pSubplan
=
pPlan
;
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
&
(
*
pTaskInfo
)
->
tableqinfoList
,
pPlan
->
pTagCond
,
pPlan
->
pTagIndexCond
,
pPlan
->
user
);
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
...
...
@@ -4977,7 +4978,9 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) {
doDestroyTableList
(
&
pTaskInfo
->
tableqinfoList
);
destroyOperatorInfo
(
pTaskInfo
->
pRoot
);
cleanupTableSchemaInfo
(
pTaskInfo
);
cleanupTableSchemaInfo
(
&
pTaskInfo
->
schemaInfo
);
nodesDestroyNode
((
SNode
*
)
pTaskInfo
->
pSubplan
);
taosMemoryFreeClear
(
pTaskInfo
->
sql
);
taosMemoryFreeClear
(
pTaskInfo
->
id
.
str
);
...
...
source/libs/qworker/inc/qwInt.h
浏览文件 @
179709f8
...
...
@@ -150,7 +150,6 @@ typedef struct SQWTaskCtx {
void
*
taskHandle
;
void
*
sinkHandle
;
SSubplan
*
plan
;
STbVerInfo
tbInfo
;
}
SQWTaskCtx
;
...
...
source/libs/qworker/src/qwUtil.c
浏览文件 @
179709f8
...
...
@@ -306,11 +306,6 @@ void qwFreeTaskCtx(SQWTaskCtx *ctx) {
dsDestroyDataSinker
(
ctx
->
sinkHandle
);
ctx
->
sinkHandle
=
NULL
;
}
if
(
ctx
->
plan
)
{
nodesDestroyNode
((
SNode
*
)
ctx
->
plan
);
ctx
->
plan
=
NULL
;
}
}
int32_t
qwDropTaskCtx
(
QW_FPARAMS_DEF
)
{
...
...
@@ -327,7 +322,6 @@ int32_t qwDropTaskCtx(QW_FPARAMS_DEF) {
atomic_store_ptr
(
&
ctx
->
taskHandle
,
NULL
);
atomic_store_ptr
(
&
ctx
->
sinkHandle
,
NULL
);
atomic_store_ptr
(
&
ctx
->
plan
,
NULL
);
QW_SET_EVENT_PROCESSED
(
ctx
,
QW_EVENT_DROP
);
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
179709f8
...
...
@@ -522,8 +522,6 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, const char* sql) {
QW_ERR_JRET
(
code
);
}
ctx
->
plan
=
plan
;
code
=
qCreateExecTask
(
qwMsg
->
node
,
mgmt
->
nodeId
,
tId
,
plan
,
&
pTaskInfo
,
&
sinkHandle
,
sql
,
OPTR_EXEC_MODEL_BATCH
);
if
(
code
)
{
QW_TASK_ELOG
(
"qCreateExecTask failed, code:%x - %s"
,
code
,
tstrerror
(
code
));
...
...
@@ -928,8 +926,6 @@ int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes) {
QW_ERR_JRET
(
code
);
}
ctx
.
plan
=
plan
;
code
=
qCreateExecTask
(
qwMsg
->
node
,
mgmt
->
nodeId
,
tId
,
plan
,
&
pTaskInfo
,
&
sinkHandle
,
NULL
,
OPTR_EXEC_MODEL_BATCH
);
if
(
code
)
{
QW_TASK_ELOG
(
"qCreateExecTask failed, code:%x - %s"
,
code
,
tstrerror
(
code
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录