to issue<53361277>:support flush pl cache single cache object
This commit is contained in:
@ -44,9 +44,11 @@
|
||||
#include "share/ob_primary_standby_service.h" // ObPrimaryStandbyService
|
||||
#include "rpc/obmysql/ob_sql_sock_session.h"
|
||||
#include "sql/plan_cache/ob_plan_cache.h"
|
||||
#include "pl/pl_cache/ob_pl_cache_mgr.h"
|
||||
#include "sql/plan_cache/ob_ps_cache.h"
|
||||
#include "share/table/ob_ttl_util.h"
|
||||
#include "rootserver/restore/ob_tenant_clone_util.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
@ -379,7 +381,38 @@ int ObFlushCacheExecutor::execute(ObExecContext &ctx, ObFlushCacheStmt &stmt)
|
||||
break;
|
||||
}
|
||||
case CACHE_TYPE_PL_OBJ: {
|
||||
if (0 == tenant_num) {
|
||||
if (stmt.flush_cache_arg_.is_fine_grained_) {
|
||||
// purge in sql_id level, aka. fine-grained plan evict
|
||||
// we assume tenant_list must not be empty and this will be checked in resolve phase
|
||||
if (0 == tenant_num) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpected tenant_list in fine-grained plan evict", K(tenant_num));
|
||||
} else {
|
||||
bool is_evict_by_schema_id = common::OB_INVALID_ID != stmt.flush_cache_arg_.schema_id_;
|
||||
for (int64_t i = 0; i < tenant_num; i++) { // ignore ret
|
||||
int64_t t_id = stmt.flush_cache_arg_.tenant_ids_.at(i);
|
||||
MTL_SWITCH(t_id) {
|
||||
ObPlanCache* plan_cache = MTL(ObPlanCache*);
|
||||
// not specified db_name, evict all dbs
|
||||
if (db_num == 0) {
|
||||
if (is_evict_by_schema_id) {
|
||||
ret = plan_cache->flush_pl_cache_single_cache_obj<pl::ObGetPLKVEntryBySchemaIdOp>(OB_INVALID_ID, stmt.flush_cache_arg_.schema_id_);
|
||||
} else {
|
||||
ret = plan_cache->flush_pl_cache_single_cache_obj<pl::ObGetPLKVEntryBySQLIDOp>(OB_INVALID_ID, sql_id);
|
||||
}
|
||||
} else { // evict db by db
|
||||
for(int64_t j = 0; j < db_num; j++) { // ignore ret
|
||||
if (is_evict_by_schema_id) {
|
||||
ret = plan_cache->flush_pl_cache_single_cache_obj<pl::ObGetPLKVEntryBySchemaIdOp>(stmt.flush_cache_arg_.db_ids_.at(j), stmt.flush_cache_arg_.schema_id_);
|
||||
} else {
|
||||
ret = plan_cache->flush_pl_cache_single_cache_obj<pl::ObGetPLKVEntryBySQLIDOp>(stmt.flush_cache_arg_.db_ids_.at(j), sql_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (0 == tenant_num) {
|
||||
common::ObArray<uint64_t> tenant_ids;
|
||||
if (OB_ISNULL(GCTX.omt_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
||||
Reference in New Issue
Block a user