Bug #117115 The server_id of the record written to the error log by semisync is incorrect

Submitted: 7 Jan 2025 7:12 Modified: 10 Feb 2025 5:50
Reporter: karry zhang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7.44, 8.0.40 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[7 Jan 2025 7:12] karry zhang
Description:
When we set replica's server_id bigger than 2147483647, and enable semisync. We will find the follwing record in master-error.log:

2025-01-06T21:09:14.266515+08:00 8775 [Note] Start binlog_dump to master_thread_id(8775) slave_server(3306128045), pos(, 4)
2025-01-06T21:09:14.266531+08:00 8775 [Note] Start asynchronous binlog_dump to slave (server_id: -988839251), pos(, 4)
2025-01-06T21:09:28.933976+08:00 8775 [Note] Stop asynchronous binlog_dump to slave (server_id: -988839251)

The server-id output by the semisyn plugin is a negative number -988839251. In fact, the server-id is 3306128045.

How to repeat:
Enable semisync and set the replica server-id to be greater than 2147483647. You can observe the above bug in the source's master-error.log.

By the way, I gave the error log of MySQL 5.7. MySQL 8.0 has the same problem because the relevant logic is the same.

Suggested fix:
The reason for this problem is that the server-id is of type ulong, but when semisyn outputs it to the error log, it uses %d to format the output.

Change %d to %u.
[7 Jan 2025 8:27] MySQL Verification Team
Hello karry zhang,

Thank you for the report and feedback.

regards,
Umesh
[7 Jan 2025 8:40] karry zhang
Fix patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: diff.txt (text/plain), 1.65 KiB.

[10 Feb 2025 5:50] karry zhang
May the new version fix this bug?

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.