disable logical plan manager

This commit is contained in:
zzg19950727
2023-02-24 13:47:02 +00:00
committed by ob-robot
parent bfc82bd433
commit 42328efa81
30 changed files with 174 additions and 4970 deletions

View File

@ -10,7 +10,7 @@
#include "sql/session/ob_sql_session_info.h"
#include "lib/thread/thread_mgr.h"
#include "common/object/ob_object.h"
#include "ob_plan_real_info_manager.h"
#include "ob_plan_info_manager.h"
#include "lib/ob_running_mode.h"
#include "util/easy_time.h"
#include "lib/rc/ob_rc.h"

View File

@ -3,8 +3,8 @@
// zhenling.zzg
// this file defines interface of plan real info manager
#ifndef SRC_OBSERVER_PLAN_REAL_INFO_MGR_H_
#define SRC_OBSERVER_PLAN_REAL_INFO_MGR_H_
#ifndef SRC_OBSERVER_PLAN_INFO_MGR_H_
#define SRC_OBSERVER_PLAN_INFO_MGR_H_
#include "lib/allocator/ob_concurrent_fifo_allocator.h"
#include "observer/mysql/ob_ra_queue.h"
#include "lib/task/ob_timer.h"
@ -238,4 +238,4 @@ private:
#endif /* SRC_OBSERVER_PLAN_REAL_INFO_MGR_H_ */
#endif /* SRC_OBSERVER_PLAN_INFO_MGR_H_ */

View File

