In Start_log_event_v3::do_apply_event(), there is code to detect when the
format description event is the first one logged after master restart. In this
case, it calls rli->close_temporary_tables() and
cleanup_load_tmpdir(&rli->mi->cmp_connection_name) to cleanup any temporary
tables left dangling.
This is a problem in parallel replication, as the code currently does not have
any serialisation for this case.
The code needs to handle this:
- before processing the master restart event, wait until all prior events
have completed, in case they are referencing temporary tables.
- Delay processing of all later events, in case they will open new temporary