Bug #38197 Errors in @@init_slave not visible in 'show slave status'
Submitted: 17 Jul 2008 16:09 Modified: 6 May 16:40
Reporter: Sven Sandberg
Status: Closed
Category:Server: Replication Severity:S3 (Non-critical)
Version:5.1+, 5.1.28-bzr OS:Any
Assigned to: Alfranio Correia Target Version:5.1+
Tags: replication, init_slave, show slave status, error reporting, Slave_SQL_Error, rli->report, sql_print_error
Triage: Triaged: D3 (Medium)

[17 Jul 2008 16:09] Sven Sandberg
Description:
Some errors that cause the slave SQL thread to stop are not shown in the Slave_SQL_Error
column of "SHOW SLAVE STATUS". Instead, the error is only in the server's error log.

That makes it difficult to analyze the error for the user. In particular, when errors
happen in pushbuild, the server logs are often removed, whereas a slave that gets an
unexpected error usually issues "SHOW SLAVE STATUS" so that the error is part of the
output from the test.

One example of an error that stops the slave but is not shown by "SHOW SLAVE STATUS" is
when @@global.init_slave is set incorrectly (e.g., it contains something that is not
valid SQL).

How to repeat:
Either inspect the code or run this test case:

--------- BEGIN TEST CASE ---------
source include/master-slave.inc;

connection slave;

STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
# produce an error
SET @@global.init_slave = 'garbage';
START SLAVE;
source include/wait_for_slave_sql_to_stop.inc;

query_vertical SHOW SLAVE STATUS;

--------- END TEST CASE ---------

Suggested fix:
Replace calls to sql_print_error() by calls to rli->report() in
slave.cc:handle_slave_sql()
[19 Jul 2008 14:35] Valeriy Kravchuk
Thank you for a bug report. Verified just as described with latest 5.1.28 from bzr on
Linux.
[5 Feb 14:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/65337

2768 Alfranio Correia	2009-02-05
      BUG#38197 Errors in @@init_slave not visible in 'show slave status'
      
      Some errors that cause the slave SQL thread to stop are not shown in the
Slave_SQL_Error
      column of "SHOW SLAVE STATUS". Instead, the error is only in the server's error
log.
      
      That makes it difficult to analyze the error for the user. One example of an error
that stops the slave
      but is not shown by "SHOW SLAVE STATUS" is when @@global.init_slave is set
incorrectly
      (e.g., it contains something that is not valid SQL).
      
      Three failures were not correctly reported:
      
      1 - Failures during slave thread initialization
      2 - Failures while initializing the relay log position right after
      starting the slave thread.
      3 - Failures while processing queries passed through the init_slave
      option.
      
      This patch fixes the issues by reporting the errors through relay-info->report.
[11 Feb 12:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/65888

2768 Alfranio Correia	2009-02-11
      BUG#38197 Errors in @@init_slave not visible in 'show slave status'
            
      Some errors that cause the slave SQL thread to stop are not shown in the
      Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error is only 
      in the server's error log.
            
      That makes it difficult to analyze the error for the user. One example of an error
      that stops the slave but is not shown by "SHOW SLAVE STATUS" is when
@@global.init_slave
      is set incorrectly (e.g., it contains something that is not valid SQL).
            
      Three failures were not correctly reported:
            
      1 - Failures during slave thread initialization
      2 - Failures while initializing the relay log position right after
      starting the slave thread.
      3 - Failures while processing queries passed through the init_slave
      option.
            
      This patch fixes the issues by reporting the errors through relay-info->report.
[11 Mar 20:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/68946

2832 Alfranio Correia	2009-03-11 [merge]
      auto-merge BUG#38197 Errors in @@init_slave not visible in 'show slave status'
[12 Mar 1:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/68975

3112 Alfranio Correia	2009-03-12 [merge]
      merge 5.1-bugteam --> 6.0-bugteam BUG#38197 Errors in @@init_slave not visible in
'show slave status'
[5 May 21:39] Bugs System
Pushed into 5.1.35 (revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (version
source revid:davi.arnaut@sun.com-20090505190206-9xmh7dlc6kom8exp) (merge vers: 5.1.35)
(pib:6)
[6 May 14:26] Jon Stephens
Documented in the 5.1.35 changelog as follows:

        The following erors were not correctly reported:

              Failures during slave thread initialization

              Failures while initializing the relay log position
              right after starting the slave thread.

              Failures while processing queries passed through the
              init_slave option.

        Information about these types of failures can now be found in the 
        output of SHOW SLAVE STATUS.

Status -> NDI : waiting for merge to 6.0.
[6 May 16:06] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version
source revid:alfranio.correia@sun.com-20090406031810-k14c2nwvf8rikm3a) (merge vers:
6.0.11-alpha) (pib:6)
[6 May 16:40] Jon Stephens
Bugfix also noted in the 6.0.12 changelog. Closed.
[15 Jun 10:26] Bugs System
Pushed into 5.1.35-ndb-6.3.26 (revid:jonas@mysql.com-20090615074202-0r5r2jmi83tww6sf)
(version source revid:jonas@mysql.com-20090615070837-9pccutgc7repvb4d) (merge vers:
5.1.35-ndb-6.3.26) (pib:6)
[15 Jun 11:05] Bugs System
Pushed into 5.1.35-ndb-7.0.7 (revid:jonas@mysql.com-20090615074335-9hcltksp5cu5fucn)
(version source revid:jonas@mysql.com-20090615072714-rmfkvrbbipd9r32c) (merge vers:
5.1.35-ndb-7.0.7) (pib:6)
[15 Jun 11:46] Bugs System
Pushed into 5.1.35-ndb-6.2.19 (revid:jonas@mysql.com-20090615061520-sq7ds4yw299ggugm)
(version source revid:jonas@mysql.com-20090615054654-ebgpz7elwu1xj36j) (merge vers:
5.1.35-ndb-6.2.19) (pib:6)