Description:
The server id in mysql is declared as uint32 type, but in the semisync plugin, the server id is printed by %d, and a negative server id may be printed by mistake.
How to repeat:
read code
Suggested fix:
fix for mysql5.7:
diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc
index 54dbb4fbc87..e3ecf001430 100644
--- a/plugin/semisync/semisync_master_plugin.cc
+++ b/plugin/semisync/semisync_master_plugin.cc
@@ -159,7 +159,7 @@ int repl_semi_binlog_dump_start(Binlog_transmit_param *param,
else
param->set_dont_observe_flag();
- sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)",
+ sql_print_information("Start %s binlog_dump to slave (server_id: %u), pos(%s, %lu)",
semi_sync_slave != 0 ? "semi-sync" : "asynchronous",
param->server_id, log_file, (unsigned long)log_pos);
@@ -170,7 +170,7 @@ int repl_semi_binlog_dump_end(Binlog_transmit_param *param)
{
bool semi_sync_slave= is_semi_sync_dump();
- sql_print_information("Stop %s binlog_dump to slave (server_id: %d)",
+ sql_print_information("Stop %s binlog_dump to slave (server_id: %u)",
semi_sync_slave ? "semi-sync" : "asynchronous",
param->server_id);
if (semi_sync_slave)
fix for mysql8.0:
diff --git a/share/messages_to_error_log.txt b/share/messages_to_error_log.txt
index c593f51ca01..59b25683b18 100644
--- a/share/messages_to_error_log.txt
+++ b/share/messages_to_error_log.txt
@@ -3567,10 +3567,10 @@ ER_SEMISYNC_FAILED_REGISTER_SLAVE_TO_RECEIVER
eng "Failed to register slave to semi-sync ACK receiver thread."
ER_SEMISYNC_START_BINLOG_DUMP_TO_SLAVE
- eng "Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)."
+ eng "Start %s binlog_dump to slave (server_id: %u), pos(%s, %lu)."
ER_SEMISYNC_STOP_BINLOG_DUMP_TO_SLAVE
- eng "Stop %s binlog_dump to slave (server_id: %d)."
+ eng "Stop %s binlog_dump to slave (server_id: %u)."
ER_SEMISYNC_UNREGISTER_TRX_OBSERVER_FAILED
eng "unregister_trans_observer failed."