diff --git a/src/pl/ob_pl_interface_pragma.h b/src/pl/ob_pl_interface_pragma.h index 9450bffd2..6a7f44f65 100644 --- a/src/pl/ob_pl_interface_pragma.h +++ b/src/pl/ob_pl_interface_pragma.h @@ -596,6 +596,7 @@ INTERFACE_DEF(INTERFACE_DBMS_SPM_CANCEL_EVOLVE_TASK, "CANCEL_EVOLVE_TASK", (ObDBMSSpm::cancel_evolve_task)) INTERFACE_DEF(INTERFACE_DBMS_SPM_CONFIGURE, "CONFIGURE", (ObDBMSSpm::configure)) INTERFACE_DEF(INTERFACE_DBMS_SPM_DROP_SQL_PLAN_BASELINE, "DROP_SQL_PLAN_BASELINE", (ObDBMSSpm::drop_baseline)) + INTERFACE_DEF(INTERFACE_DBMS_SPM_BATCH_DROP_SQL_PLAN_BASELINE, "BATCH_DROP_SQL_PLAN_BASELINE", (ObDBMSSpm::batch_drop_baseline)) INTERFACE_DEF(INTERFACE_DBMS_SPM_LOAD_PLANS_FROM_CURSOR_CACHE, "LOAD_PLANS_FROM_CURSOR_CACHE", (ObDBMSSpm::load_plans_from_cursor_cache)) INTERFACE_DEF(INTERFACE_DBMS_SPM_BATCH_LOAD_PLANS_FROM_CURSOR_CACHE, "BATCH_LOAD_PLANS_FROM_CURSOR_CACHE", (ObDBMSSpm::batch_load_plans_from_cursor_cache)) INTERFACE_DEF(INTERFACE_DBMS_SPM_AUTO_PURGE_SQL_PLAN_BASELINE, "AUTO_PURGE_SQL_PLAN_BASELINE", (ObDBMSSpm::auto_purge_sql_plan_baseline)) diff --git a/src/rootserver/ob_system_admin_util.cpp b/src/rootserver/ob_system_admin_util.cpp index a0e24b1ad..97b2536f3 100644 --- a/src/rootserver/ob_system_admin_util.cpp +++ b/src/rootserver/ob_system_admin_util.cpp @@ -2281,15 +2281,20 @@ int ObAdminLoadBaselineV2::call_server(const common::ObAddr &server, obrpc::ObLoadBaselineRes &res) { int ret = OB_SUCCESS; + int64_t timeout = THIS_WORKER.get_timeout_remain(); if (!ctx_.is_inited()) { ret = OB_NOT_INIT; LOG_WARN("not init", KR(ret)); } else if (!server.is_valid()) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid server", K(server), KR(ret)); + } else if (OB_UNLIKELY(0 >= timeout)) { + ret = OB_TIMEOUT; + LOG_WARN("query timeout is reached", K(timeout)); } else if (OB_FAIL(ctx_.rpc_proxy_->to(server) .by(arg.tenant_id_) .as(arg.tenant_id_) + .timeout(timeout) .load_baseline_v2(arg, res))) { LOG_WARN("request server load baseline failed", KR(ret), K(server)); } diff --git a/src/sql/spm/ob_plan_baseline_mgr.h b/src/sql/spm/ob_plan_baseline_mgr.h index 0d03fc8e7..7dabcdbd9 100644 --- a/src/sql/spm/ob_plan_baseline_mgr.h +++ b/src/sql/spm/ob_plan_baseline_mgr.h @@ -133,6 +133,7 @@ public: const ObString &sql_id, const uint64_t plan_hash, const bool with_plan_hash, + const uint64_t parallel, int64_t &baseline_affected); int load_baseline(ObSpmBaselineLoader &baseline_loader); int purge_baselines(const uint64_t tenant_id, int64_t baseline_affected); diff --git a/src/sql/spm/ob_plan_baseline_sql_service.h b/src/sql/spm/ob_plan_baseline_sql_service.h index 84335c89a..509f1e13e 100644 --- a/src/sql/spm/ob_plan_baseline_sql_service.h +++ b/src/sql/spm/ob_plan_baseline_sql_service.h @@ -80,6 +80,8 @@ public: const uint64_t tenant_id, const ObBaselineKey& key); + int batch_delete_plan_baselines(const uint64_t tenant_id, const uint64_t parallel, int64_t &baseline_affected); + int do_batch_delete(const uint64_t tenant_id, ObSqlString &sql, int64_t &affected_rows); int delete_all_plan_baselines(const uint64_t tenant_id, const ObBaselineKey& key, int64_t &baseline_affected); int delete_plan_baseline(const uint64_t tenant_id,