Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a036d64a
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看板
提交
a036d64a
编写于
8月 17, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avoid filter invalid table
上级
4f16771d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
72 addition
and
69 deletion
+72
-69
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+72
-69
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
a036d64a
...
@@ -53,79 +53,79 @@ _err:
...
@@ -53,79 +53,79 @@ _err:
return
-
1
;
return
-
1
;
}
}
//int metaGetTableEntryByUidTest(void* meta, SArray *uidList) {
//
int metaGetTableEntryByUidTest(void* meta, SArray *uidList) {
//
//
// SArray* readerList = taosArrayInit(taosArrayGetSize(uidList), sizeof(SMetaReader));
//
SArray* readerList = taosArrayInit(taosArrayGetSize(uidList), sizeof(SMetaReader));
// SArray* uidVersion = taosArrayInit(taosArrayGetSize(uidList), sizeof(STbDbKey));
//
SArray* uidVersion = taosArrayInit(taosArrayGetSize(uidList), sizeof(STbDbKey));
// SMeta *pMeta = meta;
//
SMeta *pMeta = meta;
// int64_t version;
//
int64_t version;
// SHashObj *uHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
//
SHashObj *uHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
//
//
// int64_t stt1 = taosGetTimestampUs();
//
int64_t stt1 = taosGetTimestampUs();
// for(int i = 0; i < taosArrayGetSize(uidList); i++) {
//
for(int i = 0; i < taosArrayGetSize(uidList); i++) {
// void* ppVal = NULL;
//
void* ppVal = NULL;
// int vlen = 0;
//
int vlen = 0;
// uint64_t * uid = taosArrayGet(uidList, i);
//
uint64_t * uid = taosArrayGet(uidList, i);
// // query uid.idx
//
// query uid.idx
// if (tdbTbGet(pMeta->pUidIdx, uid, sizeof(*uid), &ppVal, &vlen) < 0) {
//
if (tdbTbGet(pMeta->pUidIdx, uid, sizeof(*uid), &ppVal, &vlen) < 0) {
// continue;
//
continue;
// }
//
}
// version = *(int64_t *)ppVal;
//
version = *(int64_t *)ppVal;
//
//
// STbDbKey tbDbKey = {.version = version, .uid = *uid};
//
STbDbKey tbDbKey = {.version = version, .uid = *uid};
// taosArrayPush(uidVersion, &tbDbKey);
//
taosArrayPush(uidVersion, &tbDbKey);
// taosHashPut(uHash, uid, sizeof(int64_t), ppVal, sizeof(int64_t));
//
taosHashPut(uHash, uid, sizeof(int64_t), ppVal, sizeof(int64_t));
// }
//
}
// int64_t stt2 = taosGetTimestampUs();
//
int64_t stt2 = taosGetTimestampUs();
// qDebug("metaGetTableEntryByUidTest1 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt2-stt1);
//
qDebug("metaGetTableEntryByUidTest1 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt2-stt1);
//
//
// TBC *pCur = NULL;
//
TBC *pCur = NULL;
// tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
//
tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
// tdbTbcMoveToFirst(pCur);
//
tdbTbcMoveToFirst(pCur);
// void *pKey = NULL;
//
void *pKey = NULL;
// int kLen = 0;
//
int kLen = 0;
//
//
// while(1){
//
while(1){
// SMetaReader pReader = {0};
//
SMetaReader pReader = {0};
// int32_t ret = tdbTbcNext(pCur, &pKey, &kLen, &pReader.pBuf, &pReader.szBuf);
//
int32_t ret = tdbTbcNext(pCur, &pKey, &kLen, &pReader.pBuf, &pReader.szBuf);
// if (ret < 0) break;
//
if (ret < 0) break;
// STbDbKey *tmp = (STbDbKey*)pKey;
//
STbDbKey *tmp = (STbDbKey*)pKey;
// int64_t *ver = (int64_t*)taosHashGet(uHash, &tmp->uid, sizeof(int64_t));
//
int64_t *ver = (int64_t*)taosHashGet(uHash, &tmp->uid, sizeof(int64_t));
// if(ver == NULL || *ver != tmp->version) continue;
//
if(ver == NULL || *ver != tmp->version) continue;
// taosArrayPush(readerList, &pReader);
//
taosArrayPush(readerList, &pReader);
// }
//
}
// tdbTbcClose(pCur);
//
tdbTbcClose(pCur);
//
//
// taosArrayClear(readerList);
//
taosArrayClear(readerList);
// int64_t stt3 = taosGetTimestampUs();
//
int64_t stt3 = taosGetTimestampUs();
// qDebug("metaGetTableEntryByUidTest2 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt3-stt2);
//
qDebug("metaGetTableEntryByUidTest2 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt3-stt2);
// for(int i = 0; i < taosArrayGetSize(uidVersion); i++) {
//
for(int i = 0; i < taosArrayGetSize(uidVersion); i++) {
// SMetaReader pReader = {0};
//
SMetaReader pReader = {0};
//
//
// STbDbKey *tbDbKey = taosArrayGet(uidVersion, i);
//
STbDbKey *tbDbKey = taosArrayGet(uidVersion, i);
// // query table.db
//
// query table.db
// if (tdbTbGet(pMeta->pTbDb, tbDbKey, sizeof(STbDbKey), &pReader.pBuf, &pReader.szBuf) < 0) {
//
if (tdbTbGet(pMeta->pTbDb, tbDbKey, sizeof(STbDbKey), &pReader.pBuf, &pReader.szBuf) < 0) {
// continue;
//
continue;
// }
//
}
// taosArrayPush(readerList, &pReader);
//
taosArrayPush(readerList, &pReader);
// }
//
}
// int64_t stt4 = taosGetTimestampUs();
//
int64_t stt4 = taosGetTimestampUs();
// qDebug("metaGetTableEntryByUidTest3 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt4-stt3);
//
qDebug("metaGetTableEntryByUidTest3 rows:%d, cost:%ld us", taosArrayGetSize(uidList), stt4-stt3);
//
//
// for(int i = 0; i < taosArrayGetSize(readerList); i++){
//
for(int i = 0; i < taosArrayGetSize(readerList); i++){
// SMetaReader* pReader = taosArrayGet(readerList, i);
//
SMetaReader* pReader = taosArrayGet(readerList, i);
// metaReaderInit(pReader, meta, 0);
//
metaReaderInit(pReader, meta, 0);
// // decode the entry
//
// decode the entry
// tDecoderInit(&pReader->coder, pReader->pBuf, pReader->szBuf);
//
tDecoderInit(&pReader->coder, pReader->pBuf, pReader->szBuf);
//
//
// if (metaDecodeEntry(&pReader->coder, &pReader->me) < 0) {
//
if (metaDecodeEntry(&pReader->coder, &pReader->me) < 0) {
// }
//
}
// metaReaderClear(pReader);
//
metaReaderClear(pReader);
// }
//
}
// int64_t stt5 = taosGetTimestampUs();
//
int64_t stt5 = taosGetTimestampUs();
// qDebug("metaGetTableEntryByUidTest4 rows:%d, cost:%ld us", taosArrayGetSize(readerList), stt5-stt4);
//
qDebug("metaGetTableEntryByUidTest4 rows:%d, cost:%ld us", taosArrayGetSize(readerList), stt5-stt4);
// return 0;
//
return 0;
//}
//
}
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
...
@@ -824,7 +824,7 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
...
@@ -824,7 +824,7 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
#endif
#endif
const
void
*
metaGetTableTagVal
(
void
*
pTag
,
int16_t
type
,
STagVal
*
val
)
{
const
void
*
metaGetTableTagVal
(
void
*
pTag
,
int16_t
type
,
STagVal
*
val
)
{
STag
*
tag
=
(
STag
*
)
pTag
;
STag
*
tag
=
(
STag
*
)
pTag
;
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
return
tag
;
return
tag
;
}
}
...
@@ -926,6 +926,9 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
...
@@ -926,6 +926,9 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
break
;
break
;
}
}
}
}
if
(
p
->
suid
!=
pKey
->
suid
)
{
break
;
}
first
=
false
;
first
=
false
;
if
(
p
!=
NULL
)
{
if
(
p
!=
NULL
)
{
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
...
@@ -966,10 +969,10 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj
...
@@ -966,10 +969,10 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
suid
);
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pMeta
,
suid
);
SHashObj
*
uHash
=
NULL
;
SHashObj
*
uHash
=
NULL
;
size_t
len
=
taosArrayGetSize
(
uidList
);
// len > 0 means there already have uids
size_t
len
=
taosArrayGetSize
(
uidList
);
// len > 0 means there already have uids
if
(
len
>
0
)
{
if
(
len
>
0
)
{
uHash
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
uHash
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
int64_t
*
uid
=
taosArrayGet
(
uidList
,
i
);
taosHashPut
(
uHash
,
uid
,
sizeof
(
int64_t
),
&
i
,
sizeof
(
i
));
taosHashPut
(
uHash
,
uid
,
sizeof
(
int64_t
),
&
i
,
sizeof
(
i
));
}
}
...
@@ -982,7 +985,7 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj
...
@@ -982,7 +985,7 @@ int32_t metaGetTableTags(SMeta *pMeta, uint64_t suid, SArray *uidList, SHashObj
if
(
len
>
0
&&
taosHashGet
(
uHash
,
&
id
,
sizeof
(
int64_t
))
==
NULL
)
{
if
(
len
>
0
&&
taosHashGet
(
uHash
,
&
id
,
sizeof
(
int64_t
))
==
NULL
)
{
continue
;
continue
;
}
else
if
(
len
==
0
)
{
}
else
if
(
len
==
0
)
{
taosArrayPush
(
uidList
,
&
id
);
taosArrayPush
(
uidList
,
&
id
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录