MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space

- After MDEV-24621, InnoDB does buffer the insert bulk operation
for all indexes expect spatial one. But it leads to search the
primary key lookup and it leads to failure. So InnoDB should avoid
bulk insert when table has spatial index involved.
parent cd56b40f
...@@ -250,3 +250,13 @@ LOCK TABLES t1 WRITE,t2 WRITE; ...@@ -250,3 +250,13 @@ LOCK TABLES t1 WRITE,t2 WRITE;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
#
CREATE TABLE t1(
f1 SERIAL,
f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'),
SPATIAL INDEX(f2))ENGINE=InnoDB;
INSERT INTO t1(f1) VALUES(0), (1), (2);
ERROR 23000: Duplicate entry '1' for key 'f1'
DROP TABLE t1;
...@@ -261,3 +261,14 @@ LOCK TABLES t1 WRITE,t2 WRITE; ...@@ -261,3 +261,14 @@ LOCK TABLES t1 WRITE,t2 WRITE;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
DROP TABLE t2, t1; DROP TABLE t2, t1;
--echo #
--echo # MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
--echo #
CREATE TABLE t1(
f1 SERIAL,
f2 LINESTRING NOT NULL DEFAULT LineFromText('LINESTRING(1 1,2 2,3 3)'),
SPATIAL INDEX(f2))ENGINE=InnoDB;
--error ER_DUP_ENTRY
INSERT INTO t1(f1) VALUES(0), (1), (2);
DROP TABLE t1;
...@@ -2382,6 +2382,16 @@ struct dict_table_t { ...@@ -2382,6 +2382,16 @@ struct dict_table_t {
static dict_table_t *create(const span<const char> &name, fil_space_t *space, static dict_table_t *create(const span<const char> &name, fil_space_t *space,
ulint n_cols, ulint n_v_cols, ulint flags, ulint n_cols, ulint n_v_cols, ulint flags,
ulint flags2); ulint flags2);
/** Check whether the table has any spatial indexes */
bool has_spatial_index() const
{
for (auto i= UT_LIST_GET_FIRST(indexes);
(i= UT_LIST_GET_NEXT(indexes, i)) != nullptr; )
if (i->is_spatial())
return true;
return false;
}
}; };
inline void dict_index_t::set_modified(mtr_t& mtr) const inline void dict_index_t::set_modified(mtr_t& mtr) const
......
...@@ -2637,6 +2637,7 @@ row_ins_clust_index_entry_low( ...@@ -2637,6 +2637,7 @@ row_ins_clust_index_entry_low(
&& block->page.id().page_no() == index->page && block->page.id().page_no() == index->page
&& !index->table->skip_alter_undo && !index->table->skip_alter_undo
&& !index->table->n_rec_locks && !index->table->n_rec_locks
&& !index->table->has_spatial_index()
&& !trx->is_wsrep() /* FIXME: MDEV-24623 */ && !trx->is_wsrep() /* FIXME: MDEV-24623 */
&& !thd_is_slave(trx->mysql_thd) /* FIXME: MDEV-24622 */) { && !thd_is_slave(trx->mysql_thd) /* FIXME: MDEV-24622 */) {
DEBUG_SYNC_C("empty_root_page_insert"); DEBUG_SYNC_C("empty_root_page_insert");
......
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