Commit a8c14d9e authored by He Zhenxing's avatar He Zhenxing

Auto merge

parents d51bd444 3aae87ad
-- require r/have_ssl.require
disable_query_log;
show variables like 'have_ssl';
enable_query_log;
......@@ -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;
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
This diff is collapsed.
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
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
!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
#############################################################
# 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
!include ../my.cnf
[mysqld.1]
log-slave-updates
[mysqld.2]
log-slave-updates
This diff is collapsed.
#############################################################
# 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
--disable-log-slave-updates --replicate-same-server-id
# 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
......@@ -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;
......
......@@ -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;
......
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