[MDEV-21952] ibdata1 file size growing in MariaDB Created: 2020-03-16 Updated: 2023-10-18 Resolved: 2021-10-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2.25 |
| Fix Version/s: | 10.5.13, 10.6.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Tarun | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MariaDB Galera 3 Node DR |
||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
We are using DATETIME Interval in most of our MariaDB Tables where we have automated Data Purging Process to delete data at Interval 1 DAY , INTERVAL 1 HOUR and we have Optimize Table script which runs once in day ( ALTER TABLE <table> ENGINE=InnoDB ) It is observed ibdata1 file in mysql folder has grown to 122 GB Do we have Tuning options or Space recovery options that we can some have workaround on ibdata1 file ? |
| Comments |
| Comment by Marko Mäkelä [ 2020-03-16 ] |
|
The system tablespace should grow either due to the change buffer or due to undo logs. ALTER TABLE operations should not write excessive amounts of undo log in the reported version, because the It seems to me that your question should best be answered by our support staff. |
| Comment by Tarun [ 2020-03-16 ] |
|
I have enabled innodb_file_per_table =1 in my.cnf file , for each table *.ibd file is generated . We are loading Data into MariaDB Galera DR using Apache Kakfa and sometime by Load ifile option |
| Comment by Marko Mäkelä [ 2020-03-16 ] |
|
You might want to consider acquiring a support contract. |
| Comment by Marko Mäkelä [ 2021-08-20 ] |
|
During the development of Undo tablespace truncation is a special case: the entire tablespace will be rewritten. But, we could use a similar mechanism for shrinking any tablespace. If the last pages of the tablespace are freed, we could shrink the file. However, it is not trivial to shrink an arbitrary InnoDB tablespace. Even if the last pages in a tablespace are unallocated, we would want some hysteresis so that files would not be repeatedly extended ( Ultimately, I would like to remove the system tablespace at some point (MDEV-11633). It stores the following:
I think that it is easiest to configure the server so that nothing will unnecessarily be created in the system tablespace:
This should prevent most fragmentation of the system tablespace. Theoretically, the data dictionary tables could still cause trouble, but I would be surprised if it were the case. Would it be possible to defragment or pack the system tablespace?
I would like to know if this issue remains after implementing the mitigation measures: disable the change buffer, use dedicated undo tablespaces, and never use innodb_file_per_table=0. Any remaining growth should only be caused by the data dictionary tables. Those tables should not contain any BLOBs, so theoretically it should be possible to relocate pages of dictionary tables closer to the start, so that the system tablespace could be shrunk. Note: It could be that the defragmentation feature ( |
| Comment by Marko Mäkelä [ 2021-09-21 ] |
|
Once |
| Comment by Marko Mäkelä [ 2022-08-04 ] |
|
|
| Comment by Marko Mäkelä [ 2022-11-09 ] |
|
Fixing This ticket was closed because it is possible to avoid the growth of the InnoDB system tablespace by changing some configuration parameters. |
| Comment by Marko Mäkelä [ 2023-04-25 ] |
|
A contributing factor to the growth of the system tablespace would be the “caching” (delayed freeing) of undo log pages. The fix of That said, I would still recommend setting multiple innodb_undo_tablespaces. |