Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eb712702
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看板
提交
eb712702
编写于
1月 22, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818]fix bug in select * from super_table.
上级
9ef605fa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
90 addition
and
50 deletion
+90
-50
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+4
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+86
-49
未找到文件。
source/libs/executor/inc/executorimpl.h
浏览文件 @
eb712702
...
...
@@ -372,11 +372,14 @@ typedef struct STaskParam {
typedef
struct
SExchangeInfo
{
SArray
*
pSources
;
uint64_t
bytes
;
// total load bytes from remote
tsem_t
ready
;
void
*
pTransporter
;
SRetrieveTableRsp
*
pRsp
;
SSDataBlock
*
pResult
;
int32_t
current
;
uint64_t
rowsOfCurrentSource
;
uint64_t
bytes
;
// total load bytes from remote
uint64_t
totalRows
;
}
SExchangeInfo
;
typedef
struct
STableScanInfo
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
eb712702
...
...
@@ -5144,71 +5144,109 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
*
newgroup
=
false
;
if
(
pExchangeInfo
->
pRsp
!=
NULL
&&
pExchangeInfo
->
pRsp
->
completed
==
1
)
{
size_t
totalSources
=
taosArrayGetSize
(
pExchangeInfo
->
pSources
);
if
(
pExchangeInfo
->
current
>=
totalSources
)
{
return
NULL
;
}
SResFetchReq
*
pMsg
=
calloc
(
1
,
sizeof
(
SResFetchReq
));
if
(
NULL
==
pMsg
)
{
// todo handle malloc error
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
SResFetchReq
*
pMsg
=
NULL
;
SMsgSendInfo
*
pMsgSendInfo
=
NULL
;
SDownstreamSource
*
pSource
=
taosArrayGet
(
pExchangeInfo
->
pSources
,
0
);
SEpSet
epSet
=
{
0
};
while
(
1
)
{
pMsg
=
calloc
(
1
,
sizeof
(
SResFetchReq
));
if
(
NULL
==
pMsg
)
{
// todo handle malloc error
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
epSet
.
numOfEps
=
pSource
->
addr
.
numOfEps
;
epSet
.
port
[
0
]
=
pSource
->
addr
.
epAddr
[
0
].
port
;
tstrncpy
(
epSet
.
fqdn
[
0
],
pSource
->
addr
.
epAddr
[
0
].
fqdn
,
tListLen
(
epSet
.
fqdn
[
0
]));
SDownstreamSource
*
pSource
=
taosArrayGet
(
pExchangeInfo
->
pSources
,
pExchangeInfo
->
current
);
SEpSet
epSet
=
{
0
};
pMsg
->
header
.
vgId
=
htonl
(
pSource
->
addr
.
nodeId
);
pMsg
->
sId
=
htobe64
(
pSource
->
schedId
);
pMsg
->
taskId
=
htobe64
(
pSource
->
taskId
);
pMsg
->
queryId
=
htobe64
(
pTaskInfo
->
id
.
queryId
);
epSet
.
numOfEps
=
pSource
->
addr
.
numOfEps
;
epSet
.
port
[
0
]
=
pSource
->
addr
.
epAddr
[
0
].
port
;
tstrncpy
(
epSet
.
fqdn
[
0
],
pSource
->
addr
.
epAddr
[
0
].
fqdn
,
tListLen
(
epSet
.
fqdn
[
0
]));
// send the fetch remote task result reques
SMsgSendInfo
*
pMsgSendInfo
=
calloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
NULL
==
pMsgSendInfo
)
{
qError
(
"QID:%"
PRIx64
" calloc %d failed"
,
GET_TASKID
(
pTaskInfo
),
(
int32_t
)
sizeof
(
SMsgSendInfo
));
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
qDebug
(
"QID:0x%"
PRIx64
" build fetch msg and send to vgId:%d, ep:%s, taskId:0x%"
PRIx64
", %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
epSet
.
fqdn
[
0
],
pSource
->
taskId
,
pExchangeInfo
->
current
,
totalSources
);
pMsgSendInfo
->
param
=
pExchangeInfo
;
pMsgSendInfo
->
msgInfo
.
pData
=
pMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SResFetchReq
);
pMsgSendInfo
->
msgType
=
TDMT_VND_FETCH
;
pMsgSendInfo
->
fp
=
loadRemoteDataCallback
;
pMsg
->
header
.
vgId
=
htonl
(
pSource
->
addr
.
nodeId
);
pMsg
->
sId
=
htobe64
(
pSource
->
schedId
);
pMsg
->
taskId
=
htobe64
(
pSource
->
taskId
);
pMsg
->
queryId
=
htobe64
(
pTaskInfo
->
id
.
queryId
);
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pExchangeInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pMsgSendInfo
);
tsem_wait
(
&
pExchangeInfo
->
ready
);
// send the fetch remote task result reques
pMsgSendInfo
=
calloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
NULL
==
pMsgSendInfo
)
{
qError
(
"QID:0x%"
PRIx64
" prepare message %d failed"
,
GET_TASKID
(
pTaskInfo
),
(
int32_t
)
sizeof
(
SMsgSendInfo
));
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
if
(
pExchangeInfo
->
pRsp
->
numOfRows
==
0
)
{
return
NULL
;
}
pMsgSendInfo
->
param
=
pExchangeInfo
;
pMsgSendInfo
->
msgInfo
.
pData
=
pMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SResFetchReq
);
pMsgSendInfo
->
msgType
=
TDMT_VND_FETCH
;
pMsgSendInfo
->
fp
=
loadRemoteDataCallback
;
SSDataBlock
*
pRes
=
pExchangeInfo
->
pResult
;
char
*
pData
=
pExchangeInfo
->
pRsp
->
data
;
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pExchangeInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pMsgSendInfo
);
tsem_wait
(
&
pExchangeInfo
->
ready
);
for
(
int32_t
i
=
0
;
i
<
pOperator
->
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
char
*
tmp
=
realloc
(
pColInfoData
->
pData
,
pColInfoData
->
info
.
bytes
*
pExchangeInfo
->
pRsp
->
numOfRows
);
if
(
tmp
==
NULL
)
{
goto
_error
;
SRetrieveTableRsp
*
pRsp
=
pExchangeInfo
->
pRsp
;
if
(
pRsp
->
numOfRows
==
0
)
{
if
(
pExchangeInfo
->
current
>=
taosArrayGetSize
(
pExchangeInfo
->
pSources
))
{
return
NULL
;
}
qDebug
(
"QID:0x%"
PRIx64
" vgId:%d, taskID:0x%"
PRIx64
" %d of total completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
" try next"
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pExchangeInfo
->
current
+
1
,
pExchangeInfo
->
rowsOfCurrentSource
,
pExchangeInfo
->
totalRows
);
pExchangeInfo
->
rowsOfCurrentSource
=
0
;
pExchangeInfo
->
current
+=
1
;
continue
;
}
size_t
len
=
pExchangeInfo
->
pRsp
->
numOfRows
*
pColInfoData
->
info
.
bytes
;
memcpy
(
tmp
,
pData
,
len
)
;
SSDataBlock
*
pRes
=
pExchangeInfo
->
pResult
;
char
*
pData
=
pRsp
->
data
;
pColInfoData
->
pData
=
tmp
;
pData
+=
len
;
}
for
(
int32_t
i
=
0
;
i
<
pOperator
->
numOfOutput
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
char
*
tmp
=
realloc
(
pColInfoData
->
pData
,
pColInfoData
->
info
.
bytes
*
pRsp
->
numOfRows
);
if
(
tmp
==
NULL
)
{
goto
_error
;
}
size_t
len
=
pRsp
->
numOfRows
*
pColInfoData
->
info
.
bytes
;
memcpy
(
tmp
,
pData
,
len
);
pColInfoData
->
pData
=
tmp
;
pData
+=
len
;
}
pRes
->
info
.
numOfCols
=
pOperator
->
numOfOutput
;
pRes
->
info
.
rows
=
pRsp
->
numOfRows
;
pRes
->
info
.
numOfCols
=
pOperator
->
numOfOutput
;
pRes
->
info
.
rows
=
pExchangeInfo
->
pRsp
->
numOfRows
;
pExchangeInfo
->
totalRows
+=
pRsp
->
numOfRows
;
pExchangeInfo
->
bytes
+=
pRsp
->
compLen
;
pExchangeInfo
->
rowsOfCurrentSource
+=
pRsp
->
numOfRows
;
return
pExchangeInfo
->
pResult
;
if
(
pRsp
->
completed
==
1
)
{
qDebug
(
"QID:0x%"
PRIx64
" fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pRes
->
info
.
rows
,
pExchangeInfo
->
rowsOfCurrentSource
,
pExchangeInfo
->
totalRows
,
pExchangeInfo
->
bytes
,
pExchangeInfo
->
current
+
1
,
totalSources
);
pExchangeInfo
->
rowsOfCurrentSource
=
0
;
pExchangeInfo
->
current
+=
1
;
}
else
{
qDebug
(
"QID:0x%"
PRIx64
" fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" numOfRows:%d, totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pRes
->
info
.
rows
,
pExchangeInfo
->
totalRows
,
pExchangeInfo
->
bytes
);
}
return
pExchangeInfo
->
pResult
;
}
_error:
tfree
(
pMsg
);
...
...
@@ -7719,7 +7757,6 @@ SOperatorInfo* doCreateOperatorTreeNode(SPhyNode* pPhyNode, SExecTaskInfo* pTask
SExchangePhyNode
*
pEx
=
(
SExchangePhyNode
*
)
pPhyNode
;
return
createExchangeOperatorInfo
(
pEx
->
pSrcEndPoints
,
pEx
->
node
.
pTargets
,
pTaskInfo
);
}
else
if
(
pPhyNode
->
info
.
type
==
OP_StreamScan
)
{
size_t
numOfCols
=
taosArrayGetSize
(
pPhyNode
->
pTargets
);
SScanPhyNode
*
pScanPhyNode
=
(
SScanPhyNode
*
)
pPhyNode
;
// simple child table.
return
createStreamScanOperatorInfo
(
readerHandle
,
pPhyNode
->
pTargets
,
pScanPhyNode
->
uid
,
pTaskInfo
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录