Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4265fcb6
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看板
提交
4265fcb6
编写于
3月 18, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/fix/liaohj' into fix/liaohj
上级
8a8f1daa
afaa77cc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
59 addition
and
8 deletion
+59
-8
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+43
-3
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+2
-1
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+14
-4
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
4265fcb6
...
...
@@ -14,6 +14,8 @@
*/
#include "meta.h"
#include "osMemory.h"
#include "tencode.h"
void
metaReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
...
...
@@ -1235,9 +1237,14 @@ END:
return
0
;
}
int32_t
metaFilterTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
ret
=
0
;
SMetaEntry
oStbEntry
=
{
0
};
int32_t
ret
=
-
1
;
char
*
buf
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
SDecoder
dc
=
{
0
};
STbDbKey
tbDbKey
=
{
0
};
STagIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
...
...
@@ -1249,6 +1256,35 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
param
->
suid
,
sizeof
(
tb_uid_t
),
&
pData
,
&
nData
)
!=
0
)
{
goto
END
;
}
tbDbKey
.
uid
=
param
->
suid
;
tbDbKey
.
version
=
((
SUidIdxVal
*
)
pData
)[
0
].
version
;
tdbTbGet
(
pMeta
->
pTbDb
,
&
tbDbKey
,
sizeof
(
tbDbKey
),
&
pData
,
&
nData
);
tDecoderInit
(
&
dc
,
pData
,
nData
);
ret
=
metaDecodeEntry
(
&
dc
,
&
oStbEntry
);
if
(
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
==
NULL
||
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
==
NULL
)
{
ret
=
-
1
;
goto
END
;
}
for
(
int
i
=
0
;
i
<
oStbEntry
.
stbEntry
.
schemaTag
.
nCols
;
i
++
)
{
SSchema
*
schema
=
oStbEntry
.
stbEntry
.
schemaTag
.
pSchema
+
i
;
if
(
schema
->
colId
==
param
->
cid
&&
param
->
type
==
schema
->
type
&&
IS_IDX_ON
(
schema
))
{
ret
=
0
;
}
if
(
i
==
0
)
{
ret
=
0
;
}
}
if
(
ret
!=
0
)
{
goto
END
;
}
ret
=
tdbTbcOpen
(
pMeta
->
pTagIdx
,
&
pCursor
->
pCur
,
NULL
);
if
(
ret
<
0
)
{
goto
END
;
...
...
@@ -1353,6 +1389,10 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
if
(
oStbEntry
.
pBuf
)
taosMemoryFree
(
oStbEntry
.
pBuf
);
tDecoderClear
(
&
dc
);
tdbFree
(
pData
);
taosMemoryFree
(
buf
);
taosMemoryFree
(
pKey
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
4265fcb6
...
...
@@ -17,6 +17,7 @@
#include "functionMgt.h"
#include "index.h"
#include "os.h"
#include "query.h"
#include "tdatablock.h"
#include "thash.h"
#include "tmsg.h"
...
...
@@ -1061,7 +1062,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
status
=
SFLT_NOT_INDEX
;
code
=
doFilterTag
(
pTagIndexCond
,
&
metaArg
,
pUidList
,
&
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), tableU
id);
qWarn
(
"failed to get tableIds from index, suid:%"
PRIu64
,
pScanNode
->
u
id
);
code
=
TDB_CODE_SUCCESS
;
}
else
{
qInfo
(
"succ to get filter result, table num: %d"
,
(
int
)
taosArrayGetSize
(
pUidList
));
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
4265fcb6
...
...
@@ -677,6 +677,11 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
_return:
for
(
int
i
=
0
;
i
<
nParam
;
i
++
)
sifFreeParam
(
&
params
[
i
]);
taosMemoryFree
(
params
);
if
(
code
!=
0
)
{
output
->
status
=
SFLT_NOT_INDEX
;
}
else
{
output
->
status
=
SFLT_COARSE_INDEX
;
}
return
code
;
}
...
...
@@ -717,7 +722,7 @@ _return:
static
EDealRes
sifWalkFunction
(
SNode
*
pNode
,
void
*
context
)
{
SFunctionNode
*
node
=
(
SFunctionNode
*
)
pNode
;
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))};
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))
,
.
status
=
SFLT_COARSE_INDEX
};
SIFCtx
*
ctx
=
context
;
ctx
->
code
=
sifExecFunction
(
node
,
ctx
,
&
output
);
...
...
@@ -735,7 +740,7 @@ static EDealRes sifWalkFunction(SNode *pNode, void *context) {
static
EDealRes
sifWalkLogic
(
SNode
*
pNode
,
void
*
context
)
{
SLogicConditionNode
*
node
=
(
SLogicConditionNode
*
)
pNode
;
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))};
SIFParam
output
=
{.
result
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
))
,
.
status
=
SFLT_COARSE_INDEX
};
SIFCtx
*
ctx
=
context
;
ctx
->
code
=
sifExecLogic
(
node
,
ctx
,
&
output
);
...
...
@@ -831,6 +836,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
if
(
res
->
result
!=
NULL
)
{
taosArrayAddAll
(
pDst
->
result
,
res
->
result
);
}
pDst
->
status
=
res
->
status
;
sifFreeParam
(
res
);
taosHashRemove
(
ctx
.
pRes
,
(
void
*
)
&
pNode
,
POINTER_BYTES
);
...
...
@@ -887,16 +893,20 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
SFilterInfo
*
filter
=
NULL
;
SArray
*
output
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
};
SIFParam
param
=
{.
arg
=
*
metaArg
,
.
result
=
output
,
.
status
=
SFLT_NOT_INDEX
};
int32_t
code
=
sifCalculate
((
SNode
*
)
pFilterNode
,
&
param
);
if
(
code
!=
0
)
{
sifFreeParam
(
&
param
);
return
code
;
}
if
(
param
.
status
==
SFLT_NOT_INDEX
)
{
*
status
=
param
.
status
;
}
else
{
*
status
=
st
;
}
taosArrayAddAll
(
result
,
param
.
result
);
sifFreeParam
(
&
param
);
*
status
=
st
;
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录