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]

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>
  • Loading branch information
mkaruza authored and Jan Lindström committed Aug 18, 2021
1 parent cce3378 commit da17118
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sql/wsrep_mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -804,17 +804,20 @@ 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_gtid();
/* Recover last written wsrep gtid */
wsrep_init_gtid();
if (wsrep_new_cluster)
{
wsrep_server_gtid_t gtid= {wsrep_gtid_server.domain_id,
wsrep_gtid_server.server_id, 0};
wsrep_get_binlog_gtid_seqno(gtid);
wsrep_gtid_server.seqno(gtid.seqno);
/* Start with provided domain_id & server_id found in configuration */
wsrep_server_gtid_t new_gtid;
new_gtid.domain_id= wsrep_gtid_domain_id;
new_gtid.server_id= global_system_variables.server_id;
new_gtid.seqno= 0;
/* Try to search for domain_id and server_id combination in binlog if found continue from last seqno */
wsrep_get_binlog_gtid_seqno(new_gtid);
wsrep_gtid_server.gtid(new_gtid);
}
wsrep_init_schema();

if (WSREP_ON)
{
Wsrep_server_state::instance().initialized();
Expand Down

0 comments on commit da17118

Please sign in to comment.