-
Sujatha Sivakumar authored
WITHOUT FILE AND SQL_THD NOT STARTED Problem: ======== If, on an empty database: - CHANGE MASTER TO without a MASTER_FILE and MASTER_POS is used - the IO_THREAD is started WITHOUT starting the SQL_THREAD - MySQL crashed - MySQL is restarted with relay_log_recovery = 1. Crash recovery will not work as expected: - The IO_THREAD position will NOT be initialized to the SQL_THREAD position, - SQL_THREAD position will NOT be initialized to the new relay log. It looks like, when the SQL_THREAD does not have a Relay_Master_Log_File, relay_log_recovery does not work. Analysis: ======== When relay-log-recovery is set existing relay logs are ignored and IO_THREAD positions will be initialized to SQL_THREAD's positions and SQL_THREAD positions will be set to newly generated relay log. The old relay logs will be purged by the normal purge mechanism. There can be a special case where sql thread has never started all, in such case SQL_THREAD's positions will not be initialized. Existing recovery mechanism is tightly coupled with Relay_Master_Log_File's value if the file name is not set recovery will not happen. Fix: === During recovery if Relay_Master_Log_File is not set open the relaylog index file. Read the relay logs from the first relay log parse each of these files and look for Rotate event from the master which will specify from where replication has started. Extract master_log_file and master_log_pos from master's rotate event and set it as SQL_THREAD's Relay_Master_Log_File and position.
Sujatha Sivakumar authoredWITHOUT FILE AND SQL_THD NOT STARTED Problem: ======== If, on an empty database: - CHANGE MASTER TO without a MASTER_FILE and MASTER_POS is used - the IO_THREAD is started WITHOUT starting the SQL_THREAD - MySQL crashed - MySQL is restarted with relay_log_recovery = 1. Crash recovery will not work as expected: - The IO_THREAD position will NOT be initialized to the SQL_THREAD position, - SQL_THREAD position will NOT be initialized to the new relay log. It looks like, when the SQL_THREAD does not have a Relay_Master_Log_File, relay_log_recovery does not work. Analysis: ======== When relay-log-recovery is set existing relay logs are ignored and IO_THREAD positions will be initialized to SQL_THREAD's positions and SQL_THREAD positions will be set to newly generated relay log. The old relay logs will be purged by the normal purge mechanism. There can be a special case where sql thread has never started all, in such case SQL_THREAD's positions will not be initialized. Existing recovery mechanism is tightly coupled with Relay_Master_Log_File's value if the file name is not set recovery will not happen. Fix: === During recovery if Relay_Master_Log_File is not set open the relaylog index file. Read the relay logs from the first relay log parse each of these files and look for Rotate event from the master which will specify from where replication has started. Extract master_log_file and master_log_pos from master's rotate event and set it as SQL_THREAD's Relay_Master_Log_File and position.
Loading