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

Implement per-transaction schema versioning to eliminate table-level DDL locks

    XMLWordPrintable

Details

    • New Feature
    • Status: Needs Feedback (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      MariaDB acquires a table-level metadata lock (MDL) during DDL execution, blocking concurrent DML on the affected table. This causes availability degradation in high-throughput OLTP environments, especially in distributed setups where DDL propagation latency amplifies the lock duration.
      Implement schema versioning so that each transaction operates against the schema version captured at its start_ts. Concurrent DDL creates a new schema version without blocking in-flight transactions — they continue using their snapshot. New transactions after DDL commit observe the updated schema.
      This is analogous to MVCC for data but applied to schema metadata.
      Example of the current problem:

      -- Session 1: long-running DDL blocks all DML
      ALTER TABLE orders ADD COLUMN priority INT DEFAULT 0;
      -- Session 2: blocked until ALTER completes
      UPDATE orders SET status = 'shipped' WHERE id = 42;
      

      Expected behavior: Session 2 proceeds using the pre-ALTER schema version; new transactions after ALTER commit see the new column.

      Attachments

        Issue Links

          Activity

            People

              aijazfatima Aijaz Fatima
              drrtuy Roman
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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