Bug #5363 slave does not recognise replication user gone from master
Submitted: 2 Sep 2004 6:46 Modified: 2 Sep 2004 10:32
Reporter: David Logan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:4.0.20 OS:Linux (RH Advanced Server 2.1)
Assigned to: CPU Architecture:Any

[2 Sep 2004 6:46] David Logan
Description:
Replication slave has not recognised that replication user has gone from master. Still shows status ok. Please see below.

If the replication user disappears off the master and the slave cannot log in, the Slave_IO_Thread still shows running and no error in the last error number field. I can't find any references to this in the doco and am not too sure if this is intended behaviour. I would have thought that last error should have shown 1045 and the IO thread would have stopped running.

This is MySQL 4.0.20 and RH Advanced Server 2.1

After deleting the user on the master, the following message appears in
the log but the slave status shows a healthy relationship.

40902 10:54:13  Slave I/O thread: error connecting to master
'repl@hpim202-98.aus.hp.com:3307': Error: 'Access denied for user:
'repl@blk-dhcp-174.aus.hp.com' (Using password: YES)'  errno: 1045

mysql> show slave status \G
*************************** 1. row **********
          Master_Host: hpim202-98.aus.hp.com
          Master_User: repl
          Master_Port: 3307
        Connect_retry: 60
      Master_Log_File: hpim202-98-bin.001
  Read_Master_Log_Pos: 913879
       Relay_Log_File: MAU023W-relay-bin.010
        Relay_Log_Pos: 305
Relay_Master_Log_File: hpim202-98-bin.001
     Slave_IO_Running: Yes
    Slave_SQL_Running: Yes
      Replicate_do_db:
  Replicate_ignore_db:
           Last_errno: 0
           Last_error:
         Skip_counter: 0
  Exec_master_log_pos: 913879
      Relay_log_space: 301
1 row in set (0.00 sec)

How to repeat:
set up replication between master and slave

stop slave

stop master
delete replication user from master
start master

start slave

Slave should still think things are going along fine.

Suggested fix:
Set last error field to error number and stop IO thread.
[2 Sep 2004 10:32] Guilhem Bichot
Hi David,
This is normal. The slave I/O thread is really running, that is, it is alive. It is spending time trying to connect to the master, as the message you showed says (with some sleep between retries, but it's still alive during the sleeps; alive in the sense that the thread exists).
You are right, SHOW SLAVE STATUS does not show things clearly in 4.0 (fixed in 4.1); please check here for more info:
http://dev.mysql.com/doc/mysql/en/Slave_I_O_thread_states.html