diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-05-28 13:28:31 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-05-28 13:28:31 +0200 |
commit | ee2b7db3f88f6882022a8aa71b30043ed8b40792 (patch) | |
tree | ce63742ca2896e0bd73a702efeb9eb40ed784f04 /sql/rpl_gtid.h | |
parent | f5319394e3dee146f112b41674ffa188d5e89150 (diff) | |
download | mariadb-git-ee2b7db3f88f6882022a8aa71b30043ed8b40792.tar.gz |
MDEV-4478: Implement GTID "strict mode"
When @@GLOBAL.gtid_strict_mode=1, then certain operations result
in error that would otherwise result in out-of-order binlog files
between servers.
GTID sequence numbers are now allocated independently per domain;
this results in less/no holes in GTID sequences, increasing the
likelyhood that diverging binlogs will be caught by the slave when
GTID strict mode is enabled.
Diffstat (limited to 'sql/rpl_gtid.h')
-rw-r--r-- | sql/rpl_gtid.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index cc3c99f40b7..fefce684c2c 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -131,6 +131,10 @@ struct rpl_binlog_state HASH hash; /* Containing all server_id for one domain_id */ /* The most recent entry in the hash. */ rpl_gtid *last_gtid; + /* Counter to allocate next seq_no for this domain. */ + uint64 seq_no_counter; + + int update_element(const rpl_gtid *gtid); }; /* Mapping from domain_id to collection of elements. */ HASH hash; @@ -144,8 +148,12 @@ struct rpl_binlog_state void reset(); void free(); bool load(struct rpl_gtid *list, uint32 count); - int update(const struct rpl_gtid *gtid); - uint64 seq_no_from_state(); + int update(const struct rpl_gtid *gtid, bool strict); + int update_with_next_gtid(uint32 domain_id, uint32 server_id, + rpl_gtid *gtid); + int alloc_element(const rpl_gtid *gtid); + bool check_strict_sequence(uint32 domain_id, uint32 server_id, uint64 seq_no); + int bump_seq_no_if_needed(uint32 domain_id, uint64 seq_no); int write_to_iocache(IO_CACHE *dest); int read_from_iocache(IO_CACHE *src); uint32 count(); @@ -153,6 +161,7 @@ struct rpl_binlog_state int get_most_recent_gtid_list(rpl_gtid **list, uint32 *size); bool append_pos(String *str); rpl_gtid *find(uint32 domain_id, uint32 server_id); + rpl_gtid *find_most_recent(uint32 domain_id); }; |