Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e7e923a3
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看板
未验证
提交
e7e923a3
编写于
7月 11, 2023
作者:
D
dapan1121
提交者:
GitHub
7月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22017 from taosdata/enh/TD-25083-3.0
enh: exclude tk_log from timeseries check
上级
ffd3c50c
d5435926
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
127 addition
and
1 deletion
+127
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-0
source/dnode/vnode/src/meta/metaCache.c
source/dnode/vnode/src/meta/metaCache.c
+40
-0
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+83
-1
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
e7e923a3
...
...
@@ -78,6 +78,7 @@ ESyncRole vnodeGetRole(SVnode *pVnode);
int32_t
vnodeGetCtbIdList
(
void
*
pVnode
,
int64_t
suid
,
SArray
*
list
);
int32_t
vnodeGetCtbIdListByFilter
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
,
bool
(
*
filter
)(
void
*
arg
),
void
*
arg
);
int32_t
vnodeGetStbIdList
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
);
int32_t
vnodeGetStbIdListByFilter
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
,
bool
(
*
filter
)(
void
*
arg
,
void
*
arg1
),
void
*
arg
);
void
*
vnodeGetIdx
(
void
*
pVnode
);
void
*
vnodeGetIvtIdx
(
void
*
pVnode
);
...
...
@@ -126,6 +127,9 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name);
int32_t
metaGetCachedTbGroup
(
void
*
pVnode
,
tb_uid_t
suid
,
const
uint8_t
*
pKey
,
int32_t
keyLen
,
SArray
**
pList
);
int32_t
metaPutTbGroupToCache
(
void
*
pVnode
,
uint64_t
suid
,
const
void
*
pKey
,
int32_t
keyLen
,
void
*
pPayload
,
int32_t
payloadLen
);
bool
metaTbInFilterCache
(
void
*
pVnode
,
tb_uid_t
suid
,
int8_t
type
);
int32_t
metaPutTbToFilterCache
(
void
*
pVnode
,
tb_uid_t
suid
,
int8_t
type
);
int32_t
metaSizeOfTbFilterCache
(
void
*
pVnode
,
int8_t
type
);
int32_t
metaGetStbStats
(
void
*
pVnode
,
int64_t
uid
,
int64_t
*
numOfTables
);
...
...
source/dnode/vnode/src/meta/metaCache.c
浏览文件 @
e7e923a3
...
...
@@ -66,6 +66,10 @@ struct SMetaCache {
SHashObj
*
pTableEntry
;
SLRUCache
*
pResCache
;
}
STbGroupResCache
;
struct
STbFilterCache
{
SHashObj
*
pStb
;
}
STbFilterCache
;
};
static
void
entryCacheClose
(
SMeta
*
pMeta
)
{
...
...
@@ -168,6 +172,12 @@ int32_t metaCacheOpen(SMeta* pMeta) {
taosHashSetFreeFp
(
pCache
->
STbGroupResCache
.
pTableEntry
,
freeCacheEntryFp
);
taosThreadMutexInit
(
&
pCache
->
STbGroupResCache
.
lock
,
NULL
);
pCache
->
STbFilterCache
.
pStb
=
taosHashInit
(
0
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
if
(
pCache
->
STbFilterCache
.
pStb
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err2
;
}
pMeta
->
pCache
=
pCache
;
return
code
;
...
...
@@ -193,6 +203,8 @@ void metaCacheClose(SMeta* pMeta) {
taosThreadMutexDestroy
(
&
pMeta
->
pCache
->
STbGroupResCache
.
lock
);
taosHashCleanup
(
pMeta
->
pCache
->
STbGroupResCache
.
pTableEntry
);
taosHashCleanup
(
pMeta
->
pCache
->
STbFilterCache
.
pStb
);
taosMemoryFree
(
pMeta
->
pCache
);
pMeta
->
pCache
=
NULL
;
}
...
...
@@ -880,3 +892,31 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) {
metaDebug
(
"vgId:%d suid:%"
PRId64
" cached related tb group cleared"
,
vgId
,
suid
);
return
TSDB_CODE_SUCCESS
;
}
bool
metaTbInFilterCache
(
void
*
pVnode
,
tb_uid_t
suid
,
int8_t
type
)
{
SMeta
*
pMeta
=
((
SVnode
*
)
pVnode
)
->
pMeta
;
if
(
type
==
0
&&
taosHashGet
(
pMeta
->
pCache
->
STbFilterCache
.
pStb
,
&
suid
,
sizeof
(
suid
)))
{
return
true
;
}
return
false
;
}
int32_t
metaPutTbToFilterCache
(
void
*
pVnode
,
tb_uid_t
suid
,
int8_t
type
)
{
SMeta
*
pMeta
=
((
SVnode
*
)
pVnode
)
->
pMeta
;
if
(
type
==
0
)
{
return
taosHashPut
(
pMeta
->
pCache
->
STbFilterCache
.
pStb
,
&
suid
,
sizeof
(
suid
),
NULL
,
0
);
}
return
0
;
}
int32_t
metaSizeOfTbFilterCache
(
void
*
pVnode
,
int8_t
type
)
{
SMeta
*
pMeta
=
((
SVnode
*
)
pVnode
)
->
pMeta
;
if
(
type
==
0
)
{
return
taosHashGetSize
(
pMeta
->
pCache
->
STbFilterCache
.
pStb
);
}
return
0
;
}
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
e7e923a3
...
...
@@ -496,6 +496,30 @@ int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
vnodeGetStbIdListByFilter
(
SVnode
*
pVnode
,
int64_t
suid
,
SArray
*
list
,
bool
(
*
filter
)(
void
*
arg
,
void
*
arg1
),
void
*
arg
)
{
SMStbCursor
*
pCur
=
metaOpenStbCursor
(
pVnode
->
pMeta
,
suid
);
if
(
!
pCur
)
{
return
TSDB_CODE_FAILED
;
}
while
(
1
)
{
tb_uid_t
id
=
metaStbCursorNext
(
pCur
);
if
(
id
==
0
)
{
break
;
}
if
((
*
filter
)
&&
(
*
filter
)(
arg
,
&
id
))
{
continue
;
}
taosArrayPush
(
list
,
&
id
);
}
metaCloseStbCursor
(
pCur
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
vnodeGetCtbNum
(
SVnode
*
pVnode
,
int64_t
suid
,
int64_t
*
num
)
{
SMCtbCursor
*
pCur
=
metaOpenCtbCursor
(
pVnode
->
pMeta
,
suid
,
0
);
if
(
!
pCur
)
{
...
...
@@ -531,6 +555,58 @@ static int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) {
return
TSDB_CODE_SUCCESS
;
}
#ifdef TD_ENTERPRISE
#define TK_LOG_STB_NUM 19
static
const
char
*
tkLogStb
[
TK_LOG_STB_NUM
]
=
{
"cluster_info"
,
"data_dir"
,
"dnodes_info"
,
"d_info"
,
"grants_info"
,
"keeper_monitor"
,
"logs"
,
"log_dir"
,
"log_summary"
,
"m_info"
,
"taosadapter_restful_http_request_fail"
,
"taosadapter_restful_http_request_in_flight"
,
"taosadapter_restful_http_request_summary_milliseconds"
,
"taosadapter_restful_http_request_total"
,
"taosadapter_system_cpu_percent"
,
"taosadapter_system_mem_percent"
,
"temp_dir"
,
"vgroups_info"
,
"vnodes_role"
};
// exclude stbs of taoskeeper log
static
int32_t
vnodeGetTimeSeriesBlackList
(
SVnode
*
pVnode
)
{
char
*
dbName
=
strchr
(
pVnode
->
config
.
dbname
,
'.'
);
if
(
!
dbName
||
0
!=
strncmp
(
++
dbName
,
"log"
,
TSDB_DB_NAME_LEN
))
{
return
0
;
}
int32_t
tbSize
=
metaSizeOfTbFilterCache
(
pVnode
,
0
);
if
(
tbSize
<
TK_LOG_STB_NUM
)
{
for
(
int32_t
i
=
0
;
i
<
TK_LOG_STB_NUM
;
++
i
)
{
tb_uid_t
suid
=
metaGetTableEntryUidByName
(
pVnode
->
pMeta
,
tkLogStb
[
i
]);
if
(
suid
!=
0
)
{
metaPutTbToFilterCache
(
pVnode
,
suid
,
0
);
}
}
tbSize
=
metaSizeOfTbFilterCache
(
pVnode
,
0
);
}
return
tbSize
;
}
#endif
static
bool
vnodeTimeSeriesFilter
(
void
*
arg1
,
void
*
arg2
)
{
SVnode
*
pVnode
=
(
SVnode
*
)
arg1
;
if
(
metaTbInFilterCache
(
pVnode
,
*
(
tb_uid_t
*
)(
arg2
),
0
))
{
return
true
;
}
return
false
;
}
int32_t
vnodeGetTimeSeriesNum
(
SVnode
*
pVnode
,
int64_t
*
num
)
{
SArray
*
suidList
=
NULL
;
...
...
@@ -539,7 +615,13 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
return
TSDB_CODE_FAILED
;
}
if
(
vnodeGetStbIdList
(
pVnode
,
0
,
suidList
)
<
0
)
{
int32_t
tbFilterSize
=
0
;
#ifdef TD_ENTERPRISE
tbFilterSize
=
vnodeGetTimeSeriesBlackList
(
pVnode
);
#endif
if
((
!
tbFilterSize
&&
vnodeGetStbIdList
(
pVnode
,
0
,
suidList
)
<
0
)
||
(
tbFilterSize
&&
vnodeGetStbIdListByFilter
(
pVnode
,
0
,
suidList
,
vnodeTimeSeriesFilter
,
pVnode
)
<
0
))
{
qError
(
"vgId:%d, failed to get stb id list error: %s"
,
TD_VID
(
pVnode
),
terrstr
());
taosArrayDestroy
(
suidList
);
return
TSDB_CODE_FAILED
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录