Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Every binlog event is logged with a specific server_id. This is used in
circular multi-master replication, to avoid a server re-applying and
re-replicationg its own transactions infinitely.
When a new transactions is run, it gets the value of the global server_id
variable. While when a transaction is replicated on a slave, it gets the
server_id value of the event that is replicated.
It would be useful to allow a new transaction to specify a different server_id
than the global server_id value. This would ie. be useful if doing replication
external to the server, for the same reasons that it is useful for internal
replication. It could also be used in mysqlbinlog output to make
mysqlbinlog|mysql safe(r) for circular replication setups.
Changing session-level server_id should be only allowed if the process has
SUPER privileges, as it is a somewhat dangerous thing to do in circular
replication setups.
There is already a session variable pseudo_therad_id, with a similar purpose -
maybe it would make sense to call the new session variable
pseudo_server_id. There are in fact comments in the existing code hinting at
plans to introduce such pseudo_server_id variable.
The server_id already exists as a field in THD for use in the replication
slave - it is just not exposed as a user-visible session variable. So it looks
fairly easy to add, though all uses of the THD field and global variable needs
to be checked and possible side-effects analysed.
Attachments
Issue Links
- is part of
-
MDEV-26 Global transaction ID
- Closed