MDEV-6321: close_temporary_tables() in format description event not serialised correctly
When a master server starts up, it logs a special format_description event at the start of a new binlog to mark that is has restarted. This is used by a slave to drop all temporary tables - this is needed in case the master crashed and did not have a chance to send explicit DROP TEMPORARY TABLE statements to the slave. In parallel replication, we need to be careful when dropping the temporary tables - we need to be sure that no prior events are still executing that might be using the temporary tables to be dropped, _and_ that no following events have started executing that might have created new temporary tables that should not be dropped. This was not handled correctly, which could cause errors about access to not existing temporary tables or even crashes. This patch implements that such format_description events cause serialisation of event execution; all prior events are executed to completion first, then the format_description event is executed, dropping temporary tables, then following events are queued for execution. Master restarts should be sufficiently infrequent that the resulting loss of parallelism should be of minimal impact.
Showing
Please register or sign in to comment