Bug #69294 Slave reading from impossible position error could be clearer
Submitted: 21 May 2013 16:20 Modified: 24 Jun 2013 20:19
Reporter: Morgan Tocker Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[21 May 2013 16:20] Morgan Tocker
Description:
When the power is cut to a MySQL master database server, it is typically the case that when it comes back online it will have slaves that are further ahead of it (because sync_binlog defaults to zero: http://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#sysvar_sync_bin... )

I was discussing this with a colleague, and we believe that the error message should be more verbose in indicating the common cause.

How to repeat:
mysql> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: n2i-prd2.cf2dydfxiush.us-east-1.rds.amazonaws.com
                  Master_User: rdsrepladmin
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin-changelog.226554
          Read_Master_Log_Pos: 2542793
               Relay_Log_File: relaylog.054194
                Relay_Log_Pos: 210
        Relay_Master_Log_File: mysql-bin-changelog.226554
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 2542793
              Relay_Log_Space: 141863
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'mysql-bin-changelog.226554' at 2542793, the last event read from '/rdsdbdata/log/binlog/mysql-bin-changelog.226554' at 4, the last byte read from '/rdsdbdata/log/binlog/mysql-bin-changelog.226554' at 4.'
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1566631948

Suggested fix:
Could be:

Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'mysql-bin-changelog.226554' at 2542793, the last event read from '/rdsdbdata/log/binlog/mysql-bin-changelog.226554' at 4, the last byte read from '/rdsdbdata/log/binlog/mysql-bin-changelog.226554' at 4.  Possible causes for this include a master server which recently crashed and did not have sync_binlog=1 enabled - leading to data loss on the master, which the slave has already applied.
[24 Jun 2013 20:19] MySQL Verification Team
Thank you for the bug report.