[MDEV-7530] !includedir reads files in random order Created: 2015-01-29  Updated: 2015-02-25  Resolved: 2015-02-25

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0
Fix Version/s: 10.0.17

Type: Bug Priority: Critical
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 1
Labels: None


 Description   

Currently !includedir directive in my.cnf seems to include files in some unspecified order. This makes it impossible to override settings in one specific include file by adding another file that is included later.

The server should include files in alphabetical order, so that one could use config files with conventional two-digit prefixes.

the fix is to add MY_WANT_SORT to my_dir() in my_default.c



 Comments   
Comment by Alexey Botchkov [ 2015-02-16 ]

I cannot reproduce this one. Mean that '*cfg' files in an !includedir-ed directory are sorted for me.

And the sorting code is there in the my_dir() like:

  if (!(MyFlags & MY_DONT_SORT))
    my_qsort((void *) result->dir_entry, result->number_off_files,
          sizeof(FILEINFO), (qsort_cmp) comp_names);

Comment by Sergei Golubchik [ 2015-02-16 ]

Affect Version is "10.0", this task isn't for 5.5

Comment by Will Fong [ 2015-02-17 ]

I'm sorry, I don't understand C, but here was my test:

[root@7530 ~]# mysql -e "SHOW VARIABLES LIKE 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 0     |
+---------------+-------+
[root@7530 ~]# echo -e "[server]\nserver_id=200\n" > /etc/my.cnf.d/z.cnf
[root@7530 ~]# service mysql restart
Shutting down MySQL... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@7530 ~]# mysql -e "SHOW VARIABLES LIKE 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 200   |
+---------------+-------+
[root@7530 ~]# echo -e "[server]\nserver_id=100\n" > /etc/my.cnf.d/a.cnf
[root@7530 ~]# service mysql restart
Shutting down MySQL... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@7530 ~]# mysql -e "SHOW VARIABLES LIKE 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 100   |
+---------------+-------+
[root@7530 ~]# echo -e "[server]\nserver_id=500\n" > /etc/my.cnf.d/Z.cnf
[root@7530 ~]# service mysql restart
Shutting down MySQL... SUCCESS! 
Starting MySQL. SUCCESS! 
[root@7530 ~]# mysql -e "SHOW VARIABLES LIKE 'server_id'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 500   |
+---------------+-------+
[root@7530 ~]# mysql -e "SELECT VERSION()"
+-----------------+
| VERSION()       |
+-----------------+
| 10.0.16-MariaDB |
+-----------------+
[root@7530 ~]# 

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