mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
126 lines
4.1 KiB
Text
126 lines
4.1 KiB
Text
include/master-slave.inc
|
|
[connection master]
|
|
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
|
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");
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
SET @old_log_output= @@log_output;
|
|
SET GLOBAL log_output= 'TABLE';
|
|
SET @old_long_query_time= @@long_query_time;
|
|
SET GLOBAL long_query_time= 2;
|
|
TRUNCATE mysql.slow_log;
|
|
include/start_slave.inc
|
|
connection master;
|
|
CREATE TABLE t1 (a int, b int);
|
|
INSERT INTO t1 values(1, 1);
|
|
INSERT INTO t1 values(1, sleep(3));
|
|
connection slave;
|
|
TRUNCATE mysql.slow_log;
|
|
connect extra,127.0.0.1,root,,test,$SLAVE_MYPORT;
|
|
connection extra;
|
|
SELECT 1, sleep(3);
|
|
1 sleep(3)
|
|
1 0
|
|
SELECT 1;
|
|
1
|
|
1
|
|
TRUNCATE mysql.slow_log;
|
|
SET TIMESTAMP= 1;
|
|
SELECT 2, sleep(3);
|
|
2 sleep(3)
|
|
2 0
|
|
SELECT 2;
|
|
2
|
|
2
|
|
TRUNCATE mysql.slow_log;
|
|
connect extra2,127.0.0.1,root,,test,$SLAVE_MYPORT;
|
|
connection extra2;
|
|
SET @old_slow_query_log= @@slow_query_log;
|
|
SET GLOBAL slow_query_log= 'OFF';
|
|
connection extra;
|
|
SELECT 3, sleep(3);
|
|
3 sleep(3)
|
|
3 0
|
|
SELECT 3;
|
|
3
|
|
3
|
|
TRUNCATE mysql.slow_log;
|
|
connection extra2;
|
|
SET GLOBAL slow_query_log= @old_slow_query_log;
|
|
connection master;
|
|
DROP TABLE t1;
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
SET GLOBAL long_query_time= @old_long_query_time;
|
|
SET GLOBAL log_output= @old_log_output;
|
|
include/start_slave.inc
|
|
disconnect extra;
|
|
disconnect extra2;
|
|
include/rpl_reset.inc
|
|
connection master;
|
|
SET @old_log_output= @@log_output;
|
|
SET GLOBAL log_output= 'TABLE';
|
|
SET GLOBAL long_query_time= 2;
|
|
SET @old_long_query_time= @@long_query_time;
|
|
SET SESSION long_query_time= 2;
|
|
TRUNCATE mysql.slow_log;
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
SET @old_log_output= @@log_output;
|
|
SET GLOBAL log_output= 'TABLE';
|
|
SET @old_long_query_time= @@long_query_time;
|
|
SET GLOBAL long_query_time= 2;
|
|
TRUNCATE mysql.slow_log;
|
|
include/start_slave.inc
|
|
connection master;
|
|
CREATE TABLE t1 (a int, b int);
|
|
********************************************************************
|
|
**** INSERT one row that exceeds long_query_time
|
|
**** Outcome: query ends up in both master and slave slow log
|
|
********************************************************************
|
|
INSERT INTO t1 values(1, sleep(3));
|
|
connection slave;
|
|
### Assertion is good. Both Master and Slave exhibit the
|
|
### same number of queries in slow log: 1
|
|
TRUNCATE mysql.slow_log;
|
|
connection master;
|
|
TRUNCATE mysql.slow_log;
|
|
********************************************************************
|
|
**** Now do inserts again, but first add an index to the table.
|
|
**** Outcome: Note that the slave contains the same one entry (as
|
|
**** the master does) whereas before the patch it did not.
|
|
********************************************************************
|
|
ALTER TABLE t1 ADD INDEX id1(a);
|
|
INSERT INTO t1 values(1, sleep(3));
|
|
connection slave;
|
|
### Assertion is good. Both Master and Slave exhibit the
|
|
### same number of queries in slow log: 1
|
|
********************************************************************
|
|
**** TRUNCATE the slow log then check whether runtime changes of
|
|
**** log_slow_slave_statements work without slave restart.
|
|
********************************************************************
|
|
SET @old_log_slow_slave_statements= @@global.log_slow_slave_statements;
|
|
SET @@global.log_slow_slave_statements = off;
|
|
TRUNCATE mysql.slow_log;
|
|
connection master;
|
|
INSERT INTO t1 values(1, sleep(3));;
|
|
connection slave;
|
|
connection slave;
|
|
SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))';
|
|
sql_text
|
|
SET @@global.log_slow_slave_statements = on;
|
|
connection master;
|
|
INSERT INTO t1 values(1, sleep(3));;
|
|
connection slave;
|
|
connection slave;
|
|
SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))';
|
|
sql_text
|
|
INSERT INTO t1 values(1, sleep(3))
|
|
connection master;
|
|
SET @@global.log_output= @old_log_output;
|
|
SET @@global.long_query_time= @old_long_query_time;
|
|
DROP TABLE t1;
|
|
connection slave;
|
|
SET @@global.log_output= @old_log_output;
|
|
SET @@global.long_query_time= @old_long_query_time;
|
|
include/rpl_end.inc
|