mariadb/mysql-test/suite/rpl/t/rpl_geometry.test
Nikita Malyavin 5f206259e5 MDEV-30985 Replica stops with error on ALTER ONLINE with Geometry Types
The bug is inherent for row-based replication as well.
To reproduce, a virtual (not stored) field of a blob type computed from
another field of a different blob type is required.

The following happens during an update or delete row event:
1. A row is unpacked.
2. Virtual fields are updated. Field b1 stores the pointer in
   Field_blob::value and references it in table->record[0].
3. record[0] is stored to record[1] in Rows_log_event::find_row.
4. A new record is fetched from handler. (e.g. ha_rnd_next)
5. Virtual columns are updated (only non-stored).
6. Field b1 receives new value. Old value is deallocated
   (Field_blob::val_str).
7. record_compare is called. record[0] and record[1] are compared.
8. record[1] contains a reference to a freed value.

record_compare is used in replication to find a matching record for update
or delete. Virtual columns that are not stored should be definitely skipped
both for correctness, and for this bug fix.

STORED virtual columns, on the other hand, may be required and shouldn't be
skipped. Stored columns are not affected, since they are not updated after
handler's fetch.
2023-08-15 10:16:13 +02:00

39 lines
871 B
Text

source include/have_binlog_format_row.inc;
source include/master-slave.inc;
#
# Bug#48776, Bug#43784
#
create table t1(a varchar(100),
b multipoint not null,
c varchar(256));
insert into t1 set
a='hello',
b=geomfromtext('multipoint(1 1)'),
c='geometry';
create table t2 (a int(11) not null auto_increment primary key,
b geometrycollection default null,
c decimal(10,0));
insert into t2(c) values (null);
sync_slave_with_master;
connection master;
drop table t1, t2;
--echo #
--echo # MDEV-30985 Replica stops with error on ALTER ONLINE with Geometry Types
--echo #
create table t(geo geometrycollection default st_geomfromtext('point(1 1)'),
vc point as (geo));
insert into t () values (),(),();
delete from t;
sync_slave_with_master;
connection master;
drop table t;
--source include/rpl_end.inc