summaryrefslogtreecommitdiff
path: root/sql/rpl_gtid.h
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-08-16 15:10:25 +0200
committerunknown <knielsen@knielsen-hq.org>2013-08-16 15:10:25 +0200
commitf0deff867a154879971560f83f62d96bb85140c0 (patch)
tree6466ae8b67b4ef7a2b96ce858df1f9cd63d5fac6 /sql/rpl_gtid.h
parentf08946c0376cd2a116116685febe758ad5592741 (diff)
downloadmariadb-git-f0deff867a154879971560f83f62d96bb85140c0.tar.gz
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.
Diffstat (limited to 'sql/rpl_gtid.h')
-rw-r--r--sql/rpl_gtid.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index 1a94ee76eca..fcb9f08795a 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -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; }