Description:
I am not sure if this is a bug, as technically it is the correct behaviour. however look how the following 2 cases compare:
executing a optimize or analyze on the server and killing the client before the statement finishes. the server will fail to write the resultrows to the client, and log the query with a 1160 error (net_write) to the binlog (note that the optimize or analyze has been succesfully executed)
the slave will execute the same command, since it cannot fail on the client-disconnect, it will get a different result code and stop execution
BUT
executing a "create table x select a from x2;" and killing the client before the statement finishes, will not result in an error on the server. the client will continue to run
(the server version only matters for the master, the client can be any 4 version)
How to repeat:
# set up a mysql replication
# on the server
create table x1 (a varchar(20));
# add some 1000 rows; and indexes so optimize takes longer
optimize table x1;
# kill your client, before the server finishes
#wait for the statement to finish: mysqladmin proc
#on the slave
show slave status;
#there will be an error
#### but
#on the server
create table x2 select * from x1;
# kill your client, before the server finishes
#wait for the statement to finish: mysqladmin proc
#on the slave
show slave status;
#there will be NO error
Suggested fix:
- make optmize not log this error, or make the slave knowing about this error (or a new dedicated error) so replication doesnt stop
- or please document it, as specialy optimize can run a long time, and a client could easily loose connection