Bug #68144 Collation name missing from log messages about LDML definition problems
Submitted: 22 Jan 2013 15:18 Modified: 12 Feb 2014 22:02
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:mysql-5.6.9 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[22 Jan 2013 15:18] Hartmut Holzgraefe
Description:
When trying to use an invalid user defined collation error information that can be found in SHOW WARNINGS also gets logged to the error log, e.g.

  2013-01-22 16:03:02 9130 [ERROR] Shift expected at ''

The error message is missing information about the actual invalid collation though. In SHOW WARNINGS output it can be figured out from the previous entry:

  +---------+------+--------------------------------+
  | Level   | Code | Message                        |
  +---------+------+--------------------------------+
  | Error   | 1273 | Unknown collation: 'utf8_test' |
  | Warning | 1273 | Shift expected at ''           |
  +---------+------+--------------------------------+

but for a DBA looking at the error log it is impossible to tell where the error actually is ...

How to repeat:
Add a simple test collation like

  <collation name="utf8_test" id="253">
    <rules>
      <reset>A</reset>
    </rules>
  </collation>

to the utf8 section of share/charsets/Index.xml and restart the mysql server.
Check server error log to see that no errors or warnings about the utf8_test collation were logged.

Then try to use the collation:

First verify that the collation was actually loaded:

mysql> show collation like 'utf8_test';
+-----------+---------+-----+---------+----------+---------+
| Collation | Charset | Id  | Default | Compiled | Sortlen |
+-----------+---------+-----+---------+----------+---------+
| utf8_test | utf8    | 254 |         |          |       8 |
+-----------+---------+-----+---------+----------+---------+
1 row in set (0.01 sec)

Now try to actually use the collation

mysql> create table t1(id int primary key, c char(1) collate utf8_test);
ERROR 1273 (HY000): Unknown collation: 'utf8_test'

SHOW WARNINGS gives more details:

mysql> show warnings;
+---------+------+--------------------------------+
| Level   | Code | Message                        |
+---------+------+--------------------------------+
| Error   | 1273 | Unknown collation: 'utf8_test' |
| Warning | 1273 | Shift expected at ''           |
+---------+------+--------------------------------+
2 rows in set (0.00 sec)

The servers error log only logs the "Shift expected at ''" warning message though, and as ERROR instead of WARNING:

  2013-01-22 16:02:29 9130 [ERROR] Shift expected at ''

Suggested fix:
Include the collation name in the error log message ...
[22 Jan 2013 18:14] Sveta Smirnova
Thank you for the report.

Verified as described. Problem is not repeatable in version 5.5: table created fine.
[12 Feb 2014 22:02] Paul DuBois
Noted in 5.6.17, 5.7.4 changelogs.

Messages written by the server to the error log for LDML collation
definition problems were missing the collation name.
[28 Mar 2014 19:38] Laurynas Biveinis
5.6$ bzr log -r 5805 -n0
------------------------------------------------------------
revno: 5805
committer: Arun Kuruvila <arun.kuruvila@oracle.com>
branch nick: mysql-5.6
timestamp: Tue 2014-02-11 12:19:05 +0530
message:
  Bug #16204175 COLLATION NAME MISSING FROM LOG MESSAGES 
                ABOUT LDML DEFINITION PROBLEMS
  
  Description: When trying to use an invalid user defined 
  collation error information that can be found in SHOW
  WARNINGS also gets logged to the error log, e.g.
  2013-01-22 16:03:02 9130 [ERROR] Shift expected at ''
  The error message is missing information about the actual
  invalid collation
  
  Analysis: When a collation is defined with invalid grammar
  rules, " expected at '' " error is logged to error log. But
  collation name is missing in this error message. So for a
  DBA looking at the error log it is impossible to tell where
  the error actually is . So it is better to add collation
  name along with the error message which is logged to the
  error log.
  
  Fix: As a fix i added the collation name also to the error
  message which is logged to the error log.
[28 Mar 2014 19:39] Laurynas Biveinis
5.6$ bzr log -r 5807 -n0
------------------------------------------------------------
revno: 5807
committer: Arun Kuruvila <arun.kuruvila@oracle.com>
branch nick: mysql-5.6
timestamp: Tue 2014-02-11 16:39:02 +0530
message:
  Bug #16204175 COLLATION NAME MISSING FROM LOG MESSAGES 
                ABOUT LDML DEFINITION PROBLEMS
  
  Description: Follow up patch for the testcase failure in
  pb2.