-
unknown authored
"If 2 master threads with same-name temp table, slave makes bad binlog" and (two birds with one stone) for BUG#1240 "slave of slave breaks when STOP SLAVE was issud on parent slave and temp tables". Here is the design change: in a slave running with --log-slave-updates, events are now logged with the thread id they had on the master. So no more id conflicts between master threads, but introduces id conflicts between one master thread and one normal client thread connected to the slave. This is solved by storing the server id in the temp table's name. New test which requires mysql-test-run to be run with --manager, otherwise it will be skipped. Undoing a Monty's change (hum, a chill runs down my spine ;) which was "Cleanup temporary tables when slave ends" in ChangeSet 1.1572.1.1. mysql-test/mysql-test-run.sh: One new test which needs more than one slave so must be hardcoded in mysql-test-run.sh. sql/log_event.cc: The event needs to carry a slave_proxy_id (which is set at event's creation and used at event's logging). This is used for events created by ::exec_event() in the slave SQL thread: now we want to log these events with the thread id they had on the master. This is so that several same-name temp tables simultaneously created on the master end up with not the same thread id in the slave's binlog. sql/log_event.h: Query and Load need to carry a slave_proxy_id, like they carried a thread_id (to replicate temp tables well). sql/slave.cc: Do not free temp tables in the slave SQL thread. Or they will be lost when one does STOP SLAVE / START SLAVE. We even save them in rli->save_temporary_tables and set thd->temporary_tables=0 to prevent them to be freed. sql/sql_base.cc: Put the server id in the table cache key name for temp tables (we already put the slave_proxy_id, but we also need the server id in case normal clients (not slave threads) are using temp tables on the slave). sql/unireg.h: 4 more bytes, to store the server id.
fcc29ff6