Hi,

I am using replication on mysql-4.1(Master) to mysql-4.1(Slave). Suppose Master DB inserting queries in binary log file at master-bin.01 at position 100.

And on slave somehow replication is stopped.
mysql-slave> show slave status\G

Master_Host: master-ip-address
Master_Log_File: master-bin.01
Relay_Log_File: slave-relay.01
Slave_IO_Running: No
Slave_SQL_Running: No
Read_Master_Log_Pos: 100
Exec_Master__Log_Pos: 50

After fixing slave problem when i run following command

mysql> START SLAVE;

starts Slave IO_THREAD and Slave SQL_THREAD. Because slave io_thread started that's why new relay log file created slave-relay.02 and slave io_thread resumes to log queries after position 100 (Read_Master_Log_Pos: 100) to new relay file slave-relay.02 file like position 101,102 .... onwards.

Now my question is what happen when slave sql_thread executes queries. When replication stopped it executed queries till position 50 (Exec_Master__Log_Pos: 50). Either it starts executing queries from new relay file slave-relay.02 if it does so than queries are missed between position 50 to 100 on slave ?

Or slave sql_thread finishes queries first from old relay file (slave-relay.01) by executing queries in it and then executes queries from slave-relay.02 ?

Regards,
Muhammad Irfan