diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysql_priv.h | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 10 | ||||
-rw-r--r-- | sql/set_var.cc | 7 | ||||
-rw-r--r-- | sql/slave.cc | 6 |
4 files changed, 14 insertions, 11 deletions
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index d4fe5968eff..b03d98f4cb0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -703,7 +703,7 @@ extern uint protocol_version,dropping_tables; extern uint delay_key_write_options, lower_case_table_names; extern bool opt_endinfo, using_udf_functions, locked_in_memory; extern bool opt_using_transactions, mysql_embedded; -extern bool using_update_log, opt_large_files; +extern bool using_update_log, opt_large_files, server_id_supplied; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_disable_networking, opt_skip_show_db; extern bool volatile abort_loop, shutdown_in_progress, grant_option; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c1ea29caa88..8e5a2745f72 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2354,15 +2354,15 @@ You should consider changing lower_case_table_names to 1 or 2", #ifdef EXTRA_DEBUG case 1: sql_print_error("\ -Warning: You have enabled the binary log, but you haven't set server-id:\n\ -Updates will be logged to the binary log, but connections to slaves will\n\ -not be accepted."); +Warning: You have enabled the binary log, but you haven't set server-id to \ +a non-zero value: we force server id to 1; updates will be logged to the \ +binary log, but connections from slaves will not be accepted."); break; #endif case 2: sql_print_error("\ -Warning: You should set server-id to a non-0 value if master_host is set.\n\ -The server will not act as a slave."); +Warning: You should set server-id to a non-0 value if master_host is set; \ +we force server id to 2, but this MySQL server will not act as a slave."); break; } } diff --git a/sql/set_var.cc b/sql/set_var.cc index eb94ad2ebf6..56208023d94 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -90,6 +90,7 @@ static void fix_max_relay_log_size(THD *thd, enum_var_type type); static void fix_max_connections(THD *thd, enum_var_type type); static void fix_thd_mem_root(THD *thd, enum_var_type type); static void fix_trans_mem_root(THD *thd, enum_var_type type); +static void fix_server_id(THD *thd, enum_var_type type); /* Variable definition list @@ -235,7 +236,7 @@ sys_var_thd_bool sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate", &SV::query_cache_wlock_invalidate); #endif /* HAVE_QUERY_CACHE */ -sys_var_long_ptr sys_server_id("server_id",&server_id); +sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id); sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol", &opt_slave_compressed_protocol); sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout", @@ -811,6 +812,10 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type) thd->variables.trans_prealloc_size); } +static void fix_server_id(THD *thd, enum_var_type type) +{ + server_id_supplied = 1; +} bool sys_var_long_ptr::update(THD *thd, set_var *var) { diff --git a/sql/slave.cc b/sql/slave.cc index c7a7dac141a..be60b5e6217 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -143,13 +143,11 @@ int init_slave() goto err; } - /* - make sure slave thread gets started if server_id is set, - valid master.info is present, and master_host has not been specified - */ if (server_id && !master_host && active_mi->host[0]) master_host= active_mi->host; + /* If server id is not set, start_slave_thread() will say it */ + if (master_host && !opt_skip_slave_start) { if (start_slave_threads(1 /* need mutex */, |