diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2017-03-24 12:07:07 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2017-04-21 10:30:16 +0200 |
commit | fdf2d407707faf05b8b7d67662a70cc5537d15aa (patch) | |
tree | 63fa7fb276ffe1d247054bc1712a9b745f1b129d /sql/rpl_gtid.h | |
parent | 3cc89b3e85605ecb09b4b2222c8b0b8222a29fde (diff) | |
download | mariadb-git-fdf2d407707faf05b8b7d67662a70cc5537d15aa.tar.gz |
MDEV-12179: Per-engine mysql.gtid_slave_pos table
Intermediate commit.
Implement auto-creation of mysql.gtid_slave_pos* tables with needed engines,
if listed in --gtid-pos-auto-engines.
Uses an asynchronous approach to minimise locking overhead.
The list of available tables is extended with a flag. Extra entries are
added for --gtid-pos-auto-engines tables that do not exist yet, marked as
not existing but ready for auto-creation.
If record_gtid() needs a table marked for auto-creation, it sends a request
to the slave background thread to create the table, and continues to use an
existing table for the current and immediately coming transactions.
As soon as the slave background thread has made the new table available, it
will be used for all subsequent relevant transactions in record_gtid().
This asynchronous approach also avoids a lot of complex issues around trying
to do DDL in the middle of an on-going transaction.
Diffstat (limited to 'sql/rpl_gtid.h')
-rw-r--r-- | sql/rpl_gtid.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index b4f80fe3ddf..e6a3ea1a667 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -157,6 +157,12 @@ struct rpl_slave_state }; /* Descriptor for mysql.gtid_slave_posXXX table in specific engine. */ + enum gtid_pos_table_state { + GTID_POS_AUTO_CREATE, + GTID_POS_CREATE_REQUESTED, + GTID_POS_CREATE_IN_PROGRESS, + GTID_POS_AVAILABLE + }; struct gtid_pos_table { struct gtid_pos_table *next; /* @@ -167,6 +173,7 @@ struct rpl_slave_state */ void *table_hton; LEX_STRING table_name; + uint8 state; }; /* Mapping from domain_id to its element. */ @@ -232,7 +239,8 @@ struct rpl_slave_state void set_gtid_pos_tables_list(gtid_pos_table *new_list, gtid_pos_table *default_entry); void add_gtid_pos_table(gtid_pos_table *entry); - struct gtid_pos_table *alloc_gtid_pos_table(LEX_STRING *table_name, void *hton); + struct gtid_pos_table *alloc_gtid_pos_table(LEX_STRING *table_name, + void *hton, rpl_slave_state::gtid_pos_table_state state); void free_gtid_pos_tables(struct gtid_pos_table *list); }; |