Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
daa17789
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
daa17789
编写于
7月 05, 2022
作者:
L
LINxiansheng
提交者:
wangzelin.wzl
7月 05, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix a bug about show query_response_time
上级
81ddf033
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
18 deletion
+18
-18
src/observer/mysql/ob_query_response_time.cpp
src/observer/mysql/ob_query_response_time.cpp
+14
-16
src/sql/resolver/cmd/ob_show_resolver.cpp
src/sql/resolver/cmd/ob_show_resolver.cpp
+4
-2
未找到文件。
src/observer/mysql/ob_query_response_time.cpp
浏览文件 @
daa17789
...
@@ -137,10 +137,10 @@ int ObRSTCollector::collect_query_response_time(uint64_t tenant_id, uint64_t tim
...
@@ -137,10 +137,10 @@ int ObRSTCollector::collect_query_response_time(uint64_t tenant_id, uint64_t tim
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
if
(
tenant_config
->
query_response_time_stats
){
if
(
tenant_config
->
query_response_time_stats
){
ObRSTTimeCollector
*
time_collector
;
ObRSTTimeCollector
*
time_collector
;
if
(
OB_FAIL
(
ret
=
collector_map_
.
get_refactored
(
tenant_id
,
time_collector
))){
if
(
OB_FAIL
(
collector_map_
.
get_refactored
(
tenant_id
,
time_collector
))){
SERVER_LOG
(
WARN
,
"time collector of the tenant does not exist"
,
K
(
tenant_id
),
K
(
time
),
K
(
ret
));
SERVER_LOG
(
WARN
,
"time collector of the tenant does not exist"
,
K
(
tenant_id
),
K
(
time
),
K
(
ret
));
}
else
{
}
else
{
if
(
OB_FAIL
(
ret
=
time_collector
->
collect
(
time
))){
if
(
OB_FAIL
(
time_collector
->
collect
(
time
))){
SERVER_LOG
(
WARN
,
"time collector of the tenant collect time failed"
,
K
(
tenant_id
),
K
(
time
),
K
(
ret
));
SERVER_LOG
(
WARN
,
"time collector of the tenant collect time failed"
,
K
(
tenant_id
),
K
(
time
),
K
(
ret
));
}
}
}
}
...
@@ -159,15 +159,15 @@ int ObRSTCollector::flush_query_response_time(uint64_t tenant_id,const ObString&
...
@@ -159,15 +159,15 @@ int ObRSTCollector::flush_query_response_time(uint64_t tenant_id,const ObString&
SERVER_LOG
(
WARN
,
"invalid bool str"
,
K
(
ret
),
K
(
is_enable
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"invalid bool str"
,
K
(
ret
),
K
(
is_enable
),
K
(
tenant_id
));
}
else
if
(
is_enable_value
)
{
}
else
if
(
is_enable_value
)
{
ObRSTTimeCollector
*
time_collector
;
ObRSTTimeCollector
*
time_collector
;
if
(
OB_FAIL
(
ret
=
collector_map_
.
get_refactored
(
tenant_id
,
time_collector
))){
if
(
!
tenant_config
->
query_response_time_stats
){
SERVER_LOG
(
WARN
,
"query_response_time_stats already turn off"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
collector_map_
.
get_refactored
(
tenant_id
,
time_collector
))){
SERVER_LOG
(
WARN
,
"time collector of the tenant does not exist"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"time collector of the tenant does not exist"
,
K
(
ret
),
K
(
tenant_id
));
}
else
{
}
else
if
(
OB_FAIL
(
time_collector
->
setup
(
tenant_config
->
query_response_time_range_base
))){
if
(
OB_FAIL
(
ret
=
time_collector
->
setup
(
tenant_config
->
query_response_time_range_base
))){
SERVER_LOG
(
WARN
,
"time collector of the tenant set range base failed"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"time collector of the tenant set range base failed"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
time_collector
->
flush
())){
}
else
if
(
OB_FAIL
(
ret
=
time_collector
->
flush
())){
SERVER_LOG
(
WARN
,
"time collector of the tenant flush failed"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"time collector of the tenant flush failed"
,
K
(
ret
),
K
(
tenant_id
));
}
}
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -177,7 +177,7 @@ int ObRSTCollector::enable_query_response_time(uint64_t tenant_id){
...
@@ -177,7 +177,7 @@ int ObRSTCollector::enable_query_response_time(uint64_t tenant_id){
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
if
(
tenant_config
->
query_response_time_stats
){
if
(
tenant_config
->
query_response_time_stats
){
SERVER_LOG
(
INFO
,
"query_response_time_stats already turn on"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
INFO
,
"query_response_time_stats already turn on"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
ret
=
collector_map_
.
set_refactored
(
tenant_id
,
new
ObRSTTimeCollector
())))
{
}
else
if
(
OB_FAIL
(
collector_map_
.
set_refactored
(
tenant_id
,
new
ObRSTTimeCollector
())))
{
if
(
OB_HASH_EXIST
==
ret
)
{
if
(
OB_HASH_EXIST
==
ret
)
{
ret
=
OB_ERR_ALREADY_EXISTS
;
ret
=
OB_ERR_ALREADY_EXISTS
;
}
}
...
@@ -188,9 +188,7 @@ int ObRSTCollector::enable_query_response_time(uint64_t tenant_id){
...
@@ -188,9 +188,7 @@ int ObRSTCollector::enable_query_response_time(uint64_t tenant_id){
int
ObRSTCollector
::
free_query_response_time
(
uint64_t
tenant_id
){
int
ObRSTCollector
::
free_query_response_time
(
uint64_t
tenant_id
){
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
omt
::
ObTenantConfigGuard
tenant_config
(
TENANT_CONF
(
tenant_id
));
if
(
!
tenant_config
->
query_response_time_stats
){
if
(
OB_FAIL
(
collector_map_
.
erase_refactored
(
tenant_id
)))
{
SERVER_LOG
(
INFO
,
"query_response_time_stats already turn off"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
OB_FAIL
(
collector_map_
.
erase_refactored
(
tenant_id
)))
{
SERVER_LOG
(
WARN
,
"erase the time collector failed"
,
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"erase the time collector failed"
,
K
(
tenant_id
));
}
}
return
ret
;
return
ret
;
...
@@ -202,10 +200,10 @@ int ObRSTCollector::control_query_response_time(uint64_t tenant_id, const ObStri
...
@@ -202,10 +200,10 @@ int ObRSTCollector::control_query_response_time(uint64_t tenant_id, const ObStri
bool
is_valid
=
false
;
bool
is_valid
=
false
;
is_enable_value
=
ObConfigBoolParser
::
get
(
is_enable
.
ptr
(),
is_valid
);
is_enable_value
=
ObConfigBoolParser
::
get
(
is_enable
.
ptr
(),
is_valid
);
if
(
is_enable_value
)
{
if
(
is_enable_value
)
{
if
(
OB_FAIL
(
ret
=
enable_query_response_time
(
tenant_id
))){
if
(
OB_FAIL
(
enable_query_response_time
(
tenant_id
))){
SERVER_LOG
(
WARN
,
"enable the query response time failed"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"enable the query response time failed"
,
K
(
ret
),
K
(
tenant_id
));
}
}
}
else
if
(
OB_FAIL
(
ret
=
free_query_response_time
(
tenant_id
))){
}
else
if
(
OB_FAIL
(
free_query_response_time
(
tenant_id
))){
SERVER_LOG
(
WARN
,
"free the query response time failed"
,
K
(
ret
),
K
(
tenant_id
));
SERVER_LOG
(
WARN
,
"free the query response time failed"
,
K
(
ret
),
K
(
tenant_id
));
}
}
return
ret
;
return
ret
;
...
...
src/sql/resolver/cmd/ob_show_resolver.cpp
浏览文件 @
daa17789
...
@@ -1113,7 +1113,8 @@ int ObShowResolver::resolve(const ParseNode& parse_tree)
...
@@ -1113,7 +1113,8 @@ int ObShowResolver::resolve(const ParseNode& parse_tree)
}
else
{
}
else
{
show_resv_ctx
.
stmt_type_
=
stmt
::
T_SHOW_QUERY_RESPONSE_TIME
;
show_resv_ctx
.
stmt_type_
=
stmt
::
T_SHOW_QUERY_RESPONSE_TIME
;
GEN_SQL_STEP_1
(
ObShowSqlSet
::
SHOW_QUERY_RESPONSE_TIME
);
GEN_SQL_STEP_1
(
ObShowSqlSet
::
SHOW_QUERY_RESPONSE_TIME
);
GEN_SQL_STEP_2
(
ObShowSqlSet
::
SHOW_QUERY_RESPONSE_TIME
,
OB_SYS_DATABASE_NAME
,
OB_ALL_VIRTUAL_QUERY_RESPONSE_TIME_TNAME
);
GEN_SQL_STEP_2
(
ObShowSqlSet
::
SHOW_QUERY_RESPONSE_TIME
,
OB_SYS_DATABASE_NAME
,
OB_ALL_VIRTUAL_QUERY_RESPONSE_TIME_TNAME
,
real_tenant_id
);
}
}
break
;
break
;
}
}
...
@@ -2081,7 +2082,8 @@ DEFINE_SHOW_CLAUSE_SET(SHOW_ENGINES, NULL, "SELECT * FROM %s.%s ", NULL, NULL);
...
@@ -2081,7 +2082,8 @@ DEFINE_SHOW_CLAUSE_SET(SHOW_ENGINES, NULL, "SELECT * FROM %s.%s ", NULL, NULL);
DEFINE_SHOW_CLAUSE_SET
(
SHOW_PRIVILEGES
,
NULL
,
"SELECT * FROM %s.%s "
,
"SELECT * FROM %s.%s "
,
NULL
);
DEFINE_SHOW_CLAUSE_SET
(
SHOW_PRIVILEGES
,
NULL
,
"SELECT * FROM %s.%s "
,
"SELECT * FROM %s.%s "
,
NULL
);
DEFINE_SHOW_CLAUSE_SET
(
SHOW_QUERY_RESPONSE_TIME
,
NULL
,
"SELECT * FROM %s.%s "
,
NULL
,
NULL
);
DEFINE_SHOW_CLAUSE_SET
(
SHOW_QUERY_RESPONSE_TIME
,
NULL
,
"SELECT response_time as RESPONSE_TIME, count as COUNT, total as TOTAL FROM %s.%s where tenant_id = %lu"
,
NULL
,
NULL
);
DEFINE_SHOW_CLAUSE_SET
(
SHOW_COLLATION
,
NULL
,
DEFINE_SHOW_CLAUSE_SET
(
SHOW_COLLATION
,
NULL
,
"SELECT collation AS `Collation`, charset AS `Charset`, id AS `Id`, is_default AS `Default`, is_compiled AS "
"SELECT collation AS `Collation`, charset AS `Charset`, id AS `Id`, is_default AS `Default`, is_compiled AS "
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录