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
- relates to
-
MDEV-32033 all queries get stuck until a timeout occurs on all of them
-
- Open
-
-
MDEV-4259 Transactional DDL
-
- Open
-