Bug #72955 mysql_install_db fails to recognize rpl_semi_sync_slave_enabled option
Submitted: 11 Jun 2014 10:06 Modified: 12 Jun 2014 6:11
Reporter: Nilnandan Joshi Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6.19, 5.6.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.6.19

[11 Jun 2014 10:06] Nilnandan Joshi
Description:
While running mysql_install_db, it fails to recognize rpl_semi_sync_slave_enabled option when semi sync plugin is already installed and we can able to set that variable from command line. 

mysql> show global variables like 'rpl_semi_sync_slave%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled     | OFF   |
| rpl_semi_sync_slave_trace_level | 32    |
+---------------------------------+-------+
2 rows in set (0.01 sec)

mysql> SET GLOBAL rpl_semi_sync_slave_enabled = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'rpl_semi_sync_slave%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled     | ON    |
| rpl_semi_sync_slave_trace_level | 32    |
+---------------------------------+-------+
2 rows in set (0.01 sec)

mysql> 

How to repeat:
[root@centos65 nilnandan]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.19 MySQL Community Server (GPL)

...

mysql> 
mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
Query OK, 0 rows affected (0.01 sec)

mysql> INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
Query OK, 0 rows affected (0.01 sec)

mysql> show plugins;
+----------------------------+----------+--------------------+--------------------+---------+
| Name                       | Status   | Type               | Library            | License |
+----------------------------+----------+--------------------+--------------------+---------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL               | GPL     |

...
| partition                  | ACTIVE   | STORAGE ENGINE     | NULL               | GPL     |
| rpl_semi_sync_master       | ACTIVE   | REPLICATION        | semisync_master.so | GPL     |
| rpl_semi_sync_slave        | ACTIVE   | REPLICATION        | semisync_slave.so  | GPL     |
+----------------------------+----------+--------------------+--------------------+---------+
44 rows in set (0.01 sec)

[root@centos65 nilnandan]# mysql_install_db --no-defaults --rpl_semi_sync_slave_enabled=ON
Installing MySQL system tables...2014-06-11 15:26:52 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-06-11 15:26:52 2685 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-06-11 15:26:52 2685 [Note] InnoDB: The InnoDB memory heap is disabled
2014-06-11 15:26:52 2685 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-06-11 15:26:52 2685 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-06-11 15:26:52 2685 [Note] InnoDB: Using Linux native AIO
2014-06-11 15:26:52 2685 [Note] InnoDB: Not using CPU crc32 instructions
2014-06-11 15:26:52 2685 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-06-11 15:26:52 2685 [Note] InnoDB: Completed initialization of buffer pool
2014-06-11 15:26:52 2685 [Note] InnoDB: Highest supported file format is Barracuda.
2014-06-11 15:26:52 2685 [Note] InnoDB: 128 rollback segment(s) are active.
2014-06-11 15:26:52 2685 [Note] InnoDB: Waiting for purge to start
2014-06-11 15:26:52 2685 [Note] InnoDB: 5.6.19 started; log sequence number 1688649
2014-06-11 15:26:52 2685 [ERROR] /usr/sbin/mysqld: unknown variable 'rpl_semi_sync_slave_enabled=ON'
2014-06-11 15:26:52 2685 [ERROR] Aborting

2014-06-11 15:26:52 2685 [Note] Binlog end
2014-06-11 15:26:52 2685 [Note] InnoDB: FTS optimize thread exiting.
2014-06-11 15:26:52 2685 [Note] InnoDB: Starting shutdown...
2014-06-11 15:26:54 2685 [Note] InnoDB: Shutdown completed; log sequence number 1688659
2014-06-11 15:26:54 2685 [Note] /usr/sbin/mysqld: Shutdown complete

[root@centos65 nilnandan]#
[12 Jun 2014 6:11] MySQL Verification Team
Hello Joshi,

Thank you for the report.
Verified as described.

Thanks,
Umesh
[12 Jun 2014 6:13] MySQL Verification Team
How to repeat steps for Dev's:

//
1. Download latest build from internal repo
2. Use mysql_install_db which initializes the MySQL data directory and creates the system tables (my.cnf - just datadir, basedir, and socket/pid set)

cd /path/to/extracted build/
[ushastry@cluster-repo mysql-advanced-5.6.20]$ scripts/mysql_install_db --defaults-file=./my.cnf --user=mysql
..
<snip>

3. Bring up mysqld

