Commit 982b6895 authored by Nikita Malyavin's avatar Nikita Malyavin Committed by Sergei Golubchik

MDEV-31838 Assertion fails upon replication online alter with MINIMAL row

Replica honors its own binlog_row_image value when it sets up read_set.
When a slave thread is applying replicated row events in parallel with the
running online alter, we need all columns to be read from the table
(for the online alter logged row event) not only those that were present in
the pre-image for the replicated row event.

Avoid shrinking the set when online alter is running, i.e. leave it all set
parent c4adaed0
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection master;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
connection slave; connection slave;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
include/stop_slave.inc include/stop_slave.inc
set global slave_parallel_threads=3; set global slave_parallel_threads=3;
set global slave_parallel_mode= optimistic; set global slave_parallel_mode= optimistic;
set global binlog_row_image=MINIMAL;
connection master; connection master;
# #
# MDEV-31755 Replica's DML event deadlocks wit online alter table # MDEV-31755 Replica's DML event deadlocks wit online alter table
...@@ -29,10 +33,25 @@ id c a ...@@ -29,10 +33,25 @@ id c a
2 qqq 1 2 qqq 1
connection master; connection master;
drop table t; 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 slave;
connection master; connection master;
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
set global binlog_row_image=FULL;
set global slave_parallel_threads=0; set global slave_parallel_threads=0;
set global slave_parallel_mode= optimistic; set global slave_parallel_mode= optimistic;
include/start_slave.inc include/start_slave.inc
......
...@@ -2,13 +2,19 @@ source include/have_debug_sync.inc; ...@@ -2,13 +2,19 @@ source include/have_debug_sync.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source include/master-slave.inc; source include/master-slave.inc;
--connection master
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
--connection slave --connection slave
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
source include/stop_slave.inc; source include/stop_slave.inc;
--let $slave_parallel_threads=`select @@global.slave_parallel_threads` --let $slave_parallel_threads=`select @@global.slave_parallel_threads`
--let $slave_parallel_mode= `select @@global.slave_parallel_mode` --let $slave_parallel_mode= `select @@global.slave_parallel_mode`
--let $binlog_row_image= `select @@global.binlog_row_image`
set global slave_parallel_threads=3; set global slave_parallel_threads=3;
set global slave_parallel_mode= optimistic; set global slave_parallel_mode= optimistic;
set global binlog_row_image=MINIMAL;
--connection master --connection master
...@@ -43,6 +49,28 @@ select * from t; ...@@ -43,6 +49,28 @@ select * from t;
# Cleanup # Cleanup
--connection master --connection master
drop table t; drop table t;
--echo # MDEV-31838 Assertion fails on replica upon parallel
--echo # 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';
send alter table t force, algorithm=copy, lock=none;
--connection master1
set binlog_row_image=MINIMAL;
set debug_sync= 'now wait_for go_dml';
--disable_warnings
update ignore t set a = 1;
--enable_warnings
set debug_sync= 'now signal go_alter';
# Cleanup
--connection master
--reap
drop table t;
--sync_slave_with_master --sync_slave_with_master
--connection master --connection master
...@@ -52,6 +80,7 @@ drop table t; ...@@ -52,6 +80,7 @@ drop table t;
--connection slave --connection slave
source include/stop_slave.inc; source include/stop_slave.inc;
--eval set global binlog_row_image=$binlog_row_image
--eval set global slave_parallel_threads=$slave_parallel_threads --eval set global slave_parallel_threads=$slave_parallel_threads
--eval set global slave_parallel_mode= $slave_parallel_mode --eval set global slave_parallel_mode= $slave_parallel_mode
source include/start_slave.inc; source include/start_slave.inc;
......
...@@ -5082,7 +5082,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) ...@@ -5082,7 +5082,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
else else
if (get_general_type_code() == WRITE_ROWS_EVENT) if (get_general_type_code() == WRITE_ROWS_EVENT)
bitmap_copy(table->write_set, &m_cols); // for sequences bitmap_copy(table->write_set, &m_cols); // for sequences
else else // If online alter, leave all columns set (i.e. skip intersects)
if (!thd->slave_thread || !table->s->online_alter_binlog)
{ {
bitmap_intersect(table->read_set,&m_cols); bitmap_intersect(table->read_set,&m_cols);
if (get_general_type_code() == UPDATE_ROWS_EVENT) if (get_general_type_code() == UPDATE_ROWS_EVENT)
......
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