Fix skipped removal of initial logs for Ubuntu#594
Conversation
… for debian only without ubuntu. Also added initial ibdata for removal in case of custom config changing InnoDB settings.
|
Looks fine, but please try to fix the lint issues before merge. |
|
Linter should be satisfied now. |
|
The last CI run was passing as of March 10: https://github.com/geerlingguy/ansible-role-mysql/actions/runs/22932344253 The error in CI seems to be: |
…refusing to start
Just deleting the ibdata file results in a corrupted tablespace for mysql. Fix by removing the entire data dir and recreate it. Afterwards, reinitialize the data dir. For the reinitialization, detect mariadb or mysql, as the init command is different, then initialize after config copy.
|
Sorry it took a bit longer to find time again. It turned out it is a bit more complicated, because deleting ibdata leaves tablespace metadata still in place, leading to MySQL refusing to start. The main problem, however, was that I could not reproduce this problem first. The molecule test runs against the galaxy role, not against the local repository. @geerlingguy Is that intended? I changed that in b3f8158. The new behavior is to delete the data directory entirely, recreate it, and later reinitialize. I changed the recreation permissions in accordance with the recommendation from MySQL. |
Currently, the removal of the initial database logfile only works for Debian < 12, as the
distribution_versioncomparison is tailored to Debian.For reasonably recent Ubuntu versions (e.g., 24), this does not work. However, Ubuntu's apt installation will also create initial log files that have to be removed.
This PR addresses the issue by adding a check for Ubuntu. Furthermore, the apt installation will also create an initial ibdata-file that might interfere with custom user configuration of InnoDB like
innodb_page_size. Therefore, this file is deleted as well.