[MDEV-16772] mysql-server logrotate script does not flush logs Created: 2018-07-18 Updated: 2021-12-03 Resolved: 2021-12-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Platform Debian, Scripts & Clients |
| Affects Version/s: | 10.3.8 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Jan Ingvoldstad | Assignee: | Otto Kekäläinen |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | contribution, logrotate, patch | ||
| Environment: |
Debian Stretch |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
On Debian Stretch with MariaDB 10.3.8, provided via the official MariaDB debian package repo, logrotation always fails, leaving the mysqld process having "disappearing" logfiles. The problem was present in 10.2.x as well, as far as I can recall, and the logrotate script has the same issue in 10.0.x. The problem is caused by a failing assumption in the provided logrotate script. A patch with a hotfix for the issue is included. /etc/logrotate.d/mysql-server contains the following code:
However, this fails, because the my_print_defaults-grep pipe produces two lines of output:
This is due to my_print_defaults --mysqld printing every default twice, and thus the assumption that grep produces one line of output fails. Hotfix: add parameter "-m 1" to the grep statement to ensure a maximum of 1 matched line, so that the postrotate section reads as follows:
A better long-term solution is described in The hotfix assumes that the first of any duplicate print-outs is the correct one. |
| Comments |
| Comment by Elena Stepanova [ 2018-07-18 ] |
|
Thank you for the report and the patch. |
| Comment by Otto Kekäläinen [ 2021-04-04 ] |
|
Superseded by https://github.com/MariaDB/server/pull/1556 and |
| Comment by Otto Kekäläinen [ 2021-12-03 ] |
|
This will be fixed via |