Bug #113707 replication stops after updating geometry column
Submitted: 22 Jan 2024 11:52 Modified: 22 Jan 2024 12:02
Reporter: Yin Peng (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:8.3.0, 8.0.36 OS:Any
Assigned to: CPU Architecture:Any

[22 Jan 2024 11:52] Yin Peng
Description:
Replication stops with error 'HA_ERR_KEY_NOT_FOUND' after updating geometry column on master.

How to repeat:

source include/have_binlog_format_row.inc;
--source include/master-slave.inc

connection master;
CREATE TABLE t1 (path varchar(512) CHARACTER SET latin1 NOT NULL,box geometry NOT NULL SRID 4326,SPATIAL KEY box (box));
insert into t1 values('asdfghjkl', ST_GeomFromText('POINT(39.345 116.123)',4326));
insert into t1 values('wetryiwo', ST_GeomFromText('POINT(35.631122 134.5672332)',4326));
insert into t1 values('223fsdssa', ST_GeomFromText('POINT(52.34445 12.433)',4326));

--source include/sync_slave_sql_with_master.inc
connection slave;
select ST_X(box),ST_Y(box) from t1 where path='wetryiwo';

connection master;
update t1 set box=ST_GeomFromText('POINT(68.32145 123.5432)', 4326) where path='wetryiwo';

--source include/sync_slave_sql_with_master.inc
connection slave;
select ST_X(box),ST_Y(box) from t1 where path='wetryiwo';

connection master;
drop table t1;
--source include/sync_slave_sql_with_master.inc

--source include/rpl_end.inc

Suggested fix:
Maybe spatial indexes should not be used for index scan in row-based replication?
Since there is some code in row_search_mvcc:

/* We don't support sequential scan for Rtree index, because it
is no meaning to do so. */
if (dict_index_is_spatial(index) && !RTREE_SEARCH_MODE(mode)) {
  err = DB_END_OF_INDEX;
  goto func_exit;
}

In this case, the mode being used is PAGE_CUR_GE, which is not compatible with the rtree index.
[22 Jan 2024 12:02] MySQL Verification Team
Hello yin peng,

Thank you for the report and test case.

regards,
Umesh