Commit de1fa452 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

[MDEV-8411] Assertion failed in !table->write_set

The reason for the assertion failure is that the update statement for
the minimal row image sets only the PK column in the write_set of the
table to true. On the other hand, the trigger aims to update a different
column.

Make sure that triggers update the used columns accordingly, when being
processed.
parent 0e20137a
......@@ -237,4 +237,50 @@ a b
3 30
set global slave_run_triggers_for_rbr = @slave_run_triggers_for_rbr.saved;
drop table t1, tlog;
#
# MDEV-8411 Assertion `is_stat_field || !table || (!table->write_set ||
# bitmap_is_set(table->write_set, field_index) ||
# bitmap_is_set(table->vcol_set, field_index))'
# failed in Field_timestamp::store_TIME_with_warning
#
#
# Create table on master, replicate it on slave.
#
connection master;
set @binlog_row_image.saved = @@binlog_row_image;
set binlog_row_image = MINIMAL;
create table t1 (pk int primary key, f int);
connection slave;
#
# Create a trigger on the slave.
#
create trigger tr before update on t1 for each row set new.f = 1000;
set @old_slave_run_triggers_for_rbr = @@global.slave_run_triggers_for_rbr;
set global slave_run_triggers_for_rbr = YES;
connection master;
#
# Update the table to have the trigger fire on the slave.,
#
insert into t1 values (1,1),(2,2);
update t1 set pk=pk+10;
select * from t1;
pk f
11 1
12 2
connection slave;
#
# Check to see if slave has the table updated.
#
select * from t1;
pk f
11 1000
12 1000
#
# Cleanup
#
set global slave_run_triggers_for_rbr = @old_slave_run_triggers_for_rbr;
connection master;
set binlog_row_image = @binlog_row_image.saved;
drop table t1;
connection slave;
include/rpl_end.inc
......@@ -276,5 +276,54 @@ drop table t1, tlog;
sync_slave_with_master;
--echo #
--echo # MDEV-8411 Assertion `is_stat_field || !table || (!table->write_set ||
--echo # bitmap_is_set(table->write_set, field_index) ||
--echo # bitmap_is_set(table->vcol_set, field_index))'
--echo # failed in Field_timestamp::store_TIME_with_warning
--echo #
--enable_connect_log
--echo #
--echo # Create table on master, replicate it on slave.
--echo #
--connection master
set @binlog_row_image.saved = @@binlog_row_image;
set binlog_row_image = MINIMAL;
create table t1 (pk int primary key, f int);
--sync_slave_with_master
--echo #
--echo # Create a trigger on the slave.
--echo #
create trigger tr before update on t1 for each row set new.f = 1000;
set @old_slave_run_triggers_for_rbr = @@global.slave_run_triggers_for_rbr;
set global slave_run_triggers_for_rbr = YES;
--connection master
--echo #
--echo # Update the table to have the trigger fire on the slave.,
--echo #
insert into t1 values (1,1),(2,2);
update t1 set pk=pk+10;
select * from t1;
--sync_slave_with_master
--echo #
--echo # Check to see if slave has the table updated.
--echo #
select * from t1;
--echo #
--echo # Cleanup
--echo #
set global slave_run_triggers_for_rbr = @old_slave_run_triggers_for_rbr;
--connection master
set binlog_row_image = @binlog_row_image.saved;
drop table t1;
--sync_slave_with_master
--disable_connect_log
--source include/rpl_end.inc
......@@ -11352,6 +11352,7 @@ bool Rows_log_event::process_triggers(trg_event_type event,
{
bool result;
DBUG_ENTER("Rows_log_event::process_triggers");
m_table->triggers->mark_fields_used(event);
if (slave_run_triggers_for_rbr == SLAVE_RUN_TRIGGERS_FOR_RBR_YES)
{
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
......
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