Commit 8c799216 authored by Brandon Nesterenko's avatar Brandon Nesterenko Committed by Sergei Golubchik

MDEV-33672: 10.11 Fix for Two Phase Alter Flags

Extends 89c907bd to account for
binlog_two_phase_alter flags in a Gtid log event. I.e., if the
FL_COMMIT_ALTER_E1 or FL_ROLLBACK_ALTER_E2 flags are set in the
event flags, yet the length of the event is too short to hold
the value, then set the event as invalid
parent 720a0f6c
......@@ -112,6 +112,30 @@ RESET MASTER;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Test FL_COMMIT_ALTER
connection master;
set @old_dbug= @@SESSION.debug_dbug;
set @@SESSION.debug_dbug= "+d,negate_alter_fl_from_gtid";
set @old_alter_tp= @@SESSION.binlog_alter_two_phase;
set @@SESSION.binlog_alter_two_phase= 1;
alter table t1 add column (nc int);
include/save_master_gtid.inc
set @@SESSION.debug_dbug=@old_dbug;
set @@SESSION.binlog_alter_two_phase=@old_alter_tp;
connection slave;
# Waiting for slave to find invalid event..
include/wait_for_slave_sql_error.inc [errno=1594]
STOP SLAVE IO_THREAD;
# Reset master binlogs (as there is an invalid event) and slave state
connection master;
RESET MASTER;
connection slave;
SET STATEMENT sql_log_bin=0 FOR alter table t1 add column (nc int);
RESET SLAVE;
RESET MASTER;
set @@global.gtid_slave_pos="";
include/start_slave.inc
#
# Cleanup
connection master;
drop table t1;
......
......@@ -167,6 +167,38 @@ RESET MASTER;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Test FL_COMMIT_ALTER
--connection master
set @old_dbug= @@SESSION.debug_dbug;
set @@SESSION.debug_dbug= "+d,negate_alter_fl_from_gtid";
set @old_alter_tp= @@SESSION.binlog_alter_two_phase;
set @@SESSION.binlog_alter_two_phase= 1;
alter table t1 add column (nc int);
--source include/save_master_gtid.inc
set @@SESSION.debug_dbug=@old_dbug;
set @@SESSION.binlog_alter_two_phase=@old_alter_tp;
--connection slave
--echo # Waiting for slave to find invalid event..
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
source include/wait_for_slave_sql_error.inc;
STOP SLAVE IO_THREAD;
--echo # Reset master binlogs (as there is an invalid event) and slave state
--connection master
RESET MASTER;
--connection slave
# Just to keep tables consistent between master/slave
SET STATEMENT sql_log_bin=0 FOR alter table t1 add column (nc int);
RESET SLAVE;
RESET MASTER;
set @@global.gtid_slave_pos="";
--source include/start_slave.inc
--echo #
--echo # Cleanup
......
......@@ -2688,6 +2688,11 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len,
}
if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1))
{
if (event_len < static_cast<uint>(buf - buf_0) + 8)
{
seq_no= 0;
return;
}
sa_seq_no= uint8korr(buf);
buf+= 8;
}
......
......@@ -3759,7 +3759,9 @@ Gtid_log_event::write()
write_len++;
}
if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1))
if (flags_extra & (FL_COMMIT_ALTER_E1 | FL_ROLLBACK_ALTER_E1)
&& !DBUG_IF("negate_alter_fl_from_gtid")
)
{
int8store(buf + write_len, sa_seq_no);
write_len+= 8;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment