mariadb/mysql-test/suite/rpl/t/rpl_gtid_ignored.test
Michael Widenius d6d63f4844 MDEV-16421 Make system tables crash safe
Make all system tables in mysql directory of type
engine=Aria

Privilege tables are using transactional=1
Statistical tables are using transactional=0, to allow them
to be quickly updated with low overhead.
Help tables are also using transactional=0 as these are only
updated at init time.

Other changes:
- Aria store engine is now a required engine
- Update comment for Aria tables to reflect their new usage
- Fixed that _ma_reset_trn_for_table() removes unlocked table
  from transaction table list. This was needed to allow one
  to lock and unlock system tables separately from other
  tables, for example when reading a procedure from mysql.proc
- Don't give a warning when using transactional=1 for engines
  that is using transactions. This is both logical and also
  to avoid warnings/errors when doing an alter of a privilege
  table to InnoDB.
- Don't abort on warnings from ALTER TABLE for changes that
  would be accepted by CREATE TABLE.
- New created Aria transactional tables are marked as not movable
  (as they include create_rename_lsn).
- bootstrap.test was changed to kill orignal server, as one
  can't anymore have two servers started at same time on same
  data directory and data files.
- Disable maria.small_blocksize as one can't anymore change
  aria block size after system tables are created.
- Speed up creation of help tables by using lock tables.
- wsrep_sst_resync now also copies Aria redo logs.
2018-08-14 12:18:38 +03:00

141 lines
4.3 KiB
Text

--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
SET @old_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
--connection server_2
--source include/stop_slave.inc
SET @old_gtid_strict_mode= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode=1;
CHANGE MASTER TO master_use_gtid=slave_pos;
--source include/start_slave.inc
--connection server_1
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--save_master_pos
--connection server_2
--sync_with_master
--echo **** MDEV-4488: GTID position should be updated for events that are ignored due to server id ***
--source include/stop_slave.inc
CHANGE MASTER TO ignore_server_ids=(1);
--source include/start_slave.inc
--connection server_1
# These inserts should be ignored (not applied) on the slave, but the
# gtid_slave_pos should still be updated.
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
--save_master_pos
--let gtid_pos=`SELECT @@GLOBAL.gtid_binlog_pos`
--connection server_2
--sync_with_master
--let $wait_condition= SELECT @@GLOBAL.gtid_slave_pos = '$gtid_pos'
--source include/wait_condition.inc
--disable_query_log
eval SELECT IF(@@GLOBAL.gtid_slave_pos = '$gtid_pos', 'OK', CONCAT("ERROR: Expected $gtid_pos got ", @@GLOBAL.gtid_slave_pos)) AS RESULT;
--enable_query_log
SELECT * FROM t1 ORDER BY a;
--source include/stop_slave.inc
CHANGE MASTER TO ignore_server_ids=();
--source include/start_slave.inc
--sync_with_master
--disable_query_log
eval SELECT IF(@@GLOBAL.gtid_slave_pos = '$gtid_pos', 'OK', CONCAT("ERROR: Expected $gtid_pos got ", @@GLOBAL.gtid_slave_pos)) AS RESULT;
--enable_query_log
SELECT * FROM t1 ORDER BY a;
--connection server_1
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
--let gtid_pos=`SELECT @@GLOBAL.gtid_binlog_pos`
--save_master_pos
--connection server_2
--sync_with_master
--disable_query_log
eval SELECT IF(@@GLOBAL.gtid_slave_pos = '$gtid_pos', 'OK', CONCAT("ERROR: Expected $gtid_pos got ", @@GLOBAL.gtid_slave_pos)) AS RESULT;
SELECT * FROM t1 ORDER BY a;
--enable_query_log
--echo *** Test the same thing when IO thread exits before SQL thread reaches end of log. ***
--connection server_2
--source include/stop_slave.inc
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug= "+d,inject_slave_sql_before_apply_event";
CHANGE MASTER TO ignore_server_ids=(1);
--source include/start_slave.inc
--connection server_1
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
--let gtid_pos=`SELECT @@GLOBAL.gtid_binlog_pos`
--save_master_pos
--connection server_2
# Wait for IO thread to have read all events from master, and for SQL thread to
# sit in the debug_sync point.
--let $slave_param= Read_Master_Log_Pos
--let $slave_param_value= $master_pos
--source include/wait_for_slave_param.inc
# Now stop the IO thread, and let the SQL thread continue. The IO thread
# should write a Gtid_list event that the SQL thread can use to update the
# gtid_slave_pos with the GTIDs of the skipped events.
STOP SLAVE IO_THREAD;
SET debug_sync = "now SIGNAL continue";
--sync_with_master
--let $wait_condition= SELECT @@GLOBAL.gtid_slave_pos = '$gtid_pos'
--source include/wait_condition.inc
--disable_query_log
eval SELECT IF(@@GLOBAL.gtid_slave_pos = '$gtid_pos', 'OK', CONCAT("ERROR: Expected $gtid_pos got ", @@GLOBAL.gtid_slave_pos)) AS RESULT;
--let $slave_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
eval SELECT IF('$slave_pos' = '$master_pos', 'OK', "ERROR: Expected $master_pos got $slave_pos") AS RESULT;
--enable_query_log
--source include/stop_slave.inc
CHANGE MASTER TO ignore_server_ids=();
SET GLOBAL debug_dbug= @old_dbug;
--source include/start_slave.inc
--connection server_1
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
--save_master_pos
--connection server_2
--sync_with_master
SELECT * FROM t1 ORDER BY a;
# Clean up.
--connection server_1
DROP TABLE t1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode;
SET debug_sync = "reset";
--connection server_2
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode;
SET debug_sync = "reset";
--source include/rpl_end.inc