mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
ec16d1b62f
Extend show_slave_status.inc to run SHOW ALL SLAVES STATUS and SHOW SLAVE 'name' STATUS on demand, and make the test use the include file instead of direct SHOW statements
205 lines
6.7 KiB
Text
205 lines
6.7 KiB
Text
change master 'abc' to relay_log_file='';
|
|
ERROR HY000: Failed initializing relay log position: Could not find target log during relay log initialization
|
|
change master 'abc2' to master_host='';
|
|
ERROR HY000: Incorrect arguments to MASTER_HOST
|
|
change master 'master1' to
|
|
master_port=MYPORT_1,
|
|
master_host='127.0.0.1',
|
|
master_user='root';
|
|
start slave 'master1';
|
|
set default_master_connection = 'master1';
|
|
include/wait_for_slave_to_start.inc
|
|
#
|
|
# Checking SHOW SLAVE 'master1' STATUS
|
|
#
|
|
Master_Port = 'MYPORT_1'
|
|
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Last_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
#
|
|
# Checking SHOW SLAVE STATUS
|
|
#
|
|
Master_Port = 'MYPORT_1'
|
|
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Last_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
#
|
|
# Checking SHOW ALL SLAVES STATUS
|
|
#
|
|
Connection_name = 'master1'
|
|
Master_Port = 'MYPORT_1'
|
|
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Last_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
Slave_heartbeat_period = '60.000'
|
|
#
|
|
drop database if exists db1;
|
|
create database db1;
|
|
use db1;
|
|
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
|
|
insert into t1 (f1) values ('one'),('two');
|
|
select * from db1.t1;
|
|
i f1
|
|
1 one
|
|
2 two
|
|
# List of relay log files in the datadir
|
|
mysqld-relay-bin-master1.000001
|
|
mysqld-relay-bin-master1.000002
|
|
mysqld-relay-bin-master1.index
|
|
show relaylog events;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
mysqld-relay-bin-master1.000001 4 Format_desc 3 248 Server version
|
|
mysqld-relay-bin-master1.000001 248 Rotate 3 306 mysqld-relay-bin-master1.000002;pos=4
|
|
show relaylog events in 'mysqld-relay-bin-master1.000002';
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
mysqld-relay-bin-master1.000002 4 Format_desc 3 248 Server version
|
|
mysqld-relay-bin-master1.000002 248 Rotate 1 0 master-bin.000001;pos=4
|
|
mysqld-relay-bin-master1.000002 292 Format_desc 1 248 Server version
|
|
mysqld-relay-bin-master1.000002 536 Gtid_list 1 273 []
|
|
mysqld-relay-bin-master1.000002 561 Binlog_checkpoint 1 313 master-bin.000001
|
|
mysqld-relay-bin-master1.000002 601 Gtid 1 351 GTID 0-1-1
|
|
mysqld-relay-bin-master1.000002 639 Query 1 440 drop database if exists db1
|
|
mysqld-relay-bin-master1.000002 728 Gtid 1 478 GTID 0-1-2
|
|
mysqld-relay-bin-master1.000002 766 Query 1 559 create database db1
|
|
mysqld-relay-bin-master1.000002 847 Gtid 1 597 GTID 0-1-3
|
|
mysqld-relay-bin-master1.000002 885 Query 1 750 use `db1`; create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM
|
|
mysqld-relay-bin-master1.000002 1038 Gtid 1 788 BEGIN GTID 0-1-4
|
|
mysqld-relay-bin-master1.000002 1076 Intvar 1 816 INSERT_ID=1
|
|
mysqld-relay-bin-master1.000002 1104 Query 1 920 use `db1`; insert into t1 (f1) values ('one'),('two')
|
|
mysqld-relay-bin-master1.000002 1208 Query 1 988 COMMIT
|
|
change master 'master1' to
|
|
master_port=MYPORT_2,
|
|
master_host='127.0.0.1',
|
|
master_user='root';
|
|
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
|
|
change master to
|
|
master_port=MYPORT_2,
|
|
master_host='127.0.0.1',
|
|
master_user='root';
|
|
ERROR HY000: This operation cannot be performed as you have a running slave 'master1'; run STOP SLAVE 'master1' first
|
|
change master 'master2' to
|
|
master_port=MYPORT_1,
|
|
master_host='127.0.0.1',
|
|
master_user='root';
|
|
ERROR HY000: Connection 'master2' conflicts with existing connection 'master1'
|
|
set default_master_connection = '';
|
|
change master to
|
|
master_port=MYPORT_2,
|
|
master_host='127.0.0.1',
|
|
master_user='root';
|
|
start slave;
|
|
include/wait_for_slave_to_start.inc
|
|
#
|
|
# Checking SHOW ALL SLAVES STATUS
|
|
#
|
|
Connection_name = ''
|
|
Connection_name = 'master1'
|
|
Master_Port = 'MYPORT_2'
|
|
Master_Port = 'MYPORT_1'
|
|
Relay_Log_File = 'mysqld-relay-bin.000002'
|
|
Relay_Log_File = 'mysqld-relay-bin-master1.000002'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Last_Errno = '0'
|
|
Last_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
Slave_heartbeat_period = '60.000'
|
|
Slave_heartbeat_period = '60.000'
|
|
#
|
|
insert into t1 (f1) values ('three');
|
|
drop database if exists db2;
|
|
create database db2;
|
|
use db2;
|
|
create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB;
|
|
begin;
|
|
insert into t1 (f1) values (1),(2);
|
|
select * from db1.t1;
|
|
i f1
|
|
1 one
|
|
2 two
|
|
3 three
|
|
select * from db2.t1;
|
|
pk f1
|
|
commit;
|
|
select * from db2.t1;
|
|
pk f1
|
|
1 1
|
|
2 2
|
|
flush logs;
|
|
purge binary logs to 'master-bin.000002';
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000002 367
|
|
insert into t1 (f1) values ('four');
|
|
create table db1.t3 (f1 int) engine=InnoDB;
|
|
#
|
|
# Checking SHOW ALL SLAVES STATUS
|
|
#
|
|
Connection_name = ''
|
|
Connection_name = 'master1'
|
|
Master_Port = 'MYPORT_2'
|
|
Master_Port = 'MYPORT_1'
|
|
Relay_Log_File = 'mysqld-relay-bin.000002'
|
|
Relay_Log_File = 'mysqld-relay-bin-master1.000004'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_IO_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Slave_SQL_Running = 'Yes'
|
|
Last_Errno = '0'
|
|
Last_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
Last_SQL_Errno = '0'
|
|
Slave_heartbeat_period = '60.000'
|
|
Slave_heartbeat_period = '60.000'
|
|
#
|
|
select * from db1.t1;
|
|
i f1
|
|
1 one
|
|
2 two
|
|
3 three
|
|
4 four
|
|
show relaylog events;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
mysqld-relay-bin.000001 4 Format_desc 3 248 Server version
|
|
mysqld-relay-bin.000001 248 Rotate 3 298 mysqld-relay-bin.000002;pos=4
|
|
show relaylog events in 'mysqld-relay-bin.000002';
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
mysqld-relay-bin.000002 4 Format_desc 3 248 Server version
|
|
mysqld-relay-bin.000002 248 Rotate 2 0 master-bin.000001;pos=4
|
|
mysqld-relay-bin.000002 292 Format_desc 2 248 Server version
|
|
mysqld-relay-bin.000002 536 Gtid_list 2 273 []
|
|
mysqld-relay-bin.000002 561 Binlog_checkpoint 2 313 master-bin.000001
|
|
mysqld-relay-bin.000002 601 Gtid 2 351 GTID 0-2-1
|
|
mysqld-relay-bin.000002 639 Query 2 440 drop database if exists db2
|
|
mysqld-relay-bin.000002 728 Gtid 2 478 GTID 0-2-2
|
|
mysqld-relay-bin.000002 766 Query 2 559 create database db2
|
|
mysqld-relay-bin.000002 847 Gtid 2 597 GTID 0-2-3
|
|
mysqld-relay-bin.000002 885 Query 2 732 use `db2`; create table t1 (pk int auto_increment primary key, f1 int) engine=InnoDB
|
|
mysqld-relay-bin.000002 1020 Gtid 2 770 BEGIN GTID 0-2-4
|
|
mysqld-relay-bin.000002 1058 Intvar 2 798 INSERT_ID=1
|
|
mysqld-relay-bin.000002 1086 Query 2 894 use `db2`; insert into t1 (f1) values (1),(2)
|
|
mysqld-relay-bin.000002 1182 Xid 2 921 COMMIT /* xid=<num> */
|
|
stop slave io_thread;
|
|
show status like 'Slave_running';
|
|
Variable_name Value
|
|
Slave_running OFF
|
|
set default_master_connection = 'master1';
|
|
show status like 'Slave_running';
|
|
Variable_name Value
|
|
Slave_running ON
|
|
drop database db1;
|
|
drop database db2;
|
|
include/reset_master_slave.inc
|
|
drop database db1;
|
|
include/reset_master_slave.inc
|
|
drop database db2;
|
|
include/reset_master_slave.inc
|