mariadb/storage/innobase
Thirunarayanan Balathandayuthapani c6de1267dd MDEV-35689 InnoDB system tables cannot be optimized or defragmented
- With the help of MDEV-14795, InnoDB implemented a way to shrink
the InnoDB system tablespace after undo tablespaces have been moved
to separate files (MDEV-29986). There is no way to defragment any
pages of InnoDB system tables. By doing that, shrinking of
system tablespace can be more effective. This patch deals with
defragment of system tables inside ibdata1.

Following steps are done to do the defragmentation of system
tablespace:
1) Make sure that there is no user tables exist in ibdata1

2) Iterate through all extent descriptor pages in system tablespace
and note their states.

3) Find the free earlier extent to replace the lastly used
extents in the system tablespace.

4) Iterate through all indexes of system tablespace and defragment
the tree level by level.

5) Iterate the level from left page to right page and find out
the page comes under the extent to be replaced. If it is then
do step (6) else step(4)

6) Prepare the allocation of new extent by latching necessary
pages. If any error happens then there is no modification of
page happened till step (5).

7) Allocate the new page from the new extent

8) Prepare the associated pages for the block to be modified

9) Prepare the step of freeing of page

10) If any error happens during preparing of associated pages,
freeing of page then restore the page which was modified
during new page allocation

11) Copy the old page content to new page

12) Change the associative pages like left, right and parent page

13) Complete the freeing of old page

Allocation of page from new extent, changing of relative pages,
freeing of page are done by 2 steps. one is prepare which
latches the to be modified pages and checks their validation.
Other is complete(), Do the operation

fseg_validate(): Validate the list exist in inode segment

Defragmentation is enabled only when :autoextend exist in
innodb_data_file_path variable.
2025-04-10 17:13:34 +05:30
..
btr Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
buf Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
data MDEV-29694 Remove the InnoDB change buffer 2023-01-11 17:59:36 +02:00
dict Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
eval MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
fil Merge branch '10.11 into 11.4 2025-01-30 12:01:11 +01:00
fsp MDEV-35689 InnoDB system tables cannot be optimized or defragmented 2025-04-10 17:13:34 +05:30
fts MDEV-35000: dict_table_close() breaks STATS_AUTO_RECALC 2025-02-28 09:00:16 +02:00
fut MDEV-35689 InnoDB system tables cannot be optimized or defragmented 2025-04-10 17:13:34 +05:30
gis Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
ha MDEV-35472 Server crash in ha_storage_put_memlim upon reading from INNODB_LOCKS 2024-11-25 10:31:57 +02:00
handler Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
ibuf MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size 2025-03-26 17:05:44 +02:00
include MDEV-35689 InnoDB system tables cannot be optimized or defragmented 2025-04-10 17:13:34 +05:30
lock Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
log Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
mem Cleanup: Remove duplicated code 2024-11-29 14:16:34 +02:00
mtr Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
mysql-test/storage_engine Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
os Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
page Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
pars Merge 10.6 into 10.11 2025-02-25 10:23:24 +02:00
que MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure 2024-12-12 18:02:00 +02:00
read MDEV-34515: Contention between purge and workload 2024-08-26 12:23:06 +03:00
rem Merge 10.11 into 11.0 2024-03-28 10:51:36 +02:00
row Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
srv Merge 10.11 into 11.4 2025-04-02 10:15:08 +03:00
sync Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
trx Merge 10.11 into 11.4 2025-03-28 13:55:21 +02:00
unittest MDEV-35587 unit.innodb_sync leaks memory on mac 2024-12-12 10:27:36 +11:00
ut Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
.clang-format-old switch off storage/innobase/.clang-format: InnoDB uses a common formatting style for all new code 2021-03-17 11:01:15 +03:00
CMakeLists.txt Merge 10.11 into 11.4 2025-03-03 11:07:56 +02:00
COPYING.Google
COPYING.Percona