summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty.result9
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test9
-rw-r--r--storage/innobase/include/dict0mem.h7
-rw-r--r--storage/innobase/row/row0ins.cc11
-rw-r--r--storage/innobase/row/row0merge.cc12
5 files changed, 38 insertions, 10 deletions
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result
index f33bef890fd..31bf91595e7 100644
--- a/mysql-test/suite/innodb/r/insert_into_empty.result
+++ b/mysql-test/suite/innodb/r/insert_into_empty.result
@@ -222,3 +222,12 @@ ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
DROP TABLE t1;
+#
+# MDEV-27316 Assertion `!(index)->is_spatial()' failed.
+#
+CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
+INSERT INTO t VALUES (POINT(1, 1));
+SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
+COUNT(*)
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index 7719ae68d7b..bfcf96d854c 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+
--source include/have_sequence.inc
--source include/maybe_debug.inc
--source include/have_partition.inc
@@ -233,3 +234,11 @@ ALTER TABLE t1 ADD COLUMN row_start BIGINT UNSIGNED AS ROW START,
ADD COLUMN row_end BIGINT UNSIGNED AS ROW END,
ADD PERIOD FOR SYSTEM_TIME(row_start,row_end), WITH SYSTEM VERSIONING;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-27316 Assertion `!(index)->is_spatial()' failed.
+--echo #
+CREATE TABLE t (c POINT NOT NULL, SPATIAL INDEX(c)) ENGINE=InnoDB;
+INSERT INTO t VALUES (POINT(1, 1));
+SELECT COUNT(*) FROM t WHERE MBRWithin(t.c, POINT(1,1));
+DROP TABLE t;
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 919dd48a032..744ef5316ef 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1184,6 +1184,13 @@ public:
/** @return whether this is the change buffer */
bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); }
+ /** @return whether this is a normal B-tree index
+ (not the change buffer, not SPATIAL or FULLTEXT) */
+ bool is_btree() const {
+ return UNIV_LIKELY(!(type & (DICT_IBUF | DICT_SPATIAL
+ | DICT_FTS | DICT_CORRUPT)));
+ }
+
/** @return whether the index includes virtual columns */
bool has_virtual() const { return type & DICT_VIRTUAL; }
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index c2c87cf3a78..711a2ff02d5 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -3370,10 +3370,13 @@ row_ins_index_entry(
DBUG_SET("-d,row_ins_index_entry_timeout");
return(DB_LOCK_WAIT);});
- if (auto t= trx->check_bulk_buffer(index->table)) {
- /* MDEV-25036 FIXME: check also foreign key constraints */
- ut_ad(!trx->check_foreigns);
- return t->bulk_insert_buffered(*entry, *index, trx);
+ if (index->is_btree()) {
+ if (auto t= trx->check_bulk_buffer(index->table)) {
+ /* MDEV-25036 FIXME: check also foreign key
+ constraints */
+ ut_ad(!trx->check_foreigns);
+ return t->bulk_insert_buffered(*entry, *index, trx);
+ }
}
if (index->is_primary()) {
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 4a5b8ffb271..f693a9ec96e 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4986,7 +4986,7 @@ row_merge_bulk_t::row_merge_bulk_t(dict_table_t *table)
for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
n_index++;
}
@@ -4998,7 +4998,7 @@ row_merge_bulk_t::row_merge_bulk_t(dict_table_t *table)
for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
mem_heap_t *heap= mem_heap_create(100);
@@ -5019,7 +5019,7 @@ row_merge_bulk_t::~row_merge_bulk_t()
for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
row_merge_buf_free(&m_merge_buf[i]);
if (m_merge_files)
@@ -5049,7 +5049,7 @@ void row_merge_bulk_t::init_tmp_file()
for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
n_index++;
}
@@ -5112,7 +5112,7 @@ dberr_t row_merge_bulk_t::bulk_insert_buffered(const dtuple_t &row,
for (dict_index_t *index= UT_LIST_GET_FIRST(ind.table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
if (index != &ind)
@@ -5210,7 +5210,7 @@ dberr_t row_merge_bulk_t::write_to_table(dict_table_t *table, trx_t *trx)
for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
index; index= UT_LIST_GET_NEXT(indexes, index))
{
- if (index->type & DICT_FTS)
+ if (!index->is_btree())
continue;
dberr_t err= write_to_index(i, trx);