mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view
records_are_comparable() requires this condition: bitmap_is_subset(table->write_set, table->read_set) On first iteration vers_update_fields() changes write_set and read_set. On second iteration the above condition fails. Added missing read bit for ROW_START. Also reorganized bitmap_set_bit() so it is called only when needed.
This commit is contained in:
@ -410,3 +410,14 @@ select check_row_ts(row_start, row_end) from t1 for system_time all where row_st
|
||||
check_row_ts(row_start, row_end)
|
||||
CURRENT ROW
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view
|
||||
#
|
||||
create or replace table t1 (a int, primary key (a)) engine=myisam;
|
||||
insert into t1 values (0);
|
||||
create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning;
|
||||
insert into t2 values (1, 0), (2, 0);
|
||||
create or replace view v as select a, b from t1, t2;
|
||||
update v set b= null where a = 0 order by b;
|
||||
drop view v;
|
||||
drop table t1, t2;
|
||||
|
@ -336,4 +336,17 @@ select row_start from t1 into @r;
|
||||
select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22973 Assertion in compare_record upon multi-update involving versioned table via view
|
||||
--echo #
|
||||
create or replace table t1 (a int, primary key (a)) engine=myisam;
|
||||
insert into t1 values (0);
|
||||
create or replace table t2 (pk int, b int, primary key (pk), key(b)) engine=innodb with system versioning;
|
||||
insert into t2 values (1, 0), (2, 0);
|
||||
create or replace view v as select a, b from t1, t2;
|
||||
update v set b= null where a = 0 order by b;
|
||||
# cleanup
|
||||
drop view v;
|
||||
drop table t1, t2;
|
||||
|
||||
source suite/versioning/common_finish.inc;
|
||||
|
@ -8161,9 +8161,6 @@ void TABLE::evaluate_update_default_function()
|
||||
|
||||
void TABLE::vers_update_fields()
|
||||
{
|
||||
bitmap_set_bit(write_set, vers_start_field()->field_index);
|
||||
bitmap_set_bit(write_set, vers_end_field()->field_index);
|
||||
|
||||
if (!vers_write)
|
||||
{
|
||||
file->column_bitmaps_signal();
|
||||
@ -8172,17 +8169,21 @@ void TABLE::vers_update_fields()
|
||||
|
||||
if (versioned(VERS_TIMESTAMP))
|
||||
{
|
||||
bitmap_set_bit(write_set, vers_start_field()->field_index);
|
||||
if (vers_start_field()->store_timestamp(in_use->query_start(),
|
||||
in_use->query_start_sec_part()))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
vers_start_field()->set_has_explicit_value();
|
||||
bitmap_set_bit(read_set, vers_start_field()->field_index);
|
||||
}
|
||||
|
||||
bitmap_set_bit(write_set, vers_end_field()->field_index);
|
||||
vers_end_field()->set_max();
|
||||
vers_end_field()->set_has_explicit_value();
|
||||
bitmap_set_bit(read_set, vers_end_field()->field_index);
|
||||
|
||||
file->column_bitmaps_signal();
|
||||
if (vfield)
|
||||
update_virtual_fields(file, VCOL_UPDATE_FOR_READ);
|
||||
|
Reference in New Issue
Block a user