Commit 9aa80fcf authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-19485: Crash on purge after ADD SPATIAL INDEX

row_build_spatial_index_key(): Return early if the column is missing
in the table row tuple.

This is a regression that was introduced by
commit 0e5a4ac2.
parent d448cfc9
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('');
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1;
ALTER TABLE t1 ADD SPATIAL INDEX (g);
disconnect purge_control;
InnoDB 0 transactions not purged
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--source include/have_innodb.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t1 (g MULTIPOINT NOT NULL) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('');
connect purge_control,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1;
ALTER TABLE t1 ADD SPATIAL INDEX (g);
disconnect purge_control;
--source ../../innodb/include/wait_all_purged.inc
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
......@@ -62,6 +62,10 @@ static bool row_build_spatial_index_key(
ulint flag,
mem_heap_t* heap)
{
if (dfield2->type.mtype == DATA_MISSING) {
return false;
}
double* mbr;
dfield_copy(dfield, dfield2);
......@@ -92,6 +96,7 @@ static bool row_build_spatial_index_key(
if (!dfield_is_ext(dfield2)) {
dptr = static_cast<const byte*>(dfield_get_data(dfield2));
dlen = dfield_get_len(dfield2);
ut_ad(dptr != &data_error);
goto write_mbr;
}
......
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