Commit 0f7fecec authored by Jan Lindström's avatar Jan Lindström

Revert "MDEV-26223 Galera cluster node consider old server_id value even after...

Revert "MDEV-26223 Galera cluster node consider old server_id value even after modification of server_id [wsrep_gtid_mode=ON]"

This reverts commit a0f711e9.
parent 62e320c8
connection node_2;
connection node_1;
connection node_1;
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
0 11 1 1
connection node_2;
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
0 12 1 1
connection node_1;
CREATE TABLE t1(id int not null primary key) engine=innodb;
INSERT INTO t1 values (1);
show global variables like '%gtid%';
Variable_name Value
gtid_binlog_pos 1-11-2
gtid_binlog_state 1-11-2
gtid_cleanup_batch_size 64
gtid_current_pos 1-11-2
gtid_domain_id 0
gtid_ignore_duplicates OFF
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode OFF
wsrep_gtid_domain_id 1
wsrep_gtid_mode ON
connection node_2;
SET SESSION wsrep_sync_wait=15;
show global variables like '%gtid%';
Variable_name Value
gtid_binlog_pos 1-11-2
gtid_binlog_state 1-11-2
gtid_cleanup_batch_size 64
gtid_current_pos
gtid_domain_id 0
gtid_ignore_duplicates OFF
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode OFF
wsrep_gtid_domain_id 1
wsrep_gtid_mode ON
SET GLOBAL server_id=200;
ERROR 42000: Variable 'server_id' can't be set to the value of '200'
SHOW WARNINGS;
Level Code Message
Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster.
Error 1231 Variable 'server_id' can't be set to the value of '200'
SET SESSION server_id=200;
ERROR 42000: Variable 'server_id' can't be set to the value of '200'
SHOW WARNINGS;
Level Code Message
Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster.
Error 1231 Variable 'server_id' can't be set to the value of '200'
INSERT INTO t1 values(2);
show global variables like '%gtid%';
Variable_name Value
gtid_binlog_pos 1-11-3
gtid_binlog_state 1-11-3
gtid_cleanup_batch_size 64
gtid_current_pos
gtid_domain_id 0
gtid_ignore_duplicates OFF
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode OFF
wsrep_gtid_domain_id 1
wsrep_gtid_mode ON
connection node_1;
show global variables like '%gtid%';
Variable_name Value
gtid_binlog_pos 1-11-3
gtid_binlog_state 1-11-3
gtid_cleanup_batch_size 64
gtid_current_pos 1-11-3
gtid_domain_id 0
gtid_ignore_duplicates OFF
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode OFF
wsrep_gtid_domain_id 1
wsrep_gtid_mode ON
DROP TABLE t1;
!include ../galera_2nodes.cnf
[mysqld.1]
wsrep_gtid_domain_id=1
wsrep_gtid_mode=ON
server-id=11
log_slave_updates
log_bin
[mysqld.2]
wsrep_gtid_domain_id=1
wsrep_gtid_mode=ON
server-id=12
log_slave_updates
log_bin
--source include/galera_cluster.inc
--connection node_1
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
--connection node_2
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
--connection node_1
CREATE TABLE t1(id int not null primary key) engine=innodb;
INSERT INTO t1 values (1);
show global variables like '%gtid%';
--connection node_2
SET SESSION wsrep_sync_wait=15;
show global variables like '%gtid%';
# This should give error
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL server_id=200;
SHOW WARNINGS;
# This should give error
--error ER_WRONG_VALUE_FOR_VAR
SET SESSION server_id=200;
SHOW WARNINGS;
INSERT INTO t1 values(2);
show global variables like '%gtid%';
--connection node_1
show global variables like '%gtid%';
DROP TABLE t1;
...@@ -3223,21 +3223,6 @@ static Sys_var_charptr_fscs Sys_secure_file_priv( ...@@ -3223,21 +3223,6 @@ static Sys_var_charptr_fscs Sys_secure_file_priv(
PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv), PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
CMD_LINE(REQUIRED_ARG), DEFAULT(0)); CMD_LINE(REQUIRED_ARG), DEFAULT(0));
static bool check_server_id(sys_var *self, THD *thd, set_var *var)
{
#ifdef WITH_WSREP
if (WSREP_ON && WSREP_PROVIDER_EXISTS && !wsrep_new_cluster && wsrep_gtid_mode)
{
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_VALUE_FOR_VAR,
"Can't change server_id because wsrep and wsrep_gtid_mode is set."
" You can set server_id only with wsrep_new_cluster. ");
return true;
}
#endif /* WITH_WSREP */
return false;
}
static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type) static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type)
{ {
if (type == OPT_GLOBAL) if (type == OPT_GLOBAL)
...@@ -3262,7 +3247,7 @@ Sys_server_id( ...@@ -3262,7 +3247,7 @@ Sys_server_id(
"replication partners", "replication partners",
SESSION_VAR(server_id), CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID), SESSION_VAR(server_id), CMD_LINE(REQUIRED_ARG, OPT_SERVER_ID),
VALID_RANGE(1, UINT_MAX32), DEFAULT(1), 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_server_id), ON_UPDATE(fix_server_id)); NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_server_id));
static Sys_var_on_access_global<Sys_var_mybool, static Sys_var_on_access_global<Sys_var_mybool,
PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_COMPRESSED_PROTOCOL> PRIV_SET_SYSTEM_GLOBAL_VAR_SLAVE_COMPRESSED_PROTOCOL>
......
...@@ -802,6 +802,7 @@ int wsrep_init_server() ...@@ -802,6 +802,7 @@ int wsrep_init_server()
void wsrep_init_globals() void wsrep_init_globals()
{ {
wsrep_gtid_server.domain_id= wsrep_gtid_domain_id;
wsrep_init_sidno(Wsrep_server_state::instance().connected_gtid().id()); wsrep_init_sidno(Wsrep_server_state::instance().connected_gtid().id());
/* Recover last written wsrep gtid */ /* Recover last written wsrep gtid */
wsrep_init_gtid(); wsrep_init_gtid();
...@@ -816,13 +817,6 @@ void wsrep_init_globals() ...@@ -816,13 +817,6 @@ void wsrep_init_globals()
wsrep_get_binlog_gtid_seqno(new_gtid); wsrep_get_binlog_gtid_seqno(new_gtid);
wsrep_gtid_server.gtid(new_gtid); wsrep_gtid_server.gtid(new_gtid);
} }
else
{
if (wsrep_gtid_mode && wsrep_gtid_server.server_id != global_system_variables.server_id)
{
WSREP_WARN("Ignoring server id for non bootstrap node.");
}
}
wsrep_init_schema(); wsrep_init_schema();
if (WSREP_ON) if (WSREP_ON)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment