[MDEV-8064] ignore-db-dir=lost+found not working Created: 2015-04-28  Updated: 2020-03-16

Status: Stalled
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0.17
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Ainsley Assignee: Elena Stepanova
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-21951 mariabackup SST fail if data-director... Closed

 Description   

Have ignore-db-dir = 'lost+found' in my.cnf
It is recognized:
show global variables like 'ignore_db_dirs';

Variable_name Value
ignore_db_dirs lost+found

But lost+found is not hidden

show databases like "lost+found";

Database (lost+found)
lost+found

Worked correctly in version 5.5.38



 Comments   
Comment by Elena Stepanova [ 2015-04-28 ]

Hi,

Please note that ignore_db_dirs refer to the directory name, as opposed to the database name, and the difference is important here.

From your output, it looks like you previously ran
create database `lost+found`, and not
mkdir <datadir>/lost+found.

If you look into your datadir, you'll see that the existing directory is not lost+found, it's something like lost@002bfound. It gets converted back when you run show databases.

It works the same way in 5.5.38 and 10.0, see output from 5.5.38 below.

MariaDB [test]> select @@version;
+----------------+
| @@version      |
+----------------+
| 5.5.38-MariaDB |
+----------------+
1 row in set (0.00 sec)
 
MariaDB [test]> select @@ignore_db_dirs;
+------------------+
| @@ignore_db_dirs |
+------------------+
| lost+found       |
+------------------+
1 row in set (0.00 sec)
 
MariaDB [test]> select @@datadir;
+--------------------------------------------------+
| @@datadir                                        |
+--------------------------------------------------+
| /data/releases/mariadb-5.5.38-linux-x86_64/data/ |
+--------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [test]> system ls /data/releases/mariadb-5.5.38-linux-x86_64/data/
aria_log.00000001  aria_log_control  ibdata1  ib_logfile0  ib_logfile1	mysql  performance_schema  test  wheezy-64.err	wheezy-64.pid
 
MariaDB [test]> system mkdir /data/releases/mariadb-5.5.38-linux-x86_64/data/lost+found
 
MariaDB [test]> system ls /data/releases/mariadb-5.5.38-linux-x86_64/data/
aria_log.00000001  aria_log_control  ibdata1  ib_logfile0  ib_logfile1	lost+found  mysql  performance_schema  test  wheezy-64.err  wheezy-64.pid
 
MariaDB [test]> show databases like "lost+found";
Empty set (0.00 sec)

MariaDB [test]> create database `lost+found`;
Query OK, 1 row affected (0.00 sec)
 
MariaDB [test]> system ls /data/releases/mariadb-5.5.38-linux-x86_64/data/
aria_log.00000001  ibdata1	ib_logfile1	lost+found  performance_schema	wheezy-64.err
aria_log_control   ib_logfile0	lost@002bfound	mysql	    test		wheezy-64.pid
 
MariaDB [test]> show databases like "lost+found";
+-----------------------+
| Database (lost+found) |
+-----------------------+
| lost+found            |
+-----------------------+
1 row in set (0.00 sec)

Comment by Ainsley [ 2015-04-29 ]

Thank you, you were correct.
'lost@002bfound' was created by a raw data directory copy from one data dir to another.

Comment by Elena Stepanova [ 2015-04-29 ]

In this case it works as expected, closing a 'Not a bug'.
Please feel free to comment if you disagree.

Comment by drupal_user [ 2015-12-21 ]

There seems to be a bug, though. I mounted /var/lib/mysql on a separate partition before installing
mysql-server. After installing: I have /var/lib/mysql mounted as its own ext4 filesystem.

By default, the filesystem has a directory at its root named
lost+found, which is used for cleanup during bad filesystem checks.

When i install mysql-server, it mangles this directory (which doesn't
really belong to it) into "lost@002bfound", and changes ownership on
it to mysql:mysql:

ls -l /var/lib/mysql/

rw-rr- 1 root root 0 Nov 8 11:34 debian-5.1.flag
rw-rw--- 1 mysql mysql 10485760 Nov 8 11:35 ibdata1
rw-rw--- 1 mysql mysql 5242880 Nov 8 11:35 ib_logfile0
rw-rw--- 1 mysql mysql 5242880 Nov 8 11:34 ib_logfile1
drwx------ 2 mysql mysql 4096 Nov 8 11:35 lost@002bfound
drwx------ 2 mysql root 4096 Nov 8 11:35 mysql
rw------ 1 root root 6 Nov 8 11:35 mysql_upgrade_info
0 stylus:~#

Note the wrong permission lost@002bfound directory. It also now has a
db.opt file inside it.

I'm not sure how to repair this? What should I do with the db.opt file?

I already looked at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608938

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