Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
797d0891
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
797d0891
编写于
1月 08, 2022
作者:
D
dapan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
85a16137
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
15 deletion
+64
-15
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+10
-0
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+34
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+11
-6
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+9
-8
未找到文件。
source/libs/catalog/src/catalog.c
浏览文件 @
797d0891
...
...
@@ -1226,6 +1226,16 @@ int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pRpc, const S
tNameGetFullDbName
(
pTableName
,
db
);
CTG_ERR_JRET
(
ctgGetDBVgroup
(
pCatalog
,
pRpc
,
pMgmtEps
,
db
,
false
,
&
dbVgroup
));
// REMOEV THIS ....
if
(
0
==
tbMeta
->
vgId
)
{
SVgroupInfo
vgroup
=
{
0
};
catalogGetTableHashVgroup
(
pCatalog
,
pRpc
,
pMgmtEps
,
pTableName
,
&
vgroup
);
tbMeta
->
vgId
=
vgroup
.
vgId
;
}
// REMOVE THIS ....
if
(
tbMeta
->
tableType
==
TSDB_SUPER_TABLE
)
{
CTG_ERR_JRET
(
ctgGetVgInfoFromDB
(
pCatalog
,
pRpc
,
pMgmtEps
,
dbVgroup
,
pVgroupList
));
}
else
{
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
797d0891
...
...
@@ -3628,6 +3628,33 @@ int32_t evaluateSqlNode(SSqlNode* pNode, int32_t tsPrecision, SMsgBuf* pMsgBuf)
return
TSDB_CODE_SUCCESS
;
}
int32_t
setTableVgroupList
(
SParseBasicCtx
*
pCtx
,
SName
*
name
,
SVgroupsInfo
**
pVgList
)
{
SArray
*
vgroupList
=
NULL
;
int32_t
code
=
catalogGetTableDistVgroup
(
pCtx
->
pCatalog
,
pCtx
->
pTransporter
,
&
pCtx
->
mgmtEpSet
,
name
,
&
vgroupList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
int32_t
vgroupNum
=
taosArrayGetSize
(
vgroupList
);
SVgroupsInfo
*
vgList
=
calloc
(
1
,
sizeof
(
SVgroupsInfo
)
+
sizeof
(
SVgroupMsg
)
*
vgroupNum
);
vgList
->
numOfVgroups
=
vgroupNum
;
for
(
int32_t
i
=
0
;
i
<
vgroupNum
;
++
i
)
{
SVgroupInfo
*
vg
=
taosArrayGet
(
vgroupList
,
i
);
vgList
->
vgroups
[
i
].
vgId
=
vg
->
vgId
;
vgList
->
vgroups
[
i
].
numOfEps
=
vg
->
numOfEps
;
memcpy
(
vgList
->
vgroups
[
i
].
epAddr
,
vg
->
epAddr
,
sizeof
(
vgList
->
vgroups
[
i
].
epAddr
));
}
*
pVgList
=
vgList
;
taosArrayDestroy
(
vgroupList
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
qParserValidateSqlNode
(
SParseBasicCtx
*
pCtx
,
SSqlInfo
*
pInfo
,
SQueryStmtInfo
*
pQueryInfo
,
char
*
msgBuf
,
int32_t
msgBufLen
)
{
assert
(
pCtx
!=
NULL
&&
pInfo
!=
NULL
);
int32_t
code
=
0
;
...
...
@@ -3916,7 +3943,7 @@ int32_t qParserValidateSqlNode(SParseBasicCtx *pCtx, SSqlInfo* pInfo, SQueryStmt
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
data
.
pTableMeta
=
taosArrayInit
(
1
,
POINTER_BYTES
);
taosArrayPush
(
data
.
pTableMeta
,
&
pmt
);
...
...
@@ -3926,6 +3953,12 @@ int32_t qParserValidateSqlNode(SParseBasicCtx *pCtx, SSqlInfo* pInfo, SQueryStmt
pQueryInfo
->
pTableMetaInfo
[
0
]
->
name
=
*
name
;
pQueryInfo
->
numOfTables
=
1
;
code
=
setTableVgroupList
(
pCtx
,
name
,
&
pQueryInfo
->
pTableMetaInfo
[
0
]
->
vgroupList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
data
.
pTableMeta
);
return
code
;
}
// evaluate the sqlnode
STableMeta
*
pTableMeta
=
(
STableMeta
*
)
taosArrayGetP
(
data
.
pTableMeta
,
0
);
assert
(
pTableMeta
!=
NULL
);
...
...
source/libs/planner/src/physicalPlan.c
浏览文件 @
797d0891
...
...
@@ -160,9 +160,6 @@ static SPhyNode* createUserTableScanNode(SQueryPlanNode* pPlanNode, SQueryTableI
return
(
SPhyNode
*
)
node
;
}
static
SPhyNode
*
createSingleTableScanNode
(
SQueryPlanNode
*
pPlanNode
,
SQueryTableInfo
*
pTable
)
{
return
createUserTableScanNode
(
pPlanNode
,
pTable
,
OP_TableScan
);
}
static
bool
isSystemTable
(
SQueryTableInfo
*
pTable
)
{
// todo
...
...
@@ -259,12 +256,20 @@ static bool needMultiNodeScan(SQueryTableInfo* pTable) {
return
(
TSDB_SUPER_TABLE
==
pTable
->
pMeta
->
pTableMeta
->
tableType
);
}
static
SPhyNode
*
createSingleTableScanNode
(
SQueryPlanNode
*
pPlanNode
,
SQueryTableInfo
*
pTable
,
SSubplan
*
subplan
)
{
vgroupMsgToEpSet
(
&
(
pTable
->
pMeta
->
vgroupList
->
vgroups
[
0
]),
&
subplan
->
execNode
);
return
createUserTableScanNode
(
pPlanNode
,
pTable
,
OP_TableScan
);
}
static
SPhyNode
*
createTableScanNode
(
SPlanContext
*
pCxt
,
SQueryPlanNode
*
pPlanNode
)
{
SQueryTableInfo
*
pTable
=
(
SQueryTableInfo
*
)
pPlanNode
->
pExtInfo
;
if
(
needMultiNodeScan
(
pTable
))
{
return
createExchangeNode
(
pCxt
,
pPlanNode
,
splitSubplanByTable
(
pCxt
,
pPlanNode
,
pTable
));
}
return
createSingleTableScanNode
(
pPlanNode
,
pTable
);
return
createSingleTableScanNode
(
pPlanNode
,
pTable
,
pCxt
->
pCurrentSubplan
);
}
static
SPhyNode
*
createPhyNode
(
SPlanContext
*
pCxt
,
SQueryPlanNode
*
pPlanNode
)
{
...
...
@@ -322,12 +327,12 @@ static void createSubplanByLevel(SPlanContext* pCxt, SQueryPlanNode* pRoot) {
if
(
QNODE_MODIFY
==
pRoot
->
info
.
type
)
{
splitModificationOpSubPlan
(
pCxt
,
pRoot
);
}
else
{
SSubplan
*
subplan
=
initSubplan
(
pCxt
,
QUERY_TYPE_
MERGE
);
SSubplan
*
subplan
=
initSubplan
(
pCxt
,
QUERY_TYPE_
SCAN
);
++
(
pCxt
->
nextId
.
templateId
);
subplan
->
msgType
=
TDMT_VND_QUERY
;
subplan
->
pNode
=
createPhyNode
(
pCxt
,
pRoot
);
subplan
->
pDataSink
=
createDataDispatcher
(
pCxt
,
pRoot
);
subplan
->
pDataSink
=
createDataDispatcher
(
pCxt
,
pRoot
);
}
// todo deal subquery
}
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
797d0891
...
...
@@ -242,18 +242,19 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) {
}
int32_t
addNum
=
0
;
int32_t
nodeNum
=
0
;
if
(
pJob
->
nodeList
)
{
int32_t
nodeNum
=
taosArrayGetSize
(
pJob
->
nodeList
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
addNum
<
SCH_MAX_CONDIDATE_EP_NUM
;
++
i
)
{
SQueryNodeAddr
*
naddr
=
taosArrayGet
(
pJob
->
nodeList
,
i
);
nodeNum
=
taosArrayGetSize
(
pJob
->
nodeList
);
if
(
NULL
==
taosArrayPush
(
pTask
->
candidateAddrs
,
&
pTask
->
plan
->
execNode
))
{
SCH_TASK_ELOG
(
"taosArrayPush execNode to candidate addrs failed, addNum:%d, errno:%d"
,
addNum
,
errno
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
addNum
<
SCH_MAX_CONDIDATE_EP_NUM
;
++
i
)
{
SQueryNodeAddr
*
naddr
=
taosArrayGet
(
pJob
->
nodeList
,
i
);
if
(
NULL
==
taosArrayPush
(
pTask
->
candidateAddrs
,
&
pTask
->
plan
->
execNode
))
{
SCH_TASK_ELOG
(
"taosArrayPush execNode to candidate addrs failed, addNum:%d, errno:%d"
,
addNum
,
errno
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
}
}
}
if
(
addNum
<=
0
)
{
SCH_TASK_ELOG
(
"no available execNode as condidate addr, nodeNum:%d"
,
nodeNum
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录