Bug #106711 Binlog Interface Document has Improper Example
Submitted: 12 Mar 2022 0:25 Modified: 14 Mar 2022 10:18
Reporter: Ren Rongshi (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any

[12 Mar 2022 0:25] Ren Rongshi
The code example in the section "10.1 Overview of the C API Binary Log Interface" of MySQL Connector/C uses mysql_query(mysql, "SET @source_binlog_checksum='ALL'") to make the server takes as an indication that the client is checksum-aware. However, this code is not consistent with the one the mysqlbinlog uses. In mysqlbinlog application, it uses mysql_query(mysql,"SET @master_binlog_checksum = 'NONE', @source_binlog_checksum = 'NONE'"). The inconsistency is very confusing for people who want to use the Connector/C binary log interface, as the code in mysqlbinlog works well, while the one described in the document may not work in some cases. 

How to repeat:
I write a program using exactly the code of the documentation. It returns   what():  Slave can not handle replication events with the checksum that master is configured to log; the first event '' at 4, the last event read from './binlog.000001' at 125, the last byte read from './binlog.000001' at 125.

Using the code of mysqlbinlog, it just works.

Suggested fix:
Rewrite the documentation. Change the "SET @source_binlog_checksum='ALL'" to "SET @master_binlog_checksum = 'NONE', @source_binlog_checksum = 'NONE'".
[14 Mar 2022 10:18] MySQL Verification Team
Hello Ren Rongshi,

Thank you for the report and feedback.