Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5956d8f4
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看板
提交
5956d8f4
编写于
11月 24, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: group by tbname optimize
上级
61a634e8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
25 deletion
+29
-25
source/libs/executor/src/exchangeoperator.c
source/libs/executor/src/exchangeoperator.c
+29
-25
未找到文件。
source/libs/executor/src/exchangeoperator.c
浏览文件 @
5956d8f4
...
...
@@ -51,9 +51,9 @@ typedef struct SSourceDataInfo {
const
char
*
taskId
;
}
SSourceDataInfo
;
static
void
destroyExchangeOperatorInfo
(
void
*
param
);
static
void
freeBlock
(
void
*
pParam
);
static
void
freeSourceDataInfo
(
void
*
param
);
static
void
destroyExchangeOperatorInfo
(
void
*
param
);
static
void
freeBlock
(
void
*
pParam
);
static
void
freeSourceDataInfo
(
void
*
param
);
static
void
*
setAllSourcesCompleted
(
SOperatorInfo
*
pOperator
);
static
int32_t
loadRemoteDataCallback
(
void
*
param
,
SDataBuf
*
pMsg
,
int32_t
code
);
...
...
@@ -62,7 +62,8 @@ static int32_t getCompletedSources(const SArray* pArray);
static
int32_t
prepareConcurrentlyLoad
(
SOperatorInfo
*
pOperator
);
static
int32_t
seqLoadRemoteData
(
SOperatorInfo
*
pOperator
);
static
int32_t
prepareLoadRemoteData
(
SOperatorInfo
*
pOperator
);
static
int32_t
handleLimitOffset
(
SOperatorInfo
*
pOperator
,
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
bool
holdDataInBuf
);
static
int32_t
handleLimitOffset
(
SOperatorInfo
*
pOperator
,
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
bool
holdDataInBuf
);
static
int32_t
doExtractResultBlocks
(
SExchangeInfo
*
pExchangeInfo
,
SSourceDataInfo
*
pDataInfo
);
static
void
concurrentlyLoadRemoteDataImpl
(
SOperatorInfo
*
pOperator
,
SExchangeInfo
*
pExchangeInfo
,
...
...
@@ -106,7 +107,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
if
(
pRsp
->
numOfRows
==
0
)
{
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
qDebug
(
"%s vgId:%d, taskId:0x%"
PRIx64
" execId:%d index:%d completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", try next %d/%"
PRIzu
,
", totalRows:%"
PRIu64
", try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
i
,
pDataInfo
->
totalRows
,
pExchangeInfo
->
loadInfo
.
totalRows
,
i
+
1
,
totalSources
);
taosMemoryFreeClear
(
pDataInfo
->
pRsp
);
...
...
@@ -125,14 +126,14 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
if
(
pRsp
->
completed
==
1
)
{
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d index:%d completed, blocks:%d, numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", total:%.2f Kb, try next %d/%"
PRIzu
,
" execId:%d index:%d completed, blocks:%d, numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", total:%.2f Kb, try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
i
,
pRsp
->
numOfBlocks
,
pRsp
->
numOfRows
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
/
1024
.
0
,
i
+
1
,
totalSources
);
pRsp
->
numOfRows
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
/
1024
.
0
,
i
+
1
,
totalSources
);
}
else
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d blocks:%d, numOfRows:%d, totalRows:%"
PRIu64
", total:%.2f Kb"
,
" execId:%d blocks:%d, numOfRows:%d, totalRows:%"
PRIu64
", total:%.2f Kb"
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRsp
->
numOfBlocks
,
pRsp
->
numOfRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
/
1024
.
0
);
}
...
...
@@ -157,7 +158,7 @@ static void concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SExchangeIn
}
}
_error:
_error:
pTaskInfo
->
code
=
code
;
}
...
...
@@ -298,17 +299,19 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
SExchangeOpStopInfo
stopInfo
=
{
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
,
pInfo
->
self
};
qAppendTaskStopInfo
(
pTaskInfo
,
&
stopInfo
);
pInfo
->
seqLoadData
=
true
;
pInfo
->
seqLoadData
=
pExNode
->
seqRecvData
;
pInfo
->
pTransporter
=
pTransporter
;
setOperatorInfo
(
pOperator
,
"ExchangeOperator"
,
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
setOperatorInfo
(
pOperator
,
"ExchangeOperator"
,
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pDummyBlock
->
pDataBlock
);
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
);
return
pOperator
;
_error:
_error:
if
(
pInfo
!=
NULL
)
{
doDestroyExchangeOperatorInfo
(
pInfo
);
}
...
...
@@ -379,7 +382,8 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
}
else
{
taosMemoryFree
(
pMsg
->
pData
);
pSourceDataInfo
->
code
=
code
;
qDebug
(
"%s fetch rsp received, index:%d, error:%s, %p"
,
pSourceDataInfo
->
taskId
,
index
,
tstrerror
(
code
),
pExchangeInfo
);
qDebug
(
"%s fetch rsp received, index:%d, error:%s, %p"
,
pSourceDataInfo
->
taskId
,
index
,
tstrerror
(
code
),
pExchangeInfo
);
}
pSourceDataInfo
->
status
=
EX_SOURCE_DATA_READY
;
...
...
@@ -427,14 +431,14 @@ int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInfo* pTas
taosMemoryFree
(
pWrapper
);
return
pTaskInfo
->
code
;
}
void
*
msg
=
taosMemoryCalloc
(
1
,
msgSize
);
if
(
NULL
==
msg
)
{
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
taosMemoryFree
(
pWrapper
);
return
pTaskInfo
->
code
;
}
if
(
tSerializeSResFetchReq
(
msg
,
msgSize
,
&
req
)
<
0
)
{
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
taosMemoryFree
(
pWrapper
);
...
...
@@ -524,7 +528,7 @@ void* setAllSourcesCompleted(SOperatorInfo* pOperator) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
size_t
totalSources
=
taosArrayGetSize
(
pExchangeInfo
->
pSources
);
size_t
totalSources
=
taosArrayGetSize
(
pExchangeInfo
->
pSources
);
qDebug
(
"%s all %"
PRIzu
" sources are exhausted, total rows: %"
PRIu64
", %.2f Kb, elapsed:%.2f ms"
,
GET_TASKID
(
pTaskInfo
),
totalSources
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
/
1024
.
0
,
pLoadInfo
->
totalElapsed
/
1000
.
0
);
...
...
@@ -574,7 +578,7 @@ int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator) {
if
(
isTaskKilled
(
pTaskInfo
))
{
longjmp
(
pTaskInfo
->
env
,
TSDB_CODE_TSC_QUERY_CANCELLED
);
}
tsem_post
(
&
pExchangeInfo
->
ready
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -636,7 +640,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
if
(
pRsp
->
numOfRows
==
0
)
{
qDebug
(
"%s vgId:%d, taskID:0x%"
PRIx64
" execId:%d %d of total completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
" try next"
,
", totalRows:%"
PRIu64
" try next"
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pExchangeInfo
->
current
+
1
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
);
...
...
@@ -654,7 +658,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
SRetrieveTableRsp
*
pRetrieveRsp
=
pDataInfo
->
pRsp
;
if
(
pRsp
->
completed
==
1
)
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
,
pExchangeInfo
->
current
+
1
,
totalSources
);
...
...
@@ -663,7 +667,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
pExchangeInfo
->
current
+=
1
;
}
else
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" execId:%d numOfRows:%d, totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
,
", totalBytes:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pSource
->
execId
,
pRetrieveRsp
->
numOfRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
);
}
...
...
@@ -675,7 +679,7 @@ int32_t seqLoadRemoteData(SOperatorInfo* pOperator) {
return
TSDB_CODE_SUCCESS
;
}
_error:
_error:
pTaskInfo
->
code
=
code
;
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录