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.

Resolves: RHEL-5470
This commit is contained in:
Honza Horak 2025-02-05 13:30:04 +00:00 committed by Lukas Javorsky
parent 0f2e7f8716
commit d5712feb96
2 changed files with 23 additions and 1 deletions

View File

@ -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
}

View File

@ -78,7 +78,7 @@ ExcludeArch: %{ix86}
Name: mysql
Version: 8.0.37
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 . _)
@ -984,6 +986,9 @@ fi
%endif
%changelog
* Fri Apr 19 2024 Honza Horak <hhorak@redhat.com> - 8.0.37-2
- Use signal to flush logs when rotating
* Thu Apr 18 2024 Lars Tangvald <lars.tangvald@oracle.com> - 8.0.37-1
- Update to MySQL 8.0.37
- Remove some legacy cmake options