Details
Description
There are several bugs in the way how the InnoDB temporary tablespace is handled at InnoDB startup.
The theoretical minimum size of the InnoDB temporary tablespace should be one allocation extent (1M for innodb_page_size=16k or less, 2M for innodb_page_size=32k, 4M for innodb_page_size=64k). For simplicity, it should be possible to set the minimum size as 4M.
MDEV-12289 creates 128 rollback segments for the temporary tablespace. This might be an overkill, and perhaps we should create only 32 of them, like MySQL 5.7 does.
In SysTablespace::open_or_create(), even if the specification lacks :autoextend for the last file, max_size=ULINT_MAX will be incorrectly assigned. This bug was introduced in MySQL 5.7 by WL#7943 https://github.com/mysql/mysql-server/commit/38e3aa74d8d2bf882863d9586ad8c9e9ed2c4f00, most of which was reverted from MariaDB 10.2 in MDEV-11426.
MDEV-11585 accidentally inverted a condition in fsp_fill_free_list() that decides if the innodb_temporary tablespace should be extended.
The biggest problem is that trx_rseg_header_create() is trying to extend the temporary tablespace already for creating the very first rollback segment. This happens for a 12MiB temporary tablespace when using 64KiB page size. The following test will crash:
./mtr --mysqld=--innodb-buffer-pool-size=24m --mysqld=--innodb-page-size=64k --mem innodb.temporary_table
|
This must be fixed, so that the test can be run with all innodb_page_size combinations.
Attachments
Issue Links
- blocks
-
MDEV-26782 InnoDB temporary tablespace: reclaiming of free space does not work
-
- Closed
-
- relates to
-
MDEV-21952 ibdata1 file size growing in MariaDB
-
- Closed
-
-
MDEV-28038 Why is there a big gap in the actual Table space? (calculated vs information_schema vs file size)
-
- Open
-
-
MDEV-28699 Shrink temporary tablespaces without restart
-
- Closed
-
-
MDEV-11585 Hard-code the shared InnoDB temporary tablespace ID
-
- Closed
-
-
MDEV-12042 Re-bootstrap the server if InnoDB options are incompatible (Make InnoDB tests run with all --mysqld=--innodb-page-size)
-
- Closed
-
-
MDEV-12289 Keep 128 persistent rollback segments for compatibility and performance
-
- Closed
-
-
MDEV-12600 crash during install_db with innodb_page_size=32K and ibdata1=3M;
-
- Closed
-
-
MDEV-14887 On a 32-bit system, MariaDB 10.2 mishandles data file sizes exceeding 4GiB
-
- Closed
-
-
MDEV-26525 Replication stops because too big innodb-temp-data-file
-
- Closed
-
Minimum test case:
temp1.opt
========
--innodb_temp_data_file_path=ibtmp1:12M
--innodb-page-size=64k
--innodb-buffer-pool-size=24M\
temp1.test
==========
--source include/have_innodb.inc
The above test case fails only during create table in 10.2. It fails because there are no undo logs created
for temporary tablespace.
But in mysql-5.7, It fails while starting the mysql-5.7 server with following error:
During server startup, InnoDB tries to create rollback segment in temporary tablespace(fseg_create()).
It always call with the assumption that there is no reservation done before. (fseg_create_general).
fsp_reserve_free_extents() also tries to reserve the extent in FSP_NORMAL allocation mode.
and 1 extent + 0.5 % to cleaning operations; NOTE: this source
code is duplicated in the function below! */
reserve = 2 + ((size / FSP_EXTENT_SIZE) * 2) / 200;
}
Above comment made in the function looks like invalid one. Theortically we have 2 free extents(128 pages) and 63 free pages.
These pages are enough to create inode pages and 128 rollback segment pages. We have to evaluate the comments are valid now
and re-evaluate the condition for small tablespace and assumption of no reservation before.
These changes are more risky to 10.3. Hence moving this issue to 10.4.
Another observation:
For page size = 64k, ibtmp1 is 76mb (mysql-5.7 and 10.3)
There is no change in file size because of 128 temporary tablespace rollback segments in 10.3