Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41962

Fallback SQL parser for vendor-dialect statements offloaded to an external analytical engine

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • None
    • 13.3
    • None
    • None

    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.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            drrtuy Roman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 5d
                5d
                Remaining:
                Remaining Estimate - 5d
                5d
                Logged:
                Time Spent - Not Specified
                Not Specified

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.