[ushastry@cluster-repo mysql-advanced-5.6.20]$ bin/mysqld_safe --defaults-file=./my.cnf --user=mysql &
[1] 22196
[ushastry@cluster-repo mysql-advanced-5.6.20]$ 140614 02:11:36 mysqld_safe Logging to '/data/ushastry/server/mysql-advanced-5.6.20/data/cluster-repo.err'.
140614 02:11:36 mysqld_safe Starting mysqld daemon with databases from /data/ushastry/server/mysql-advanced-5.6.20/data

4.  Semisynchronous Replication Installation and Configuration (see - http://dev.mysql.com/doc/refman/5.6/en/replication-semisync-installation.html)

[ushastry@cluster-repo mysql-advanced-5.6.20]$ bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-------------------------------------------+
| version()                                 |
+-------------------------------------------+
| 5.6.20-enterprise-commercial-advanced-log |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
Query OK, 0 rows affected (0.02 sec)

mysql> INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
Query OK, 0 rows affected (0.02 sec)

mysql> show plugins;
+----------------------------+----------+--------------------+--------------------+-------------+
| Name                       | Status   | Type               | Library            | License     |
+----------------------------+----------+--------------------+--------------------+-------------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL               | PROPRIETARY |
..
..
| rpl_semi_sync_master       | ACTIVE   | REPLICATION        | semisync_master.so | PROPRIETARY |
| rpl_semi_sync_slave        | ACTIVE   | REPLICATION        | semisync_slave.so  | PROPRIETARY |
+----------------------------+----------+--------------------+--------------------+-------------+
45 rows in set (0.01 sec)

mysql>
mysql> show global variables like 'rpl_semi_sync_slave%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled     | OFF   |
| rpl_semi_sync_slave_trace_level | 32    |
+---------------------------------+-------+
2 rows in set (0.00 sec)

mysql> SET GLOBAL rpl_semi_sync_slave_enabled = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'rpl_semi_sync_slave%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled     | ON    |
| rpl_semi_sync_slave_trace_level | 32    |
+---------------------------------+-------+
2 rows in set (0.00 sec)

mysql> \q
Bye
[ushastry@cluster-repo mysql-advanced-5.6.20]$

5. Bring down mysqld, invoke  mysql_install_db with --rpl_semi_sync_slave_enabled=ON 

[ushastry@cluster-repo mysql-advanced-5.6.20]$ scripts/mysql_install_db --defaults-file=./my.cnf --rpl_semi_sync_slave_enabled=ON --user=mysql
Installing MySQL system tables...2014-06-14 02:19:33 0 [Warning] option 'expire_logs_days': unsigned value 100 adjusted to 99
2014-06-14 02:19:33 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-06-14 02:19:33 22508 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2014-06-14 02:19:33 22508 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)

2014-06-14 02:19:33 22508 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-06-14 02:19:33 22508 [Note] InnoDB: The InnoDB memory heap is disabled
2014-06-14 02:19:33 22508 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-06-14 02:19:33 22508 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-06-14 02:19:33 22508 [Note] InnoDB: Using Linux native AIO
2014-06-14 02:19:33 22508 [Note] InnoDB: Not using CPU crc32 instructions
2014-06-14 02:19:33 22508 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-06-14 02:19:33 22508 [Note] InnoDB: Completed initialization of buffer pool
2014-06-14 02:19:33 22508 [Note] InnoDB: Highest supported file format is Barracuda.
2014-06-14 02:19:33 22508 [Note] InnoDB: 128 rollback segment(s) are active.
2014-06-14 02:19:33 22508 [Note] InnoDB: Waiting for purge to start
2014-06-14 02:19:33 22508 [Note] InnoDB: 5.6.20 started; log sequence number 1659268
2014-06-14 02:19:33 22508 [ERROR] ./bin/mysqld: unknown variable 'rpl_semi_sync_slave_enabled=ON' <--------------
2014-06-14 02:19:33 22508 [ERROR] Aborting
[12 Jun 2014 6:17] MySQL Verification Team
Looking at the manual page - http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_rpl_semi_sync_s...

There are no "Command-Line Format","Option-File Format" options available for this option.. It is assumed that non mysql_install_db options are passed to mysqld but in this case it is complaning for the same. It would be good if this is documented if not allowed.
[16 Jun 2014 9:53] Libing Song
Posted by developer:
 
mysql_install_db starts server in bootstrap mode and plugins listed in mysql.plugin will not be load automatically at server startup. For this bug, the semisync plugins were not be loaded when starting server through 'mysql_install_db'. So the server reported "unknown variable 'rpl_semi_sync_slave_enabled=ON'".