1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.
This commit is contained in:
Marko Mäkelä
2022-05-06 09:30:17 +03:00
parent 84e32eff5b
commit 20ae4816bb
6 changed files with 41 additions and 19 deletions

View File

@ -61,10 +61,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
count(*)
57344
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;

View File

@ -0,0 +1,14 @@
#
# 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;

View File

@ -72,11 +72,3 @@ select count(*) from t1 where MBRWithin(t1.c2, @g1);
# Clean up.
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;

View File

@ -0,0 +1,18 @@
--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;

View File

@ -1,7 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@ -376,6 +376,7 @@ rtr_update_mbr_field(
if (!rtr_update_mbr_field_in_place(index, rec,
offsets, mbr, mtr)) {
mem_heap_free(heap);
return(false);
}

View File

@ -1,7 +1,7 @@
/*****************************************************************************
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
the terms of the GNU General Public License as published by the Free Software
@ -2900,8 +2900,12 @@ row_ins_sec_index_entry_low(
rtr_init_rtr_info(&rtr_info, false, &cursor,
index, false);
rtr_info_update_btr(&cursor, &rtr_info);
mtr_start(&mtr);
mtr.set_named_space(index->space);
mtr.start();
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 |= BTR_MODIFY_TREE;
err = btr_cur_search_to_nth_level(