WL#13689: USE signal SIGUSR1 to flush logs
Affects: Server-8.0
—
Status: Complete
Repurpose signal SIGUSR1 to be a light version of SIGHUP. The signal is needed to have a reliable way to flush logs in mysql from the outside. This will include error log, general log and slow query log. SIGHUP: Causes the server to reload the grant tables and to flush tables, logs, the thread cache, and the host cache. These actions are like various forms of the FLUSH statement. Prior to MySQL 8.0.20, the server also writes a status report to the error log that has this format: As of MySQL 8.0.19, SIGUSR1 causes the server to flush the error log, general query log, and slow query log. One use for SIGUSR1 is to implement log rotation without having to connect to the server (which to flush logs requires an account that has the RELOAD privilege). See Section 5.4.7, Server Log Maintenance.
FR1: When SIGUSR1 is sent to the server, it must flush the error log. FR2: When SIGUSR1 is sent to the server, it must flush the general log. FR3: When SIGUSR1 is sent to the server, it must flush the slow query log. FR4: SIGUSR1 must not send MySQL status report. Currently when SIGHUP is sent to the server a large report of information is printed to stdout, the status report. FR5: The server must not fail when SIGUSR1 is sent, even though slow log is not enabled. FR6: The server must not fail when SIGUSR1 is sent, even though slow log output is set to a table (log_output). FR7: The server must not fail when SIGUSR1 is sent, even though general log is set to OFF. NFR1: SIGALRM must be undisguisable from how SIGUSR1 behaved before.
Copyright (c) 2000, 2024, Oracle Corporation and/or its affiliates. All rights reserved.