Remove is_valid in ps cache and plan cache.
This commit is contained in:
parent
9b8edfcf0c
commit
59df2a1a27
@ -380,8 +380,6 @@ int ObAllPlanCacheStat::get_row_from_tenants()
|
||||
ObPlanCache *plan_cache = pcm_->get_plan_cache(tenant_id);
|
||||
if (OB_UNLIKELY(NULL == plan_cache)) {
|
||||
SERVER_LOG(WARN, "invalid plan cache", K(ret), K(tenant_id));
|
||||
} else if (!plan_cache->is_valid()) {
|
||||
// do nothing
|
||||
} else {
|
||||
if (OB_FAIL(fill_cells(*plan_cache))) {
|
||||
SERVER_LOG(WARN, "fail to fill cells", K(ret), K(cur_row_));
|
||||
|
@ -198,10 +198,9 @@ int ObAllVirtualPsItemInfo::get_next_row_from_specified_tenant(uint64_t tenant_i
|
||||
} else if (NULL == (ps_cache_ = pcm_->get_ps_cache(tenant_id))) {
|
||||
is_end = true;
|
||||
SERVER_LOG(DEBUG, "plan cache not exists for this tenant yet", K(ret));
|
||||
} else if (false == ps_cache_->is_inited() || false == ps_cache_->is_valid()) {
|
||||
} else if (false == ps_cache_->is_inited()) {
|
||||
is_end = true;
|
||||
SERVER_LOG(DEBUG, "ps cache is not ready, ignore this", K(ret), K(ps_cache_->is_inited()),
|
||||
K(ps_cache_->is_valid()));
|
||||
SERVER_LOG(DEBUG, "ps cache is not ready, ignore this", K(ret), K(ps_cache_->is_inited()));
|
||||
} else if (OB_FAIL(ps_cache_->get_all_stmt_id(&stmt_id_array_))) {
|
||||
SERVER_LOG(WARN, "get_all_stmt_id failed", K(ret));
|
||||
} else {
|
||||
|
@ -126,8 +126,6 @@ int ObAllVirtualPsStat::inner_get_next_row()
|
||||
K(effective_tenant_id_));
|
||||
} else if (false == ps_cache->is_inited()) {
|
||||
SERVER_LOG(DEBUG, "ps_cache is not init, ignore this", K(ret));
|
||||
} else if (false == ps_cache->is_valid()) {
|
||||
SERVER_LOG(DEBUG, "ps_cache is not valid, ignore this", K(ret));
|
||||
} else if (OB_FAIL(fill_cells(*ps_cache, tenant_id))) {
|
||||
SERVER_LOG(WARN, "fill_cells failed", K(ret), K(tenant_id));
|
||||
} else {
|
||||
|
@ -322,7 +322,6 @@ struct ObNodeStatFilterOp : public ObKVEntryTraverseOp
|
||||
|
||||
ObPlanCache::ObPlanCache()
|
||||
:inited_(false),
|
||||
valid_(false),
|
||||
tenant_id_(OB_INVALID_TENANT_ID),
|
||||
mem_limit_pct_(OB_PLAN_CACHE_PERCENTAGE),
|
||||
mem_high_pct_(OB_PLAN_CACHE_EVICT_HIGH_PERCENTAGE),
|
||||
@ -376,7 +375,6 @@ int ObPlanCache::init(int64_t hash_bucket, common::ObAddr addr,
|
||||
tenant_id_ = tenant_id;
|
||||
ref_handle_mgr_.set_tenant_id(tenant_id_);
|
||||
inited_ = true;
|
||||
valid_ = true;
|
||||
pcm_ = pcm;
|
||||
}
|
||||
}
|
||||
|
@ -275,8 +275,6 @@ public:
|
||||
int foreach_cache_evict(CallBack &cb);
|
||||
//asynchronous update plan baseline
|
||||
int asyn_update_baseline();
|
||||
bool is_valid() {return valid_;}
|
||||
void set_valid(bool valid) {valid_ = valid;}
|
||||
void destroy();
|
||||
int64_t inc_ref_count();
|
||||
void dec_ref_count();
|
||||
@ -368,7 +366,6 @@ private:
|
||||
const static int64_t SLICE_SIZE = 1024; //1k
|
||||
private:
|
||||
bool inited_;
|
||||
bool valid_;
|
||||
int64_t tenant_id_;
|
||||
int64_t mem_limit_pct_;
|
||||
int64_t mem_high_pct_; // high water mark percentage
|
||||
|
@ -263,7 +263,6 @@ int ObPlanCacheManager::revert_plan_cache(const uint64_t &tenant_id)
|
||||
"pc ref_count", ppc->get_ref_count(),
|
||||
K(tenant_id));
|
||||
//cancel scheduled task
|
||||
ppc->set_valid(false);
|
||||
ppc->dec_ref_count();
|
||||
} else if (OB_HASH_NOT_EXIST == tmp_ret) { // maybe erase by other thread
|
||||
SQL_PC_LOG(INFO, "Plan Cache not exist", K(tenant_id));
|
||||
@ -742,7 +741,6 @@ int ObPlanCacheManager::revert_ps_cache(const uint64_t &tenant_id)
|
||||
K(tenant_id));
|
||||
//cancel scheduled task
|
||||
ppc->dec_ref_count();
|
||||
ppc->set_valid(false);
|
||||
} else if (OB_HASH_NOT_EXIST == tmp_ret) { // maybe erase by other thread
|
||||
SQL_PC_LOG(INFO, "PS Plan Cache not exist", K(tenant_id));
|
||||
} else {
|
||||
|
@ -28,7 +28,6 @@ namespace sql
|
||||
ObPsCache::ObPsCache()
|
||||
: next_ps_stmt_id_(0),
|
||||
inited_(false),
|
||||
valid_(false),
|
||||
tenant_id_(OB_INVALID_ID),
|
||||
host_(),
|
||||
ref_count_(0),
|
||||
@ -96,7 +95,6 @@ int ObPsCache::init(const int64_t hash_bucket,
|
||||
tenant_id_ = tenant_id;
|
||||
host_ = addr;
|
||||
inited_ = true;
|
||||
valid_ = true;
|
||||
LOG_INFO("init ps plan cache success", K(addr), K(tenant_id), K(hash_bucket));
|
||||
}
|
||||
}
|
||||
@ -492,9 +490,6 @@ int ObPsCache::get_all_stmt_id(ObIArray<ObPsStmtId> *id_array)
|
||||
} else if (!is_inited()) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ps_cache is not init yet", K(ret));
|
||||
} else if (!is_valid()) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ps_cache is not valid anymore", K(ret));
|
||||
} else if (OB_FAIL(stmt_info_map_.foreach_refactored(op))) {
|
||||
LOG_WARN("traverse stmt_info_map_ failed", K(ret));
|
||||
} else if (OB_FAIL(op.get_callback_ret())) {
|
||||
@ -771,9 +766,6 @@ int ObPsCache::inner_cache_evict(bool is_evict_all)
|
||||
if (!is_inited()) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ps_cache is not init yet", K(ret));
|
||||
} else if (!is_valid()) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ps_cache is not valid anymore", K(ret));
|
||||
} else if (OB_FAIL(stmt_info_map_.foreach_refactored(op))) {
|
||||
LOG_WARN("traverse stmt_info_map_ failed", K(ret));
|
||||
} else if (OB_FAIL(op.get_callback_ret())) {
|
||||
@ -835,7 +827,7 @@ int ObPsCache::mem_total(int64_t &mem_total) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
mem_total = 0;
|
||||
if (true == is_inited() && true == is_valid()) {
|
||||
if (true == is_inited()) {
|
||||
if (OB_ISNULL(inner_allocator_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("inner_allocator_ is NULL", K(ret));
|
||||
@ -843,7 +835,7 @@ int ObPsCache::mem_total(int64_t &mem_total) const
|
||||
mem_total = inner_allocator_->total();
|
||||
}
|
||||
} else {
|
||||
LOG_DEBUG("ps cache is not init or not valid", K(ret), K(is_inited()), K(is_valid()));
|
||||
LOG_DEBUG("ps cache is not init", K(ret), K(is_inited()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -48,8 +48,6 @@ public:
|
||||
const common::ObAddr addr,
|
||||
const uint64_t tenant_id);
|
||||
bool is_inited() const { return inited_; }
|
||||
bool is_valid() const { return valid_; }
|
||||
void set_valid(bool valid) { valid_ = valid; }
|
||||
int64_t inc_ref_count();
|
||||
void dec_ref_count();
|
||||
int64_t get_ref_count() const { return ref_count_; }
|
||||
@ -144,7 +142,6 @@ private:
|
||||
|
||||
ObPsStmtId next_ps_stmt_id_;
|
||||
bool inited_;
|
||||
bool valid_;
|
||||
int64_t tenant_id_;
|
||||
common::ObAddr host_;
|
||||
volatile int64_t ref_count_;
|
||||
|
@ -886,7 +886,7 @@ ObPsCache *ObSQLSessionInfo::get_ps_cache()
|
||||
{
|
||||
if (OB_ISNULL(plan_cache_manager_)) {
|
||||
LOG_WARN("invalid status", K_(ps_cache), K_(plan_cache_manager));
|
||||
} else if (OB_NOT_NULL(ps_cache_) && ps_cache_->is_valid()) {
|
||||
} else if (OB_NOT_NULL(ps_cache_)) {
|
||||
//do nothing
|
||||
} else {
|
||||
int ret = OB_SUCCESS;
|
||||
@ -906,7 +906,7 @@ ObPsCache *ObSQLSessionInfo::get_ps_cache()
|
||||
ps_cache_ = plan_cache_manager_->get_or_create_ps_cache(tenant_id,
|
||||
pc_mem_conf);
|
||||
if (OB_ISNULL(ps_cache_)) {
|
||||
LOG_WARN("failed to get ps pl an cache");
|
||||
LOG_WARN("failed to get ps plan cache");
|
||||
} else {
|
||||
ps_session_info_allocator_.set_attr(mem_attr);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user