diff options
author | unknown <knielsen@knielsen-hq.org> | 2012-10-23 12:46:29 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2012-10-23 12:46:29 +0200 |
commit | ab8e8f4b277c23e6989650e0590ec0a5fa03fb3a (patch) | |
tree | 55f94a23720a018908f99044fffd407b63ed7426 /sql/repl_failsafe.cc | |
parent | be86e4428010f41804608c2d2ff7adcd9d6fb270 (diff) | |
download | mariadb-git-ab8e8f4b277c23e6989650e0590ec0a5fa03fb3a.tar.gz |
MDEV-500: Session variable for server_id
MDEV-26: Global transaction id, partial commit
Change server_id to be a session variable.
User with SUPER can set it to binlog with different server_id.
Implement backward-compatible ::server_id mirror for plugins.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r-- | sql/repl_failsafe.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 89fb1bb27de..35b43fd4305 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -89,14 +89,15 @@ void change_rpl_status(ulong from_status, ulong to_status) void unregister_slave(THD* thd, bool only_mine, bool need_mutex) { - if (thd->server_id) + uint32 thd_server_id= thd->variables.server_id; + if (thd_server_id) { if (need_mutex) mysql_mutex_lock(&LOCK_slave_list); SLAVE_INFO* old_si; if ((old_si = (SLAVE_INFO*)my_hash_search(&slave_list, - (uchar*)&thd->server_id, 4)) && + (uchar*)&thd_server_id, 4)) && (!only_mine || old_si->thd == thd)) my_hash_delete(&slave_list, (uchar*)old_si); @@ -127,7 +128,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME)))) goto err2; - thd->server_id= si->server_id= uint4korr(p); + thd->variables.server_id= si->server_id= uint4korr(p); p+= 4; get_object(p,si->host, "Failed to register slave: too long 'report-host'"); get_object(p,si->user, "Failed to register slave: too long 'report-user'"); @@ -145,7 +146,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) // si->rpl_recovery_rank= uint4korr(p); p += 4; if (!(si->master_id= uint4korr(p))) - si->master_id= server_id; + si->master_id= global_system_variables.server_id; si->thd= thd; mysql_mutex_lock(&LOCK_slave_list); |