mirror of
https://github.com/MariaDB/server.git
synced 2025-02-15 09:55:33 +01:00
![Nikita Malyavin](/assets/img/avatar_default.png)
... upon replicating online ALTER When an online event is applied and slave_exec_mode is idempotent, Write_rows_log_event::do_before_row_operations had reset thd->lex->sql_command to SQLCOM_REPLACE. This led to that a statement was detected as a row-type during binlogging, and was logged as not standalone. So the corresponding Gtid_log_event, when applied on replica, did not exit early and created a new PSI transaction. Hence the difference with non-online ALTER.
84 lines
2.6 KiB
Text
84 lines
2.6 KiB
Text
include/master-slave.inc
|
|
[connection master]
|
|
connection master;
|
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
|
|
connection slave;
|
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
|
|
# MDEV-31804 Assertion `thd->m_transaction_psi == __null' fails upon
|
|
# replicating online ALTER
|
|
connection master;
|
|
create table t (a char(8)) engine=myisam;
|
|
insert into t values ('foo'),('bar');
|
|
set debug_sync= 'alter_table_online_progress signal go_dml wait_for go_alter';
|
|
set @old_slave_exec_mode= @@global.slave_exec_mode;
|
|
set @@global.slave_exec_mode= idempotent;
|
|
alter table t force;
|
|
connection master1;
|
|
set debug_sync= 'now wait_for go_dml';
|
|
insert into t (a) values ('qux');
|
|
set debug_sync= 'now signal go_alter';
|
|
connection master;
|
|
connection slave;
|
|
connection master;
|
|
drop table t;
|
|
set global slave_exec_mode= @old_slave_exec_mode;
|
|
set debug_sync= reset;
|
|
#
|
|
# End of 11.2 tests (Single-phase alter)
|
|
#
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
set global slave_parallel_threads=3;
|
|
set global slave_parallel_mode= optimistic;
|
|
set global binlog_row_image=MINIMAL;
|
|
connection master;
|
|
#
|
|
# MDEV-31755 Replica's DML event deadlocks wit online alter table
|
|
#
|
|
# Three threads for SA,U,CA
|
|
create table t (id int, a int, primary key (id)) engine=innodb;
|
|
insert into t values (1,10), (2,20);
|
|
set @@session.binlog_alter_two_phase=1;
|
|
set debug_sync= 'alter_table_online_downgraded signal ready wait_for go';
|
|
alter table t add c text default('qqq') after id, algorithm=copy, lock=none;
|
|
connection master1;
|
|
set debug_sync= 'now wait_for ready';
|
|
update t set a = 1;
|
|
set debug_sync= 'now signal go';
|
|
connection master;
|
|
include/save_master_gtid.inc
|
|
connection slave;
|
|
include/start_slave.inc
|
|
include/sync_with_master_gtid.inc
|
|
select * from t;
|
|
id c a
|
|
1 qqq 1
|
|
2 qqq 1
|
|
connection master;
|
|
drop table t;
|
|
# MDEV-31838 Assertion fails on replica upon parallel
|
|
# replication with two-phase alter and MINIMAL row image
|
|
create table t (id int, a int, primary key(id)) engine=aria;
|
|
insert into t values (1,0);
|
|
set @@session.binlog_alter_two_phase=1;
|
|
set debug_sync= 'alter_table_online_progress signal go_dml wait_for go_alter';
|
|
alter table t force, algorithm=copy, lock=none;
|
|
connection master1;
|
|
set binlog_row_image=MINIMAL;
|
|
set debug_sync= 'now wait_for go_dml';
|
|
update ignore t set a = 1;
|
|
set debug_sync= 'now signal go_alter';
|
|
connection master;
|
|
drop table t;
|
|
connection slave;
|
|
connection master;
|
|
#
|
|
# End of 11.2 tests (Two-phase alter)
|
|
#
|
|
connection slave;
|
|
include/stop_slave.inc
|
|
set global binlog_row_image=FULL;
|
|
set global slave_parallel_threads=0;
|
|
set global slave_parallel_mode= optimistic;
|
|
include/start_slave.inc
|
|
include/rpl_end.inc
|