Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e6c5fd87
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看板
未验证
提交
e6c5fd87
编写于
12月 30, 2022
作者:
D
dapan1121
提交者:
GitHub
12月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19175 from taosdata/szhou/fixbugs2
enhance: remove assert
上级
18c7fbd0
ceea74ee
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
131 addition
and
63 deletion
+131
-63
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+115
-58
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+0
-1
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+0
-1
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+3
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+13
-3
未找到文件。
source/libs/executor/src/sysscanoperator.c
浏览文件 @
e6c5fd87
...
...
@@ -65,6 +65,8 @@ typedef struct SSysTableScanInfo {
SSDataBlock
*
pRes
;
int64_t
numOfBlocks
;
// extract basic running information.
SLoadRemoteDataInfo
loadInfo
;
int32_t
tbnameSlotId
;
}
SSysTableScanInfo
;
typedef
struct
{
...
...
@@ -346,6 +348,11 @@ static int32_t optSysTabFilteImpl(void* arg, SNode* cond, SArray* result);
static
int32_t
optSysCheckOper
(
SNode
*
pOpear
);
static
int32_t
optSysMergeRslt
(
SArray
*
mRslt
,
SArray
*
rslt
);
static
SSDataBlock
*
sysTableScanFromMNode
(
SOperatorInfo
*
pOperator
,
SSysTableScanInfo
*
pInfo
,
const
char
*
name
,
SExecTaskInfo
*
pTaskInfo
);
void
extractTbnameSlotId
(
SSysTableScanInfo
*
pInfo
,
const
SScanPhysiNode
*
pScanNode
);
static
SSDataBlock
*
sysTableScanFillTbName
(
SOperatorInfo
*
pOperator
,
const
SSysTableScanInfo
*
pInfo
,
const
char
*
name
,
SSDataBlock
*
pBlock
);
__optSysFilter
optSysGetFilterFunc
(
int32_t
ctype
,
bool
*
reverse
)
{
if
(
ctype
==
OP_TYPE_LOWER_EQUAL
||
ctype
==
OP_TYPE_LOWER_THAN
)
{
*
reverse
=
true
;
...
...
@@ -1309,84 +1316,112 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
getDBNameFromCondition
(
pInfo
->
pCondition
,
dbName
);
sprintf
(
pInfo
->
req
.
db
,
"%d.%s"
,
pInfo
->
accountId
,
dbName
);
}
SSDataBlock
*
pBlock
=
NULL
;
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
return
sysTableScanUserTables
(
pOperator
);
pBlock
=
sysTableScanUserTables
(
pOperator
);
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TAGS
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
return
sysTableScanUserTags
(
pOperator
);
pBlock
=
sysTableScanUserTags
(
pOperator
);
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_STABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
&&
pInfo
->
showRewrite
&&
IS_SYS_DBNAME
(
dbName
))
{
return
sysTableScanUserSTables
(
pOperator
);
pBlock
=
sysTableScanUserSTables
(
pOperator
);
}
else
{
// load the meta from mnode of the given epset
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
while
(
1
)
{
int64_t
startTs
=
taosGetTimestampUs
();
tstrncpy
(
pInfo
->
req
.
tb
,
tNameGetTableName
(
&
pInfo
->
name
),
tListLen
(
pInfo
->
req
.
tb
));
tstrncpy
(
pInfo
->
req
.
user
,
pInfo
->
pUser
,
tListLen
(
pInfo
->
req
.
user
));
pBlock
=
sysTableScanFromMNode
(
pOperator
,
pInfo
,
name
,
pTaskInfo
);
}
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
pInfo
->
req
);
char
*
buf1
=
taosMemoryCalloc
(
1
,
contLen
);
tSerializeSRetrieveTableReq
(
buf1
,
contLen
,
&
pInfo
->
req
);
return
sysTableScanFillTbName
(
pOperator
,
pInfo
,
name
,
pBlock
);
}
// send the fetch remote task result reques
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
NULL
==
pMsgSendInfo
)
{
qError
(
"%s prepare message %d failed"
,
GET_TASKID
(
pTaskInfo
),
(
int32_t
)
sizeof
(
SMsgSendInfo
));
pTaskInfo
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
static
SSDataBlock
*
sysTableScanFillTbName
(
SOperatorInfo
*
pOperator
,
const
SSysTableScanInfo
*
pInfo
,
const
char
*
name
,
SSDataBlock
*
pBlock
)
{
if
(
pBlock
!=
NULL
)
{
if
(
pInfo
->
tbnameSlotId
!=
-
1
)
{
SColumnInfoData
*
pColumnInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
tbnameSlotId
);
char
varTbName
[
TSDB_TABLE_FNAME_LEN
-
1
+
VARSTR_HEADER_SIZE
]
=
{
0
};
memcpy
(
varDataVal
(
varTbName
),
name
,
strlen
(
name
));
varDataSetLen
(
varTbName
,
strlen
(
name
));
for
(
int
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColumnInfoData
,
i
,
varTbName
,
NULL
);
}
doFilterResult
(
pBlock
,
pOperator
->
exprSupp
.
pFilterInfo
);
}
}
if
(
pBlock
&&
pBlock
->
info
.
rows
!=
0
)
{
return
pBlock
;
}
else
{
return
NULL
;
}
}
int32_t
msgType
=
(
strcasecmp
(
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
?
TDMT_DND_SYSTABLE_RETRIEVE
:
TDMT_MND_SYSTABLE_RETRIEVE
;
static
SSDataBlock
*
sysTableScanFromMNode
(
SOperatorInfo
*
pOperator
,
SSysTableScanInfo
*
pInfo
,
const
char
*
name
,
SExecTaskInfo
*
pTaskInfo
)
{
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
pMsgSendInfo
->
param
=
pOperator
;
pMsgSendInfo
->
msgInfo
.
pData
=
buf1
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgType
=
msgType
;
pMsgSendInfo
->
fp
=
loadSysTableCallback
;
pMsgSendInfo
->
requestId
=
pTaskInfo
->
id
.
queryId
;
while
(
1
)
{
int64_t
startTs
=
taosGetTimestampUs
();
tstrncpy
(
pInfo
->
req
.
tb
,
tNameGetTableName
(
&
pInfo
->
name
),
tListLen
(
pInfo
->
req
.
tb
));
tstrncpy
(
pInfo
->
req
.
user
,
pInfo
->
pUser
,
tListLen
(
pInfo
->
req
.
user
));
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pInfo
->
readHandle
.
pMsgCb
->
clientRpc
,
&
pInfo
->
epSet
,
&
transporterId
,
pMsgSendInfo
);
tsem_wait
(
&
pInfo
->
ready
);
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
pInfo
->
req
);
char
*
buf1
=
taosMemoryCalloc
(
1
,
contLen
);
tSerializeSRetrieveTableReq
(
buf1
,
contLen
,
&
pInfo
->
req
);
if
(
pTaskInfo
->
code
)
{
qDebug
(
"%s load meta data from mnode failed, totalRows:%"
PRIu64
", code:%s"
,
GET_TASKID
(
pTaskInfo
),
pInfo
->
loadInfo
.
totalRows
,
tstrerror
(
pTaskInfo
->
code
));
return
NULL
;
}
// send the fetch remote task result reques
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
NULL
==
pMsgSendInfo
)
{
qError
(
"%s prepare message %d failed"
,
GET_TASKID
(
pTaskInfo
),
(
int32_t
)
sizeof
(
SMsgSendInfo
));
pTaskInfo
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
SRetrieveMetaTableRsp
*
pRsp
=
pInfo
->
pRsp
;
pInfo
->
req
.
showId
=
pRsp
->
handle
;
int32_t
msgType
=
(
strcasecmp
(
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
?
TDMT_DND_SYSTABLE_RETRIEVE
:
TDMT_MND_SYSTABLE_RETRIEVE
;
if
(
pRsp
->
numOfRows
==
0
||
pRsp
->
completed
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
qDebug
(
"%s load meta data from mnode completed, rowsOfSource:%d, totalRows:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pRsp
->
numOfRows
,
pInfo
->
loadInfo
.
totalRows
);
pMsgSendInfo
->
param
=
pOperator
;
pMsgSendInfo
->
msgInfo
.
pData
=
buf1
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgType
=
msgType
;
pMsgSendInfo
->
fp
=
loadSysTableCallback
;
pMsgSendInfo
->
requestId
=
pTaskInfo
->
id
.
queryId
;
if
(
pRsp
->
numOfRows
==
0
)
{
taosMemoryFree
(
pRsp
);
return
NULL
;
}
}
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pInfo
->
readHandle
.
pMsgCb
->
clientRpc
,
&
pInfo
->
epSet
,
&
transporterId
,
pMsgSendInfo
);
tsem_wait
(
&
pInfo
->
ready
);
char
*
pStart
=
pRsp
->
data
;
extractDataBlockFromFetchRsp
(
pInfo
->
pRes
,
pRsp
->
data
,
pInfo
->
matchInfo
.
pList
,
&
pStart
);
updateLoadRemoteInfo
(
&
pInfo
->
loadInfo
,
pRsp
->
numOfRows
,
pRsp
->
compLen
,
startTs
,
pOperator
);
if
(
pTaskInfo
->
code
)
{
qDebug
(
"%s load meta data from mnode failed, totalRows:%"
PRIu64
", code:%s"
,
GET_TASKID
(
pTaskInfo
),
pInfo
->
loadInfo
.
totalRows
,
tstrerror
(
pTaskInfo
->
code
));
return
NULL
;
}
// todo log the filter info
doFilterResult
(
pInfo
->
pRes
,
pOperator
->
exprSupp
.
pFilterInfo
);
taosMemoryFree
(
pRsp
);
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
return
pInfo
->
pRes
;
}
else
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
SRetrieveMetaTableRsp
*
pRsp
=
pInfo
->
pRsp
;
pInfo
->
req
.
showId
=
pRsp
->
handle
;
if
(
pRsp
->
numOfRows
==
0
||
pRsp
->
completed
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
qDebug
(
"%s load meta data from mnode completed, rowsOfSource:%d, totalRows:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pRsp
->
numOfRows
,
pInfo
->
loadInfo
.
totalRows
);
if
(
pRsp
->
numOfRows
==
0
)
{
taosMemoryFree
(
pRsp
);
return
NULL
;
}
}
char
*
pStart
=
pRsp
->
data
;
extractDataBlockFromFetchRsp
(
pInfo
->
pRes
,
pRsp
->
data
,
pInfo
->
matchInfo
.
pList
,
&
pStart
);
updateLoadRemoteInfo
(
&
pInfo
->
loadInfo
,
pRsp
->
numOfRows
,
pRsp
->
compLen
,
startTs
,
pOperator
);
// todo log the filter info
doFilterResult
(
pInfo
->
pRes
,
pOperator
->
exprSupp
.
pFilterInfo
);
taosMemoryFree
(
pRsp
);
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
return
pInfo
->
pRes
;
}
else
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
}
}
...
...
@@ -1407,6 +1442,8 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
goto
_error
;
}
extractTbnameSlotId
(
pInfo
,
pScanNode
);
pInfo
->
accountId
=
pScanPhyNode
->
accountId
;
pInfo
->
pUser
=
taosMemoryStrDup
((
void
*
)
pUser
);
pInfo
->
sysInfo
=
pScanPhyNode
->
sysInfo
;
...
...
@@ -1449,6 +1486,26 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
return
NULL
;
}
void
extractTbnameSlotId
(
SSysTableScanInfo
*
pInfo
,
const
SScanPhysiNode
*
pScanNode
)
{
pInfo
->
tbnameSlotId
=
-
1
;
if
(
pScanNode
->
pScanPseudoCols
!=
NULL
)
{
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pScanNode
->
pScanPseudoCols
)
{
STargetNode
*
pTargetNode
=
NULL
;
if
(
nodeType
(
pNode
)
==
QUERY_NODE_TARGET
)
{
pTargetNode
=
(
STargetNode
*
)
pNode
;
SNode
*
expr
=
pTargetNode
->
pExpr
;
if
(
nodeType
(
expr
)
==
QUERY_NODE_FUNCTION
)
{
SFunctionNode
*
pFuncNode
=
(
SFunctionNode
*
)
expr
;
if
(
pFuncNode
->
funcType
==
FUNCTION_TYPE_TBNAME
)
{
pInfo
->
tbnameSlotId
=
pTargetNode
->
slotId
;
}
}
}
}
}
}
void
destroySysScanOperator
(
void
*
param
)
{
SSysTableScanInfo
*
pInfo
=
(
SSysTableScanInfo
*
)
param
;
tsem_destroy
(
&
pInfo
->
ready
);
...
...
source/libs/function/src/tudf.c
浏览文件 @
e6c5fd87
...
...
@@ -1230,7 +1230,6 @@ int32_t udfcGetUdfTaskResultFromUvTask(SClientUdfTask *task, SClientUvTaskNode *
if
(
uvTask
->
rspBuf
.
base
!=
NULL
)
{
SUdfResponse
rsp
=
{
0
};
void
*
buf
=
decodeUdfResponse
(
uvTask
->
rspBuf
.
base
,
&
rsp
);
assert
(
uvTask
->
rspBuf
.
len
==
POINTER_DISTANCE
(
buf
,
uvTask
->
rspBuf
.
base
));
task
->
errCode
=
rsp
.
code
;
switch
(
task
->
type
)
{
...
...
source/libs/function/src/udfd.c
浏览文件 @
e6c5fd87
...
...
@@ -400,7 +400,6 @@ void udfdProcessTeardownRequest(SUvUdfWork *uvUdf, SUdfRequest *request) {
void
udfdProcessRpcRsp
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SUdfdRpcSendRecvInfo
*
msgInfo
=
(
SUdfdRpcSendRecvInfo
*
)
pMsg
->
info
.
ahandle
;
ASSERT
(
pMsg
->
info
.
ahandle
!=
NULL
);
if
(
pEpSet
)
{
if
(
!
isEpsetEqual
(
&
global
.
mgmtEp
.
epSet
,
pEpSet
))
{
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
e6c5fd87
...
...
@@ -2388,6 +2388,9 @@ static bool tagScanOptShouldBeOptimized(SLogicNode* pNode) {
if
(
pScan
->
hasNormalCols
)
{
return
false
;
}
if
(
pScan
->
tableType
==
TSDB_SYSTEM_TABLE
)
{
return
false
;
}
if
(
NULL
==
pNode
->
pParent
||
QUERY_NODE_LOGIC_PLAN_AGG
!=
nodeType
(
pNode
->
pParent
)
||
1
!=
LIST_LENGTH
(
pNode
->
pParent
->
pChildren
))
{
return
false
;
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
e6c5fd87
...
...
@@ -333,13 +333,23 @@ static bool stbSplHasPartTbname(SNodeList* pPartKeys) {
return
false
;
}
static
bool
stbSplIsPartTableAgg
(
SAggLogicNode
*
pAgg
)
{
if
(
NULL
!=
pAgg
->
pGroupKeys
)
{
return
stbSplHasPartTbname
(
pAgg
->
pGroupKeys
);
static
bool
stbSplNotSystemScan
(
SLogicNode
*
pNode
)
{
if
(
QUERY_NODE_LOGIC_PLAN_SCAN
==
nodeType
(
pNode
))
{
return
SCAN_TYPE_SYSTEM_TABLE
!=
((
SScanLogicNode
*
)
pNode
)
->
scanType
;
}
else
if
(
QUERY_NODE_LOGIC_PLAN_PARTITION
==
nodeType
(
pNode
))
{
return
stbSplNotSystemScan
((
SLogicNode
*
)
nodesListGetNode
(
pNode
->
pChildren
,
0
));
}
else
{
return
true
;
}
}
static
bool
stbSplIsPartTableAgg
(
SAggLogicNode
*
pAgg
)
{
if
(
1
!=
LIST_LENGTH
(
pAgg
->
node
.
pChildren
))
{
return
false
;
}
if
(
NULL
!=
pAgg
->
pGroupKeys
)
{
return
stbSplHasPartTbname
(
pAgg
->
pGroupKeys
)
&&
stbSplNotSystemScan
((
SLogicNode
*
)
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
));
}
return
stbSplHasPartTbname
(
stbSplGetPartKeys
((
SLogicNode
*
)
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
)));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录