Skip to content

Conversation

@dlenev
Copy link
Contributor

@dlenev dlenev commented Jan 6, 2026

…pending DDL clashes with FTRWL".

Draft fix for local deadlock issue.

Ensure that CREATE TABLE statement (and other DDL statements) acquires protection against Backup Lock first (i.e. IX lock on BACKUP_LOCK MDL singleton) and only then tries to acquire protection against Global Read Lock (i.e. IX lock on GLOBAL MDL singleton) and not vice versa.

This allows to avoid deadlock which sometimes occured and resulted in CREATE TABLE failure with appropriate error when mydumper backup tool was run concurrently. This (as well as some other) backup tool does LOCK INSTANCE FOR BACKUP first (which acquires S lock on BACKUP_LOCK singleton) and then does FLUSH TABLES WITH READ LOCK (which acquires S lock on GLOBAL MDL singleton). Acquiring conflicting lock in opposite order is deadlock-prone.

…pending DDL clashes with FTRWL".

Draft fix for local deadlock issue.

Ensure that CREATE TABLE statement (and other DDL statements) acquires
protection against Backup Lock first (i.e. IX lock on BACKUP_LOCK MDL
singleton) and only then tries to acquire protection against Global
Read Lock (i.e. IX lock on GLOBAL MDL singleton) and not vice versa.

This allows to avoid deadlock which sometimes occured and resulted in
CREATE TABLE failure with appropriate error when mydumper backup tool
was run concurrently. This (as well as some other) backup tool does
LOCK INSTANCE FOR BACKUP first (which acquires S lock on BACKUP_LOCK
singleton) and then does FLUSH TABLES WITH READ LOCK (which acquires S
lock on GLOBAL MDL singleton). Acquiring conflicting lock in opposite
order is deadlock-prone.
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.

1 participant