1# 2# Test of sql_slave_skip_counter and rpl_max_size 3# 4 5# Create a schema and a table i 6# on the 1st master 7 8--source include/not_embedded.inc 9--let $rpl_server_count= 0 10 11--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) 12 13--disable_warnings 14drop database if exists db; 15--enable_warnings 16create database db; 17create table db.this_will_not_be_replicated (i int) engine=MyISAM; 18create table db.t1 (i int) engine=MyISAM; 19create table db.t2 (i int) engine=MyISAM; 20--save_master_pos 21 22# Create the same schema and another table 23# on the 2nd master 24 25--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) 26 27--disable_warnings 28drop database if exists db; 29--enable_warnings 30create database db; 31create table db.t3 (i int) engine=MyISAM; 32 33--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) 34 35# Start replication from the first master 36 37--replace_result $SERVER_MYPORT_1 MYPORT_1 38eval change master 'master1' to 39master_port=$SERVER_MYPORT_1, 40master_host='127.0.0.1', 41master_user='root'; 42 43start slave 'master1'; 44set default_master_connection = 'master1'; 45--source include/wait_for_slave_to_start.inc 46--sync_with_master 0,'master1' 47 48# Start replication from the second master 49 50set default_master_connection = 'master2'; 51 52--replace_result $SERVER_MYPORT_2 MYPORT_2 53eval change master 'master2' to 54master_port=$SERVER_MYPORT_2, 55master_host='127.0.0.1', 56master_user='root'; 57 58# the schema creation will be replicated from the 1st master, 59# so we want to skip it in the second replication connection 60# The events we want to skip are: 61# 62# The start format statement event 63# drop database if exists db 64# create database db 65# Create table db.t1 66# - > 4 events in total 67 68--let $skip_counter_saved = `select @@global.sql_slave_skip_counter` 69--let $max_relay_log_size_saved= `select @@global.max_relay_log_size` 70--let $max_binlog_size_saved= `select @@global.max_binlog_size` 71set global sql_slave_skip_counter = 2; 72select @@global.sql_slave_skip_counter; 73select @@session.sql_slave_skip_counter; 74set session sql_slave_skip_counter = 3; 75select @@global.sql_slave_skip_counter; 76select @@session.sql_slave_skip_counter; 77set global sql_slave_skip_counter= default; 78select @@global.sql_slave_skip_counter; 79select @@session.sql_slave_skip_counter; 80set global sql_slave_skip_counter= 4; 81 82set default_master_connection = 'master1'; 83select @@session.sql_slave_skip_counter; 84set default_master_connection = 'qqq'; 85select @@session.sql_slave_skip_counter; 86set default_master_connection = 'master2'; 87select @@session.sql_slave_skip_counter; 88 89# Test of setting max_relay_log_size 90select @@global.max_relay_log_size; 91set global max_relay_log_size = 1*1024*1024; 92select @@global.max_relay_log_size; 93select @@session.max_relay_log_size; 94set session max_relay_log_size = 3*1024*1024; 95select @@global.max_relay_log_size; 96select @@session.max_relay_log_size; 97set global max_relay_log_size= default; 98select @@global.max_relay_log_size; 99select @@session.max_relay_log_size; 100set global max_relay_log_size= 3*1024*1024; 101set default_master_connection = 'master1'; 102select @@session.max_relay_log_size; 103set default_master_connection = 'qqq'; 104select @@session.max_relay_log_size; 105set default_master_connection = 'master2'; 106select @@session.max_relay_log_size; 107set global max_binlog_size= 4*1024*1024; 108select @@global.max_relay_log_size; 109 110start slave 'master2'; 111--source include/wait_for_slave_to_start.inc 112set default_master_connection = ''; 113 114--connection master2 115--save_master_pos 116 117--connection slave 118 119--sync_with_master 0,'master2' 120 121# If the skip_counter worked as expected, we should 122# get here (replication shouldn't have broken) 123# and should see both tables here 124# (drop database which came from master2 shouldn't have been executed 125# so t1 should still exist) 126 127show tables in db; 128 129# Cleanup 130 131drop database db; 132 133--eval set global sql_slave_skip_counter = $skip_counter_saved 134--eval set global max_relay_log_size = $max_relay_log_size_saved 135--eval set global max_binlog_size = $max_binlog_size_saved 136 137--source include/reset_master_slave.inc 138--disconnect slave 139 140--connection master1 141drop database db; 142--source include/reset_master_slave.inc 143--disconnect master1 144 145--connection master2 146drop database db; 147--source include/reset_master_slave.inc 148--disconnect master2 149 150