mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '12.0' into 12.1
This commit is contained in:
158
mysql-test/suite/rpl/r/rpl_create_select_row.result
Normal file
158
mysql-test/suite/rpl/r/rpl_create_select_row.result
Normal file
@@ -0,0 +1,158 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection master;
|
||||
set @max_binlog_cache_size = @@global.max_binlog_cache_size;
|
||||
set @binlog_cache_size = @@global.binlog_cache_size;
|
||||
set @@global.max_binlog_cache_size = 4096;
|
||||
set @@global. binlog_cache_size = 4096;
|
||||
#
|
||||
# MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert
|
||||
#
|
||||
connect conn_err,localhost,root,,;
|
||||
call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
|
||||
create table t engine=myisam select repeat ('a',4096*3) AS a;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
create table t engine=innodb select repeat ('a',4096*3) AS a;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
|
||||
ERROR 23000: Duplicate entry '1' for key 'a'
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
disconnect conn_err;
|
||||
connection master;
|
||||
|
||||
#
|
||||
# MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog
|
||||
#
|
||||
#
|
||||
# Engine = innodb
|
||||
#
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=innodb select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',4096*3) AS a;;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
#
|
||||
# Engine = myisam
|
||||
#
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=myisam select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',4096*3) AS a;;
|
||||
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
|
||||
select * from t;
|
||||
ERROR 42S02: Table 'test.t' doesn't exist
|
||||
#
|
||||
# Prove an expected lonely `DROP table t'
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
|
||||
master-bin.000001 # Query # # ROLLBACK
|
||||
create table ti_pk (a int primary key) engine=innodb;
|
||||
create table ta (a int) engine=aria;
|
||||
create function f_ia(arg int)
|
||||
returns integer
|
||||
begin
|
||||
insert into ti_pk set a=1;
|
||||
insert into ta set a=1;
|
||||
insert into ti_pk set a=arg;
|
||||
return 1;
|
||||
end |
|
||||
set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t_y;
|
||||
ERROR 42S02: Table 'test.t_y' doesn't exist
|
||||
# correct execution: `ta` is modified and its new record is binlogged
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Table_map # # table_id: # (test.ta)
|
||||
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
select * from ta;
|
||||
a
|
||||
1
|
||||
select * from ti_pk;
|
||||
a
|
||||
connection slave;
|
||||
include/diff_tables.inc [master:ta,slave:ta]
|
||||
connection master;
|
||||
delete from ta;
|
||||
connection slave;
|
||||
connection master;
|
||||
set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t_y;
|
||||
ERROR 42S02: Table 'test.t_y' doesn't exist
|
||||
# ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged
|
||||
include/show_binlog_events.inc
|
||||
select *,'on_master' from ta;
|
||||
a on_master
|
||||
1 on_master
|
||||
select * from ti_pk;
|
||||
a
|
||||
connection slave;
|
||||
select *,'on_slave' from ta;
|
||||
a on_slave
|
||||
connection master;
|
||||
drop function f_ia;
|
||||
drop table ti_pk, ta;
|
||||
SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
|
||||
SET @@global. binlog_cache_size = @binlog_cache_size;
|
||||
connection slave;
|
||||
End of the tests
|
||||
include/rpl_end.inc
|
@@ -51,6 +51,11 @@ master_pos_wait('master-bin.000001',1000000,1,"my_slave")
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
|
||||
select master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE");
|
||||
master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE")
|
||||
-1
|
||||
Warnings:
|
||||
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
|
||||
STOP SLAVE 'my_slave';
|
||||
RESET SLAVE 'my_slave' ALL;
|
||||
change master to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';
|
||||
|
@@ -0,0 +1,41 @@
|
||||
# Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
|
||||
connection slave;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
connection slave;
|
||||
connection master;
|
||||
SELECT ID INTO @binlog_dump_tid
|
||||
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
|
||||
# Control State
|
||||
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
|
||||
STATE
|
||||
Master has sent all binlog to slave; waiting for more updates
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 1
|
||||
# Disable Semi-Sync while the dump thread is still connected to its slave
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
|
||||
STATE
|
||||
Master has sent all binlog to slave; waiting for more updates
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 1
|
||||
# Disconnect the slave and wait until the master's dump thread is gone
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 0
|
||||
# Cleanup
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= 0;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1;
|
||||
connection slave;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
|
||||
include/rpl_end.inc
|
53
mysql-test/suite/rpl/r/rpl_semi_sync_ssl_stop.result
Normal file
53
mysql-test/suite/rpl/r/rpl_semi_sync_ssl_stop.result
Normal file
@@ -0,0 +1,53 @@
|
||||
# Skip starting the slave because we manually start with SSL later
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
#
|
||||
# Setup
|
||||
connection master;
|
||||
CREATE USER replssl@localhost;
|
||||
GRANT REPLICATION SLAVE on *.* to replssl@localhost REQUIRE SSL;
|
||||
set @orig_master_enabled= @@GLOBAL.rpl_semi_sync_master_enabled;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
|
||||
connection slave;
|
||||
CHANGE MASTER TO
|
||||
master_user='replssl',
|
||||
master_password='',
|
||||
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';
|
||||
set @orig_slave_enabled= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
# Verify Semi-Sync is active
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_master_clients 1
|
||||
# Create some table so slave can be seen as up-to-date and working
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT);
|
||||
connection slave;
|
||||
# Disconnect the slave and wait until the master's dump thread is gone
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
# MDEV-36663: Verifying dump thread connection is killed..
|
||||
# ..done
|
||||
# Cleanup
|
||||
connection master;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= @orig_master_enabled;
|
||||
DROP USER replssl@localhost;
|
||||
DROP TABLE t1;
|
||||
connection slave;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @orig_slave_enabled;
|
||||
CHANGE MASTER TO
|
||||
master_user='root',
|
||||
master_ssl=1,
|
||||
master_ssl_ca='',
|
||||
master_ssl_cert='',
|
||||
master_ssl_key='';
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
include/rpl_end.inc
|
||||
# End of rpl_semi_sync_ssl_stop.inc
|
161
mysql-test/suite/rpl/t/rpl_create_select_row.test
Normal file
161
mysql-test/suite/rpl/t/rpl_create_select_row.test
Normal file
@@ -0,0 +1,161 @@
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--connection master
|
||||
set @max_binlog_cache_size = @@global.max_binlog_cache_size;
|
||||
set @binlog_cache_size = @@global.binlog_cache_size;
|
||||
set @@global.max_binlog_cache_size = 4096;
|
||||
set @@global. binlog_cache_size = 4096;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert
|
||||
--echo #
|
||||
# fix the current (write) binlog position
|
||||
--let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
|
||||
# use a separate connection also to validate its close will be clean
|
||||
connect (conn_err,localhost,root,,);
|
||||
|
||||
call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
create table t engine=myisam select repeat ('a',4096*3) AS a;
|
||||
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
create table t engine=innodb select repeat ('a',4096*3) AS a;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t;
|
||||
|
||||
--disconnect conn_err
|
||||
|
||||
--connection master
|
||||
--let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
|
||||
--let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0`
|
||||
if (!$cmp)
|
||||
{
|
||||
--echo *** Error: unexpected advance of binlog position
|
||||
--die
|
||||
}
|
||||
|
||||
--echo
|
||||
--echo #
|
||||
--echo # MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog
|
||||
--echo #
|
||||
--let $i = 2
|
||||
while ($i)
|
||||
{
|
||||
--let $engine=`select if($i % 2, "myisam", "innodb")`
|
||||
--echo #
|
||||
--echo # Engine = $engine
|
||||
--echo #
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--error ER_DUP_ENTRY
|
||||
--eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t;
|
||||
--echo #
|
||||
--echo # Prove an expected lonely `DROP table t'
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# error before stmt commit
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t;
|
||||
--echo #
|
||||
--echo # Prove an expected lonely `DROP table t'
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# error at stmt commit
|
||||
set statement binlog_format=statement for create table t (a int) select 1 as a;
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--error ER_TRANS_CACHE_FULL
|
||||
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t;
|
||||
--echo #
|
||||
--echo # Prove an expected lonely `DROP table t'
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
--dec $i
|
||||
}
|
||||
|
||||
# Tests of mixed engines to demonstrate non-transaction table updates
|
||||
# are binlogged or otherwise MDEV-36027.
|
||||
create table ti_pk (a int primary key) engine=innodb;
|
||||
create table ta (a int) engine=aria;
|
||||
delimiter |;
|
||||
create function f_ia(arg int)
|
||||
returns integer
|
||||
begin
|
||||
insert into ti_pk set a=1;
|
||||
insert into ta set a=1;
|
||||
insert into ti_pk set a=arg;
|
||||
return 1;
|
||||
end |
|
||||
delimiter ;|
|
||||
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t_y;
|
||||
|
||||
--echo # correct execution: `ta` is modified and its new record is binlogged
|
||||
--source include/show_binlog_events.inc
|
||||
select * from ta;
|
||||
select * from ti_pk;
|
||||
|
||||
--sync_slave_with_master
|
||||
--let $diff_tables=master:ta,slave:ta
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--connection master
|
||||
delete from ta;
|
||||
--sync_slave_with_master
|
||||
|
||||
--connection master
|
||||
# MDEV-36027 Errored-out CREATE-SELECT does not binlog results of any function modifying non-transactional table
|
||||
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||
--error ER_DUP_ENTRY
|
||||
set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t_y;
|
||||
|
||||
--echo # ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged
|
||||
--source include/show_binlog_events.inc
|
||||
select *,'on_master' from ta;
|
||||
select * from ti_pk;
|
||||
|
||||
--sync_slave_with_master
|
||||
select *,'on_slave' from ta;
|
||||
|
||||
# Cleanup
|
||||
--connection master
|
||||
drop function f_ia;
|
||||
drop table ti_pk, ta;
|
||||
|
||||
SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
|
||||
SET @@global. binlog_cache_size = @binlog_cache_size;
|
||||
|
||||
# test that binlog replicates correctly to slave
|
||||
# --connection slave
|
||||
--sync_slave_with_master
|
||||
|
||||
--echo End of the tests
|
||||
--source include/rpl_end.inc
|
@@ -48,6 +48,7 @@ select master_pos_wait('master-bin.000001',1000000,1);
|
||||
|
||||
--echo # Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
|
||||
select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
|
||||
select master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE");
|
||||
|
||||
STOP SLAVE 'my_slave';
|
||||
RESET SLAVE 'my_slave' ALL;
|
||||
|
@@ -0,0 +1,68 @@
|
||||
# MDEV-36359: Master crashes when reverting to async after Semi-Sync disabled.
|
||||
#
|
||||
# Assert behavior of turning Semi-Sync off on
|
||||
# the master when still connected to a slave
|
||||
|
||||
--source include/have_binlog_format_mixed.inc # format-agnostic
|
||||
|
||||
--echo # Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
|
||||
--let $rpl_skip_start_slave= 1
|
||||
--source include/master-slave.inc
|
||||
|
||||
--let $orig_master_enabled=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
|
||||
--let $orig_wait_no_slave=`SELECT @@GLOBAL.rpl_semi_sync_master_wait_no_slave`
|
||||
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
|
||||
|
||||
--connection slave
|
||||
--let $orig_slave_enabled=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection master
|
||||
# Make sure Semi-Sync is active
|
||||
--let $status_var= Rpl_semi_sync_master_status
|
||||
--let $status_var_value= ON
|
||||
--source include/wait_for_status_var.inc
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection master
|
||||
|
||||
--disable_cursor_protocol
|
||||
SELECT ID INTO @binlog_dump_tid
|
||||
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
|
||||
--enable_cursor_protocol
|
||||
|
||||
--echo # Control State
|
||||
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
|
||||
--echo # Disable Semi-Sync while the dump thread is still connected to its slave
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
|
||||
--let $status_var_value= OFF
|
||||
--source include/wait_for_status_var.inc
|
||||
|
||||
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
|
||||
--echo # Disconnect the slave and wait until the master's dump thread is gone
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
# Starting with MDEV-13073,
|
||||
# Semi-Sync STOP SLAVE also terminates its dump thread on the master.
|
||||
--connection master
|
||||
|
||||
# MDEV-36359: The disconnection would crash the master and leave the wait with
|
||||
# error 2013 'Lost connection to server during query'
|
||||
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid
|
||||
--source include/wait_condition.inc
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
|
||||
--echo # Cleanup
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $orig_master_enabled
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave
|
||||
--connection slave
|
||||
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $orig_slave_enabled
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
100
mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test
Normal file
100
mysql-test/suite/rpl/t/rpl_semi_sync_ssl_stop.test
Normal file
@@ -0,0 +1,100 @@
|
||||
#
|
||||
# This test verifies that semi-sync setups configured to use SSL can kill
|
||||
# the replication connection when the IO thread is stopped (e.g. from
|
||||
# STOP SLAVE). The way it should happen, is that the IO thread creates a new
|
||||
# connection to the primary which issues KILL on the connection id of the
|
||||
# replication connection. MDEV-36663 reported an issue where this new
|
||||
# kill-oriented connection could not connect to a primary when it requires
|
||||
# connections to use SSL.
|
||||
#
|
||||
# This test sets up a semi-sync SSL master-slave topology, and stops the
|
||||
# slave IO thread. It then validates that the connection was killed by using
|
||||
# the wait_condition.inc utility to wait for the binlog dump thread to die,
|
||||
# and also validates that the status variable Rpl_semi_sync_master_clients
|
||||
# reports as 0.
|
||||
#
|
||||
# References:
|
||||
# MDEV-36663: Semi-sync Replica Can't Kill Dump Thread When Using SSL
|
||||
#
|
||||
--source include/have_binlog_format_mixed.inc # format-agnostic
|
||||
--source include/have_ssl_communication.inc
|
||||
|
||||
--echo # Skip starting the slave because we manually start with SSL later
|
||||
--let $rpl_skip_start_slave= 1
|
||||
--source include/master-slave.inc
|
||||
|
||||
--echo #
|
||||
--echo # Setup
|
||||
--connection master
|
||||
CREATE USER replssl@localhost;
|
||||
GRANT REPLICATION SLAVE on *.* to replssl@localhost REQUIRE SSL;
|
||||
|
||||
set @orig_master_enabled= @@GLOBAL.rpl_semi_sync_master_enabled;
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
|
||||
|
||||
--connection slave
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval CHANGE MASTER TO
|
||||
master_user='replssl',
|
||||
master_password='',
|
||||
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';
|
||||
|
||||
set @orig_slave_enabled= @@GLOBAL.rpl_semi_sync_slave_enabled;
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
|
||||
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection master
|
||||
--echo # Verify Semi-Sync is active
|
||||
--let $status_var= Rpl_semi_sync_master_clients
|
||||
--let $status_var_value= 1
|
||||
--source include/wait_for_status_var.inc
|
||||
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
|
||||
|
||||
--echo # Create some table so slave can be seen as up-to-date and working
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT);
|
||||
--sync_slave_with_master
|
||||
|
||||
--echo # Disconnect the slave and wait until the master's dump thread is gone
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
--connection master
|
||||
|
||||
--echo # MDEV-36663: Verifying dump thread connection is killed..
|
||||
# Prior to MDEV-36663 fixes, this would time out and
|
||||
# Rpl_semi_sync_master_clients would remain 1.
|
||||
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE USER = 'replssl'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--let $n_master_clients= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_master_clients', Value, 1)
|
||||
if ($n_master_clients)
|
||||
{
|
||||
--echo # Rpl_semi_sync_master_clients: $n_master_clients
|
||||
--die Semi-sync dump thread connection not killed
|
||||
}
|
||||
--echo # ..done
|
||||
|
||||
--echo # Cleanup
|
||||
--connection master
|
||||
SET @@GLOBAL.rpl_semi_sync_master_enabled= @orig_master_enabled;
|
||||
DROP USER replssl@localhost;
|
||||
DROP TABLE t1;
|
||||
|
||||
--connection slave
|
||||
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @orig_slave_enabled;
|
||||
CHANGE MASTER TO
|
||||
master_user='root',
|
||||
master_ssl=1,
|
||||
master_ssl_ca='',
|
||||
master_ssl_cert='',
|
||||
master_ssl_key='';
|
||||
|
||||
--connection slave
|
||||
--source include/start_slave.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
--echo # End of rpl_semi_sync_ssl_stop.inc
|
Reference in New Issue
Block a user