[MDEV-27952] Improve error log messages with descriptive text already present in the code Created: 2022-02-25 Updated: 2024-01-30 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Server |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Roel Van de Paar | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | affects-tests, beginner-friendly | ||
| Description |
|
It would be great if we could improve the quality of some or all error messages. For example:
Will lead to (in the CLI):
Which is sufficiently clear to understand what is happening, or at least to get a good hint in the case where the SELECT happens much later than the DISCARD TABLESPACE. However, the error log is much more cryptic:
Sysadmins would have to use the bin/perror tool (if they know it exists), or search online, to find out what is happening. We can save them from having to take this extra and unnecessary step by automating (and improving) the error to message step:
It would seem that this is low hanging fruit and a feature easy to implement. |
| Comments |
| Comment by Roel Van de Paar [ 2022-03-12 ] | ||||||||
|
Another example
Whilst not commonly used SQL at the CLI, it highlights the issue well. At the CLI this gives:
Which is cryptic at best. However the error log clearly explains the issue:
Interestingly, there is another error code here too. Elkin fyi in case that's a bug. | ||||||||
| Comment by Roel Van de Paar [ 2022-04-09 ] | ||||||||
|
Similar to the last example (same output):
| ||||||||
| Comment by Roel Van de Paar [ 2023-03-25 ] | ||||||||
|
Please also try this testcase against any bug fix
| ||||||||
| Comment by Zhibo Zhang [ 2023-06-15 ] | ||||||||
|
investigating it | ||||||||
| Comment by Zhibo Zhang [ 2023-06-19 ] | ||||||||
|
The error message for the example given in the body part of this Jira is already informative: https://github.com/MariaDB/server/blob/3883eb63dc5e663558571c33d086c9fd3aa0cf8f/storage/innobase/dict/dict0load.cc#L2234 | ||||||||
| Comment by Zhibo Zhang [ 2023-06-19 ] | ||||||||
|
Execution result in the database: {{Welcome to the MariaDB monitor. Commands end with ; or \g. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases;
--------------------
-------------------- MariaDB [(none)]> create database zhibo; MariaDB [(none)]> use zhibo; MariaDB [zhibo]> ALTER TABLE t DISCARD TABLESPACE; MariaDB [zhibo]> SELECT * FROM t; According error log: 2023-06-19 15:11:10 3 [Warning] InnoDB: Tablespace for table `zhibo`.`t` is set as discarded. | ||||||||
| Comment by Zhibo Zhang [ 2023-06-19 ] | ||||||||
|
Reproduction of the second case mentioned in the comments: ``` MariaDB [test]> BINLOG ' O1ZVRw8BAAAAZgAAAGoAAAAAAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA7VlVHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC '; # Table_map MariaDB [test]> BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; # Format description In the error log: | ||||||||
| Comment by Roel Van de Paar [ 2023-06-28 ] | ||||||||
|
zhibozhang You can use {noformat} tags in JIRA. | ||||||||
| Comment by Roel Van de Paar [ 2023-06-28 ] | ||||||||
|
In 11.1.2 rev 3883eb63dc5e663558571c33d086c9fd3aa0cf8f the Got error 194 seen with the original testcase is confirmed gone. However, the error remains for this testcase:
Leads to:
Which now makes me wonder if there is another issue/error at play here. | ||||||||
| Comment by Zhibo Zhang [ 2023-12-06 ] | ||||||||
|
The place where error code 194 is defined https://github.com/MariaDB/server/blob/1a5e69b42b4ff0a3fd4585f1463adf01127241cd/include/my_base.h#L533 | ||||||||
| Comment by Zhibo Zhang [ 2024-01-30 ] | ||||||||
|
Error code 194 uses a default error message as shown in https://github.com/MariaDB/server/blob/d039346a7acac7c72f264377a8cd6b0273c548df/sql/unireg.h#L53 | ||||||||
| Comment by Zhibo Zhang [ 2024-01-30 ] | ||||||||
|
We need to replace the default error message with a customized error message for error code 194 in this line https://github.com/MariaDB/server/blob/b0e77c08e55c433e443a2cfbcb7315dd6f006b3e/sql/handler.cc#L498 |