Add virtual table Query_Response_Time
This commit is contained in:
committed by
wangzelin.wzl
parent
e99cf210e6
commit
10041293f1
@ -37,12 +37,14 @@
|
||||
#include "sql/resolver/cmd/ob_variable_set_stmt.h"
|
||||
#include "observer/ob_server.h"
|
||||
#include "rootserver/ob_rs_event_history_table_operator.h"
|
||||
#include "observer/mysql/ob_query_response_time.h"
|
||||
|
||||
namespace oceanbase {
|
||||
using namespace common;
|
||||
using namespace obrpc;
|
||||
using namespace share;
|
||||
using namespace share::schema;
|
||||
using namespace observer;
|
||||
namespace sql {
|
||||
typedef ObAlterSystemResolverUtil Util;
|
||||
|
||||
@ -2443,6 +2445,14 @@ int ObSetConfigResolver::resolve(const ParseNode& parse_tree)
|
||||
if (OB_FAIL(check_auto_update_reserved_backup_timestamp(item.value_.str()))) {
|
||||
LOG_WARN("cannot set enable log archive true", K(ret));
|
||||
}
|
||||
} else if (0 == STRCMP(item.name_.ptr(), QUERY_RESPPONSE_TIME_FLUSH)) {
|
||||
if(OB_FAIL(observer::ObRSTCollector::get_instance().flush_query_response_time(item.exec_tenant_id_, item.value_.str()))){
|
||||
LOG_WARN("set query response time flush", K(ret));
|
||||
}
|
||||
} else if (0 == STRCMP(item.name_.ptr(), QUERY_RESPPONSE_TIME_STATS)) {
|
||||
if(OB_FAIL(observer::ObRSTCollector::get_instance().control_query_response_time(item.exec_tenant_id_, item.value_.str()))){
|
||||
LOG_WARN("set query response time stats", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ int ObShowResolver::resolve(const ParseNode& parse_tree)
|
||||
if (OB_UNLIKELY(NULL == session_info_ || NULL == params_.allocator_ || NULL == schema_checker_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("data member is not init", K(ret), K(session_info_), K(params_.allocator_), K(schema_checker_));
|
||||
} else if (OB_UNLIKELY(parse_tree.type_ < T_SHOW_TABLES || parse_tree.type_ > T_SHOW_GRANTS) &&
|
||||
} else if (OB_UNLIKELY(parse_tree.type_ < T_SHOW_TABLES || parse_tree.type_ > T_SHOW_QUERY_RESPONSE_TIME) &&
|
||||
(parse_tree.type_ != T_SHOW_TRIGGERS)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected parse tree type", K(ret), K(parse_tree.type_));
|
||||
@ -1103,6 +1103,20 @@ int ObShowResolver::resolve(const ParseNode& parse_tree)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case T_SHOW_QUERY_RESPONSE_TIME: {
|
||||
if (is_oracle_mode) {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
LOG_WARN("not support show engines in oracle mode", K(ret));
|
||||
} else if (OB_UNLIKELY(parse_tree.num_child_ != 0)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("parse tree is wrong", K(ret), K(parse_tree.num_child_));
|
||||
} else {
|
||||
show_resv_ctx.stmt_type_ = stmt::T_SHOW_QUERY_RESPONSE_TIME;
|
||||
GEN_SQL_STEP_1(ObShowSqlSet::SHOW_QUERY_RESPONSE_TIME);
|
||||
GEN_SQL_STEP_2(ObShowSqlSet::SHOW_QUERY_RESPONSE_TIME, OB_INFORMATION_SCHEMA_NAME, OB_QUERY_RESPONSE_TIME_TNAME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case T_SHOW_RECYCLEBIN: {
|
||||
if (OB_UNLIKELY(parse_tree.num_child_ != 0)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -2067,6 +2081,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_QUERY_RESPONSE_TIME, NULL, "SELECT * FROM %s.%s ", NULL, 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 "
|
||||
"`Compiled`, sortlen AS `Sortlen` FROM %s.%s ",
|
||||
|
||||
@ -74,6 +74,7 @@ struct ObShowResolver::ObShowSqlSet {
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_ENGINES);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_PRIVILEGES);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_GRANTS);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_QUERY_RESPONSE_TIME);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_PROCESSLIST);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_FULL_PROCESSLIST);
|
||||
DECLARE_SHOW_CLAUSE_SET(SHOW_SYS_PROCESSLIST);
|
||||
|
||||
Reference in New Issue
Block a user