Skip to content

[codex] Add configurable MySQL OSC executors#28

Merged
jruszo merged 2 commits intomasterfrom
feature/mysql-ddl-executors
Apr 17, 2026
Merged

[codex] Add configurable MySQL OSC executors#28
jruszo merged 2 commits intomasterfrom
feature/mysql-ddl-executors

Conversation

@jruszo
Copy link
Copy Markdown
Owner

@jruszo jruszo commented Apr 17, 2026

Summary

Add MySQL DDL executor support for direct, gh-ost, and pt-online-schema-change, with configurable binary paths, compatibility checks, API plumbing, UI selection, and end-to-end coverage.

What Changed

  • added sql/engines/mysql_ddl.py to inspect, resolve, preflight, and execute MySQL schema changes through direct, gh-ost, or pt-osc
  • integrated executor selection into MySQL workflow execution, scheduling, API serializers, and workflow detail responses
  • added system settings for configurable gh_ost and pt_osc binary locations
  • updated the workflow detail UI to show compatible executors, blocker reasons, and selected executor state
  • added backend tests for executor inspection and workflow API behavior
  • added Playwright coverage for executor selection and stabilized workflow smoke tests on a clean demo environment

Why

Online schema change support needs to respect tool-specific limitations instead of treating all MySQL DDL the same. This change makes executor choice explicit and safe, and it establishes a structure that can be extended with additional tools later.

Root Cause

Previously, MySQL DDL execution only had the direct path, so there was no safe way to route schema changes through online schema change tools or surface compatibility constraints in the product.

Impact

Users can now:

  • configure gh-ost and pt-osc binary paths in system settings
  • see which executors are compatible for a given MySQL DDL workflow
  • select a supported executor for immediate or scheduled execution
  • understand why a specific executor is unavailable for a workflow

Validation

  • black --check .
  • npm run build in frontend/
  • docker exec datamingle-app python manage.py test sql.engines.tests.TestMysqlDDLExecutorService sql_api.tests.TestWorkflow
  • E2E_START_FRONTEND=1 bash scripts/e2e/run-local-playwright.sh

Summary by CodeRabbit

  • New Features
    • Added support for executing MySQL DDL workflows using multiple executors (gh-ost, pt-online-schema-change, or direct mode)
    • Introduced executor selection UI for MySQL DDL workflows with availability validation and incompatibility explanations
    • Added system settings to configure external DDL executor binary paths

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18051393-8370-4a51-bd1f-443f427cef20

📥 Commits

Reviewing files that changed from the base of the PR and between 4e9cce0 and 3852731.

📒 Files selected for processing (14)
  • frontend/src/lib/api.ts
  • frontend/src/lib/system-settings.ts
  • frontend/src/views/WorkflowDetailView.vue
  • frontend/tests/e2e/support/workflow-helpers.ts
  • frontend/tests/e2e/workflow-smoke.spec.ts
  • sql/engines/mysql.py
  • sql/engines/mysql_ddl.py
  • sql/engines/tests.py
  • sql/utils/execute_sql.py
  • sql/utils/tasks.py
  • sql_api/api_settings.py
  • sql_api/api_workflow.py
  • sql_api/serializers.py
  • sql_api/tests.py

📝 Walkthrough

Walkthrough

This change implements full-stack support for MySQL online DDL executors (gh-ost and pt-online-schema-change), adding system configuration for binary paths, frontend UI for executor selection, backend DDL analysis and compatibility resolution, and API routing for executor-aware workflow execution and scheduling.

Changes

