Details
-
New Feature
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
-
None
-
Q4/2026 Server Development
Description
Goal
Let MariaDB accept a closed subset of a third-party SQL dialect and execute such statements on an external analytical engine that holds read-only copies of MariaDB tables. Ordinary MariaDB SQL must keep its current parse result and cost.
Approach
- Fallback-first dispatch. The MariaDB (Bison) parser always runs first. The additional parser is tried only when Bison fails with a syntax error (ER_PARSE_ERROR); name-resolution and execution errors never trigger it. Statements valid in both dialects keep their MariaDB meaning. This inverts the existing pluggable-parser design (plugin first) and removes its per-statement cost and the parser-selection system variable.
- Two hook points: mysql_parse() and Prepared_statement::prepare(). Internal re-parses (views, triggers, stored programs, events, .frm, replication) are not hooked.
- Two-phase plugin contract: a pure recognize() that does not touch THD state, then execute(). A non-matching statement returns Bison's original error, byte-identical.
- Carrier statement: one new enum_sql_command value with an opaque Sql_cmd, so PSI, Com_ counters, KILL, max_statement_time, audit, slow log and prepared statements work unchanged. No foreign-AST-to-LEX conversion; no local fallback execution.
- Privileges: table references are extracted by parsing embedded and outer queries with Bison (parse-only); every table must be fully qualified, mirrored, and pass SELECT_ACL.
- Multi-node: shared registry and cluster-wide on/off control; fail closed when state is unconfirmed.
- Statements in write or persisting contexts are refused.
Acceptance criteria
- MTR main with the plugin loaded vs not loaded: no result difference; parser error texts byte-identical.
- No measurable per-statement overhead (perf stat on sysbench point-select / read-write).
- ps, sp, perfschema suites pass against the prototype under ASan.
- Two-node tests: object created on node 1 is usable and droppable on node 2; REVOKE and cluster-wide disable are honoured on all nodes.