Blame SOURCES/mariadb-logrotate.patch

584bfd
Adjust the mysql-log-rotate script in several ways:
584bfd
584bfd
* Use the correct log file pathname for Red Hat installations.
584bfd
* Enable creation of the log file by logrotate (needed since
584bfd
  /var/log/ isn't writable by mysql user); and set the same 640
584bfd
  permissions we normally use.
584bfd
* Comment out the actual rotation commands, so that user must edit
584bfd
  the file to enable rotation.  This is unfortunate, but the fact
584bfd
  that the script will probably fail without manual configuration
584bfd
  (to set a root password) means that we can't really have it turned
584bfd
  on by default.  Fortunately, in most configurations the log file
584bfd
  is low-volume and so rotation is not critical functionality.
584bfd
584bfd
See discussions at RH bugs 799735, 547007
584bfd
* Note they are from Fedora 15 / 16
584bfd
584bfd
Update 3/2017
584bfd
* it would be big unexpected change for anyone upgrading, if we start shipping it now.
584bfd
  Maybe it is good candidate for shipping with MariaDB 10.2 ?
584bfd
* the 'mysqladmin flush logs' doesn´t guarantee, no entries are lost
584bfd
  during flushing, the operation is not atomic.
584bfd
  We should not ship it in that state
584bfd
584bfd
Update 6/2018
584bfd
* the SIGHUP causes server to flush all logs. No password admin needed, the only constraint is
584bfd
  beeing able to send the SIGHUP to the process and read the mysqld pid file, which root can.
584bfd
* Submited as PR: https://github.com/MariaDB/server/pull/807
584bfd
abe1a0
Update 01/2022
abe1a0
* added delaycompress option
abe1a0
* see https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux
abe1a0
abe1a0
--- mariadb-10.3.32/support-files/mysql-log-rotate.sh	2022-01-14 17:03:27.000000000 +0100
abe1a0
+++ mariadb-10.3.32/support-files/mysql-log-rotate.sh_patched	2022-01-17 15:07:54.205379672 +0100
363386
@@ -3,36 +3,22 @@
19da60
 # in the [mysqld] section as follows:
584bfd
 #
19da60
 # [mysqld]
19da60
-# log-error=@localstatedir@/mysqld.log
584bfd
-#
584bfd
-# If the root user has a password you have to create a
584bfd
-# /root/.my.cnf configuration file with the following
584bfd
-# content:
584bfd
-#
584bfd
-# [mysqladmin]
584bfd
-# password = <secret> 
584bfd
-# user= root
584bfd
-#
584bfd
-# where "<secret>" is the password. 
584bfd
-#
584bfd
-# ATTENTION: This /root/.my.cnf should be readable ONLY
584bfd
-# for root !
19da60
+# log-error=@LOG_LOCATION@
584bfd
 
584bfd
-@localstatedir@/mysqld.log {
584bfd
-        # create 600 mysql mysql
584bfd
+@LOG_LOCATION@ {
584bfd
+        create 600 mysql mysql
363386
         su mysql mysql
584bfd
         notifempty
19da60
         daily
584bfd
         rotate 3
abe1a0
         missingok
584bfd
         compress
abe1a0
+        delaycompress
584bfd
     postrotate
584bfd
 	# just if mysqld is really running
584bfd
-	if test -x @bindir@/mysqladmin && \
584bfd
-	   @bindir@/mysqladmin ping &>/dev/null
584bfd
-	then
584bfd
-	   @bindir@/mysqladmin --local flush-error-log \
584bfd
-              flush-engine-log flush-general-log flush-slow-log
584bfd
-	fi
584bfd
+        if [ -e @PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid ]
584bfd
+        then
584bfd
+           kill -1 $(<@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid)
584bfd
+        fi
584bfd
     endscript
584bfd
 }