Skip to content

Remove residual SPM (SQL Plan Baseline) code #1172

Description

@footka

Background

The core functionality of SQL Plan Management (SPM / SQL Plan Baseline) has been removed from seekdb: the DBMS_SPM package and Baseline lifecycle implementation have been deleted, Plan Baseline/SPM internal tables are marked as abandoned, and the Plan Cache loading Baseline implementation has been commented out. However, residual code remains, including system variables, empty manager pointers, DBMS_XPLAN display entry points, error codes/enums, comments, and orphaned result files.

Branch

master

Current State Quantification

  • Approximately 40 source files contain SPM/SQL Plan Baseline related names or fields.
  • System variables optimizer_use_sql_plan_baselines and optimizer_capture_sql_plan_baselines can still be set, but have no actual business logic reading them.
  • ObPlanBaselineMgr only contains forward declarations and nullptr members; no implementation or initialization found.
  • Two SPM mysqltests only have .result files remaining; their corresponding .test files have been deleted.

Scope of Work

  1. Delete optimizer_use_sql_plan_baselines, optimizer_capture_sql_plan_baselines, and the generated system variable and Session Cache code.
  2. Delete forward declarations of ObPlanBaselineMgr and residual empty pointers in Tenant Module/Module Provider/Observer.
  3. Delete placeholder definitions for abandoned Plan Baseline/SPM internal tables, related schema declarations, and invalid display fields.
  4. Delete the fully commented-out Baseline loading code in Plan Cache, along with unused enums like WAY_PLAN_BASELINE and PLAN_BASELINE_HANDLE.
  5. Delete the DBMS_XPLAN.DISPLAY_SQL_PLAN_BASELINE interface, package declaration/body, and its access to the abandoned Baseline virtual tables.
  6. Delete orphaned files spm_expr.result, spm_new_plan_not_ok.result, and other pure SPM comment/test residues.
  7. Handle OB_SQL_RETRY_SPM: This error code is currently still used for EXPLAIN/Outline plan replay retries. It needs to be renamed with a new name reflecting Outline semantics while preserving the original retry behavior. The call chain cannot be directly deleted.

Boundaries

  • Outline functionality must be preserved. CREATE/ALTER/DROP OUTLINE, Outline Schema/DDL, Plan Cache Outline status, optimizer Hint application, concurrency throttling, and related tests are not within the deletion scope of this task.
  • Evolution/sampling logic reused in adaptive Plan Cache/Plan Expiration will be evaluated based on actual functionality; only invalid SPM semantics and dead code will be cleaned.

Acceptance Criteria

  • The master branch compiles successfully, and Outline and Plan Cache related regression tests pass.
  • The following searches yield no valid SPM residues: ObPlanBaseline, DBMS_SPM, SQL_PLAN_BASELINE, PLAN_BASELINE_HANDLE, WAY_PLAN_BASELINE, optimizer_use_sql_plan_baselines, optimizer_capture_sql_plan_baselines, OB_SQL_RETRY_SPM, __all_*plan_baseline, spm_*.
  • Outline SQL creation, modification, deletion, and query plan application chains remain functional.
  • DBMS_XPLAN no longer exposes SQL Plan Baseline display entry points that lack backend support.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions