Commit 20ae4816 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28478: INSERT into SPATIAL INDEX in TEMPORARY table writes log

row_ins_sec_index_entry_low(): If a separate mini-transaction is
needed to adjust the minimum bounding rectangle (MBR) in the parent
page, we must disable redo logging if the table is a temporary table.
For temporary tables, no log is supposed to be written, because
the temporary tablespace will be reinitialized on server restart.

rtr_update_mbr_field(): Plug a memory leak.
parent 84e32eff
...@@ -61,10 +61,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1); ...@@ -61,10 +61,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*) count(*)
57344 57344
drop table t1; drop table t1;
#
# MDEV-27417 Spatial index tries to update
# change buffer bookkeeping page
#
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
DROP TABLE t1;
#
# MDEV-27417 Spatial index tries to update
# change buffer bookkeeping page
#
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
DROP TABLE t1;
#
# MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO
#
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
DROP TABLE t1;
...@@ -72,11 +72,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1); ...@@ -72,11 +72,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
# Clean up. # Clean up.
drop table t1; drop table t1;
--echo #
--echo # MDEV-27417 Spatial index tries to update
--echo # change buffer bookkeeping page
--echo #
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
DROP TABLE t1;
--source include/have_innodb.inc
--source include/have_sequence.inc
--echo #
--echo # MDEV-27417 Spatial index tries to update
--echo # change buffer bookkeeping page
--echo #
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL, SPATIAL(c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT PointFromText('POINT(0 0)') FROM seq_1_to_366;
DROP TABLE t1;
--echo #
--echo # MDEV-28478 Assertion mtr->get_log_mode() == MTR_LOG_NO_REDO
--echo #
CREATE TEMPORARY TABLE t1 (c POINT NOT NULL,SPATIAL (c)) ENGINE=InnoDB;
INSERT INTO t1 SELECT POINT(0,0) FROM seq_1_to_366;
INSERT INTO t1 VALUES (POINT(1e-270,1e-130));
DROP TABLE t1;
/***************************************************************************** /*****************************************************************************
Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, 2020, MariaDB Corporation. Copyright (c) 2019, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -376,6 +376,7 @@ rtr_update_mbr_field( ...@@ -376,6 +376,7 @@ rtr_update_mbr_field(
if (!rtr_update_mbr_field_in_place(index, rec, if (!rtr_update_mbr_field_in_place(index, rec,
offsets, mbr, mtr)) { offsets, mbr, mtr)) {
mem_heap_free(heap);
return(false); return(false);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2021, MariaDB Corporation. Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -2900,8 +2900,12 @@ row_ins_sec_index_entry_low( ...@@ -2900,8 +2900,12 @@ row_ins_sec_index_entry_low(
rtr_init_rtr_info(&rtr_info, false, &cursor, rtr_init_rtr_info(&rtr_info, false, &cursor,
index, false); index, false);
rtr_info_update_btr(&cursor, &rtr_info); rtr_info_update_btr(&cursor, &rtr_info);
mtr_start(&mtr); mtr.start();
mtr.set_named_space(index->space); if (index->table->is_temporary()) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
} else {
mtr.set_named_space(index->space);
}
search_mode &= ulint(~BTR_MODIFY_LEAF); search_mode &= ulint(~BTR_MODIFY_LEAF);
search_mode |= BTR_MODIFY_TREE; search_mode |= BTR_MODIFY_TREE;
err = btr_cur_search_to_nth_level( err = btr_cur_search_to_nth_level(
......
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