@ -91,8 +91,8 @@ int ObSqlPlan::store_sql_plan(ObLogPlan* plan,
sql_id,
plan_text))) {
LOG_WARN("failed to set plan id", K(ret));
} else if (OB_FAIL(inner_store_sql_plan(sql_plan_infos, false))) {
LOG_WARN("failed to store sql plan", K(ret));
// } else if (OB_FAIL(inner_store_sql_plan(sql_plan_infos, false))) {
// LOG_WARN("failed to store sql plan", K(ret));
}
if (OB_FAIL(ret)) {
LOG_WARN("failed to store sql plan", K(ret));
@ -121,15 +121,12 @@ int ObSqlPlan::store_sql_plan_for_explain(ObLogPlan* plan,
LOG_WARN("failed to get sql plan infos", K(ret));
} else if (OB_FAIL(set_plan_id_for_explain(sql_plan_infos))) {
LOG_WARN("failed to set plan id", K(ret));
// } else if (OB_FAIL(inner_store_sql_plan(sql_plan_infos, true))) {
// LOG_WARN("failed to store sql plan", K(ret));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(inner_store_sql_plan(sql_plan_infos, true))) {
LOG_WARN("failed to store sql plan", K(ret));
}
if (OB_FAIL(ret)) {
LOG_WARN("failed to store sql plan", K(ret));
ret = OB_SUCCESS;
}
if (OB_FAIL(ret)) {
LOG_WARN("failed to store sql plan", K(ret));
ret = OB_SUCCESS;
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(format_sql_plan(sql_plan_infos,
@ -2054,7 +2051,7 @@ int ObSqlPlan::inner_format_plan_to_json(ObIArray<ObSqlPlanItem*> &sql_plan_info
int ObSqlPlan::init_buffer(PlanText &plan_text)
{
int ret = OB_SUCCESS;
plan_text.buf_len_ = ObLogValues::MAX_EXPLAIN_BUFFER_SIZE;
plan_text.buf_len_ = 1024 * 1024;
plan_text.buf_ = static_cast<char*>(allocator_.alloc(plan_text.buf_len_));
if (OB_ISNULL(plan_text.buf_)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
@ -2119,6 +2116,11 @@ int ObSqlPlan::plan_text_to_strings(PlanText &plan_text,
last_pos = i + 1;
}
}
if (OB_SUCC(ret) &&
plan_strs.empty() &&
OB_FAIL(plan_strs.push_back(""))) {
LOG_WARN("failed to push back plan text", K(ret));
}
return ret;
}

View File

@ -6,7 +6,7 @@
#ifndef SRC_OBSERVER_SQL_PLAN_H_
#define SRC_OBSERVER_SQL_PLAN_H_
#include "sql/ob_sql_define.h"
#include "ob_plan_real_info_manager.h"
#include "ob_plan_info_manager.h"
namespace oceanbase
{

View File

@ -68,15 +68,15 @@ int ObSqlPlanMgr::init(uint64_t tenant_id)
} else if (OB_FALSE_IT(plan_real_info_mgr_=new(buf)ObPlanRealInfoMgr(get_allocator()))) {
} else if (OB_FAIL(plan_real_info_mgr_->init(tenant_id, queue_size))) {
LOG_WARN("failed to init plan real info manager", K(ret));
} else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::ReqMemEvict,
tg_id_))) {
SERVER_LOG(WARN, "create failed", K(ret));
} else if (OB_FAIL(TG_START(tg_id_))) {
SERVER_LOG(WARN, "init timer fail", K(ret));
} else if (OB_FAIL(task_.init(this))) {
SERVER_LOG(WARN, "fail to init sql plan timer task", K(ret));
} else if (OB_FAIL(TG_SCHEDULE(tg_id_, task_, EVICT_INTERVAL, true))) {
SERVER_LOG(WARN, "start eliminate task failed", K(ret));
// } else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::ReqMemEvict,
// tg_id_))) {
// SERVER_LOG(WARN, "create failed", K(ret));
// } else if (OB_FAIL(TG_START(tg_id_))) {
// SERVER_LOG(WARN, "init timer fail", K(ret));
// } else if (OB_FAIL(task_.init(this))) {
// SERVER_LOG(WARN, "fail to init sql plan timer task", K(ret));
// } else if (OB_FAIL(TG_SCHEDULE(tg_id_, task_, EVICT_INTERVAL, true))) {
// SERVER_LOG(WARN, "start eliminate task failed", K(ret));
} else {
inited_ = true;
destroyed_ = false;
@ -145,25 +145,25 @@ int ObSqlPlanMgr::get_mem_limit(int64_t &mem_limit)
// default mem limit
mem_limit = static_cast<int64_t>(SQL_PLAN_MEM_FACTOR * tenant_mem_limit);
// get mem_percentage from session info
ObArenaAllocator alloc;
ObObj obj_val;
int64_t mem_pct = 0;
if (OB_FAIL(ObBasicSessionInfo::get_global_sys_variable(tenant_id_,
alloc,
ObDataTypeCastParams(),
ObString(share::OB_SV_SQL_PLAN_MEMORY_PERCENTAGE),
obj_val))) {
LOG_WARN("failed to get global sys variable", K(tenant_id_), K(ret));
} else if (OB_FAIL(obj_val.get_int(mem_pct))) {
LOG_WARN("failed to get int", K(ret), K(obj_val));
} else if (mem_pct < 0 || mem_pct > 100) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid value of sql plan mem percentage", K(ret), K(mem_pct));
} else {
mem_limit = static_cast<int64_t>(tenant_mem_limit * mem_pct / 100.0);
LOG_DEBUG("tenant sql plan memory limit", K_(tenant_id),
K(tenant_mem_limit), K(mem_pct), K(mem_limit));
}
// ObArenaAllocator alloc;
// ObObj obj_val;
// int64_t mem_pct = 0;
// if (OB_FAIL(ObBasicSessionInfo::get_global_sys_variable(tenant_id_,
// alloc,
// ObDataTypeCastParams(),
// ObString(share::OB_SV_SQL_PLAN_MEMORY_PERCENTAGE),
// obj_val))) {
// LOG_WARN("failed to get global sys variable", K(tenant_id_), K(ret));
// } else if (OB_FAIL(obj_val.get_int(mem_pct))) {
// LOG_WARN("failed to get int", K(ret), K(obj_val));
// } else if (mem_pct < 0 || mem_pct > 100) {
// ret = OB_INVALID_ARGUMENT;
// LOG_WARN("invalid value of sql plan mem percentage", K(ret), K(mem_pct));
// } else {
// mem_limit = static_cast<int64_t>(tenant_mem_limit * mem_pct / 100.0);
// LOG_DEBUG("tenant sql plan memory limit", K_(tenant_id),
// K(tenant_mem_limit), K(mem_pct), K(mem_limit));
// }
return ret;
}
@ -174,7 +174,9 @@ int ObSqlPlanMgr::init_plan_table_manager(ObPlanItemMgr* &plan_table_mgr)
plan_table_mgr = NULL;
int64_t evict_high_level = 0;
int64_t evict_low_level = 0;
if (OB_FAIL(task_.calc_evict_mem_level(evict_low_level, evict_high_level))) {
if (1 == 1) {
//do nothing
} else if (OB_FAIL(task_.calc_evict_mem_level(evict_low_level, evict_high_level))) {
LOG_WARN("fail to get sql plan evict memory level", K(ret));
} else if (evict_high_level <= allocator_.allocated()) {
//do nothing

View File

@ -7,7 +7,7 @@
#define SRC_OBSERVER_SQL_PLAN_MGR_H_
#include "lib/allocator/ob_concurrent_fifo_allocator.h"
#include "observer/mysql/ob_ra_queue.h"
#include "ob_plan_real_info_manager.h"
#include "ob_plan_info_manager.h"
#include "lib/lock/ob_spin_lock.h"
#include "lib/task/ob_timer.h"
namespace oceanbase
@ -42,8 +42,8 @@ public:
//进行一次release_old操作删除的记录数
static const int32_t BATCH_RELEASE_COUNT = 5000;
//初始化queue大小为100w
static const int64_t MAX_QUEUE_SIZE = 1000000; //100w
static const int64_t MINI_MODE_MAX_QUEUE_SIZE = 100000; // 10w
static const int64_t MAX_QUEUE_SIZE = 1; //100w
static const int64_t MINI_MODE_MAX_QUEUE_SIZE = 1; // 10w
//当sql_plan超过90w行记录时触发淘汰
static constexpr const double HIGH_LEVEL_EVICT_SIZE_PERCENT = 0.9;
//按行淘汰的低水位线