Cohort / File(s) Summary
API Type Definitions
frontend/src/lib/api.ts, sql_api/serializers.py
Added WorkflowExecutorOption type and extended workflow payloads with optional executor field; defined DDL_EXECUTOR_CHOICES constant for valid executor IDs.
System Settings Schema
frontend/src/lib/system-settings.ts, sql_api/api_settings.py
Added gh_ost and pt_osc binary path configuration fields with text input UI and validation against installed tool binaries.
Frontend Workflow Detail UI
frontend/src/views/WorkflowDetailView.vue
Introduced executor selection state, computed flags for requirement/availability, UI block rendering available executors dropdown, blocker reasons, and scheduled executor label; updated execute/schedule buttons to enforce executor selection when required.
MySQL DDL Execution Engine
sql/engines/mysql_ddl.py, sql/engines/mysql.py
New module implementing DDL statement parsing, table metadata inspection, executor compatibility checks, and three executor implementations (Direct, gh-ost, pt-osc); updated MysqlEngine to route DDL-only workflows to new DDL executor service with executor resolution and preflight validation.
Execution & Scheduling Flow
sql/utils/execute_sql.py, sql/utils/tasks.py, sql_api/api_workflow.py
Extended execution signature to accept execution_options parameter; added MySQL DDL detection, executor inspection/resolution, and audit logging with executor context; wired executor selection through scheduling and execution endpoints.
Backend Test Coverage
sql/engines/tests.py, sql_api/tests.py
Added test scaffolding for DDL executor service behavior (inspection, resolution, blocker registration) and MySQL workflow execution/scheduling with executor selection and error handling.
Frontend E2E Tests
frontend/tests/e2e/support/workflow-helpers.ts, frontend/tests/e2e/workflow-smoke.spec.ts
Refactored system config helper into generic setSystemConfigValues() function; added executor configuration in test setup; added comprehensive e2e test covering DDL executor selection UI, selection enforcement, and execution completion.

Sequence Diagram

sequenceDiagram
    participant UI as Frontend UI
    participant API as Workflow API
    participant Engine as MySQL Engine
    participant DDLSvc as DDL Executor Service
    participant Tool as External DDL Tool

    UI->>API: POST execute/schedule with executor selection
    API->>Engine: execute_workflow(..., execution_options={executor})
    Engine->>Engine: Detect DDL-only workflow
    alt DDL-only detected
        Engine->>DDLSvc: resolve_ddl_executor(workflow, executor_id)
        DDLSvc->>DDLSvc: Inspect available executors & blockers
        alt Executor available
            DDLSvc->>DDLSvc: Validate executor compatibility
            DDLSvc-->>Engine: Return resolved executor
            Engine->>DDLSvc: execute_external_ddl_workflow(...)
            DDLSvc->>Tool: Run tool subprocess with SQL
            Tool-->>DDLSvc: Return execution result
            DDLSvc-->>Engine: ReviewResult with executor_id
        else Executor unavailable
            DDLSvc-->>Engine: Raise MysqlDDLExecutorError
            Engine-->>API: Error response
            API-->>UI: Display error & blockers
        end
    else Non-DDL or no executor needed
        Engine->>Engine: Execute via standard flow
    end
    Engine-->>API: ReviewSet with executor context
    API-->>UI: Workflow status & execution info
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through DDL trees,
With gh-ost and pt-osc to please,
When schemas change online so bright,
Multiple executors make it right,
No table locks will slow the spree! 🚀

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/mysql-ddl-executors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread sql_api/api_settings.py
try:
return validate_binary_path(value, "gh-ost")
except ValueError as exc:
raise serializers.ValidationError(str(exc))
Comment thread sql_api/api_settings.py
try:
return validate_binary_path(value, "pt-online-schema-change")
except ValueError as exc:
raise serializers.ValidationError(str(exc))
Comment thread sql_api/api_workflow.py
preflight=True,
)
except MysqlDDLExecutorError as exc:
raise serializers.ValidationError({"errors": str(exc)})
Comment thread sql_api/api_workflow.py
preflight=True,
)
except MysqlDDLExecutorError as exc:
raise serializers.ValidationError({"errors": str(exc)})
@jruszo jruszo marked this pull request as ready for review April 17, 2026 12:46
@jruszo jruszo merged commit d09ddf0 into master Apr 17, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants