diff options
author | Monty <monty@mariadb.org> | 2016-08-29 20:28:06 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2016-08-29 20:28:06 +0300 |
commit | 1c91569274219ac612fcfdea4764311e2377977c (patch) | |
tree | 3d00dcc739c364f5da4c202e4f631791d7b62496 /sql | |
parent | e139d971ecbffe00d9a5626fdcd69aa1b9ba0f2c (diff) | |
download | mariadb-git-1c91569274219ac612fcfdea4764311e2377977c.tar.gz |
Set server_id to 1 by default and disallow to set it to 0
This makes it easier to setup master as on only have to set --log-bin.
Before this patch if one did set up the master with just --log-bin, slaves
could not connect until server_id was set on the master, which could be
both confusing and hard to do.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 14 | ||||
-rw-r--r-- | sql/mysqld.h | 2 | ||||
-rw-r--r-- | sql/sql_repl.cc | 12 | ||||
-rw-r--r-- | sql/sql_repl.h | 1 | ||||
-rw-r--r-- | sql/sys_vars.cc | 3 |
5 files changed, 2 insertions, 30 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9b5fcbddd6c..8fa8f01b894 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -400,7 +400,6 @@ bool opt_error_log= IF_WIN(1,0); bool opt_disable_networking=0, opt_skip_show_db=0; bool opt_skip_name_resolve=0; my_bool opt_character_set_client_handshake= 1; -bool server_id_supplied = 0; bool opt_endinfo, using_udf_functions; my_bool locked_in_memory; bool opt_using_transactions; @@ -5831,17 +5830,6 @@ int mysqld_main(int argc, char **argv) if (WSREP_ON && wsrep_check_opts()) global_system_variables.wsrep_on= 0; - if (opt_bin_log && !global_system_variables.server_id) - { - SYSVAR_AUTOSIZE(global_system_variables.server_id, ::server_id= 1); -#ifdef EXTRA_DEBUG - sql_print_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."); -#endif - } - /* The subsequent calls may take a long time : e.g. innodb log read. Thus set the long running service control manager timeout @@ -8707,7 +8695,6 @@ static int mysql_init_variables(void) mqh_used= 0; kill_in_progress= 0; cleanup_done= 0; - server_id_supplied= 0; test_flags= select_errors= dropping_tables= ha_open_options=0; thread_count= thread_running= kill_cached_threads= wake_thread= 0; service_thread_count= 0; @@ -9176,7 +9163,6 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) opt_noacl=opt_bootstrap=1; break; case OPT_SERVER_ID: - server_id_supplied = 1; ::server_id= global_system_variables.server_id; break; case OPT_LOWER_CASE_TABLE_NAMES: diff --git a/sql/mysqld.h b/sql/mysqld.h index 6783eeff810..846a01a9427 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -107,7 +107,7 @@ extern CHARSET_INFO *error_message_charset_info; extern CHARSET_INFO *character_set_filesystem; extern MY_BITMAP temp_pool; -extern bool opt_large_files, server_id_supplied; +extern bool opt_large_files; extern bool opt_update_log, opt_bin_log, opt_error_log; extern my_bool opt_log, opt_bootstrap; extern my_bool opt_backup_history_log; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 36f0cd84cbf..6ece9b793c9 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -2116,12 +2116,6 @@ static int init_binlog_sender(binlog_send_info *info, info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; return 1; } - if (!server_id_supplied) - { - info->errmsg= "Misconfigured master - server id was not set"; - info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG; - return 1; - } char search_file_name[FN_REFLEN]; const char *name=search_file_name; @@ -3072,12 +3066,6 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) if (init_master_info(mi,master_info_file_tmp,relay_log_info_file_tmp, 0, thread_mask)) slave_errno=ER_MASTER_INFO; - else if (!server_id_supplied) - { - slave_errno= ER_BAD_SLAVE; net_report= 0; - my_message(slave_errno, "Misconfigured slave: server_id was not set; Fix in config file", - MYF(0)); - } else if (!*mi->host) { slave_errno= ER_BAD_SLAVE; net_report= 0; diff --git a/sql/sql_repl.h b/sql/sql_repl.h index e2000bbca73..4105bdddf4e 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -36,7 +36,6 @@ struct slave_connection_state; extern my_bool opt_show_slave_auth_info; extern char *master_host, *master_info_file; -extern bool server_id_supplied; extern int max_binlog_dump_events; extern my_bool opt_sporadic_binlog_dump_fail; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index db054a635af..4047b5d6781 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2850,7 +2850,6 @@ static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) { - server_id_supplied = 1; thd->variables.server_id= global_system_variables.server_id; /* Historically, server_id was a global variable that is exported to @@ -2867,7 +2866,7 @@ static Sys_var_ulong Sys_server_id( "Uniquely identifies the server instance in the community of " "replication partners", SESSION_VAR(server_id), CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID), - VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD, + VALID_RANGE(1, UINT_MAX32), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super), ON_UPDATE(fix_server_id)); static Sys_var_mybool Sys_slave_compressed_protocol( |