| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 4 |
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); |
| 5 |
connection slave; |
| 6 |
include/stop_slave.inc |
| 7 |
SET @old_log_output= @@log_output; |
| 8 |
SET GLOBAL log_output= 'TABLE'; |
| 9 |
SET @old_long_query_time= @@long_query_time; |
| 10 |
SET GLOBAL long_query_time= 2; |
| 11 |
TRUNCATE mysql.slow_log; |
| 12 |
include/start_slave.inc |
| 13 |
connection master; |
| 14 |
CREATE TABLE t1 (a int, b int); |
| 15 |
INSERT INTO t1 values(1, 1); |
| 16 |
INSERT INTO t1 values(1, sleep(3)); |
| 17 |
connection slave; |
| 18 |
TRUNCATE mysql.slow_log; |
| 19 |
connect extra,127.0.0.1,root,,test,$SLAVE_MYPORT; |
| 20 |
connection extra; |
| 21 |
SELECT 1, sleep(3); |
| 22 |
1 sleep(3) |
| 23 |
1 0 |
| 24 |
SELECT 1; |
| 25 |
1 |
| 26 |
1 |
| 27 |
TRUNCATE mysql.slow_log; |
| 28 |
SET TIMESTAMP= 1; |
| 29 |
SELECT 2, sleep(3); |
| 30 |
2 sleep(3) |
| 31 |
2 0 |
| 32 |
SELECT 2; |
| 33 |
2 |
| 34 |
2 |
| 35 |
TRUNCATE mysql.slow_log; |
| 36 |
connect extra2,127.0.0.1,root,,test,$SLAVE_MYPORT; |
| 37 |
connection extra2; |
| 38 |
SET @old_slow_query_log= @@slow_query_log; |
| 39 |
SET GLOBAL slow_query_log= 'OFF'; |
| 40 |
connection extra; |
| 41 |
SELECT 3, sleep(3); |
| 42 |
3 sleep(3) |
| 43 |
3 0 |
| 44 |
SELECT 3; |
| 45 |
3 |
| 46 |
3 |
| 47 |
TRUNCATE mysql.slow_log; |
| 48 |
connection extra2; |
| 49 |
SET GLOBAL slow_query_log= @old_slow_query_log; |
| 50 |
connection master; |
| 51 |
DROP TABLE t1; |
| 52 |
connection slave; |
| 53 |
include/stop_slave.inc |
| 54 |
SET GLOBAL long_query_time= @old_long_query_time; |
| 55 |
SET GLOBAL log_output= @old_log_output; |
| 56 |
include/start_slave.inc |
| 57 |
disconnect extra; |
| 58 |
disconnect extra2; |
| 59 |
include/rpl_reset.inc |
| 60 |
connection master; |
| 61 |
SET @old_log_output= @@log_output; |
| 62 |
SET GLOBAL log_output= 'TABLE'; |
| 63 |
SET GLOBAL long_query_time= 2; |
| 64 |
SET @old_long_query_time= @@long_query_time; |
| 65 |
SET SESSION long_query_time= 2; |
| 66 |
TRUNCATE mysql.slow_log; |
| 67 |
connection slave; |
| 68 |
include/stop_slave.inc |
| 69 |
SET @old_log_output= @@log_output; |
| 70 |
SET GLOBAL log_output= 'TABLE'; |
| 71 |
SET @old_long_query_time= @@long_query_time; |
| 72 |
SET GLOBAL long_query_time= 2; |
| 73 |
TRUNCATE mysql.slow_log; |
| 74 |
include/start_slave.inc |
| 75 |
connection master; |
| 76 |
CREATE TABLE t1 (a int, b int); |
| 77 |
******************************************************************** |
| 78 |
**** INSERT one row that exceeds long_query_time |
| 79 |
**** Outcome: query ends up in both master and slave slow log |
| 80 |
******************************************************************** |
| 81 |
INSERT INTO t1 values(1, sleep(3)); |
| 82 |
connection slave; |
| 83 |
### Assertion is good. Both Master and Slave exhibit the |
| 84 |
### same number of queries in slow log: 1 |
| 85 |
TRUNCATE mysql.slow_log; |
| 86 |
connection master; |
| 87 |
TRUNCATE mysql.slow_log; |
| 88 |
******************************************************************** |
| 89 |
**** Now do inserts again, but first add an index to the table. |
| 90 |
**** Outcome: Note that the slave contains the same one entry (as |
| 91 |
**** the master does) whereas before the patch it did not. |
| 92 |
******************************************************************** |
| 93 |
ALTER TABLE t1 ADD INDEX id1(a); |
| 94 |
INSERT INTO t1 values(1, sleep(3)); |
| 95 |
connection slave; |
| 96 |
### Assertion is good. Both Master and Slave exhibit the |
| 97 |
### same number of queries in slow log: 1 |
| 98 |
******************************************************************** |
| 99 |
**** TRUNCATE the slow log then check whether runtime changes of |
| 100 |
**** log_slow_slave_statements work without slave restart. |
| 101 |
******************************************************************** |
| 102 |
SET @old_log_slow_slave_statements= @@global.log_slow_slave_statements; |
| 103 |
SET @@global.log_slow_slave_statements = off; |
| 104 |
TRUNCATE mysql.slow_log; |
| 105 |
connection master; |
| 106 |
INSERT INTO t1 values(1, sleep(3));; |
| 107 |
connection slave; |
| 108 |
connection slave; |
| 109 |
SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))'; |
| 110 |
sql_text |
| 111 |
SET @@global.log_slow_slave_statements = on; |
| 112 |
connection master; |
| 113 |
INSERT INTO t1 values(1, sleep(3));; |
| 114 |
connection slave; |
| 115 |
connection slave; |
| 116 |
SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))'; |
| 117 |
sql_text |
| 118 |
INSERT INTO t1 values(1, sleep(3)) |
| 119 |
connection master; |
| 120 |
SET @@global.log_output= @old_log_output; |
| 121 |
SET @@global.long_query_time= @old_long_query_time; |
| 122 |
DROP TABLE t1; |
| 123 |
connection slave; |
| 124 |
SET @@global.log_output= @old_log_output; |
| 125 |
SET @@global.long_query_time= @old_long_query_time; |
| 126 |
include/rpl_end.inc |