Bug #95439 FLUSH LOGS is not added to binlog
Submitted: 21 May 2019 1:41 Modified: 21 May 2019 17:56
Reporter: Dieter Adriaenssens Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7.26 OS:Any
Assigned to: CPU Architecture:Any

[21 May 2019 1:41] Dieter Adriaenssens
According to documentation of FLUSH (https://dev.mysql.com/doc/refman/5.7/en/flush.html):

'By default, the server writes FLUSH statements to the binary log so that they replicate to replication slaves. To suppress logging, specify the optional NO_WRITE_TO_BINLOG keyword or its alias LOCAL.'

When using 'FLUSH LOGS;' this statement is never logged to the binary log.

Other FLUSH statements are logged (FLUSH ERROR LOGS, FLUSH BINARY LOGS, ...), as expected.
If the LOCAL parameter is used, the flush statements are not logged, as expected.

Related bug : https://bugs.mysql.com/bug.php?id=88720

How to repeat:
FLUSH LOGS; -> it is NOT present in the binlogs
FLUSH LOCAL LOGS; -> it is NOT present in the binlogs
FLUSH ERROR LOGS; -> it is present in the binlogs
FLUSH LOCAL ERROR LOGS; it is NOT present in the binlogs

Suggested fix:
Adjust FLUSH LOGS behaviour, ie. add it to binlogs when executed, so it is consistent with documentation and the other FLUSH (ERROR, BINARY, ...) LOGS statements.
Or update documentation so it correctly describes this behaviour.
[21 May 2019 4:55] Umesh Shastry
Hello Dieter,

Thank you for the report.
This is documented behavior, quoting from manual "FLUSH LOGS, FLUSH BINARY LOGS, FLUSH TABLES WITH READ LOCK (with or without a table list), and FLUSH TABLES tbl_name ... FOR EXPORT are not written to the binary log in any case because they would cause problems if replicated to a slave. " - https://dev.mysql.com/doc/refman/5.7/en/flush.html

[21 May 2019 17:56] Dieter Adriaenssens
Thanks for clarifying, I guess I missed this remark when reading the documentation.