Skip to content

Commit 3330f8d

Browse files
MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert()
- Change partition does undo logging of all rows unnecessarily and it invokes bulk insert during DDL. Better to avoid the logging of undo records during copy of the parititon.
1 parent 742e1c7 commit 3330f8d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

mysql-test/suite/innodb/r/insert_into_empty.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,11 @@ t1 CREATE TABLE `t1` (
296296
) ENGINE=InnoDB DEFAULT CHARSET=latin1
297297
CREATE TABLE t2(d INT)ENGINE=InnoDB;
298298
DROP TABLE t2, t1;
299+
#
300+
# MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert
301+
#
302+
SET SESSION foreign_key_checks=0;
303+
CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2;
304+
INSERT INTO t1 VALUES (1),(2);
305+
ALTER TABLE t1 REBUILD PARTITION p0;
306+
DROP TABLE t1;

mysql-test/suite/innodb/t/insert_into_empty.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,14 @@ SET SESSION foreign_key_checks=TRUE;
304304
SHOW CREATE TABLE t1;
305305
CREATE TABLE t2(d INT)ENGINE=InnoDB;
306306
DROP TABLE t2, t1;
307+
308+
--echo #
309+
--echo # MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert
310+
--echo #
311+
312+
SET SESSION foreign_key_checks=0;
313+
CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY HASH(a) PARTITIONS 2;
314+
INSERT INTO t1 VALUES (1),(2);
315+
ALTER TABLE t1 REBUILD PARTITION p0;
316+
# Cleanup
317+
DROP TABLE t1;

sql/ha_partition.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,10 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
21432143
}
21442144
DBUG_ASSERT(m_new_file == 0);
21452145
m_new_file= new_file_array;
2146-
if (unlikely((error= copy_partitions(copied, deleted))))
2146+
(*m_new_file)->extra(HA_EXTRA_BEGIN_ALTER_COPY);
2147+
error= copy_partitions(copied, deleted);
2148+
(*m_new_file)->extra(HA_EXTRA_END_ALTER_COPY);
2149+
if (unlikely(error))
21472150
{
21482151
/*
21492152
Close and unlock the new temporary partitions.

0 commit comments

Comments
 (0)