Bug #35125 Allow the ability to set the server_id for a connection for logging to binary lo
Submitted: 6 Mar 2008 21:34
Reporter: Harrison Fisk Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.0.56 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[6 Mar 2008 21:34] Harrison Fisk
Description:
It could be useful in some cases to be able to control the server_id on a per-session basis for replication/binary logging.

This is useful when you get very complex replication setups (involving tools that replay binary logs manually, such as mysqlbinlog) and want to make sure that the server will not replay an event that it generated.

There is the ability to set the thread_id for replication purposes via SET PSEUDO_THREAD_ID=#;  So I would propose either the same thing, or SET @@session.server_id = #;

There is a TODO in log_event.cc which mentions adding this ability as well.

How to repeat:
Replay a binary log using mysqlbinlog.  

Notice that the server_id's stored in the new binary log are the value of the local system, and not from the original binary log.

Suggested fix:
Add the feature to do so.

SET PSEUDO_SERVER_ID=#;

or 

SET @@SESSION.SERVER_ID=#;
[28 Jan 2010 12:56] li pickup
we need this reasonable feature too. Hope it will be implemented soon. Thanks!
[27 Dec 2013 8:43] - -
It seems this bug duplicates #27845.