mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
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.
This commit is contained in:
parent
e139d971ec
commit
1c91569274
10 changed files with 24 additions and 46 deletions
|
@ -1339,7 +1339,7 @@ performance-schema-max-rwlock-instances -1
|
|||
performance-schema-max-socket-classes 10
|
||||
performance-schema-max-socket-instances -1
|
||||
performance-schema-max-stage-classes 150
|
||||
performance-schema-max-statement-classes 181
|
||||
performance-schema-max-statement-classes 184
|
||||
performance-schema-max-table-handles -1
|
||||
performance-schema-max-table-instances -1
|
||||
performance-schema-max-thread-classes 50
|
||||
|
@ -1384,7 +1384,7 @@ rowid-merge-buff-size 8388608
|
|||
safe-user-create FALSE
|
||||
secure-auth TRUE
|
||||
secure-file-priv (No default value)
|
||||
server-id 0
|
||||
server-id 1
|
||||
show-slave-auth-info FALSE
|
||||
silent-startup FALSE
|
||||
skip-grant-tables TRUE
|
||||
|
|
|
@ -1466,15 +1466,17 @@ SELECT @@GLOBAL.server_id;
|
|||
@@GLOBAL.server_id
|
||||
4294967295
|
||||
SET GLOBAL server_id = 0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '0'
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
0
|
||||
1
|
||||
SET GLOBAL server_id = -1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '-1'
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
0
|
||||
1
|
||||
SET GLOBAL server_id = @old_server_id;
|
||||
#
|
||||
# BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
|
||||
|
|
|
@ -8,17 +8,19 @@ SET @@global.server_id = 500000;
|
|||
SET @@global.server_id = DEFAULT;
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
0
|
||||
1
|
||||
'#--------------------FN_DYNVARS_144_02-------------------------#'
|
||||
SET @@global.server_id = DEFAULT;
|
||||
SELECT @@global.server_id = 0;
|
||||
@@global.server_id = 0
|
||||
SELECT @@global.server_id = 1;
|
||||
@@global.server_id = 1
|
||||
1
|
||||
'#--------------------FN_DYNVARS_144_03-------------------------#'
|
||||
SET @@global.server_id = 0;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '0'
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
0
|
||||
1
|
||||
SET @@global.server_id = 1;
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
|
@ -62,13 +64,13 @@ Warnings:
|
|||
Warning 1292 Truncated incorrect server_id value: '-1'
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
0
|
||||
1
|
||||
SET @@global.server_id = -2147483648;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '-2147483648'
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
0
|
||||
1
|
||||
SET @@global.server_id = 2147483649*2;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '4294967298'
|
||||
|
@ -102,9 +104,11 @@ SELECT @@global.server_id;
|
|||
@@global.server_id
|
||||
1
|
||||
SET @@global.server_id = FALSE;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '0'
|
||||
SELECT @@global.server_id;
|
||||
@@global.server_id
|
||||
0
|
||||
1
|
||||
'#---------------------FN_DYNVARS_001_09----------------------#'
|
||||
SET @@global.server_id = 512;
|
||||
SELECT @@server_id = @@global.server_id;
|
||||
|
|
|
@ -3007,9 +3007,9 @@ READ_ONLY YES
|
|||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE 181
|
||||
GLOBAL_VALUE 184
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE 181
|
||||
DEFAULT_VALUE 184
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT Maximum number of statement instruments.
|
||||
|
@ -3779,11 +3779,11 @@ VARIABLE_NAME SERVER_ID
|
|||
SESSION_VALUE 1
|
||||
GLOBAL_VALUE 1
|
||||
GLOBAL_VALUE_ORIGIN CONFIG
|
||||
DEFAULT_VALUE 0
|
||||
DEFAULT_VALUE 1
|
||||
VARIABLE_SCOPE SESSION
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MIN_VALUE 1
|
||||
NUMERIC_MAX_VALUE 4294967295
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
ENUM_VALUE_LIST NULL
|
||||
|
|
|
@ -54,7 +54,7 @@ SELECT @@global.server_id;
|
|||
###################################################################
|
||||
|
||||
SET @@global.server_id = DEFAULT;
|
||||
SELECT @@global.server_id = 0;
|
||||
SELECT @@global.server_id = 1;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_144_03-------------------------#'
|
||||
##################################################################################
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue