← Back to team overview

maria-developers team mailing list archive

Re: Aliasing slave_parallel_workers/slave_parallel_threads


Colin Charles <byte@xxxxxxxxxxx> writes:

> MySQL 5.7 has been released and I’m sure you realise that it uses the
> variable slave_parallel_workers
> (http://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html#sysvar_slave_parallel_workers). In
> MariaDB Server 10.1 we use slave_parallel_threads
> (https://mariadb.com/kb/en/mariadb/replication-and-binary-log-server-system-variables/#slave_parallel_threads)

> It would be wise for us to alias this, so that its easier from a DBA usability standpoint IMHO

The problem with doing this is that the options are not identical between
MySQL and MariaDB. This means that users/DBAs can experience unpleasant
surprises when their configuration carries over from one to the other but
then silently does the wrong thing.

For example, --slave-parallel-workers in MySQL enables out-of-order parallel
replication between schemas. This can break replication unless applications
are careful to avoid cross-schema queries. In contrast, MariaDB
--slave-parallel-threads is in-order (unless GTID is used), so does not
restrict applications. This means that moving from a MariaDB with
--slave-parallel-workers set to MySQL can silently break replication.

But maybe the options are sufficiently similar (or maybe we do not care
about MariaDB->MySQL migrations). If the consensus is to add the alias, I
do not have a strong opinion one way or the other.

Attached is a patch that implements this. Monty or Sanja, can one of you
review the patch? IIRC, you worked previously on MySQL option compatibility.

 - Kristian.

diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index eec9892..71dd928 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7623,7 +7623,6 @@ struct my_option my_long_options[]=
   MYSQL_TO_BE_IMPLEMENTED_OPTION("slave-allow-batching"),         // HAVE_REPLICATION
   MYSQL_COMPATIBILITY_OPTION("slave-checkpoint-period"),      // HAVE_REPLICATION
   MYSQL_COMPATIBILITY_OPTION("slave-checkpoint-group"),       // HAVE_REPLICATION
-  MYSQL_SUGGEST_ANALOG_OPTION("slave-parallel-workers", "--slave-parallel-threads"),       // HAVE_REPLICATION
   MYSQL_SUGGEST_ANALOG_OPTION("slave-pending-jobs-size-max", "--slave-parallel-max-queued"),  // HAVE_REPLICATION
   MYSQL_TO_BE_IMPLEMENTED_OPTION("sha256-password-private-key-path"), // HAVE_OPENSSL && !HAVE_YASSL
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 42bcfa2..6836d19 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1848,6 +1848,15 @@ static Sys_var_ulong Sys_slave_parallel_threads(
        NOT_IN_BINLOG, ON_CHECK(check_slave_parallel_threads),
+/* Alias for @@slave_parallel_threads to match what MySQL 5.7 uses. */
+static Sys_var_ulong Sys_slave_parallel_workers(
+       "slave_parallel_workers",
+       "Alias for slave_parallel_threads",
+       GLOBAL_VAR(opt_slave_parallel_threads), CMD_LINE(REQUIRED_ARG),
+       NOT_IN_BINLOG, ON_CHECK(check_slave_parallel_threads),
+       ON_UPDATE(fix_slave_parallel_threads));
 static bool
 check_slave_domain_parallel_threads(sys_var *self, THD *thd, set_var *var)

Follow ups