Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
96feaaad
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
96feaaad
编写于
1月 12, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): add the check of item when putting in cache.
上级
effcfc05
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
2 deletion
+36
-2
source/dnode/vnode/src/meta/metaCache.c
source/dnode/vnode/src/meta/metaCache.c
+36
-2
未找到文件。
source/dnode/vnode/src/meta/metaCache.c
浏览文件 @
96feaaad
...
@@ -431,7 +431,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
...
@@ -431,7 +431,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
SHashObj
*
pTableMap
=
pMeta
->
pCache
->
sTagFilterResCache
.
pTableEntry
;
SHashObj
*
pTableMap
=
pMeta
->
pCache
->
sTagFilterResCache
.
pTableEntry
;
TdThreadMutex
*
pLock
=
&
pMeta
->
pCache
->
sTagFilterResCache
.
lock
;
TdThreadMutex
*
pLock
=
&
pMeta
->
pCache
->
sTagFilterResCache
.
lock
;
uint64_t
buf
[
3
]
=
{
0
}
;
uint64_t
buf
[
3
];
uint32_t
times
=
0
;
uint32_t
times
=
0
;
*
acquireRes
=
0
;
*
acquireRes
=
0
;
...
@@ -465,7 +465,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
...
@@ -465,7 +465,7 @@ int32_t metaGetCachedTableUidList(SMeta* pMeta, tb_uid_t suid, const uint8_t* pK
taosThreadMutexUnlock
(
pLock
);
taosThreadMutexUnlock
(
pLock
);
// check if scanning all items are necessary or not
// check if scanning all items are necessary or not
if
(
times
>=
5000
&&
TD_DLIST_NELES
(
&
(
*
pEntry
)
->
list
)
>
10
)
{
if
(
times
>=
5000
&&
TD_DLIST_NELES
(
&
(
*
pEntry
)
->
list
)
>
10
0
)
{
taosThreadMutexLock
(
pLock
);
taosThreadMutexLock
(
pLock
);
SArray
*
pInvalidRes
=
taosArrayInit
(
64
,
POINTER_BYTES
);
SArray
*
pInvalidRes
=
taosArrayInit
(
64
,
POINTER_BYTES
);
...
@@ -549,6 +549,8 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
...
@@ -549,6 +549,8 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
tdListAppend
(
&
p
->
list
,
pKey
);
tdListAppend
(
&
p
->
list
,
pKey
);
}
else
{
}
else
{
// check if it exists or not
// check if it exists or not
int32_t
times
=
atomic_add_fetch_32
(
&
(
*
pEntry
)
->
qTimes
,
1
);
size_t
size
=
listNEles
(
&
(
*
pEntry
)
->
list
);
size_t
size
=
listNEles
(
&
(
*
pEntry
)
->
list
);
if
(
size
==
0
)
{
if
(
size
==
0
)
{
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
...
@@ -562,6 +564,17 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
...
@@ -562,6 +564,17 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
}
}
}
else
{
// more than one element
}
else
{
// more than one element
bool
checkCacheEntry
=
false
;
SArray
*
pInvalidRes
=
NULL
;
uint64_t
keyBuf
[
3
];
if
(
size
>=
100
||
times
>
5000
)
{
// if the threshold value is reached, need to check the value.
checkCacheEntry
=
true
;
keyBuf
[
0
]
=
suid
;
pInvalidRes
=
taosArrayInit
(
64
,
POINTER_BYTES
);
}
SListIter
iter
=
{
0
};
SListIter
iter
=
{
0
};
tdListInitIter
(
&
(
*
pEntry
)
->
list
,
&
iter
,
TD_LIST_FORWARD
);
tdListInitIter
(
&
(
*
pEntry
)
->
list
,
&
iter
,
TD_LIST_FORWARD
);
...
@@ -574,6 +587,27 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
...
@@ -574,6 +587,27 @@ int32_t metaUidFilterCachePut(SMeta* pMeta, uint64_t suid, const void* pKey, int
taosThreadMutexUnlock
(
pLock
);
taosThreadMutexUnlock
(
pLock
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
// check whether it is existed in LRU cache, and remove it from linked list if not.
if
(
checkCacheEntry
)
{
keyBuf
[
1
]
=
p
[
1
];
keyBuf
[
2
]
=
p
[
2
];
LRUHandle
*
pRes
=
taosLRUCacheLookup
(
pCache
,
keyBuf
,
24
);
if
(
pRes
==
NULL
)
{
// remove the item in the linked list
taosArrayPush
(
pInvalidRes
,
&
pNode
);
}
else
{
taosLRUCacheRelease
(
pCache
,
pRes
,
false
);
}
}
}
// do remove invalid entry in hash
size_t
s
=
taosArrayGetSize
(
pInvalidRes
);
for
(
int32_t
i
=
0
;
i
<
s
;
++
i
)
{
SListNode
**
p1
=
taosArrayGet
(
pInvalidRes
,
i
);
tdListPopNode
(
&
(
*
pEntry
)
->
list
,
*
p1
);
taosMemoryFree
(
*
p1
);
}
}
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
tdListAppend
(
&
(
*
pEntry
)
->
list
,
pKey
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录