WL#6049: Meta-data locking for FOREIGN KEY tables

Affects: Server-8.0   —   Status: Complete

This worklog consists of two parts:
1) Acquiring metadata locks on tables across foreign key relationships so
   that conflicting operations are blocked.
2) Updating FK metadata if a parent table changes.

Currently, InnoDB handles FOREIGN KEY constraints internally. This complicates a
few tasks, because MySQL meta-data locking is handled at the SQL layer 
and will not protect the FOREIGN KEY parent tables of a table during statement
execution. E.g. the parent table can be dropped while a InnoDB is running a
foreign key check. Taking metadata locks is required to fix these issues.

Also, foreign key definitions in the new DD are now not updated
if the parent changes. This is because FK metadata is owned by the child and
thus needs the child to be locked to be updated safely. Doing such FK updates
when the parent changes, will also be part of this worklog.