Commit 4c9cb95c authored by Serge Kozlov's avatar Serge Kozlov

Bug#43828, Bug#59494.

After introducing new way of initialization of replication the setting different heartbeat periods for slaves was missed.
Added asserts
parent 15d09994
...@@ -2,13 +2,21 @@ include/rpl_init.inc [topology=1->2,1->3] ...@@ -2,13 +2,21 @@ include/rpl_init.inc [topology=1->2,1->3]
include/rpl_connect.inc [creating master] include/rpl_connect.inc [creating master]
include/rpl_connect.inc [creating slave_1] include/rpl_connect.inc [creating slave_1]
include/rpl_connect.inc [creating slave_2] include/rpl_connect.inc [creating slave_2]
include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 0.1;
include/start_slave.inc
include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 1;
include/start_slave.inc
Slave has received heartbeat event Slave has received heartbeat event
slave_2 has received heartbeat event include/assert.inc [slave_1 should have received more heartbeats than slave_2]
slave_1 has received more heartbeats than slave_2 (1 means 'yes'): 0
include/rpl_stop_slaves.inc include/rpl_stop_slaves.inc
include/rpl_change_topology.inc [new topology=1->3->2] include/rpl_change_topology.inc [new topology=1->3->2]
include/rpl_start_slaves.inc include/rpl_start_slaves.inc
include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1;
include/start_slave.inc
slave_1 has received heartbeat event slave_1 has received heartbeat event
[on master] [on master]
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT);
...@@ -26,7 +34,7 @@ Tables_in_test ...@@ -26,7 +34,7 @@ Tables_in_test
[on master] [on master]
creating updates on master and send to slave_2 during 5 second creating updates on master and send to slave_2 during 5 second
[on slave_1] [on slave_1]
slave_1 has received heartbeats (1 means 'yes'): 0 include/assert.inc [slave_1 should have received heartbeats]
*** Clean up *** *** Clean up ***
DROP TABLE t1; DROP TABLE t1;
......
...@@ -20,7 +20,19 @@ ...@@ -20,7 +20,19 @@
--source include/rpl_connect.inc --source include/rpl_connect.inc
# #
# Testing heartbeat # Set different heartbeat periods for slaves
#
--connection slave_1
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 0.1;
--source include/start_slave.inc
--connection slave_2
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD = 1;
--source include/start_slave.inc
#
# Testing heartbeat for one master and two slaves
# #
# Check that heartbeat events sent to both slaves with correct periods # Check that heartbeat events sent to both slaves with correct periods
...@@ -35,15 +47,11 @@ let $status_var= slave_received_heartbeats; ...@@ -35,15 +47,11 @@ let $status_var= slave_received_heartbeats;
let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $status_var_comparsion= >; let $status_var_comparsion= >;
--source include/wait_for_status_var.inc --source include/wait_for_status_var.inc
let $slave_2_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); --let $assert_cond= [slave_1:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > [slave_2:SHOW STATUS LIKE "slave_received_heartbeats", Value, 1]
--echo slave_2 has received heartbeat event --let $assert_text= slave_1 should have received more heartbeats than slave_2
--connection slave_1 --source include/assert.inc
let $slave_1_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($slave_1_rcvd_heartbeats DIV $slave_2_rcvd_heartbeats) > 1 AS Result, Result, 1);
--echo slave_1 has received more heartbeats than slave_2 (1 means 'yes'): $result
--echo --echo
# Create topology master->slave_2->slave_1 and check that slave_1 # Create topology master->slave_2->slave_1 and check that slave_1
# receives heartbeat while slave_2 gets data. # receives heartbeat while slave_2 gets data.
...@@ -54,6 +62,10 @@ let $result= query_get_value(SELECT ($slave_1_rcvd_heartbeats DIV $slave_2_rcvd_ ...@@ -54,6 +62,10 @@ let $result= query_get_value(SELECT ($slave_1_rcvd_heartbeats DIV $slave_2_rcvd_
--let $rpl_topology= 1->3->2 --let $rpl_topology= 1->3->2
--source include/rpl_change_topology.inc --source include/rpl_change_topology.inc
--source include/rpl_start_slaves.inc --source include/rpl_start_slaves.inc
--connection slave_1
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1;
--source include/start_slave.inc
# Check heartbeat for new replication channel slave_2->slave # Check heartbeat for new replication channel slave_2->slave
let $status_var= slave_received_heartbeats; let $status_var= slave_received_heartbeats;
...@@ -93,8 +105,6 @@ while ($i) { ...@@ -93,8 +105,6 @@ while ($i) {
let $time_before = `SELECT NOW()`; let $time_before = `SELECT NOW()`;
} }
if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) { if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) {
--connection slave_1
let $slave_1_rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $i= 0; let $i= 0;
} }
--connection master --connection master
...@@ -104,8 +114,9 @@ while ($i) { ...@@ -104,8 +114,9 @@ while ($i) {
--enable_query_log --enable_query_log
--connection slave_1 --connection slave_1
--echo [on slave_1] --echo [on slave_1]
let $result= query_get_value(SELECT ($slave_1_rcvd_heartbeats_after - $slave_1_rcvd_heartbeats_before) > 0 AS Result, Result, 1); --let $assert_cond= [SHOW STATUS LIKE "slave_received_heartbeats", Value, 1] > $slave_1_rcvd_heartbeats_before
--echo slave_1 has received heartbeats (1 means 'yes'): $result --let $assert_text= slave_1 should have received heartbeats
--source include/assert.inc
--echo --echo
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment