mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-8386: MARIADB creates very big tmp file > 351Gb. Started happening after Version 10.0.16-15
Fixed small size limit and added additional information if we reserve new pages more then 50 times.
This commit is contained in:
45
mysql-test/suite/innodb/r/innodb-alter-table.result
Normal file
45
mysql-test/suite/innodb/r/innodb-alter-table.result
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
drop database if exists moodle19;
|
||||||
|
Warnings:
|
||||||
|
Note 1008 Can't drop database 'moodle19'; database doesn't exist
|
||||||
|
create database moodle19;
|
||||||
|
use moodle19;
|
||||||
|
CREATE TABLE `mdl_course_modules` (
|
||||||
|
`id` bigint(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`course` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`module` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`instance` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`section` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`idnumber` varchar(100) DEFAULT NULL,
|
||||||
|
`added` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`delay` varchar(10) NOT NULL DEFAULT '0',
|
||||||
|
`score` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`indent` mediumint(5) NOT NULL DEFAULT '0',
|
||||||
|
`visible` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`checkboxesforprereqs` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`stylewhencomplete` varchar(200) DEFAULT '',
|
||||||
|
`checkboxforcomplete` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`stylewhenlocked` varchar(200) DEFAULT 'locked',
|
||||||
|
`visiblewhenlocked` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`visibleold` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`groupmode` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`groupingid` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`groupmembersonly` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`completion` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`completiongradeitemnumber` bigint(10) DEFAULT NULL,
|
||||||
|
`completionview` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`completionexpected` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`availablefrom` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`availableuntil` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`showavailability` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`showdescription` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `mdl_courmodu_vis_ix` (`visible`),
|
||||||
|
KEY `mdl_courmodu_cou_ix` (`course`),
|
||||||
|
KEY `mdl_courmodu_mod_ix` (`module`),
|
||||||
|
KEY `mdl_courmodu_ins_ix` (`instance`),
|
||||||
|
KEY `mdl_courmodu_idncou_ix` (`idnumber`,`course`),
|
||||||
|
KEY `mdl_courmodu_gro_ix` (`groupingid`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=447023 DEFAULT CHARSET=utf8 COMMENT='course_modules table retrofitted from MySQL';
|
||||||
|
# Inserting 2701 rows into the table...
|
||||||
|
ALTER TABLE moodle19.mdl_course_modules ADD stefantest LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci AFTER showdescription;
|
||||||
|
drop database moodle19;
|
59
mysql-test/suite/innodb/t/innodb-alter-table.test
Normal file
59
mysql-test/suite/innodb/t/innodb-alter-table.test
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
#
|
||||||
|
# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
|
||||||
|
#
|
||||||
|
drop database if exists moodle19;
|
||||||
|
create database moodle19;
|
||||||
|
use moodle19;
|
||||||
|
|
||||||
|
CREATE TABLE `mdl_course_modules` (
|
||||||
|
`id` bigint(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`course` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`module` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`instance` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`section` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`idnumber` varchar(100) DEFAULT NULL,
|
||||||
|
`added` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`delay` varchar(10) NOT NULL DEFAULT '0',
|
||||||
|
`score` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`indent` mediumint(5) NOT NULL DEFAULT '0',
|
||||||
|
`visible` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`checkboxesforprereqs` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`stylewhencomplete` varchar(200) DEFAULT '',
|
||||||
|
`checkboxforcomplete` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`stylewhenlocked` varchar(200) DEFAULT 'locked',
|
||||||
|
`visiblewhenlocked` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`visibleold` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
|
`groupmode` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`groupingid` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`groupmembersonly` smallint(4) NOT NULL DEFAULT '0',
|
||||||
|
`completion` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`completiongradeitemnumber` bigint(10) DEFAULT NULL,
|
||||||
|
`completionview` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`completionexpected` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`availablefrom` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`availableuntil` bigint(10) NOT NULL DEFAULT '0',
|
||||||
|
`showavailability` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`showdescription` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `mdl_courmodu_vis_ix` (`visible`),
|
||||||
|
KEY `mdl_courmodu_cou_ix` (`course`),
|
||||||
|
KEY `mdl_courmodu_mod_ix` (`module`),
|
||||||
|
KEY `mdl_courmodu_ins_ix` (`instance`),
|
||||||
|
KEY `mdl_courmodu_idncou_ix` (`idnumber`,`course`),
|
||||||
|
KEY `mdl_courmodu_gro_ix` (`groupingid`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=447023 DEFAULT CHARSET=utf8 COMMENT='course_modules table retrofitted from MySQL';
|
||||||
|
|
||||||
|
let $num= 2701;
|
||||||
|
--disable_query_log
|
||||||
|
--echo # Inserting $num rows into the table...
|
||||||
|
while ($num)
|
||||||
|
{
|
||||||
|
eval INSERT INTO mdl_course_modules VALUES ($num,4,5,5,24,NULL,1141569781,'',0,0,1,0,'',0,'locked',1,1,0,0,0,0,NULL,0,0,0,0,0,0);
|
||||||
|
dec $num;
|
||||||
|
}
|
||||||
|
--enable_query_log
|
||||||
|
ALTER TABLE moodle19.mdl_course_modules ADD stefantest LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci AFTER showdescription;
|
||||||
|
|
||||||
|
drop database moodle19;
|
@ -2715,6 +2715,8 @@ fsp_reserve_free_extents(
|
|||||||
ulint reserve;
|
ulint reserve;
|
||||||
ibool success;
|
ibool success;
|
||||||
ulint n_pages_added;
|
ulint n_pages_added;
|
||||||
|
size_t total_reserved = 0;
|
||||||
|
ulint rounds = 0;
|
||||||
|
|
||||||
ut_ad(mtr);
|
ut_ad(mtr);
|
||||||
*n_reserved = n_ext;
|
*n_reserved = n_ext;
|
||||||
@ -2783,6 +2785,7 @@ try_again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
success = fil_space_reserve_free_extents(space, n_free, n_ext);
|
success = fil_space_reserve_free_extents(space, n_free, n_ext);
|
||||||
|
*n_reserved = n_ext;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -2790,8 +2793,19 @@ try_again:
|
|||||||
try_to_extend:
|
try_to_extend:
|
||||||
success = fsp_try_extend_data_file(&n_pages_added, space,
|
success = fsp_try_extend_data_file(&n_pages_added, space,
|
||||||
space_header, mtr);
|
space_header, mtr);
|
||||||
|
|
||||||
if (success && n_pages_added > 0) {
|
if (success && n_pages_added > 0) {
|
||||||
|
|
||||||
|
rounds++;
|
||||||
|
total_reserved += n_pages_added;
|
||||||
|
|
||||||
|
if (rounds > 50) {
|
||||||
|
ib_logf(IB_LOG_LEVEL_INFO,
|
||||||
|
"Space id %lu trying to reserve %lu extents actually reserved %lu "
|
||||||
|
" reserve %lu free %lu size %lu rounds %lu total_reserved %lu",
|
||||||
|
space, n_ext, n_pages_added, reserve, n_free, size, rounds, total_reserved);
|
||||||
|
}
|
||||||
|
|
||||||
goto try_again;
|
goto try_again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2724,6 +2724,8 @@ fsp_reserve_free_extents(
|
|||||||
ulint reserve;
|
ulint reserve;
|
||||||
ibool success;
|
ibool success;
|
||||||
ulint n_pages_added;
|
ulint n_pages_added;
|
||||||
|
size_t total_reserved = 0;
|
||||||
|
ulint rounds = 0;
|
||||||
|
|
||||||
ut_ad(mtr);
|
ut_ad(mtr);
|
||||||
*n_reserved = n_ext;
|
*n_reserved = n_ext;
|
||||||
@ -2737,7 +2739,7 @@ fsp_reserve_free_extents(
|
|||||||
try_again:
|
try_again:
|
||||||
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
if (size < FSP_EXTENT_SIZE) {
|
if (size < FSP_EXTENT_SIZE / 2) {
|
||||||
/* Use different rules for small single-table tablespaces */
|
/* Use different rules for small single-table tablespaces */
|
||||||
*n_reserved = 0;
|
*n_reserved = 0;
|
||||||
return(fsp_reserve_free_pages(space, space_header, size, mtr));
|
return(fsp_reserve_free_pages(space, space_header, size, mtr));
|
||||||
@ -2752,7 +2754,6 @@ try_again:
|
|||||||
some of them will contain extent descriptor pages, and therefore
|
some of them will contain extent descriptor pages, and therefore
|
||||||
will not be free extents */
|
will not be free extents */
|
||||||
|
|
||||||
ut_ad(size >= free_limit);
|
|
||||||
n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
|
n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
|
||||||
|
|
||||||
if (n_free_up > 0) {
|
if (n_free_up > 0) {
|
||||||
@ -2793,6 +2794,7 @@ try_again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
success = fil_space_reserve_free_extents(space, n_free, n_ext);
|
success = fil_space_reserve_free_extents(space, n_free, n_ext);
|
||||||
|
*n_reserved = n_ext;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -2802,6 +2804,16 @@ try_to_extend:
|
|||||||
space_header, mtr);
|
space_header, mtr);
|
||||||
if (success && n_pages_added > 0) {
|
if (success && n_pages_added > 0) {
|
||||||
|
|
||||||
|
rounds++;
|
||||||
|
total_reserved += n_pages_added;
|
||||||
|
|
||||||
|
if (rounds > 50) {
|
||||||
|
ib_logf(IB_LOG_LEVEL_INFO,
|
||||||
|
"Space id %lu trying to reserve %lu extents actually reserved %lu "
|
||||||
|
" reserve %lu free %lu size %lu rounds %lu total_reserved %lu",
|
||||||
|
space, n_ext, n_pages_added, reserve, n_free, size, rounds, total_reserved);
|
||||||
|
}
|
||||||
|
|
||||||
goto try_again;
|
goto try_again;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user