Bug #118051 Semi-Sync Replication Relay Log Flushing Discrepancy
Submitted: 24 Apr 10:51 Modified: 5 May 11:35
Reporter: Yunus UYANIK Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any
Tags: semi-sync

[24 Apr 10:51] Yunus UYANIK
Description:
The official documentation states: https://dev.mysql.com/doc/refman/8.0/en/replication-semisync.html#:~:text=The%20replica%20....

"The replica acknowledges receipt of a transaction's events only after the events have been written to its relay log and flushed to disk."

However, examination of the source code reveals that:

The semi-sync plugin (semisync_replica.cc) sends acknowledgment after writing to the relay log but before an explicit fsync. There is no direct fsync operation in the semi-sync acknowledgment path.

Code Path: https://github.com/mysql/mysql-server/blob/ff05628a530696bc6851ba6540ac250c7a059aa7/plugin...

The acknowledgment is sent in ReplSemiSyncSlave::slaveReply() (semisync_replica.cc) after flush() but without explicit fsync

Documentation implies fsync-before-ack, but implementation shows ack-before-fsync

How to repeat:
Codes and docs provided.

Suggested fix:
Fix needed to be done depending on which part is broken docs or codes.
[24 Apr 14:25] Jervin Real
There is nothing implied in the documentation IMHO, it only flushes, no fsync. Doc and code aligns.
[5 May 11:35] MySQL Verification Team
This is not a bug.

Code does flush as described in the documentation.