Bug #79033 Could you confirm document for log-warnings on MySQL5.7GA
Submitted: 30 Oct 2015 12:25 Modified: 4 Jan 2016 13:18
Reporter: Shinya Sugiyama Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.7.9,5.7.10 OS:Any
Assigned to: CPU Architecture:Any

[30 Oct 2015 12:25] Shinya Sugiyama
Could you confirm default value? 


【 Current 】 
Permitted Values (64-bit platforms, >= 5.7.2)	Type	integer
Default	        2
Min Value	0
Max Value	18446744073709551615

【 If I confirm with following command, it seems 0 is default value 】
[root@misc01 admin]# mysqld --version
mysqld  Ver 5.7.9-enterprise-commercial-advanced for linux-glibc2.5 on x86_64 (MySQL Enterprise Server - Advanced Edition (Commercial))
[root@misc01 admin]# mysqld --no-defaults --verbose --help | grep log-warnings
  -W, --log-warnings[=#] 
log-warnings                                                 0
[root@misc01 admin]# 

How to repeat:
mysqld --no-defaults --verbose --help | grep log-warnings

Suggested fix:
Permitted Values (64-bit platforms, >= 5.7.9)	Type	integer
Default	        0
Min Value	0
Max Value	18446744073709551615

0 as disabled.

Best Regard
[30 Oct 2015 13:42] Miguel Solorzano
Thank you for the bug report.

C:\dbs>5.7\bin\mysqld --no-defaults --verbose --help | findstr log-warnings
  -W, --log-warnings[=#]
log-warnings                                                 0

C:\dbs>5.7\bin\mysqld --version
5.7\bin\mysqld  Ver 5.7.10 for Win64 on x86_64 (Source distribution PULL: 2015-OCT-24)
[2 Nov 2015 18:23] Paul Dubois
From the source (sql/sys_vars.cc):

static Sys_var_ulong Sys_log_warnings(
      "Log some not critical warnings to the log file",
      CMD_LINE(OPT_ARG, 'W'),
      NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_log_warnings),

Looks like the default is 2.

And that's what I get as well:

mysql> select @@log_warnings;
| @@log_warnings |
|              2 |
1 row in set, 1 warning (0.00 sec)

However, note the warning:

mysql> show warnings\G
*************************** 1. row ***************************
 Level: Warning
  Code: 1287
Message: '@@log_warnings' is deprecated and will be removed in a future release. Please use log_error_verbosity instead
1 row in set (0.01 sec)

It could be that the output from mysqld --help is misleading in this case; perhaps the variable is initialized differently at runtime from what gets displayed for a --help-only execution.
[4 Nov 2015 11:01] tsubasa tanaka

I found log_error_verbosity is set as 1 (and log_warnings is set as log_error_verbosity - 1) in get_options function when "--help" option is given.


So, log_warnings's default value is exactly 2.
Just "mysqld --no-defaults --help --verbose" can't report log_warnings (and log_error_verbosity) 's implicit default value.

$ bin/mysqld --no-defaults --help --verbose | egrep "log-error-verbosity|log-warnings"
  -W, --log-warnings[=#]
log-error-verbosity                                          1
log-warnings                                                 0
[4 Jan 2016 13:18] Shinya Sugiyama

Change Category from "MySQL Server: Documentation" to "MySQL Server: General".
This is not a documentation bug but "--help" option for mysqld command.

It is not fixed in MySQL5.7.10. 

[root@misc01 mysql]# bin/mysql -u root -p -e "select  @@version"
Enter password: 
| @@version                                 |
| 5.7.10-enterprise-commercial-advanced-log |
[root@misc01 mysql]# bin/mysqld --no-defaults --help --verbose | egrep "log-error-verbosity|log-warnings"
  -W, --log-warnings[=#] 
log-error-verbosity                                          1
log-warnings                                                 0
[root@misc01 mysql]#