| 1 |
############################################################################# |
| 2 |
# BUG#43579 mysql_upgrade tries to alter log tables on replicated database |
| 3 |
# Master and slave should be upgraded separately. All statements executed by |
| 4 |
# mysql_upgrade will not be binlogged. --write-binlog and --skip-write-binlog |
| 5 |
# options are added into mysql_upgrade. These options control whether sql |
| 6 |
# statements are binlogged or not. |
| 7 |
############################################################################# |
| 8 |
--source include/have_innodb.inc |
| 9 |
--source include/mysql_upgrade_preparation.inc |
| 10 |
--source include/master-slave.inc |
| 11 |
|
| 12 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 13 |
call mtr.add_suppression("table or database name 'mysqltest-1'"); |
| 14 |
|
| 15 |
connection master; |
| 16 |
--disable_warnings |
| 17 |
CREATE DATABASE `mysqltest-1`; |
| 18 |
--enable_warnings |
| 19 |
sync_slave_with_master; |
| 20 |
|
| 21 |
connection master; |
| 22 |
let $before_position= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 23 |
|
| 24 |
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading. |
| 25 |
--exec $MYSQL_UPGRADE --skip-verbose --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1 |
| 26 |
sync_slave_with_master; |
| 27 |
|
| 28 |
connection master; |
| 29 |
let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 30 |
|
| 31 |
if ($before_position == $after_position) |
| 32 |
{ |
| 33 |
echo Master position is not changed; |
| 34 |
} |
| 35 |
|
| 36 |
# Some log events of the mysql_upgrade previously caused errors on slave, |
| 37 |
# however with MDEV-4851 this should be ok, so we test it: |
| 38 |
connection slave; |
| 39 |
SET @old_general_log_state = @@global.general_log; |
| 40 |
SET @old_slow_log_state = @@global.slow_query_log; |
| 41 |
SET @old_log_output = @@global.log_output; |
| 42 |
SET GLOBAL general_log = 'ON'; |
| 43 |
SET GLOBAL slow_query_log = 'ON'; |
| 44 |
SET GLOBAL log_output = 'FILE'; |
| 45 |
|
| 46 |
connection master; |
| 47 |
#With '--force' option, mysql_upgrade always executes all sql statements for upgrading. |
| 48 |
ALTER TABLE mysql.slow_log DROP COLUMN thread_id, DROP COLUMN rows_affected; |
| 49 |
DROP DATABASE `mysqltest-1`; |
| 50 |
sync_slave_with_master; |
| 51 |
|
| 52 |
connection slave; |
| 53 |
SHOW CREATE TABLE mysql.slow_log; |
| 54 |
connection master; |
| 55 |
--exec $MYSQL_UPGRADE --skip-verbose --write-binlog --force --user=root > $MYSQLTEST_VARDIR/log/mysql_upgrade.log 2>&1 |
| 56 |
|
| 57 |
let $datadir= `select @@datadir`; |
| 58 |
remove_file $datadir/mariadb_upgrade_info; |
| 59 |
|
| 60 |
connection master; |
| 61 |
let $after_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 62 |
let $after_position= query_get_value(SHOW MASTER STATUS, Position, 1); |
| 63 |
|
| 64 |
if ($before_position != $after_position) |
| 65 |
{ |
| 66 |
echo Master position has been changed; |
| 67 |
} |
| 68 |
|
| 69 |
sync_slave_with_master; |
| 70 |
connection slave; |
| 71 |
SHOW CREATE TABLE mysql.slow_log; |
| 72 |
SET GLOBAL general_log = 'OFF'; |
| 73 |
SET GLOBAL slow_query_log = 'OFF'; |
| 74 |
truncate mysql.slow_log; |
| 75 |
truncate mysql.general_log; |
| 76 |
SET GLOBAL general_log = @old_general_log_state; |
| 77 |
SET GLOBAL slow_query_log = @old_slow_log_state; |
| 78 |
SET GLOBAL log_output = @old_log_output; |
| 79 |
|
| 80 |
--source include/rpl_end.inc |