metadata locking and deadlock detection in mysql 5.5

14
Metadata locking in MySQL 5.5 Konstantin Osipov Engineer @ Mail.Ru [email protected] These slides released under the Creative Commons Attribution-Noncommercial-Share Alike License

Upload: oleksiy-kovyrin

Post on 14-Oct-2014

329 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Metadata Locking and Deadlock Detection in MySQL 5.5

Metadata locking inMySQL 5.5

Konstantin OsipovEngineer @ Mail.Ru

[email protected]

These slides released under the Creative Commons Attribution­Noncommercial­Share Alike License

Page 2: Metadata Locking and Deadlock Detection in MySQL 5.5

Mastering a 25-foot saw

Page 3: Metadata Locking and Deadlock Detection in MySQL 5.5

DDL vs. DML: an illustration

Page 4: Metadata Locking and Deadlock Detection in MySQL 5.5

What if... a transactional catalog

Page 5: Metadata Locking and Deadlock Detection in MySQL 5.5

Locking agents

Page 6: Metadata Locking and Deadlock Detection in MySQL 5.5

Define the problem (2)

Four groups of bugs:

- ALTER, DROP violate ACID

- … or ... break replication

- deadlocks in LOCK TABLES, FLUSH,

SET GLOBAL read_only and ALTER

- DML doesn't scale or THANK YOU

LOCK_open

Page 7: Metadata Locking and Deadlock Detection in MySQL 5.5

Define the problem (3)

Page 8: Metadata Locking and Deadlock Detection in MySQL 5.5

In come metadata locks

Page 9: Metadata Locking and Deadlock Detection in MySQL 5.5

Deadlock detection

How does a typical wait-for grpah look like?

Page 10: Metadata Locking and Deadlock Detection in MySQL 5.5

How to plug in

Engines need to plug-in to avoid cross-storage-

engine deadlocks.

- it's safe to #include “mdl.h”, no extra deps

- subclass MDL_waitfor_subgraph to accept

- MDL_waitfor_graph_visitor

- let us know when you're waiting, by calilng

- MDL_context::will_wait_for()

Page 11: Metadata Locking and Deadlock Detection in MySQL 5.5

Performance impact

Page 12: Metadata Locking and Deadlock Detection in MySQL 5.5

The roadmap

- help us add cross-storage-engine deadlock

detection!

- thr_lock.c and handler::store_lock() need not be

mandatory any more

- consistent DDL across all NDB cluster

- shard MDL_set (performance++)

- instrumentation

Page 13: Metadata Locking and Deadlock Detection in MySQL 5.5

Performance impact

Page 14: Metadata Locking and Deadlock Detection in MySQL 5.5

That's it.

Thank you for coming!

Further reading: WL#3873, WL#3726, WL#4284Mdl.pdf is available in MySQL internals manual.