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
This commit is contained in:
Honza Horak 2024-01-30 13:36:54 +00:00 committed by Lukas Javorsky
parent f6259b3f09
commit e7752d4c32
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 @@
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 <hhorak@redhat.com> - 8.0.36-2
- Use signal to flush logs when rotating
* Wed Jan 31 2024 Lukas Javorsky <ljavorsk@redhat.com> - 8.0.36-1
- Rebase to version 8.0.36