Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b14afeef
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看板
提交
b14afeef
编写于
2月 10, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor.
上级
120ee13d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
17 deletion
+15
-17
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+15
-17
未找到文件。
source/libs/executor/src/executil.c
浏览文件 @
b14afeef
...
...
@@ -47,7 +47,7 @@ static int32_t removeInvalidUid(SArray* uids, SHashObj* tags);
static
int32_t
optimizeTbnameInCond
(
void
*
metaHandle
,
int64_t
suid
,
SArray
*
pRes
,
SNode
*
pTagCond
);
static
int32_t
optimizeTbnameInCondImpl
(
void
*
metaHandle
,
SArray
*
pExistedUidList
,
SNode
*
pTagCond
);
static
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
);
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
,
const
char
*
idstr
);
static
SSDataBlock
*
createTagValBlockForFilter
(
SArray
*
pColList
,
int32_t
numOfTables
,
SArray
*
pUidTagList
,
void
*
metaHandle
);
static
int64_t
getLimit
(
const
SNode
*
pLimit
)
{
return
NULL
==
pLimit
?
-
1
:
((
SLimitNode
*
)
pLimit
)
->
limit
;
}
...
...
@@ -1003,21 +1003,21 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN
}
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
)
{
STableListInfo
*
pListInfo
,
const
char
*
idstr
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
size_t
numOfTables
=
0
;
uint64_t
tableUid
=
pScanNode
->
uid
;
pListInfo
->
suid
=
pScanNode
->
suid
;
SArray
*
p
Res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SArray
*
p
UidList
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
if
(
pScanNode
->
tableType
!=
TSDB_SUPER_TABLE
)
{
if
(
metaIsTableExist
(
metaHandle
,
tableUid
))
{
taosArrayPush
(
p
Res
,
&
tableUid
);
taosArrayPush
(
p
UidList
,
&
tableUid
);
}
code
=
doFilterByTagCond
(
pListInfo
,
p
Res
,
pTagCond
,
metaHandle
);
code
=
doFilterByTagCond
(
pListInfo
,
p
UidList
,
pTagCond
,
metaHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1027,7 +1027,6 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
if
(
tsTagFilterCache
)
{
// try to retrieve the result from meta cache
genTagFilterDigest
(
pTagCond
,
&
context
);
SArray
*
pUidList
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
bool
acquired
=
false
;
metaGetCachedTableUidList
(
metaHandle
,
pScanNode
->
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
pUidList
,
&
acquired
);
...
...
@@ -1039,7 +1038,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
if
(
!
pTagCond
)
{
// no tag filter condition exists, let's fetch all tables of this super table
ASSERT
(
pTagIndexCond
==
NULL
);
vnodeGetCtbIdList
(
pVnode
,
pScanNode
->
suid
,
p
Res
);
vnodeGetCtbIdList
(
pVnode
,
pScanNode
->
suid
,
p
UidList
);
}
else
{
// failed to find the result in the cache, let try to calculate the results
if
(
pTagIndexCond
)
{
...
...
@@ -1047,7 +1046,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
.
metaEx
=
metaHandle
,
.
idx
=
tsdbGetIdx
(
metaHandle
),
.
ivtIdx
=
tsdbGetIvtIdx
(
metaHandle
),
.
suid
=
tableUid
};
SIdxFltStatus
status
=
SFLT_NOT_INDEX
;
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
p
Res
,
&
status
);
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
p
UidList
,
&
status
);
if
(
code
!=
0
||
status
==
SFLT_NOT_INDEX
)
{
// temporarily disable it for performance sake
// qError("failed to get tableIds from index, reason:%s, suid:%" PRIu64, tstrerror(code), tableUid);
code
=
TDB_CODE_SUCCESS
;
...
...
@@ -1055,13 +1054,13 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
}
}
code
=
doFilterByTagCond
(
pListInfo
,
p
Res
,
pTagCond
,
metaHandle
);
code
=
doFilterByTagCond
(
pListInfo
,
p
UidList
,
pTagCond
,
metaHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
// let's add the filter results into meta-cache
numOfTables
=
taosArrayGetSize
(
p
Res
);
numOfTables
=
taosArrayGetSize
(
p
UidList
);
if
(
tsTagFilterCache
)
{
size_t
size
=
numOfTables
*
sizeof
(
uint64_t
)
+
sizeof
(
int32_t
);
...
...
@@ -1069,7 +1068,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
if
(
numOfTables
>
0
)
{
*
(
int32_t
*
)
pPayload
=
numOfTables
;
memcpy
(
pPayload
+
sizeof
(
int32_t
),
taosArrayGet
(
pRes
,
0
),
numOfTables
*
sizeof
(
uint64_t
));
memcpy
(
pPayload
+
sizeof
(
int32_t
),
taosArrayGet
(
pUidList
,
0
),
numOfTables
*
sizeof
(
uint64_t
));
}
metaUidFilterCachePut
(
metaHandle
,
pScanNode
->
suid
,
context
.
digest
,
tListLen
(
context
.
digest
),
pPayload
,
size
,
1
);
...
...
@@ -1078,20 +1077,19 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
}
_end:
numOfTables
=
taosArrayGetSize
(
pRes
);
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++
)
{
STableKeyInfo
info
=
{.
uid
=
*
(
uint64_t
*
)
taosArrayGet
(
p
Res
,
i
),
.
groupId
=
0
};
STableKeyInfo
info
=
{.
uid
=
*
(
uint64_t
*
)
taosArrayGet
(
p
UidList
,
i
),
.
groupId
=
0
};
void
*
p
=
taosArrayPush
(
pListInfo
->
pTableList
,
&
info
);
if
(
p
==
NULL
)
{
taosArrayDestroy
(
p
Res
);
taosArrayDestroy
(
p
UidList
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
qTrace
(
"tagfilter get uid:%"
PRIu64
""
,
info
.
uid
);
qTrace
(
"tagfilter get uid:%"
PRIu64
", %s"
,
info
.
uid
,
idstr
);
}
taosArrayDestroy
(
p
Res
);
taosArrayDestroy
(
p
UidList
);
return
code
;
}
...
...
@@ -1990,7 +1988,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
return
TSDB_CODE_INVALID_PARA
;
}
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
pScanNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
);
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
pScanNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
,
idStr
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to getTableList, code: %s"
,
tstrerror
(
code
));
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录