Remove is_valid in ps cache and plan cache.
This commit is contained in:
@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user