mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
MDEV-4820: Empty master does not give error for slave GTID position that does not exist in the binlog
The main bug here was the following situation: Suppose we set up a completely new master2 as an extra multi-master to an existing slave that already has a different master1 for domain_id=0. When the slave tries to connect to master2, master2 will not have anything that slave requests in domain_id=0, but that is fine as master2 is supposedly meant to serve eg. domain_id=1. (This is MDEV-4485). But suppose that master2 then actually starts sending events from domain_id=0. In this case, the fix for MDEV-4485 was incomplete, and the code would fail to give the error that the position requested by the slave in domain_id=0 was missing from the binlogs of master2. This could lead to lost events or completely wrong replication. The patch for this bug fixes this issue. In addition, it cleans up the code a bit, getting rid of the fake_gtid_hash in the code. And the error message when slave and master have diverged due to alternate future is clarified, as requested in the bug description.
This commit is contained in:
parent
f08946c037
commit
f0deff867a
6 changed files with 342 additions and 75 deletions
|
|
@ -174,7 +174,14 @@ struct rpl_binlog_state
|
|||
*/
|
||||
struct slave_connection_state
|
||||
{
|
||||
/* Mapping from domain_id to the GTID requested for that domain. */
|
||||
struct entry {
|
||||
rpl_gtid gtid;
|
||||
uint32 flags;
|
||||
};
|
||||
static const uint32 START_OWN_SLAVE_POS= 0x1;
|
||||
static const uint32 START_ON_EMPTY_DOMAIN= 0x2;
|
||||
|
||||
/* Mapping from domain_id to the entry with GTID requested for that domain. */
|
||||
HASH hash;
|
||||
|
||||
slave_connection_state();
|
||||
|
|
@ -185,6 +192,7 @@ struct slave_connection_state
|
|||
int load(const rpl_gtid *gtid_list, uint32 count);
|
||||
int load(rpl_slave_state *state, rpl_gtid *extra_gtids, uint32 num_extra);
|
||||
rpl_gtid *find(uint32 domain_id);
|
||||
entry *find_entry(uint32 domain_id);
|
||||
int update(const rpl_gtid *in_gtid);
|
||||
void remove(const rpl_gtid *gtid);
|
||||
ulong count() const { return hash.records; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue