Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
54573927
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看板
提交
54573927
编写于
1月 07, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/feature/qnode' into feature/3.0_wxy
上级
fda3f090
797d0891
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
397 addition
and
297 deletion
+397
-297
include/libs/qcom/query.h
include/libs/qcom/query.h
+2
-1
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+1
-1
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/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+32
-23
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+307
-265
未找到文件。
include/libs/qcom/query.h
浏览文件 @
54573927
...
...
@@ -91,9 +91,10 @@ enum {
META_TYPE_NON_TABLE
=
1
,
META_TYPE_CTABLE
,
META_TYPE_TABLE
,
META_TYPE_BOTH_TABLE
,
META_TYPE_BOTH_TABLE
};
typedef
struct
STableMetaOutput
{
int32_t
metaType
;
char
ctbFname
[
TSDB_TABLE_FNAME_LEN
];
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
54573927
...
...
@@ -24,7 +24,7 @@ extern "C" {
#include "catalog.h"
typedef
struct
SSchedulerCfg
{
int32_t
maxJobNum
;
u
int32_t
maxJobNum
;
}
SSchedulerCfg
;
typedef
struct
SQueryProfileSummary
{
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
54573927
...
...
@@ -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
浏览文件 @
54573927
...
...
@@ -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
;
...
...
@@ -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
浏览文件 @
54573927
...
...
@@ -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,7 +327,7 @@ 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
;
...
...
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
54573927
...
...
@@ -37,8 +37,8 @@ enum {
};
typedef
struct
SSchedulerMgmt
{
uint64_t
taskId
;
uint64_t
sId
;
uint64_t
taskId
;
// sequential taksId
uint64_t
sId
;
// schedulerId
SSchedulerCfg
cfg
;
SHashObj
*
jobs
;
// key: queryId, value: SQueryJob*
}
SSchedulerMgmt
;
...
...
@@ -83,52 +83,61 @@ typedef struct SSchJobAttr {
typedef
struct
SSchJob
{
uint64_t
queryId
;
int32_t
levelNum
;
int32_t
levelIdx
;
int8_t
status
;
SSchJobAttr
attr
;
SEpSet
dataSrcEps
;
SEpAddr
resEp
;
int32_t
levelNum
;
void
*
transport
;
SArray
*
nodeList
;
// qnode/vnode list, element is SQueryNodeAddr
SArray
*
levels
;
// Element is SQueryLevel, starting from 0. SArray<SSchLevel>
SArray
*
subPlans
;
// subplan pointer copied from DAG, no need to free it in scheduler
int32_t
levelIdx
;
SEpSet
dataSrcEps
;
SHashObj
*
execTasks
;
// executing tasks, key:taskid, value:SQueryTask*
SHashObj
*
succTasks
;
// succeed tasks, key:taskid, value:SQueryTask*
SHashObj
*
failTasks
;
// failed tasks, key:taskid, value:SQueryTask*
int8_t
status
;
SQueryNodeAddr
resNode
;
tsem_t
rspSem
;
int32_t
userFetch
;
int32_t
remoteFetch
;
SSchTask
*
fetchTask
;
int32_t
errCode
;
void
*
res
;
int32_t
resNumOfRows
;
SHashObj
*
execTasks
;
// executing tasks, key:taskid, value:SQueryTask*
SHashObj
*
succTasks
;
// succeed tasks, key:taskid, value:SQueryTask*
SHashObj
*
failTasks
;
// failed tasks, key:taskid, value:SQueryTask*
SArray
*
levels
;
// Element is SQueryLevel, starting from 0. SArray<SSchLevel>
SArray
*
subPlans
;
// Element is SArray*, and nested element is SSubplan. The execution level of subplan, starting from 0. SArray<void*>
SQueryProfileSummary
summary
;
}
SSchJob
;
#define SCH_HAS_QNODE_IN_CLUSTER(type) (false) //TODO CLUSTER TYPE
#define SCH_TASK_READY_TO_LUNCH(task) (
(task)->childReady >= taosArrayGetSize((task)->children)) // MAY NEED TO ENHANCE
#define SCH_TASK_READY_TO_LUNCH(task) (
atomic_load_32(&(task)->childReady) >= taosArrayGetSize((task)->children))
#define SCH_IS_DATA_SRC_TASK(task) ((task)->plan->type == QUERY_TYPE_SCAN)
#define SCH_TASK_NEED_WAIT_ALL(task) ((task)->plan->type == QUERY_TYPE_MODIFY)
#define SCH_JOB_ERR_LOG(param, ...) qError("QID:%"PRIx64 param, job->queryId, __VA_ARGS__)
#define SCH_TASK_ERR_LOG(param, ...) qError("QID:%"PRIx64",TID:%"PRIx64 param, job->queryId, task->taskId, __VA_ARGS__)
#define SCH_SET_TASK_STATUS(task, st) atomic_store_8(&(task)->status, st)
#define SCH_GET_TASK_STATUS(task) atomic_load_8(&(task)->status)
#define SCH_SET_JOB_STATUS(job, st) atomic_store_8(&(job)->status, st)
#define SCH_GET_JOB_STATUS(job) atomic_load_8(&(job)->status)
#define SCH_SET_JOB_TYPE(pAttr, type) (pAttr)->queryJob = ((type) != QUERY_TYPE_MODIFY)
#define SCH_JOB_NEED_FETCH(pAttr) ((pAttr)->queryJob)
#define SCH_JOB_ELOG(param, ...) qError("QID:%"PRIx64" " param, pJob->queryId, __VA_ARGS__)
#define SCH_JOB_DLOG(param, ...) qDebug("QID:%"PRIx64" " param, pJob->queryId, __VA_ARGS__)
#define SCH_TASK_ELOG(param, ...) qError("QID:%"PRIx64",TID:%"PRIx64" " param, pJob->queryId, pTask->taskId, __VA_ARGS__)
#define SCH_TASK_DLOG(param, ...) qDebug("QID:%"PRIx64",TID:%"PRIx64" " param, pJob->queryId, pTask->taskId, __VA_ARGS__)
#define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define SCH_ERR_LRET(c,...) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { qError(__VA_ARGS__); terrno = _code; return _code; } } while (0)
#define SCH_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
#define SCH_LOCK(type, _lock) (SCH_READ == (type) ? taosRLockLatch(_lock) : taosWLockLatch(_lock))
#define SCH_UNLOCK(type, _lock) (SCH_READ == (type) ? taosRUnLockLatch(_lock) : taosWUnLockLatch(_lock))
extern
int32_t
schLaunchTask
(
SSchJob
*
job
,
SSchTask
*
task
);
extern
int32_t
schBuildAndSendMsg
(
SSchJob
*
job
,
SSchTask
*
task
,
int32_t
msgType
);
static
int32_t
schLaunchTask
(
SSchJob
*
job
,
SSchTask
*
task
);
static
int32_t
schBuildAndSendMsg
(
SSchJob
*
job
,
SSchTask
*
task
,
int32_t
msgType
);
#ifdef __cplusplus
}
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
54573927
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录