| 1 |
# |
| 2 |
# Test Galera as a slave to a MySQL master |
| 3 |
# |
| 4 |
# The galera/galera_2node_slave.cnf describes the setup of the nodes |
| 5 |
# |
| 6 |
|
| 7 |
--source include/have_innodb.inc |
| 8 |
--source include/galera_cluster.inc |
| 9 |
|
| 10 |
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it |
| 11 |
# we open the node_3 connection here |
| 12 |
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 |
| 13 |
|
| 14 |
--connection node_2 |
| 15 |
--disable_query_log |
| 16 |
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_SSL_VERIFY_SERVER_CERT=0, MASTER_PORT=$NODE_MYPORT_3; |
| 17 |
--enable_query_log |
| 18 |
START SLAVE; |
| 19 |
|
| 20 |
--connection node_3 |
| 21 |
|
| 22 |
## |
| 23 |
## Verify the correct operation of the auto-increment when |
| 24 |
## the binlog format set to the 'STATEMENT' on the master node: |
| 25 |
## |
| 26 |
|
| 27 |
SET SESSION binlog_format='STATEMENT'; |
| 28 |
|
| 29 |
CREATE TABLE t1 ( |
| 30 |
i int(11) NOT NULL AUTO_INCREMENT, |
| 31 |
c char(32) DEFAULT 'dummy_text', |
| 32 |
PRIMARY KEY (i) |
| 33 |
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
| 34 |
|
| 35 |
insert into t1(i) values(null); |
| 36 |
|
| 37 |
select * from t1; |
| 38 |
|
| 39 |
insert into t1(i) values(null), (null), (null); |
| 40 |
|
| 41 |
select * from t1; |
| 42 |
|
| 43 |
SET SESSION auto_increment_increment=7; |
| 44 |
insert into t1(i) values(null), (null), (null); |
| 45 |
|
| 46 |
SET SESSION auto_increment_offset=5; |
| 47 |
insert into t1(i) values(null), (null), (null); |
| 48 |
|
| 49 |
select * from t1; |
| 50 |
|
| 51 |
show variables like 'binlog_format'; |
| 52 |
show variables like 'auto_increment_increment'; |
| 53 |
|
| 54 |
--connection node_2 |
| 55 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 56 |
--source include/wait_condition.inc |
| 57 |
|
| 58 |
--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; |
| 59 |
--source include/wait_condition.inc |
| 60 |
|
| 61 |
select * from t1; |
| 62 |
|
| 63 |
show variables like 'binlog_format'; |
| 64 |
show variables like 'auto_increment_increment'; |
| 65 |
|
| 66 |
--connection node_1 |
| 67 |
select * from t1; |
| 68 |
|
| 69 |
show variables like 'binlog_format'; |
| 70 |
show variables like 'auto_increment_increment'; |
| 71 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 72 |
|
| 73 |
--connection node_3 |
| 74 |
DROP TABLE t1; |
| 75 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 76 |
|
| 77 |
--connection node_2 |
| 78 |
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 79 |
--source include/wait_condition.inc |
| 80 |
|
| 81 |
STOP SLAVE; |
| 82 |
RESET SLAVE ALL; |
| 83 |
|
| 84 |
--connection node_3 |
| 85 |
RESET MASTER; |