diff options
author | unknown <knielsen@knielsen-hq.org> | 2013-06-05 14:32:47 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2013-06-05 14:32:47 +0200 |
commit | 5cb486d159e45b9b8dc4d647b2df2492a286cf4d (patch) | |
tree | 85bdb56bae9cad68033b742092012f0961172745 /sql/sql_repl.h | |
parent | 7ad47ab0e080ca66f8a41de461b036d3bdff25fb (diff) | |
download | mariadb-git-5cb486d159e45b9b8dc4d647b2df2492a286cf4d.tar.gz |
MDEV-26: Global transaction ID.
Fix problems related to reconnect. When we need to reconnect (ie. explict
stop/start of just the IO thread by user, or automatic reconnect due to
loosing network connection with the master), it is a bit complex to correctly
resume at the right point without causing duplicate or missing events in the
relay log. The previous code had multiple problems in this regard.
With this patch, the problem is solved as follows. The IO thread keeps track
(in memory) of which GTID was last queued to the relay log. If it needs to
reconnect, it resumes at that GTID position. It also counts number of events
received within the last, possibly partial, event group, and skips the same
number of events after a reconnect, so that events already enqueued before the
reconnect are not duplicated.
(There is no need to keep any persistent state; whenever we restart slave
threads after both of them being stopped (such as after server restart), we
erase the relay logs and start over from the last GTID applied by SQL thread.
But while the SQL thread is running, this patch is needed to get correct relay
log).
Diffstat (limited to 'sql/sql_repl.h')
-rw-r--r-- | sql/sql_repl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_repl.h b/sql/sql_repl.h index 820ffed0928..a242fa4aeef 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -32,6 +32,8 @@ typedef struct st_slave_info THD* thd; } SLAVE_INFO; +class slave_connection_state; + extern my_bool opt_show_slave_auth_info; extern char *master_host, *master_info_file; extern bool server_id_supplied; @@ -70,6 +72,7 @@ void rpl_init_gtid_slave_state(); void rpl_deinit_gtid_slave_state(); int gtid_state_from_binlog_pos(const char *name, uint32 pos, String *out_str); int rpl_append_gtid_state(String *dest, bool use_binlog); +int rpl_load_gtid_state(slave_connection_state *state, bool use_binlog); bool rpl_gtid_pos_check(THD *thd, char *str, size_t len); bool rpl_gtid_pos_update(THD *thd, char *str, size_t len); |