-
Dyre Tjeldvoll authored
Problem: Running insert, alter and drop schema concurrently could trigger a deadlock. Root cause was that it was possible to block waiting for a TABLE_SHARE being opened by another thread while already holding MDL on the schema. The other thread would, as part of opening the share, attempt to also acquire MDL on the schema. This could result in a pseudo deadlock, as the operation would proceed only after the thread requesting the MDL had timed out. Solution: When the share is not found in the tdc and there is no prior MDL on schema, get_table_share() must temporarily release LOCK_open, acquire MDL on schema, and retry the tdc lookup. This way there is no need to acquire schema MDL while share->open_in_progress is true. Note that the MDL now has transaction duration rather than a (shorter) explicit duration. This should not harm concurrency, as exclusive access to the schema was always prevented by MDL on a table in it, and concurrent access is still possible.
Dyre Tjeldvoll authoredProblem: Running insert, alter and drop schema concurrently could trigger a deadlock. Root cause was that it was possible to block waiting for a TABLE_SHARE being opened by another thread while already holding MDL on the schema. The other thread would, as part of opening the share, attempt to also acquire MDL on the schema. This could result in a pseudo deadlock, as the operation would proceed only after the thread requesting the MDL had timed out. Solution: When the share is not found in the tdc and there is no prior MDL on schema, get_table_share() must temporarily release LOCK_open, acquire MDL on schema, and retry the tdc lookup. This way there is no need to acquire schema MDL while share->open_in_progress is true. Note that the MDL now has transaction duration rather than a (shorter) explicit duration. This should not harm concurrency, as exclusive access to the schema was always prevented by MDL on a table in it, and concurrent access is still possible.
Loading