mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
"write set" for replication finally got its correct place (mark_columns_per_binlog_row_image()). When done generally in mark_columns_needed_for_update() it affects optimization algorithm. used_key_is_modified, query_plan.using_io_buffer are wrongly set and that leads to wrong prepare_for_keyread() which limits read_set.
This commit is contained in:
@ -285,3 +285,15 @@ with system versioning;
|
|||||||
insert into t1 (a) values ('foo');
|
insert into t1 (a) values ('foo');
|
||||||
update t1 set a = 'bar';
|
update t1 set a = 'bar';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
|
||||||
|
#
|
||||||
|
create or replace table t1 (
|
||||||
|
pk int, a char(8), b char(8),
|
||||||
|
primary key (pk)
|
||||||
|
) with system versioning;
|
||||||
|
create or replace view v1 as select * from t1;
|
||||||
|
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
|
||||||
|
update v1 set a= null where b = '';
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
@ -202,4 +202,20 @@ insert into t1 (a) values ('foo');
|
|||||||
update t1 set a = 'bar';
|
update t1 set a = 'bar';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-21147 Assertion `marked_for_read()' upon UPDATE on versioned table via view
|
||||||
|
--echo #
|
||||||
|
create or replace table t1 (
|
||||||
|
pk int, a char(8), b char(8),
|
||||||
|
primary key (pk)
|
||||||
|
) with system versioning;
|
||||||
|
|
||||||
|
create or replace view v1 as select * from t1;
|
||||||
|
insert into t1 values (1, null, 'd') , (2, null, 'i') ;
|
||||||
|
update v1 set a= null where b = '';
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
source suite/versioning/common_finish.inc;
|
source suite/versioning/common_finish.inc;
|
||||||
|
16
sql/table.cc
16
sql/table.cc
@ -6613,12 +6613,8 @@ void TABLE::mark_columns_needed_for_update()
|
|||||||
/*
|
/*
|
||||||
For System Versioning we have to read all columns since we store
|
For System Versioning we have to read all columns since we store
|
||||||
a copy of previous row with modified row_end back to a table.
|
a copy of previous row with modified row_end back to a table.
|
||||||
|
|
||||||
Without write_set versioning.rpl,row is unstable until MDEV-16370 is
|
|
||||||
applied.
|
|
||||||
*/
|
*/
|
||||||
bitmap_union(read_set, &s->all_set);
|
bitmap_union(read_set, &s->all_set);
|
||||||
bitmap_union(write_set, &s->all_set);
|
|
||||||
need_signal= true;
|
need_signal= true;
|
||||||
}
|
}
|
||||||
if (check_constraints)
|
if (check_constraints)
|
||||||
@ -6781,8 +6777,16 @@ void TABLE::mark_columns_per_binlog_row_image()
|
|||||||
binary log will include all columns read anyway.
|
binary log will include all columns read anyway.
|
||||||
*/
|
*/
|
||||||
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
|
mark_columns_used_by_index_no_reset(s->primary_key, read_set);
|
||||||
/* Only write columns that have changed */
|
if (versioned())
|
||||||
rpl_write_set= write_set;
|
{
|
||||||
|
// TODO: After MDEV-18432 we don't pass history rows, so remove this:
|
||||||
|
rpl_write_set= &s->all_set;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Only write columns that have changed */
|
||||||
|
rpl_write_set= write_set;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user