Skip to content

Commit

Permalink
MDEV-26223 Galera cluster node consider old server_id value even afte…
Browse files Browse the repository at this point in the history
…r modification of server_id [wsrep_gtid_mode=ON]

Variable `wsrep_new_cluster` now will be TRUE also when there is only `gcomm://` used
in configuration. This configuration, even without --wsrep-new-cluster,
is considered to bootstrap new cluster.

Updated galera GTID test to ignore warning message when non bootstrap
node have server-id different thant one cluster is initialized with.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
  • Loading branch information
mkaruza authored and Jan Lindström committed Jan 27, 2022
1 parent 56f5599 commit 5317370
Show file tree
Hide file tree
Showing 29 changed files with 241 additions and 11 deletions.
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/MDEV-10715.result
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ wsrep_last_written_gtid()
1-1-0
connection node_1;
drop table t1;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/r/galera-features#117.result
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f2 INTEGER);
Expand Down Expand Up @@ -35,3 +37,4 @@ Killing server ...
CALL mtr.add_suppression("Inconsistent by consensus.");
CALL mtr.add_suppression("WSREP: Failed to execute TOI action");
CALL mtr.add_suppression("WSREP: TO isolation end failed");
connection node_1;
83 changes: 83 additions & 0 deletions mysql-test/suite/galera/r/galera_gtid_server_id.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
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 0-12-1,1-11-2
gtid_binlog_state 0-12-1,1-11-2
gtid_cleanup_batch_size 64
gtid_current_pos 0-12-1
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 0-12-1,1-11-3
gtid_binlog_state 0-12-1,1-11-3
gtid_cleanup_batch_size 64
gtid_current_pos 0-12-1
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;
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/galera_gtid_slave.result
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ reset master;
SET GLOBAL wsrep_on=ON;
connection node_3;
reset master;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ set global wsrep_on=ON;
#Connection 3
connection node_3;
reset master;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
1 change: 1 addition & 0 deletions mysql-test/suite/galera/r/galera_gtid_trx_conflict.result
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ SELECT @@gtid_binlog_state;
@@gtid_binlog_state
1-1-101
DROP TABLE t1;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/galera_last_committed_id.result
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ wsrep_last_written_id_advanced
1
SET AUTOCOMMIT=ON;
DROP TABLE t1;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/galera_sync_wait_upto.result
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ WSREP_SYNC_WAIT_UPTO
1
connection node_1;
DROP TABLE t1;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
disconnect node_2;
disconnect node_1;
# End of test
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/r/mdev_10518.result
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
disconnect node_2;
disconnect node_1;
# End of test
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/MDEV-10715.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ select wsrep_last_written_gtid();

--connection node_1
drop table t1;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
9 changes: 9 additions & 0 deletions mysql-test/suite/galera/t/galera-features#117.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source ../galera/include/auto_increment_offset_save.inc

--connection node_2
SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f2 INTEGER);
Expand Down Expand Up @@ -36,3 +41,7 @@ SHOW TABLES IN test;
CALL mtr.add_suppression("Inconsistent by consensus.");
CALL mtr.add_suppression("WSREP: Failed to execute TOI action");
CALL mtr.add_suppression("WSREP: TO isolation end failed");

--connection node_1
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
16 changes: 16 additions & 0 deletions mysql-test/suite/galera/t/galera_gtid_server_id.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!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

28 changes: 28 additions & 0 deletions mysql-test/suite/galera/t/galera_gtid_server_id.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--source include/galera_cluster.inc

--connection node_1
select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
--connection node_2
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
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;
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/galera_gtid_slave.test
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,6 @@ SET GLOBAL wsrep_on=ON;

--connection node_3
reset master;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,6 @@ set global wsrep_on=ON;
--echo #Connection 3
--connection node_3
reset master;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
4 changes: 2 additions & 2 deletions mysql-test/suite/galera/t/galera_gtid_trx_conflict.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ SELECT @@gtid_binlog_state;

--connection node_2
SELECT @@gtid_binlog_state;


DROP TABLE t1;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/galera_last_committed_id.test
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ COMMIT;
SET AUTOCOMMIT=ON;

DROP TABLE t1;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/galera_sync_wait_upto.test
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ INSERT INTO t1 VALUES (2);

--connection node_1
DROP TABLE t1;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
4 changes: 3 additions & 1 deletion mysql-test/suite/galera/t/galera_var_gtid_domain_id.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--source include/galera_end.inc
--echo # End of test

4 changes: 3 additions & 1 deletion mysql-test/suite/galera/t/mdev_10518.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_2
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--source include/galera_end.inc
--echo # End of test

6 changes: 5 additions & 1 deletion mysql-test/suite/galera_3nodes/r/GCF-363.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
SET GLOBAL wsrep_on=OFF;
INSERT INTO t1 VALUES (1, 'a');
SET GLOBAL wsrep_on=ON;
Expand Down Expand Up @@ -44,3 +47,4 @@ connection node_3;
CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent with group. Leaving cluster.");
CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on ");
CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
connection node_1;
4 changes: 4 additions & 0 deletions mysql-test/suite/galera_3nodes/r/galera_2_cluster.result
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,19 @@ connection node_2;
SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
connection node_3;
SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
connection node_5;
SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
connection node_6;
SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;
CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
11 changes: 10 additions & 1 deletion mysql-test/suite/galera_3nodes/t/GCF-363.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;
--connection node_1
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source ../galera/include/auto_increment_offset_save.inc

--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) ENGINE=InnoDB;

SET GLOBAL wsrep_on=OFF;
INSERT INTO t1 VALUES (1, 'a');
SET GLOBAL wsrep_on=ON;
Expand Down Expand Up @@ -63,4 +69,7 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\\(success\\\) on (.*) is inconsistent
CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on ");
CALL mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");

--connection node_1
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc

8 changes: 8 additions & 0 deletions mysql-test/suite/galera_3nodes/t/galera_2_cluster.test
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,28 @@ SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_3

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_5

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");

--connection node_6

SET GLOBAL wsrep_on = OFF;
RESET MASTER;
SET GLOBAL wsrep_on = ON;

CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
1 change: 1 addition & 0 deletions mysql-test/suite/galera_sr/r/mdev_18631.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ connection node_1;
CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3);
connection node_2;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
SELECT * FROM t1;
f1
1
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/galera_sr/t/mdev_18631.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1), (2), (3);

--connection node_2
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
SELECT * FROM t1;

--connection node_1
Expand Down
Loading

0 comments on commit 5317370

Please sign in to comment.