1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-34924 : gtid_slave_pos table neven been deleted on non replica nodes (wsrep_gtid_mode = 1)

Problem was caused by MDEV-31413 commit 277968aa where
mysql.gtid_slave_pos table was replicated by Galera.
However, as not all nodes in Galera cluster are replica
nodes, rows were not deleted from table.

In this fix this is corrected so that mysql.gtid_slave_pos
table is not replicated by Galera. Instead when Galera
node receives GTID event and wsrep_gtid_mode=1, this event
is stored to mysql.gtid_slave_pos table.

Added test case galera_2primary_replica for 2 async
primaries replicating to galera cluster.

Added test case galera_circular_replication where
async primary replicates to galera cluster and
one of the galera cluster nodes is master
to async replica.

Modified test case galera_restart_replica to monitor
gtid positions and rows in mysql.gtid_pos_table.
This commit is contained in:
Jan Lindström
2024-12-11 09:34:18 +02:00
committed by Julius Goryavsky
parent fe2f237768
commit 133e26fd7d
13 changed files with 1110 additions and 181 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015-2023 Codership Oy <info@codership.com>
/* Copyright (C) 2015-2024 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -22,7 +22,6 @@
#include "mysqld.h"
#include "wsrep_mysqld.h"
/*
Forward decls
*/
@ -32,6 +31,7 @@ struct TABLE;
struct TABLE_LIST;
struct st_mysql_lex_string;
typedef struct st_mysql_lex_string LEX_STRING;
class Gtid_log_event;
/** Name of the table in `wsrep_schema_str` used for storing streaming
replication data. In an InnoDB full format, e.g. "database/tablename". */
@ -133,6 +133,16 @@ class Wsrep_schema
*/
int recover_sr_transactions(THD* orig_thd);
/**
Store GTID-event to mysql.gtid_slave_pos table.
@param thd The THD object of the calling thread.
@param gtid GTID event from binlog.
@return Zero on success, non-zero on failure.
*/
int store_gtid_event(THD* thd, const Gtid_log_event *gtid);
private:
/* Non-copyable */
Wsrep_schema(const Wsrep_schema&);