Skip to content

Commit da17118

Browse files
mkaruzaJan Lindström
authored andcommitted
MDEV-26223 Galera cluster node consider old server_id value even after modification of server_id [wsrep_gtid_mode=ON]
If cluster is bootstrapped in existing database, we should use provided configuration variables for wsrep_gtid_domain_id and server_id instead of recovered ones. If 'new' combination of wsrep_gtid_domain_id & server_id already existed somewere before in binlog we should continue from last seqno, if combination is new we start from seqno 0. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
1 parent cce3378 commit da17118

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

sql/wsrep_mysqld.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,17 +804,20 @@ void wsrep_init_globals()
804804
{
805805
wsrep_gtid_server.domain_id= wsrep_gtid_domain_id;
806806
wsrep_init_sidno(Wsrep_server_state::instance().connected_gtid().id());
807-
wsrep_init_gtid();
808807
/* Recover last written wsrep gtid */
808+
wsrep_init_gtid();
809809
if (wsrep_new_cluster)
810810
{
811-
wsrep_server_gtid_t gtid= {wsrep_gtid_server.domain_id,
812-
wsrep_gtid_server.server_id, 0};
813-
wsrep_get_binlog_gtid_seqno(gtid);
814-
wsrep_gtid_server.seqno(gtid.seqno);
811+
/* Start with provided domain_id & server_id found in configuration */
812+
wsrep_server_gtid_t new_gtid;
813+
new_gtid.domain_id= wsrep_gtid_domain_id;
814+
new_gtid.server_id= global_system_variables.server_id;
815+
new_gtid.seqno= 0;
816+
/* Try to search for domain_id and server_id combination in binlog if found continue from last seqno */
817+
wsrep_get_binlog_gtid_seqno(new_gtid);
818+
wsrep_gtid_server.gtid(new_gtid);
815819
}
816820
wsrep_init_schema();
817-
818821
if (WSREP_ON)
819822
{
820823
Wsrep_server_state::instance().initialized();

0 commit comments

Comments
 (0)