diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-12-05 16:09:48 +0100 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-12-06 08:49:50 +0100 |
commit | db21fddc3740dfa48f3443751c48282467afac5e (patch) | |
tree | 3ed31a4a5ce9abf3fe98cdd9c9bdf68ba8b5832b /sql/rpl_mi.h | |
parent | 1e3f09f1638e2bdec6029f6c98317d17d7ca76d1 (diff) | |
download | mariadb-git-db21fddc3740dfa48f3443751c48282467afac5e.tar.gz |
MDEV-6676: Optimistic parallel replication
Implement a new mode for parallel replication. In this mode, all transactions
are optimistically attempted applied in parallel. In case of conflicts, the
offending transaction is rolled back and retried later non-parallel.
This is an early-release patch to facilitate testing, more changes to user
interface / options will be expected. The new mode is not enabled by default.
Diffstat (limited to 'sql/rpl_mi.h')
-rw-r--r-- | sql/rpl_mi.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 5eacbc97a95..6c970de608b 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -16,6 +16,18 @@ #ifndef RPL_MI_H #define RPL_MI_H + +/* + Bit masks for the values in --slave-parallel-mode. + Note that these values cannot be changed - they are stored in master.info, + so need to be possible to read back in a different version of the server. +*/ +#define SLAVE_PARALLEL_DOMAIN (1ULL << 0) +#define SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT (1ULL << 1) +#define SLAVE_PARALLEL_TRX (1ULL << 2) +#define SLAVE_PARALLEL_WAITING (1ULL << 3) + + #ifdef HAVE_REPLICATION #include "rpl_rli.h" @@ -131,6 +143,8 @@ public: }; +extern TYPELIB slave_parallel_mode_typelib; + /***************************************************************************** Replication IO Thread @@ -180,6 +194,10 @@ class Master_info : public Slave_reporting_capability return connection_name.str == 0; } static const char *using_gtid_astext(enum enum_using_gtid arg); + bool using_parallel() + { + return opt_slave_parallel_threads > 0 && parallel_mode != 0; + } /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN+6]; /* Room for multi-*/ @@ -293,6 +311,13 @@ class Master_info : public Slave_reporting_capability /* domain-id based filter */ Domain_id_filter domain_id_filter; + + /* + The parallel replication modes, if any. A combination (binary OR) of any + of SLAVE_PARALLEL_DOMAIN, SLAVE_PARALLEL_FOLLOW_MASTER_COMMIT, + SLAVE_PARALLEL_TRX, and SLAVE_PARALLEL_WAITING. + */ + ulonglong parallel_mode; }; int init_master_info(Master_info* mi, const char* master_info_fname, @@ -358,6 +383,13 @@ void create_logfile_name_with_suffix(char *res_file_name, size_t length, uchar *get_key_master_info(Master_info *mi, size_t *length, my_bool not_used __attribute__((unused))); void free_key_master_info(Master_info *mi); +int mi_cmdline_init(); +void mi_cmdline_destroy(); +void mi_slave_parallel_mode_lookup(LEX_STRING *connection_name, + ulonglong *out_mode); +int mi_slave_parallel_mode_ptr(LEX_STRING *connection_name, + ulonglong **out_mode_ptr, + bool create_if_missing); #endif /* HAVE_REPLICATION */ |