[MDEV-9969] mysql_install_db error processing ignore_db_dirs Created: 2016-04-22  Updated: 2016-06-20  Resolved: 2016-06-16

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.1.13, 10.0, 10.1
Fix Version/s: 10.0.27

Type: Bug Priority: Major
Reporter: Jesse Cotton Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: upstream-fixed
Environment:

CentOS 6.6, MariaDB 10.1


Sprint: 10.0.26

 Description   

`mysql_install_db` fails with `An error occurred while storing ignore_db_dirs to a hash.` when a `ignore_db_dirs` value is present in my.cnf.

[root@mariadb tmp]# /usr/bin/mysql_install_db --basedir=/usr --defaults-extra-file=/etc/my.cnf --datadir=/var/lib/mysql --user=mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
2016-04-22  6:00:33 140718721837088 [Note] /usr/sbin/mysqld (mysqld 10.1.13-MariaDB) starting as process 30747 ...
2016-04-22  6:00:33 140718721837088 [ERROR] An error occurred while storing ignore_db_dirs to a hash.
2016-04-22  6:00:33 140718721837088 [ERROR] Aborting

# my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
 
[mysqld]
ignore-db-dirs = lost+found
 
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d



 Comments   
Comment by Elena Stepanova [ 2016-04-22 ]

Please check if any files in /etc/my.cnf.d also contain the same setting.

Comment by Jesse Cotton [ 2016-04-22 ]

I saw https://bugs.mysql.com/bug.php?id=69441. No, none of the files within /etc/my.cnf.d contain the same setting.

I should probably also add that this only seems to affect mysql_install_db. If I remove ignore-db-dirs from my.cnf, run mysql_install_db, add ignore-db-dirs back to my.cnf, mysqld starts fine and processes ignore-db-dirs.

Comment by Jesse Cotton [ 2016-04-22 ]

It just dawned on me that the parameter to mysql_install_db, `defaults-extra-file=/etc/my.cnf` might be causing mysql_install_db to process /etc/my.cnf twice since `/etc/my.cnf` is the default file. That does seem to be the case. If I run mysql_install_db with `defaults-file=/etc/my.cnf` no error is thrown.

Comment by Elena Stepanova [ 2016-04-22 ]

That's right. But if you ran mysqld with the same defaults-extra-file, you should have experienced the same problem.

Comment by Jesse Cotton [ 2016-04-22 ]

You're correct however mysqld isn't started with a `defaults-extra-file` parameter. I am using Puppet to deploy MariaDB and I am at the mercy of the Puppet module. I am not sure why they chose to use `defaults-extra-file` for mysql_install_db but I'll look into it.

So this does look like a manifestation of https://bugs.mysql.com/bug.php?id=69441?

Comment by Elena Stepanova [ 2016-04-22 ]

Okay, now it's clear. Thanks for the report.
Yes, the problem you encountered is https://bugs.mysql.com/bug.php?id=69441. It's been fixed in MySQL 5.7, and the fix needs to be merged to MariaDB 10.x (or re-done, if it's not good enough).

For a note, while experimenting with it, I've found another issue with mysql_install_db processing ignore_db_dirs.
If the option is provided on the command line, even once and without any default files involved, it causes the exact same error

 scripts/mysql_install_db --no-defaults --ignore-db-dir=xxxx 
Installing MariaDB/MySQL system tables in './data' ...
2016-04-22 19:46:50 140679461701504 [Note] ./bin/mysqld (mysqld 10.1.13-MariaDB) starting as process 17497 ...
2016-04-22 19:46:50 140679461701504 [ERROR] An error occurred while storing ignore_db_dirs to a hash.
2016-04-22 19:46:50 140679461701504 [ERROR] Aborting

It happens because while preparing the bootstrap command line, mysql_install_db goes through the arguments twice, so they end up being duplicated on final command line:

> scripts/mysql_install_db --no-defaults --ignore-db-dir=xxxx --lock-wait-timeout=5
./bin/mysqld --no-defaults --lc-messages=en_US --bootstrap --basedir=. --datadir=./data --log-warnings=0 --enforce-storage-engine=  --ignore-db-dir=xxxx --lock-wait-timeout=5 --ignore-db-dir=xxxx --lock-wait-timeout=5 --max_allowed_packet=8M --net_buffer_length=16K

The specific problem with ignore-db-dir will disappear after the server part is fixed, but still providing duplicate options is not good, so it would be useful to fix the script as well.
In MySQL 5.6 it was fixed apparently when mysql_install_db was rewritten in Perl.

Comment by Alexey Botchkov [ 2016-06-16 ]

Patch for the server:
http://lists.askmonty.org/pipermail/commits/2016-June/009456.html

Comment by Alexey Botchkov [ 2016-06-16 ]

Patch to the mysql_install_db scripts: http://lists.askmonty.org/pipermail/commits/2016-June/009457.html

Generated at Thu Feb 08 07:38:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.