hugowan / maatkit

Automatically exported from code.google.com/p/maatkit
0 stars 0 forks source link

mk-audit warns about bogus differences between online values and my.cnf values #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
mk-audit reports me bunch of problems, although I do not have them on my
box. I do not have duplicate variables neither variables out of sync. (I
use 5.0.62 percona build)

report:

   PROBLEMS ______________________________________________________________
        Duplicate system variables in config file:
                - datadir
                - socket
                - old_passwords
                - max_allowed_packet
                - table_cache
                - default_character_set
                - max_connections
                - net_read_timeout
                - net_write_timeout
                - innodb_log_file_size
                - innodb_buffer_pool_size
                - innodb_flush_method
                - key_buffer_size
                - innodb_log_buffer_size
                - innodb_flush_log_at_trx_commit
                - innodb_file_per_table
                - innodb_open_files
                - long_query_time
                - log_slow_verbosity
                - log_slow_rate_limit
                - log_slow_queries
                - skip_name_resolve
                - log_bin
                - server_id
        System variables out of sync (online differs from config):
                - date_format: online=%Y-%m-%d config=
                - log_slow_verbosity: online=microtime,innodb config=innodb
                - tmpdir: online=/tmp/ config=
                - query_cache_type: online=ON config=1
                - datetime_format: online=%Y-%m-%d %H:%i:%s config=
                - sql_mode: online= config=OFF
                - time_format: online=%H:%i:%s config=
                - log_slow_queries: online=ON
config=/var/lib/mysql/slow_query.log
                - innodb_log_group_home_dir: online=./ config=
                - pid_file: online=/var/lib/mysql/DB03.boardreader.com.pid
config=/var/lib/mysql/DB03.pid
                - ft_stopword_file: online=(built-in) config=
                - open_files_limit: online=8192 config=0
                - log_bin: online=ON config=db03-bin

Original issue reported on code.google.com by baron.schwartz on 27 Aug 2008 at 1:48

GoogleCodeExporter commented 9 years ago
What does 'mysqld --help --verbose' say? We've seen this issue before and it was
because of a custom compiled mysqld reading one of the default conf files 
twice, as
reported by 'mysqld --help --verbose'.

Original comment by dan...@percona.com on 28 Aug 2008 at 1:38

GoogleCodeExporter commented 9 years ago
The culprit is my_print_defaults and mysqld binaries compiled with a duplicate 
conf
file location like:
mysqld --help --verbose
...
Default options are read from the following files in the given order:
/etc/my.cnf ~/.my.cnf /etc/my.cnf 

Apparently, my_print_defaults reads /etc/my.cnf, reports what it sees, then 
reads it
again and reports the exact same thing, all in one big list. This make it 
difficult
for mk-audit to know if duplicates are real duplicates (dupes in the same file) 
or
"false" duplicates as a result of this weirdness.

Original comment by dan...@percona.com on 29 Aug 2008 at 7:21

GoogleCodeExporter commented 9 years ago
Here's what we're going to do. We'll discover the default defaults file that
my_print_defaults will read from the mysqld --help --verbose output. So in the 
above
case we'll parse the output and see that /etc/my.cnf appears twice. We'll remove
duplicates and then call my_print_defaults directly on each unique conf file, 
like:
my_print_defaults --defaults-file=/etc/my.cnf mysqld
my_print_defaults --defaults-file=~/.my.cnf mysqld

This should work. The other alternative would be some super-fancy duplication
detection but that would be more difficult than the above solution. Or, we could
patch my_print_defaults.c directly and submit a bug report to MySQL AB... maybe 
later.

Original comment by dan...@percona.com on 29 Aug 2008 at 7:48

GoogleCodeExporter commented 9 years ago
The false-positive duplicates should be fixed now. I can't really test it on my
system because my system's mysqld doesn't have duplicate default defaults 
files. But,
on another system which demonstrated this problem, the problem is fixed in 
r2254.

Original comment by dan...@percona.com on 30 Aug 2008 at 3:17

GoogleCodeExporter commented 9 years ago
I think that works.  I tested it on a system that reads /etc/my.cnf twice and 
got no
dupes; put a dupe in deliberately and it was reported.

   PROBLEMS ______________________________________________________________
    Duplicate system variables in config file:
        - max_allowed_packet
Undefined system variable: relay_log at mk-audit line 2716
    System variables out of sync (online differs from config):
        - date_format: online=%Y-%m-%d config=
        - tmpdir: online=/tmp/ config=
        - query_cache_type: online=ON config=1
        - datetime_format: online=%Y-%m-%d %H:%i:%s config=
        - sql_mode: online= config=OFF
        - time_format: online=%H:%i:%s config=
        - log_slow_queries: online=ON config=/var/lib/mysql/slow_query.log
        - innodb_log_group_home_dir: online=./ config=
        - pid_file: online=/var/lib/mysql/sb1.percona.com.pid config=/var/lib/mysql/sb1.pid
        - ft_stopword_file: online=(built-in) config=
        - open_files_limit: online=2314 config=0
        - log_bin: online=ON config=mpb-bin
    Things to Note:
        - max_connections has been modified from its default (100): 256
        - Zero thread cache (thread_cache_size = 0)

Original comment by baron.schwartz on 30 Aug 2008 at 3:44

GoogleCodeExporter commented 9 years ago
Excellent. I'm fixing now the other thing: bad/annoying sys vars out of sync.
Hopefully my magick in fixing this will be as effective as the false-pos dupes.

Original comment by dan...@percona.com on 30 Aug 2008 at 3:47

GoogleCodeExporter commented 9 years ago
Okay: with r2258 you can see how I've fixed a number of these annoying out of 
sync
vars. Some are flat-out ignored (%ignore_sys_var) and others now have a special 
'eq'
(%eq_for).

I think we can close this issue and perhaps start appending to the mk-audit 
TODO a
list of other vars that need to be handled and how. Now it's just a matter of
defining new eq_for subs. For example: on unix systems, is tmpdir always /tmp/ 
by
default if not given in the config (as in the example above)? But what about on
Windows? And eq_for{tmpdir} can handle this, however we choose.

Original comment by dan...@percona.com on 30 Aug 2008 at 4:34

GoogleCodeExporter commented 9 years ago
Example: log_slow_queries: online=ON config=/var/lib/mysql/slow_query.log

An eq_for{log_slow_queries} would check that if one of the given vals (the 
eq_for
subs don't know which is online or conf) is ON and the other is any kind of 
file,
then it is "equal."

Original comment by dan...@percona.com on 30 Aug 2008 at 4:36

GoogleCodeExporter commented 9 years ago
Don't forget to commit trunk/common/t/samples/mysqld_01_issue_58.txt :)

Original comment by baron.schwartz on 30 Aug 2008 at 4:59