Bug #35702 setting SQL_SLAVE_SKIP_COUNTER does not work on solaris
Submitted: 31 Mar 2008 11:02 Modified: 30 Apr 2008 12:07
Reporter: Salman Rawala Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.1.22 OS:Solaris (Sun Solaris 10)
Assigned to: CPU Architecture:Any
Tags: master, replication, skip replication statement, slave, slave replication skip

[31 Mar 2008 11:02] Salman Rawala
Description:
The variable SQL_SLAVE_SKIP_COUNTER does not work on solaris 10 causing the statements to execute, which are not supposed to execute upon slave synchronization to client.

The statements given to reproduce this bug is supposed to be executed on mysql test suite.

How to repeat:
#
# Execute on master database
#

SET SESSION sql_log_bin = ON;

#
# Create tables
#

CREATE TABLE t1 (a int PRIMARY KEY);
CREATE TABLE t2 (a int PRIMARY KEY);

#
# Execute on slave database
#
STOP SLAVE SQL_THREAD;

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

START SLAVE;

#
# Take master snapshot and then sync with slave
#
save_master_pos;

#
# Execute on slave database
#

#
# Synchronizing slave with master
#
sync_with_master;

#
# t1 SHOULD NOT exist on the slave
#
SELECT * FROM t1;
-- this should result in an error as the slave should have skipped 1 statement.

Suggested fix:
Replication should skip number of statements equal to the value of SQL_SLAVE_SKIP_COUNTER variable.
[31 Mar 2008 12:07] Sveta Smirnova
Thank you for the report.

Please add select * from t1; between STOP SLAVE SQL_THREAD; and SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;:

STOP SLAVE SQL_THREAD;

select * from t1;

SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

Table can exists on slave before you run SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;

Also please note this statement skips the next N  events (not only queries) from the master. See also http://dev.mysql.com/doc/refman/5.1/en/set-global-sql-slave-skip-counter.html
[1 May 2008 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".