Skip to content

Conversation

dbussink
Copy link

@dbussink dbussink commented Jul 4, 2024

The issue here is that when multiple FTS indexes are dropped in a single ALTER TABLE statement, we don't clean up the auxiliary index tables from the data dictionary. They are still referenced and when MySQL restarts the next time, it prints a number of warnings:

2024-07-04T10:07:26.207208Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 12, name 'test/fts_000000000000042d_00000000000000a7_index_1', file './test/fts_000000000000042d_00000000000000a7_index_1.ibd' is missing!
2024-07-04T10:07:26.207251Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 13, name 'test/fts_000000000000042d_00000000000000a7_index_2', file './test/fts_000000000000042d_00000000000000a7_index_2.ibd' is missing!
2024-07-04T10:07:26.207285Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 14, name 'test/fts_000000000000042d_00000000000000a7_index_3', file './test/fts_000000000000042d_00000000000000a7_index_3.ibd' is missing!
2024-07-04T10:07:26.207303Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 15, name 'test/fts_000000000000042d_00000000000000a7_index_4', file './test/fts_000000000000042d_00000000000000a7_index_4.ibd' is missing!
2024-07-04T10:07:26.207319Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 16, name 'test/fts_000000000000042d_00000000000000a7_index_5', file './test/fts_000000000000042d_00000000000000a7_index_5.ibd' is missing!
2024-07-04T10:07:26.207335Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 17, name 'test/fts_000000000000042d_00000000000000a7_index_6', file './test/fts_000000000000042d_00000000000000a7_index_6.ibd' is missing!

The problem is that when multiple indexes are dropped at once, we end up looping through and overwriting ctx->fts_drop_aux_vec on the next iteration.

This means that this both leaks memory as the old vector is not de-allocated but also that the initial set of aux tables is not removed from the data dictionary later on.

The fix is simple, only allocate ctx->fts_drop_aux_vec if it's not allocated yet. This way all aux tables are gathered for all indexes and cleaned up correctly.

A test is added that reproduces the above warning and this test passes with the fixes here.

The issue here is that when multiple FTS indexes are dropped in a single
`ALTER TABLE` statement, we don't clean up the auxiliary index tables
from the data dictionary. They are still referenced and when MySQL
restarts the next time, it prints a number of warnings:

2024-07-04T10:07:26.207208Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 12, name 'test/fts_000000000000042d_00000000000000a7_index_1', file './test/fts_000000000000042d_00000000000000a7_index_1.ibd' is missing!
2024-07-04T10:07:26.207251Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 13, name 'test/fts_000000000000042d_00000000000000a7_index_2', file './test/fts_000000000000042d_00000000000000a7_index_2.ibd' is missing!
2024-07-04T10:07:26.207285Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 14, name 'test/fts_000000000000042d_00000000000000a7_index_3', file './test/fts_000000000000042d_00000000000000a7_index_3.ibd' is missing!
2024-07-04T10:07:26.207303Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 15, name 'test/fts_000000000000042d_00000000000000a7_index_4', file './test/fts_000000000000042d_00000000000000a7_index_4.ibd' is missing!
2024-07-04T10:07:26.207319Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 16, name 'test/fts_000000000000042d_00000000000000a7_index_5', file './test/fts_000000000000042d_00000000000000a7_index_5.ibd' is missing!
2024-07-04T10:07:26.207335Z 1 [Warning] [MY-012351] [InnoDB] Tablespace 17, name 'test/fts_000000000000042d_00000000000000a7_index_6', file './test/fts_000000000000042d_00000000000000a7_index_6.ibd' is missing!

The problem is that when multiple indexes are dropped at once, we end up
looping through and overwriting ctx->fts_drop_aux_vec on the next
iteration.

This means that this both leaks memory as the old vector is not
de-allocated but also that the initial set of aux tables is not removed
from the data dictionary later on.

The fix is simple, only allocate ctx->fts_drop_aux_vec if it's not
allocated yet. This way all aux tables are gathered for all indexes and
cleaned up correctly.

A test is added that reproduces the above warning and this test passes
with the fixes here.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@dbussink
Copy link
Author

dbussink commented Jul 4, 2024

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=115527 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants