| 1 |
# |
| 2 |
# Purpose: |
| 3 |
# |
| 4 |
# This test ensures that mysqlbinlog prints a comment when two-phase alter |
| 5 |
# is enabled which shows the original alter query issued. |
| 6 |
# |
| 7 |
# |
| 8 |
# References: |
| 9 |
# MENT-662: Finalize MDEV-11675 "Lag Free Alter On Slave" |
| 10 |
# |
| 11 |
|
| 12 |
# Just row format for faster testing |
| 13 |
--source include/have_binlog_format_row.inc |
| 14 |
--source include/have_innodb.inc |
| 15 |
|
| 16 |
#--- |
| 17 |
# Setup |
| 18 |
#--- |
| 19 |
--let $binlog_alter_two_phase= `select @@binlog_alter_two_phase` |
| 20 |
set global binlog_alter_two_phase = ON; |
| 21 |
set binlog_alter_two_phase = ON; |
| 22 |
|
| 23 |
RESET MASTER; |
| 24 |
create table myt (a int) engine=InnoDB; |
| 25 |
|
| 26 |
|
| 27 |
#--- |
| 28 |
# Issue ALTER |
| 29 |
#--- |
| 30 |
alter table myt add column (b int); |
| 31 |
|
| 32 |
|
| 33 |
#--- |
| 34 |
# Check binlog output |
| 35 |
#--- |
| 36 |
FLUSH LOGS; |
| 37 |
|
| 38 |
--disable_query_log |
| 39 |
--let $MYSQLD_DATADIR= `select @@datadir` |
| 40 |
--let $BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1) |
| 41 |
|
| 42 |
--echo # Exec MYSQL_BINLOG --base64-output=decode-rows -v MYSQLD_DATADIR/BINLOG_FILENAME > MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql |
| 43 |
--exec $MYSQL_BINLOG --base64-output=decode-rows -v $MYSQLD_DATADIR/$BINLOG_FILENAME > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql |
| 44 |
|
| 45 |
create table raw_binlog_rows (txt varchar(1000)); |
| 46 |
--eval load data local infile '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql' into table raw_binlog_rows columns terminated by '\n' |
| 47 |
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_verbose.sql |
| 48 |
--enable_query_log |
| 49 |
--echo Verbose statements from : $BINLOG_FILENAME |
| 50 |
# Output --verbose lines, with extra Windows CR's trimmed |
| 51 |
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%'; |
| 52 |
|
| 53 |
#--- |
| 54 |
# Cleanup |
| 55 |
#--- |
| 56 |
drop table raw_binlog_rows; |
| 57 |
drop table myt; |
| 58 |
--eval set global binlog_alter_two_phase=$binlog_alter_two_phase |