summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/include/have_ssl_communication.inc4
-rw-r--r--mysql-test/r/sp_trans_log.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result55
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result304
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id_ignore.result46
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf17
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test142
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf7
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test536
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test54
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id_ignore.test114
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result4
15 files changed, 1311 insertions, 12 deletions
diff --git a/mysql-test/include/have_ssl_communication.inc b/mysql-test/include/have_ssl_communication.inc
new file mode 100644
index 00000000000..6f2d5587a75
--- /dev/null
+++ b/mysql-test/include/have_ssl_communication.inc
@@ -0,0 +1,4 @@
+-- require r/have_ssl.require
+disable_query_log;
+show variables like 'have_ssl';
+enable_query_log;
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
index 3eec6f70063..117f6de754a 100644
--- a/mysql-test/r/sp_trans_log.result
+++ b/mysql-test/r/sp_trans_log.result
@@ -14,15 +14,5 @@ end|
reset master|
insert into t2 values (bug23333(),1)|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-show binlog events from <binlog_start>|
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Table_map # # table_id: # (test.t1)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; ROLLBACK
-select count(*),@a from t1 /* must be 1,1 */|
-count(*) @a
-1 1
drop table t1,t2;
drop function if exists bug23333;
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result
new file mode 100644
index 00000000000..ecb7c62c488
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result
@@ -0,0 +1,55 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Preparing ***
+[on slave]
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG';
+include/start_slave.inc
+[on slave1]
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='MASTER_BINLOG';
+include/start_slave.inc
+
+*** 2 slaves ***
+Slave has received heartbeat event
+Slave1 has received heartbeat event
+Slave has received more heartbeats than Slave1 (1 means 'yes'): 1
+
+*** Master->data->Slave1->heartbeat->Slave: ***
+[on slave1]
+RESET MASTER;
+[on slave]
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE1_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='SLAVE1_BINLOG';
+include/start_slave.inc
+Slave has received heartbeat event
+[on master]
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on master', '');
+SHOW TABLES;
+Tables_in_test
+t1
+[on slave1]
+SHOW TABLES;
+Tables_in_test
+t1
+[on slave]
+SHOW TABLES;
+Tables_in_test
+[on master]
+creating updates on master and send to slave1 during 5 second
+[on slave]
+Slave has received heartbeats (1 means 'yes'): 1
+
+*** Clean up ***
+DROP TABLE t1;
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
new file mode 100644
index 00000000000..ddb2122c631
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -0,0 +1,304 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Preparing ***
+include/stop_slave.inc
+RESET SLAVE;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+RESET MASTER;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+SET @restore_event_scheduler=@@global.event_scheduler;
+
+*** Default value ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+slave_net_timeout/slave_heartbeat_timeout=2.0000
+RESET SLAVE;
+
+*** Reset slave affect ***
+SET @@global.slave_net_timeout=30;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+RESET SLAVE;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 15.000
+
+*** Default value if slave_net_timeout changed ***
+SET @@global.slave_net_timeout=50;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 25.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
+SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1;
+Warnings:
+Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Warning if updated slave_heartbeat_timeout > slave_net_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+RESET SLAVE;
+
+*** CHANGE MASTER statement only updates slave_heartbeat_period ***
+SET @@global.slave_net_timeout=20;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 20
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 5.000
+SET @@global.slave_net_timeout=2*@@global.slave_net_timeout;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 40
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 5.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+
+*** Update slave_net_timeout on master ***
+SET @@global.slave_net_timeout=500;
+SET @@global.slave_net_timeout=200;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
+include/start_slave.inc
+SHOW VARIABLES LIKE 'slave_net_timeout';
+Variable_name Value
+slave_net_timeout 200
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 100.000
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+
+*** Start/stop slave ***
+SET @@global.slave_net_timeout=100;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+include/start_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 20.000
+include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 20.000
+
+*** Reload slave ***
+SET @@global.slave_net_timeout=50;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+Reload slave
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 30.000
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+
+*** Disable heartbeat ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+include/start_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+RESET SLAVE;
+SELECT SLAVE_HEARTBEAT_TIMEOUT = 0 AS Result;
+Result
+0
+
+*** Min slave_heartbeat_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.001
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+Warnings:
+Warning 1624 The requested value for the heartbeat period is less than 1 msec. The period is reset to zero which means no heartbeats will be sending
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 0.000
+RESET SLAVE;
+
+*** Max slave_heartbeat_timeout ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+Warnings:
+Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout.
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+Variable_name Value
+Slave_heartbeat_period 4294967.000
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds
+RESET SLAVE;
+
+*** Misc incorrect values ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''-1'' at line 1
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''123abc'' at line 1
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1
+RESET SLAVE;
+
+*** Running slave ***
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+
+*** Stopped slave ***
+include/stop_slave.inc
+Number of received heartbeat events while slave stopped: 0
+
+*** Started slave ***
+include/start_slave.inc
+Heartbeat event received
+
+*** Stopped IO thread ***
+STOP SLAVE IO_THREAD;
+Number of received heartbeat events while io thread stopped: 0
+
+*** Started IO thread ***
+START SLAVE IO_THREAD;
+Heartbeat event received
+
+*** Stopped SQL thread ***
+STOP SLAVE SQL_THREAD;
+Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
+
+*** Started SQL thread ***
+START SLAVE SQL_THREAD;
+Heartbeat event received
+
+*** Stopped SQL thread by error ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on slave', NULL);
+INSERT INTO t1 VALUES (1, 'on master', NULL);
+Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
+include/stop_slave.inc
+DROP TABLE t1;
+
+*** Master send to slave ***
+CREATE EVENT e1
+ON SCHEDULE EVERY 1 SECOND
+DO
+BEGIN
+UPDATE test.t1 SET a = a + 1 WHERE a < 10;
+END|
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5;
+include/start_slave.inc
+SET @@global.event_scheduler=1;
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+SHOW STATUS LIKE 'slave_received_heartbeats';
+Variable_name Value
+Slave_received_heartbeats 0
+DELETE FROM t1;
+DROP EVENT e1;
+
+*** Flush logs on slave ***
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+DROP TABLE t1;
+RESET MASTER;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+include/start_slave.inc
+Heartbeat events are received while rotation of relay logs (1 means 'yes'): 1
+
+*** Compressed protocol ***
+SET @@global.slave_compressed_protocol=1;
+include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_compressed_protocol=1;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+SET @@global.slave_compressed_protocol=0;
+SET @@global.slave_compressed_protocol=0;
+
+*** Reset master ***
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+RESET MASTER;
+Heartbeat events are received after reset of master (1 means 'yes'): 1
+
+*** Reload master ***
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+include/start_slave.inc
+Heartbeat event received
+Reload master
+Heartbeat event received
+
+*** Circular replication ***
+RESET MASTER;
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
+include/stop_slave.inc
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG';
+RESET SLAVE;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='SLAVE_BINLOG';
+include/start_slave.inc
+INSERT INTO t1 VALUES(1, 'on master');
+include/start_slave.inc
+INSERT INTO t1 VALUES(2, 'on slave');
+SELECT * FROM t1 ORDER BY a;
+a b
+1 on master
+2 on slave
+SELECT * FROM t1 ORDER BY a;
+a b
+1 on master
+2 on slave
+Heartbeat event received on master
+Heartbeat event received on slave
+Slave has received more events than master (1 means 'yes'): 1
+
+*** Clean up ***
+include/stop_slave.inc
+DROP TABLE t1;
+include/stop_slave.inc
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
new file mode 100644
index 00000000000..42de3c459cb
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Heartbeat over SSL ***
+include/stop_slave.inc
+RESET SLAVE;
+CHANGE MASTER TO
+MASTER_HOST='127.0.0.1',
+MASTER_PORT=MASTER_PORT,
+MASTER_USER='root',
+MASTER_HEARTBEAT_PERIOD=0.1,
+MASTER_LOG_FILE='MASTER_BINLOG',
+MASTER_SSL=1,
+MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem',
+MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
+MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem';
+include/start_slave.inc
+Master_SSL_Allowed: Yes
+Heartbeat event has received
+
+*** Clean up ***
+
+End of 6.0 test
diff --git a/mysql-test/suite/rpl/r/rpl_server_id_ignore.result b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
new file mode 100644
index 00000000000..cba6571eb1a
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
@@ -0,0 +1,46 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+master_id: 1
+stop slave;
+*** --replicate-same-server-id and change master option can clash ***
+change master to IGNORE_SERVER_IDS= (2, 1);
+ERROR HY000: The requested server id 2 clashes with the slave startup option --replicate-same-server-id
+*** must be empty due to the error ***
+ignore server id list:
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** must be 10, 100 ***
+ignore server id list: 10, 100
+reset slave;
+*** must be empty due to reset slave ***
+ignore server id list: 10, 100
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup ***
+change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1);
+*** must be 1, 3, 4, 5 due to overriding policy ***
+ignore server id list: 1, 3, 4, 5
+*** ignore master (server 1) queries for a while ***
+start slave;
+create table t1 (n int);
+*** must be empty as the event is to be filtered out ***
+show tables;
+Tables_in_test
+*** allowing events from master ***
+stop slave;
+reset slave;
+change master to IGNORE_SERVER_IDS= (10, 100);
+*** the list must remain (10, 100) after reset slave ***
+change master to IGNORE_SERVER_IDS= ();
+*** must be empty due to IGNORE_SERVER_IDS empty list ***
+ignore server id list:
+change master to master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root';
+start slave;
+*** must have caught create table ***
+show tables;
+Tables_in_test
+t1
+drop table t1;
+end of the tests
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf
new file mode 100644
index 00000000000..a3ed77c8bd2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf
@@ -0,0 +1,17 @@
+!include ../my.cnf
+
+[mysqld.1]
+server_id=1
+
+[mysqld.2]
+server_id=2
+
+[mysqld.3]
+server_id=3
+
+[ENV]
+SLAVE_MYPORT1= @mysqld.3.port
+SLAVE_MYSOCK1= @mysqld.3.socket
+
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test
new file mode 100644
index 00000000000..81737feea9e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test
@@ -0,0 +1,142 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing heartbeat for schema
+# 1 master and 2 slaves
+#############################################################
+--source include/master-slave.inc
+--echo
+
+--echo *** Preparing ***
+--connection master
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--echo [on slave]
+--source include/stop_slave.inc
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+--disconnect slave1
+--connect(slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,)
+--connection slave1
+--echo [on slave1]
+--disable_warnings
+STOP SLAVE;
+--enable_warnings
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+--echo
+
+#
+# Testing heartbeat
+#
+
+# Check that heartbeat events sent to both slaves with correct periods
+--echo *** 2 slaves ***
+--connection slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Slave has received heartbeat event
+--connection slave1
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+let $slave1_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--echo Slave1 has received heartbeat event
+--connection slave
+let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $slave1_rcvd_heartbeats) > 1 AS Result, Result, 1);
+--echo Slave has received more heartbeats than Slave1 (1 means 'yes'): $result
+--echo
+
+
+# Create topology A->B->C and check that C receives heartbeat while B gets data
+# Slave1 (B) started w/o --log-slave-updates because B should not send data from A to C
+--echo *** Master->data->Slave1->heartbeat->Slave: ***
+--connection slave1
+--echo [on slave1]
+RESET MASTER;
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--echo [on slave]
+--source include/stop_slave.inc
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT1 SLAVE1_PORT $binlog_file SLAVE1_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT1, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='$binlog_file';
+--source include/start_slave.inc
+# Check heartbeat for new replication channel slave1->slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Slave has received heartbeat event
+--connection master
+--echo [on master]
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+INSERT INTO t1 VALUES (1, 'on master', '');
+--save_master_pos
+SHOW TABLES;
+--connection slave1
+--sync_with_master 0
+--echo [on slave1]
+SHOW TABLES;
+let $slave_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+--save_master_pos
+--connection slave
+--sync_with_master 0
+--echo [on slave]
+SHOW TABLES;
+--connection master
+--echo [on master]
+--echo creating updates on master and send to slave1 during 5 second
+# Generate events on master and send to slave1 during 5 second
+let $i= 1;
+let $j= 1;
+let $k= 1;
+--disable_query_log
+while ($i) {
+ eval SET @c_text=REPEAT('1234567890', $j);
+ eval UPDATE t1 SET a=$j, c=@c_text;
+ --connection slave1
+ let $slave_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
+ if (`SELECT ($k*($slave_pos - $slave_pos_before)) > 0`) {
+ --connection slave
+ let $slave_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+ let $k= 0;
+ let $time_before = `SELECT NOW()`;
+ }
+ if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) {
+ --connection slave
+ let $slave_rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+ let $i= 0;
+ }
+ --connection master
+ inc $j;
+ sleep 0.1;
+}
+--enable_query_log
+--connection slave
+--echo [on slave]
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats_after - $slave_rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Slave has received heartbeats (1 means 'yes'): $result
+--echo
+
+#
+# Clean up
+#
+--echo *** Clean up ***
+--connection master
+DROP TABLE t1;
+--save_master_pos
+--connection slave1
+--sync_with_master 0
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf
new file mode 100644
index 00000000000..a4a291bca79
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+
+[mysqld.2]
+log-slave-updates
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
new file mode 100644
index 00000000000..198f1208344
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -0,0 +1,536 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing basic functionality of heartbeat.
+# Description:
+# * Testing different values for slave_heartbeat_period.
+# * How to affect various statements to slave_heartbeat_period
+# * Various states of slave and heartbeat
+# * Various states of master and heartbeat
+# * Circular replication
+#############################################################
+--source include/master-slave.inc
+--echo
+
+--echo *** Preparing ***
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--disable_query_log
+eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout;
+--enable_query_log
+
+--connection master
+RESET MASTER;
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+SET @restore_event_scheduler=@@global.event_scheduler;
+--echo
+
+#
+# Test slave_heartbeat_period
+#
+
+--connection slave
+
+# Default value of slave_heartbeat_timeout = slave_net_timeout/2
+--echo *** Default value ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1);
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+let $result= query_get_value(SELECT $slave_net_timeout/$slave_heartbeat_timeout AS Result, Result, 1);
+--echo slave_net_timeout/slave_heartbeat_timeout=$result
+RESET SLAVE;
+--echo
+
+# Reset slave set slave_heartbeat_timeout = slave_net_timeout/2
+--echo *** Reset slave affect ***
+--disable_warnings
+SET @@global.slave_net_timeout=30;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+RESET SLAVE;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--echo
+
+# Check default value of slave_heartbeat_timeout if slave_net_timeout is changed
+--echo *** Default value if slave_net_timeout changed ***
+--disable_warnings
+SET @@global.slave_net_timeout=50;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Set slave_net_timeout less than current value of slave_heartbeat_period
+--echo *** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT
+eval SET @@global.slave_net_timeout=FLOOR($slave_heartbeat_timeout)-1;
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Set value of slave_heartbeat_period greater than slave_net_timeout
+--echo *** Warning if updated slave_heartbeat_timeout > slave_net_timeout ***
+let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1);
+inc $slave_net_timeout;
+--replace_result $MASTER_MYPORT MASTER_PORT $slave_net_timeout SLAVE_NET_TIMEOUT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=$slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Changing of slave_net_timeout shouldn't affect to current value of slave_heartbeat_period
+--echo *** CHANGE MASTER statement only updates slave_heartbeat_period ***
+--disable_warnings
+SET @@global.slave_net_timeout=20;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=2*@@global.slave_net_timeout;
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+RESET SLAVE;
+--echo
+
+# Master value of slave_net_timeout shouldn't affect to slave's slave_heartbeat_period
+--echo *** Update slave_net_timeout on master ***
+--connection master
+--disable_warnings
+SET @@global.slave_net_timeout=500;
+--enable_warnings
+--connection slave
+SET @@global.slave_net_timeout=200;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root';
+--source include/start_slave.inc
+--sync_with_master
+SHOW VARIABLES LIKE 'slave_net_timeout';
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--source include/stop_slave.inc
+RESET SLAVE;
+--connection master
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--echo
+
+# Start/stop slave shouldn't change slave_heartbeat_period
+--echo *** Start/stop slave ***
+--connection slave
+--disable_warnings
+SET @@global.slave_net_timeout=100;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20;
+--source include/start_slave.inc
+--sync_with_master
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--source include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+--echo
+
+# Reload slave shouldn't change slave_heartbeat_period
+--echo *** Reload slave ***
+--connection slave
+--disable_warnings
+SET @@global.slave_net_timeout=50;
+--enable_warnings
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30;
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+wait
+EOF
+--echo Reload slave
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SET @restore_slave_net_timeout=@@global.slave_net_timeout;
+--echo
+
+# Disable heartbeat
+--echo *** Disable heartbeat ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--source include/start_slave.inc
+--sync_with_master
+--sleep 2
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--source include/stop_slave.inc
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+SHOW STATUS LIKE 'slave_received_heartbeats';
+RESET SLAVE;
+let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
+--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT
+--eval SELECT $slave_heartbeat_timeout = 0 AS Result
+--echo
+
+#
+# Check limits for slave_heartbeat_timeout
+#
+
+--echo *** Min slave_heartbeat_timeout ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--echo
+
+--echo *** Max slave_heartbeat_timeout ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967;
+SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968;
+RESET SLAVE;
+# Check double size of max allowed value for master_heartbeat_period
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935;
+RESET SLAVE;
+# Check 2^32
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296;
+RESET SLAVE;
+--echo
+
+--echo *** Misc incorrect values ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc';
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_PARSE_ERROR
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='';
+RESET SLAVE;
+--echo
+
+#
+# Testing heartbeat
+#
+
+# Check received heartbeat events for running slave
+--echo *** Running slave ***
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+--sync_with_master
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped slave
+--echo *** Stopped slave ***
+--source include/stop_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1);
+--echo Number of received heartbeat events while slave stopped: $result
+--echo
+
+# Check received heartbeat events for started slave
+--echo *** Started slave ***
+--source include/start_slave.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped IO thread
+--echo *** Stopped IO thread ***
+STOP SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_stop.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1);
+--echo Number of received heartbeat events while io thread stopped: $result
+--echo
+
+# Check received heartbeat events for started IO thread
+--echo *** Started IO thread ***
+START SLAVE IO_THREAD;
+--source include/wait_for_slave_io_to_start.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat events for stopped SQL thread
+--echo *** Stopped SQL thread ***
+STOP SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_stop.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
+--echo
+
+# Check received heartbeat events for started SQL thread
+--echo *** Started SQL thread ***
+START SLAVE SQL_THREAD;
+--source include/wait_for_slave_sql_to_start.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Check received heartbeat event for stopped SQL thread by error
+--echo *** Stopped SQL thread by error ***
+--connection master
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
+--sync_slave_with_master
+INSERT INTO t1 VALUES (1, 'on slave', NULL);
+--connection master
+INSERT INTO t1 VALUES (1, 'on master', NULL);
+--connection slave
+let $slave_errno= ER_DUP_ENTRY
+--source include/wait_for_slave_sql_error.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+sleep 2;
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
+--source include/stop_slave.inc
+DROP TABLE t1;
+--echo
+
+# Check received heartbeat events while master send events to slave
+--echo *** Master send to slave ***
+--connection master
+# Create the event that will update table t1 every second
+DELIMITER |;
+CREATE EVENT e1
+ ON SCHEDULE EVERY 1 SECOND
+ DO
+ BEGIN
+ UPDATE test.t1 SET a = a + 1 WHERE a < 10;
+ END|
+DELIMITER ;|
+--connection slave
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5;
+--source include/start_slave.inc
+--connection master
+# Enable scheduler
+SET @@global.event_scheduler=1;
+--connection slave
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--sync_with_master
+# Wait some updates for table t1 from master
+let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
+--source include/wait_condition.inc
+SHOW STATUS LIKE 'slave_received_heartbeats';
+--connection master
+DELETE FROM t1;
+DROP EVENT e1;
+--echo
+
+# Check received heartbeat events while logs flushed on slave
+--connection slave
+--echo *** Flush logs on slave ***
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+--connection master
+DROP TABLE t1;
+RESET MASTER;
+--connection slave
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5;
+let $slave_param_comparison= =;
+--source include/start_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Flush logs every 0.1 second during 5 sec
+--disable_query_log
+let $i=50;
+while ($i) {
+ FLUSH LOGS;
+ dec $i;
+ sleep 0.1;
+}
+--enable_query_log
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received while rotation of relay logs (1 means 'yes'): $result
+--echo
+
+# Use compressed protocol between master and slave
+--echo *** Compressed protocol ***
+--connection master
+SET @@global.slave_compressed_protocol=1;
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+SET @@global.slave_compressed_protocol=1;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+SET @@global.slave_compressed_protocol=0;
+--connection master
+SET @@global.slave_compressed_protocol=0;
+--echo
+
+
+# Check received heartbeat events after reset of master
+--echo *** Reset master ***
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--connection master
+RESET MASTER;
+--enable_query_log
+--sync_slave_with_master
+--sleep 2
+let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
+--echo Heartbeat events are received after reset of master (1 means 'yes'): $result
+--echo
+
+# Reloaded master should restore heartbeat
+--echo *** Reload master ***
+--connection slave
+STOP SLAVE;
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1;
+--source include/start_slave.inc
+# Wait until slave_received_heartbeats will be incremented
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--connection master
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--echo Reload master
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--connection slave
+# Wait until slave_received_heartbeats will be incremented
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received
+--echo
+
+# Circular replication
+--echo *** Circular replication ***
+# Configure circular replication
+--connection master
+RESET MASTER;
+let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
+--sync_slave_with_master
+--source include/stop_slave.inc
+RESET MASTER;
+let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+RESET SLAVE;
+--replace_result $MASTER_MYPORT MASTER_PORT $master_binlog MASTER_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$master_binlog';
+--connection master
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog';
+--source include/start_slave.inc
+# Insert data on master and on slave and make sure that it replicated for both directions
+INSERT INTO t1 VALUES(1, 'on master');
+--save_master_pos
+--connection slave
+--source include/start_slave.inc
+--sync_with_master
+INSERT INTO t1 VALUES(2, 'on slave');
+--save_master_pos
+--connection master
+--sync_with_master
+SELECT * FROM t1 ORDER BY a;
+let $master_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+--connection slave
+SELECT * FROM t1 ORDER BY a;
+# Wait heartbeat event on master
+--connection master
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received on master
+let $master_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Wait heartbeat event on slave
+--connection slave
+let $status_var= slave_received_heartbeats;
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event received on slave
+let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+# Heartbeat period on slave less than on master therefore number of received events on slave
+# should be greater than on master
+let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $master_rcvd_heartbeats) > 1 AS Result, Result, 1);
+--echo Slave has received more events than master (1 means 'yes'): $result
+--echo
+
+#
+# Clean up and restore system variables
+#
+--echo *** Clean up ***
+--connection master
+--source include/stop_slave.inc
+DROP TABLE t1;
+--sync_slave_with_master
+--source include/stop_slave.inc
+SET @@global.slave_net_timeout=@restore_slave_net_timeout;
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
new file mode 100644
index 00000000000..6460b157b52
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
@@ -0,0 +1,54 @@
+#############################################################
+# Author: Serge Kozlov <Serge.Kozlov@Sun.COM>
+# Date: 02/19/2009
+# Purpose: Testing basic functionality of heartbeat over SSL
+#############################################################
+--source include/have_ssl_communication.inc
+--source include/master-slave.inc
+--echo
+
+#
+# Testing heartbeat over SSL
+#
+
+# Heartbeat over SSL
+--echo *** Heartbeat over SSL ***
+--connection master
+let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
+--connection slave
+--source include/stop_slave.inc
+RESET SLAVE;
+# Connect to master with SSL
+--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TEST_DIR MYSQL_TEST_DIR $master_binlog MASTER_BINLOG
+eval CHANGE MASTER TO
+ MASTER_HOST='127.0.0.1',
+ MASTER_PORT=$MASTER_MYPORT,
+ MASTER_USER='root',
+ MASTER_HEARTBEAT_PERIOD=0.1,
+ MASTER_LOG_FILE='$master_binlog',
+ MASTER_SSL=1,
+ MASTER_SSL_CA='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem';
+--source include/start_slave.inc
+# Check SSL state of slave
+let $slave_ssl_status= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
+--echo Master_SSL_Allowed: $slave_ssl_status
+# Wait until hearbeat event will received
+let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
+let $status_var= slave_received_heartbeats;
+let $status_var_comparsion= >;
+--source include/wait_for_status_var.inc
+--echo Heartbeat event has received
+--echo
+
+#
+# Clean up
+#
+--echo *** Clean up ***
+--connection master
+--sync_slave_with_master
+--echo
+
+# End of 6.0 test
+--echo End of 6.0 test
diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt
new file mode 100644
index 00000000000..302889525dd
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt
@@ -0,0 +1 @@
+--disable-log-slave-updates --replicate-same-server-id
diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
new file mode 100644
index 00000000000..1b38bd34d3d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
@@ -0,0 +1,114 @@
+# This test checks that the slave rejects events originating
+# by a server from the list of ignored originators (bug#27808 etc)
+#
+# phases of tests:
+#
+# 0. master_id new line in show slave status
+# 1. syntax related:
+# a. error reporting if options clash;
+# b. overriding the old IGNORE_SERVER_IDS setup by the following
+# CHANGE MASTER ... IGNORE_SERVER_IDS= (list);
+# c. the old setup preserving by CHANGE MASTER w/o IGNORE_SERVER_IDS
+# d. resetting the ignored server ids with the empty list arg to
+# IGNORE_SERVER_IDS=()
+# e. RESET SLAVE preserves the list
+# 2. run time related:
+# a. observing no processing events from a master listed in IGNORE_SERVER_IDS
+# b. nullifying the list and resuming of taking binlog from the very beginning with
+# executing events this time
+
+source include/master-slave.inc;
+
+connection slave;
+
+# a new line for master_id
+let $master_id= query_get_value(SHOW SLAVE STATUS, Master_Server_Id, 1);
+echo master_id: $master_id;
+
+stop slave;
+--echo *** --replicate-same-server-id and change master option can clash ***
+--error ER_SLAVE_IGNORE_SERVER_IDS
+change master to IGNORE_SERVER_IDS= (2, 1);
+--echo *** must be empty due to the error ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** must be 10, 100 ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+reset slave;
+--echo *** must be empty due to reset slave ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup ***
+change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1);
+--echo *** must be 1, 3, 4, 5 due to overriding policy ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+--echo *** ignore master (server 1) queries for a while ***
+start slave;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+let $slave_relay_pos0= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+
+connection master;
+create table t1 (n int);
+let $master_binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+connection slave;
+let $slave_param= Exec_Master_Log_Pos;
+let $slave_param_value= $master_binlog_end;
+source include/wait_for_slave_param.inc;
+--echo *** must be empty as the event is to be filtered out ***
+show tables;
+--echo *** allowing events from master ***
+let $slave_relay_pos1= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
+#
+# checking stability of relay log pos
+#
+if (`select $slave_relay_pos1 - $slave_relay_pos0`)
+{
+ --echo Error: relay log position changed: $slave_relay_pos0, $slave_relay_pos1
+ query_vertical show slave status;
+}
+
+stop slave;
+source include/wait_for_slave_to_stop.inc;
+reset slave;
+change master to IGNORE_SERVER_IDS= (10, 100);
+--echo *** the list must remain (10, 100) after reset slave ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+
+change master to IGNORE_SERVER_IDS= ();
+--echo *** must be empty due to IGNORE_SERVER_IDS empty list ***
+let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
+echo ignore server id list: $ignore_list;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root';
+start slave;
+
+connection master;
+
+#connection slave;
+sync_slave_with_master;
+--echo *** must have caught create table ***
+show tables;
+
+# cleanup
+connection master;
+drop table t1;
+#connection slave
+sync_slave_with_master;
+
+--echo end of the tests
+
+
+
+
+
+
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 86752fbc4b8..301f4c2e45b 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -299,6 +299,8 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+Replicate_Ignore_Server_Ids
+Master_Server_Id 1
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index f8eb5ebdd89..66eeaa6357c 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -26,11 +26,11 @@ stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-106 master-bin.000001
+107 master-bin.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
master_log_file = 'master-bin.000001',
-master_log_pos = 106 ;
+master_log_pos = 107 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;