[CP] fix ps diag view bug: return -4002 error code
This commit is contained in:
@ -149,6 +149,7 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
const ObPhysicalPlan *plan = NULL;
|
||||
const pl::ObPLFunction *pl_func = NULL;
|
||||
const pl::ObPLPackage *pl_pkg = NULL;
|
||||
bool cache_stat_updated = false;
|
||||
if (OB_ISNULL(cache_obj) || OB_ISNULL(allocator_)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
SERVER_LOG(WARN, "invalid argument", K(cache_obj), K(ret));
|
||||
@ -156,6 +157,8 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
if (OB_ISNULL(plan = dynamic_cast<const ObPhysicalPlan *>(cache_obj))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "unexpected null plan", K(ret), K(plan));
|
||||
} else {
|
||||
cache_stat_updated = plan->stat_.is_updated();
|
||||
}
|
||||
} else if (cache_obj->is_pkg()) { // pl package
|
||||
if (OB_ISNULL(pl_pkg = dynamic_cast<const pl::ObPLPackage *>(cache_obj))) {
|
||||
@ -166,6 +169,8 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
if (OB_ISNULL(pl_func = dynamic_cast<const pl::ObPLFunction *>(cache_obj))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "unexpected null pl function", K(ret));
|
||||
} else {
|
||||
cache_stat_updated = pl_func->get_stat().is_updated();
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -205,6 +210,7 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
}
|
||||
//sql_id
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SQL_ID: {
|
||||
if (cache_stat_updated) {
|
||||
ObString sql_id;
|
||||
if (OB_NOT_NULL(pl_func)) {
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
@ -227,6 +233,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
cells[i].set_collation_type(ObCharset::get_default_collation(
|
||||
ObCharset::get_default_charset()));
|
||||
}
|
||||
} else {
|
||||
cells[i].set_null();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::TYPE: {
|
||||
@ -238,7 +247,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::IS_BIND_SENSITIVE: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.is_bind_sensitive_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -246,7 +257,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::IS_BIND_AWARE: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.is_bind_aware_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -254,7 +267,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::DB_ID: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(plan->stat_.db_id_);
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -265,7 +280,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
ObString statement;
|
||||
ObString src_stmt;
|
||||
ObCollationType tmp_sql_cs_type;
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
if (plan->need_param()) {
|
||||
src_stmt = plan->stat_.stmt_;
|
||||
} else {
|
||||
@ -304,7 +321,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::QUERY_SQL: {
|
||||
if (cache_obj->is_sql_crsr() || cache_obj->is_anon()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr() || cache_obj->is_anon()) {
|
||||
ObString tmp_sql;
|
||||
ObCollationType tmp_sql_cs_type;
|
||||
if (cache_obj->is_anon()) {
|
||||
@ -337,7 +356,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SPECIAL_PARAMS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString sp_info_str;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.sp_info_str_,
|
||||
@ -354,7 +375,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::PARAM_INFOS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString param_info_lob_str;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.param_infos_,
|
||||
@ -372,7 +395,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SYS_VARS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString sys_vars_str;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.sys_vars_str_,
|
||||
@ -389,7 +414,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::CONFIGS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString config_str;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.config_str_,
|
||||
@ -406,7 +433,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::PLAN_HASH: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(plan->stat_.plan_hash_value_);
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -415,7 +444,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::FIRST_LOAD_TIME: {
|
||||
int64_t gen_time = 0;
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
gen_time = plan->stat_.gen_time_;
|
||||
} else if (NULL != pl_func) {
|
||||
gen_time = pl_func->get_stat().gen_time_;
|
||||
@ -424,7 +455,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SCHEMA_VERSION: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.schema_version_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -433,7 +466,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::LAST_ACTIVE_TIME: {
|
||||
int64_t last_active_time = 0;
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
last_active_time = plan->stat_.last_active_time_;
|
||||
} else if (NULL != pl_func) {
|
||||
last_active_time = pl_func->get_stat().last_active_time_;
|
||||
@ -442,7 +477,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::AVG_EXE_USEC: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
if (plan->stat_.execute_times_ != 0) {
|
||||
cells[i].set_int(plan->stat_.elapsed_time_ / plan->stat_.execute_times_);
|
||||
} else {
|
||||
@ -454,7 +491,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SLOWEST_EXE_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_timestamp(plan->stat_.slowest_exec_time_);
|
||||
} else {
|
||||
cells[i].set_timestamp(0);
|
||||
@ -462,7 +501,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SLOWEST_EXE_USEC: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.slowest_exec_usec_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -470,7 +511,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SLOW_COUNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.slow_count_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -479,7 +522,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::HIT_COUNT: {
|
||||
int64_t hit_count = 0;
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
hit_count = plan->stat_.hit_count_;
|
||||
} else if (NULL != pl_func) {
|
||||
hit_count = pl_func->get_stat().hit_count_;
|
||||
@ -489,7 +534,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::PLAN_SIZE: {
|
||||
int64_t mem_used = 0;
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
mem_used = plan->stat_.mem_used_;
|
||||
} else {
|
||||
mem_used = cache_obj->get_mem_size();
|
||||
@ -498,7 +545,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::EXECUTIONS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.execute_times_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -506,7 +555,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::DISK_READS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.disk_reads_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -514,7 +565,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::DIRECT_WRITES: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.direct_writes_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -522,7 +575,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::BUFFER_GETS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.buffer_gets_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -530,7 +585,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::APPLICATION_WAIT_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(static_cast<uint64_t>(plan->stat_.application_wait_time_));
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -538,7 +595,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::CONCURRENCY_WAIT_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(static_cast<uint64_t>(plan->stat_.concurrency_wait_time_));
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -546,7 +605,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::USER_IO_WAIT_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(static_cast<uint64_t>(plan->stat_.user_io_wait_time_));
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -554,7 +615,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ROWS_PROCESSED: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.rows_processed_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -562,7 +625,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ELAPSED_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(static_cast<uint64_t>(plan->stat_.elapsed_time_));
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -570,7 +635,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::CPU_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(static_cast<uint64_t>(plan->stat_.cpu_time_));
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -578,7 +645,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::LARGE_QUERYS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.large_querys_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -586,7 +655,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::DELAYED_LARGE_QUERYS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.delayed_large_querys_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -594,7 +665,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::OUTLINE_VERSION: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.outline_version_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -602,7 +675,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::OUTLINE_ID: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.outline_id_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -610,7 +685,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::HINTS_INFO: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString hints_info;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.hints_info_,
|
||||
@ -628,7 +705,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::OUTLINE_DATA: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString outline_data;
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
plan->stat_.outline_data_,
|
||||
@ -646,7 +725,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ACS_SEL_INFO: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString acs_info;
|
||||
stmt.assign_ptr(plan->stat_.plan_sel_info_str_, plan->stat_.plan_sel_info_str_len_);
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
@ -681,7 +762,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::HINTS_ALL_WORKED: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_bool(plan->stat_.hints_all_worked_);
|
||||
} else {
|
||||
cells[i].set_bool(false);
|
||||
@ -689,7 +772,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::EVO_EXECUTIONS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.evolution_stat_.executions_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -697,7 +782,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::EVO_CPU_TIME: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(plan->stat_.evolution_stat_.cpu_time_);
|
||||
} else {
|
||||
cells[i].set_uint64(0);
|
||||
@ -705,7 +792,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::TIMEOUT_COUNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.timeout_count_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -713,7 +802,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::PS_STMT_ID: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.ps_stmt_id_);
|
||||
} else if (cache_obj->is_anon()) {
|
||||
cells[i].set_int(pl_func->get_stat().pl_schema_id_);
|
||||
@ -723,7 +814,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::DELAYED_PX_QUERYS: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.delayed_px_querys_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -731,7 +824,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::SESSID: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_uint64(plan->stat_.sessid_);
|
||||
} else {
|
||||
cells[i].set_uint64(OB_INVALID_ID);
|
||||
@ -739,7 +834,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::TEMP_TABLES: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
ObString tmp_tbls;
|
||||
stmt.assign_ptr(plan->stat_.plan_tmp_tbl_name_str_, plan->stat_.plan_tmp_tbl_name_str_len_);
|
||||
if (OB_FAIL(ob_write_string(*allocator_,
|
||||
@ -757,7 +854,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::IS_USE_JIT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_bool(plan->stat_.is_use_jit_);
|
||||
} else {
|
||||
cells[i].set_bool(false);
|
||||
@ -777,7 +876,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ENABLE_BF_CACHE: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_bool(plan->stat_.enable_bf_cache_);
|
||||
} else {
|
||||
cells[i].set_bool(false);
|
||||
@ -785,7 +886,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::BF_FILTER_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.bf_filter_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -793,7 +896,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::BF_ACCESS_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.bf_access_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -801,7 +906,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ENABLE_ROW_CACHE: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_bool(plan->stat_.enable_fuse_row_cache_);
|
||||
} else {
|
||||
cells[i].set_bool(false);
|
||||
@ -809,7 +916,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ROW_CACHE_HIT_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.row_cache_hit_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -817,7 +926,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ROW_CACHE_MISS_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.row_cache_miss_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -825,7 +936,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::ENABLE_FUSE_ROW_CACHE: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_bool(plan->stat_.enable_fuse_row_cache_);
|
||||
} else {
|
||||
cells[i].set_bool(false);
|
||||
@ -833,7 +946,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::FUSE_ROW_CACHE_HIT_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.fuse_row_cache_hit_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
@ -841,7 +956,9 @@ int ObGVSql::fill_cells(const ObILibCacheObject *cache_obj, const ObPlanCache &p
|
||||
break;
|
||||
}
|
||||
case share::ALL_VIRTUAL_PLAN_STAT_CDE::FUSE_ROW_CACHE_MISS_CNT: {
|
||||
if (cache_obj->is_sql_crsr()) {
|
||||
if (!cache_stat_updated) {
|
||||
cells[i].set_null();
|
||||
} else if (cache_obj->is_sql_crsr()) {
|
||||
cells[i].set_int(plan->stat_.fuse_row_cache_miss_cnt_);
|
||||
} else {
|
||||
cells[i].set_int(0);
|
||||
|
||||
@ -92,6 +92,11 @@ struct PLCacheObjStat
|
||||
sql_id_[0] = '\0';
|
||||
}
|
||||
|
||||
inline bool is_updated() const
|
||||
{
|
||||
return last_active_time_ != 0;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
sql_id_[0] = '\0';
|
||||
|
||||
@ -859,6 +859,11 @@ struct ObPlanStat
|
||||
}
|
||||
}
|
||||
|
||||
inline bool is_updated() const
|
||||
{
|
||||
return last_active_time_ != 0;
|
||||
}
|
||||
|
||||
/* XXX: support printing maxium 30 class members.
|
||||
* if you want to print more members, remove some first
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user