From e7752d4c32128c24668e3b68141b48cbe6c3a575 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Tue, 30 Jan 2024 13:36:54 +0000 Subject: [PATCH] Use signal to flush logs when rotating Using signals has a benefit over mysqladmin call that we don't need to care about password if root has some. Related: https://issues.redhat.com/browse/RHEL-5470 --- mysql-flush-logrotate.patch | 17 +++++++++++++++++ mysql8.0.spec | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 mysql-flush-logrotate.patch diff --git a/mysql-flush-logrotate.patch b/mysql-flush-logrotate.patch new file mode 100644 index 0000000..1e30f6a --- /dev/null +++ b/mysql-flush-logrotate.patch @@ -0,0 +1,17 @@ +diff -up mysql-8.0.35/support-files/mysql-log-rotate.in.origf mysql-8.0.35/support-files/mysql-log-rotate.in +--- mysql-8.0.35/support-files/mysql-log-rotate.in.origf 2024-01-29 23:00:32.043257515 +0100 ++++ mysql-8.0.35/support-files/mysql-log-rotate.in 2024-01-29 23:02:26.520440388 +0100 +@@ -49,11 +49,7 @@ + missingok + compress + postrotate +- # just if mysqld is really running +- if test -x @bindir@/mysqladmin && \ +- @bindir@/mysqladmin ping &>/dev/null +- then +- @bindir@/mysqladmin flush-logs +- fi ++ # SIGUSR1 makes the daemon to flush the logs, no need to connect ++ @bindir@/kill -USR1 $(systemctl show --property MainPID --value mysqld) + endscript + } diff --git a/mysql8.0.spec b/mysql8.0.spec index 4419b16..7765adf 100644 --- a/mysql8.0.spec +++ b/mysql8.0.spec @@ -78,7 +78,7 @@ Name: mysql8.0 Version: 8.0.36 -Release: 1%{?with_debug:.debug}%{?dist} +Release: 2%{?with_debug:.debug}%{?dist} Summary: MySQL client programs and shared libraries URL: http://www.mysql.com @@ -121,6 +121,7 @@ Patch52: %{pkgnamepatch}-rpath.patch Patch53: %{pkgnamepatch}-mtr.patch Patch54: %{pkgnamepatch}-arm32-timer.patch Patch55: %{pkgnamepatch}-c99.patch +Patch56: %{pkgnamepatch}-flush-logrotate.patch # Patches taken from boost 1.59 Patch111: boost-1.58.0-pool.patch @@ -394,6 +395,7 @@ the MySQL sources. %patch -P53 -p1 %patch -P54 -p1 %patch -P55 -p1 +%patch -P56 -p1 # Patch Boost pushd boost/boost_$(echo %{boost_bundled_version}| tr . _) @@ -994,6 +996,9 @@ fi %endif %changelog +* Wed Jan 31 2024 Honza Horak - 8.0.36-2 +- Use signal to flush logs when rotating + * Wed Jan 31 2024 Lukas Javorsky - 8.0.36-1 - Rebase to version 8.0.36