[MDEV-13013] InnoDB unnecessarily extends data files Created: 2017-06-06 Updated: 2023-03-13 Resolved: 2022-08-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10 |
| Fix Version/s: | 10.3.37, 10.4.27, 10.5.18, 10.6.10, 10.7.6, 10.8.5, 10.9.3, 10.10.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Marko Mäkelä | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | space, startup | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
| 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.
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
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:
This must be fixed, so that the test can be run with all innodb_page_size combinations. |
| Comments |
| Comment by Thirunarayanan Balathandayuthapani [ 2018-02-19 ] | ||||||||||||||||||||||||||||||||
|
Minimum test case:
The above test case fails only during create table in 10.2. It fails because there are no undo logs created 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()).
Above comment made in the function looks like invalid one. Theortically we have 2 free extents(128 pages) and 63 free pages. 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) | ||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2021-11-26 ] | ||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2021-11-26 ] | ||||||||||||||||||||||||||||||||
|
alice, which innodb_temp_data_file_path did you specify to get that SIGSEGV? I do not think that we test non-autoextend system or temporary tablespaces much. | ||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2021-12-07 ] | ||||||||||||||||||||||||||||||||
|
marko it is the case from the first comment, min test from Thiru. I was browsing for some other bug and tried this one if it is repeatable and then just decided to add stacktraces | ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-07-29 ] | ||||||||||||||||||||||||||||||||
|
thiru, the code change in bb-10.3-MDEV-13013 looks OK to me. Some updates to test .rdiff files should be cleaned up. A test seems to fail everywhere on our CI system. | ||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-08-03 ] | ||||||||||||||||||||||||||||||||
|
While I am fairly confident that the fix is correct, I think that it is safer that we omit it from the quarterly releases that are being prepared right now, and implement this right after the releases are out. In that way, we will have 3 months time to catch and address any surprise regression. | ||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2022-08-15 ] | ||||||||||||||||||||||||||||||||
|
|