summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2022-01-20 11:30:49 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2022-01-20 11:53:41 +0200
commita0f711e928178b90523f62983ce0ee52d21a5824 (patch)
tree90ae4b7a91b7a657ec78f3866e47f46d0f799c27 /mysql-test
parent66465914c1a22ae30f96a57aca7e8635a2506f8d (diff)
downloadmariadb-git-a0f711e928178b90523f62983ce0ee52d21a5824.tar.gz
MDEV-26223 Galera cluster node consider old server_id value even after modification of server_id [wsrep_gtid_mode=ON]bb-10.5-MDEV-26223
For non bootstrap node server id should be ignored because using custom value can lead to inconsistency problem with replicated GTID in cluster. Providing warning message when this happens. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_server_id.result82
-rw-r--r--mysql-test/suite/galera/t/galera_gtid_server_id.cnf16
-rw-r--r--mysql-test/suite/galera/t/galera_gtid_server_id.test27
3 files changed, 125 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/r/galera_gtid_server_id.result b/mysql-test/suite/galera/r/galera_gtid_server_id.result
new file mode 100644
index 00000000000..815e7e98885
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid_server_id.result
@@ -0,0 +1,82 @@
+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;
diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf
new file mode 100644
index 00000000000..bda7a00ab2e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf
@@ -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
+
diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.test b/mysql-test/suite/galera/t/galera_gtid_server_id.test
new file mode 100644
index 00000000000..6e1d6b93a01
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid_server_id.test
@@ -0,0 +1,27 @@
+--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;