Commit 2316a4e1 authored by Philip Stoev's avatar Philip Stoev Committed by Nirbhay Choubey

Galera MTR Tests: Tests for GRA*.log files, replication bundle, preordered...

Galera MTR Tests: Tests for GRA*.log files, replication bundle, preordered events, forced binlog format
parent a1a7414b
START SLAVE USER='root';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
COUNT(DISTINCT f1) = 2 * 100 * 10 * 10
1
SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
COUNT(*) = 2 * 100 * 10 * 10
1
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
COUNT(DISTINCT f1) = 2 * 100 * 10 * 10
1
DROP TABLE t1;
DROP TABLE ten;
STOP SLAVE;
RESET SLAVE ALL;
START SLAVE USER='root';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
INSERT INTO t1 VALUES(4);
INSERT INTO t1 VALUES(5);
SELECT COUNT(*) = 4 FROM t1;
COUNT(*) = 4
1
DROP TABLE t1;
STOP SLAVE;
RESET SLAVE ALL;
RESET MASTER;
SET SESSION binlog_format = 'STATEMENT';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION binlog_format = 'MIXED';
INSERT INTO t1 VALUES (2);
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB
mysqld-bin.000001 <Pos> Query 1 <End_log_pos> BEGIN
mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
mysqld-bin.000001 <Pos> Write_rows 1 <End_log_pos> table_id: ### flags: STMT_END_F
mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
mysqld-bin.000001 <Pos> Query 1 <End_log_pos> BEGIN
mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1)
mysqld-bin.000001 <Pos> Write_rows 1 <End_log_pos> table_id: ### flags: STMT_END_F
mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */
DROP TABLE t1;
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t1 (f1 INTEGER);
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
<ISO TIMESTAMP> server id 2 end_log_pos 120 Start: binlog v 4, server v 5.6.24-debug-log created 150804 11:37:14 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
BINLOG '
unnAVQ8CAAAAdAAAAHgAAAABAAQANS42LjI0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAC6ecBVEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAKNu
Jfk=
'/*!*/;
# at 120
<ISO TIMESTAMP> server id 1 end_log_pos 91 Query thread_id=7 exec_time=0 error_code=0
use `test`/*!*/;
SET TIMESTAMP=<TIMESTAMKP>/*!*/;
SET @@session.pseudo_thread_id=7/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=1073741824/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (f1 INTEGER)
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
SET SESSION wsrep_on=ON;
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
DROP TABLE t1;
!include ../galera_2nodes_as_slave.cnf
[mysqld]
wsrep-preordered=TRUE
#
# Test Galera as a slave to a MySQL master with --wsrep-preordered=TRUE
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE USER='root';
#
# Issue many large-ish transaction on the async master
#
--connection node_1
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
--disable_query_log
--let $count = 100
while ($count)
{
--eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--dec $count
}
--enable_query_log
#
# While the async transactions are being applied, issue another set of transactions
# on the Galera node.
#
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $count = 100
--disable_query_log
while ($count)
{
--eval INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2;
--dec $count
}
--enable_query_log
#
# Confirm that all transactions successfully committed
#
--let $wait_condition = SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
SELECT COUNT(*) = 2 * 100 * 10 * 10 FROM t1;
SELECT COUNT(DISTINCT f1) = 2 * 100 * 10 * 10 FROM t1;
#
# Cleanup
#
--connection node_1
DROP TABLE t1;
DROP TABLE ten;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
!include ../galera_2nodes_as_slave.cnf
[mysqld]
wsrep-mysql-replication-bundle=2
#
# Test the wsrep_replication_bundle variable. We expect that multiple async replication events
# will be grouped together and thus a smaller number of wsrep_last_committed transactions will
# be reported.
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE USER='root';
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
INSERT INTO t1 VALUES(4);
INSERT INTO t1 VALUES(5);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
# With wsrep_mysql_replication_bundle = 2, the last insert is not delivered
# because there are not enough events remaining to complete an entire bundle
SELECT COUNT(*) = 4 FROM t1;
# Bundle is now complete, the last INSERT and the DROP are delivered
--connection node_1
DROP TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
#
# Test that wsrep_forced_binlog_format=ROW indeed prevents the log to be switched to STATEMENT format on a per-connection basis
#
--source include/have_log_bin.inc
--source include/have_innodb.inc
--source include/galera_cluster.inc
--connection node_1
RESET MASTER;
SET SESSION binlog_format = 'STATEMENT';
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION binlog_format = 'MIXED';
INSERT INTO t1 VALUES (2);
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
--replace_column 2 <Pos> 5 <End_log_pos>
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
DROP TABLE t1;
#
# Test that GRA_* files are generated on applier failure and are readable.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_2
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
# Create applier failure
SET SESSION wsrep_on=OFF;
CREATE TABLE t1 (f1 INTEGER);
--connection node_1
CREATE TABLE t1 (f1 INTEGER);
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
# Compose a valid binlog from a header file and the GRA file
--let $gra_binlog_file = $MYSQLTEST_VARDIR/tmp/gra.log
--exec rm -rf $gra_binlog_file
--exec cp std_data/binlog-header.log $gra_binlog_file
--exec cat $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log >> $gra_binlog_file
# Make sure the binlog thus produced is readable and contains the failure
--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMKP>/ /#[0-9]+ [0-9]+:[0-9]+:[0-9]+/<ISO TIMESTAMP>/
--exec $MYSQL_BINLOG $gra_binlog_file
SET SESSION wsrep_on=ON;
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
DROP TABLE t1;
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