-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect and expose client errors/warnings as a table #14433
Comments
PTAL |
@wwar Thank you very much for paying attention to this point. We implement the metric schema mainly to implement diagnostic rules. These diagnostic rules will soon begin to add, and if you are interested, you can get involved. In addition, for the time being we do not have the same thing as sys, we consider adding a partially compatible view in the future. |
@wwar It would be helpful if you can clearly specify the tables you want to add to tidb. |
Let me fill in the request. I would like to see the following tables in information schema: CREATE TABLE client_errors_summary_by_host (
`HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci DEFAULT NULL,
`ERROR_NUMBER` int DEFAULT NULL,
`ERROR_NAME` varchar(64) DEFAULT NULL,
`SQL_STATE` varchar(5) DEFAULT NULL,
`SUM_ERROR_RAISED` bigint unsigned NOT NULL,
`SUM_ERROR_HANDLED` bigint unsigned NOT NULL,
`FIRST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
`LAST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
UNIQUE KEY `HOST` (`HOST`,`ERROR_NUMBER`)
);
CREATE TABLE `client_errors_summary_by_user` (
`USER` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`ERROR_NUMBER` int DEFAULT NULL,
`ERROR_NAME` varchar(64) DEFAULT NULL,
`SQL_STATE` varchar(5) DEFAULT NULL,
`SUM_ERROR_RAISED` bigint unsigned NOT NULL,
`SUM_ERROR_HANDLED` bigint unsigned NOT NULL,
`FIRST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
`LAST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
UNIQUE KEY `USER` (`USER`,`ERROR_NUMBER`)
);
CREATE TABLE `client_errors_summary_global` (
`ERROR_NUMBER` int DEFAULT NULL,
`ERROR_NAME` varchar(64) DEFAULT NULL,
`SQL_STATE` varchar(5) DEFAULT NULL,
`SUM_ERROR_RAISED` bigint unsigned NOT NULL,
`SUM_ERROR_HANDLED` bigint unsigned NOT NULL,
`FIRST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
`LAST_SEEN` timestamp NULL DEFAULT '0000-00-00 00:00:00',
UNIQUE KEY `ERROR_NUMBER` (`ERROR_NUMBER`)
); Here is an example output: SELECT * FROM client_errors_summary_by_host WHERE sum_error_raised > 0;
+-----------+--------------+------------------------------------------+-----------+------------------+-------------------+---------------------+---------------------+
| HOST | ERROR_NUMBER | ERROR_NAME | SQL_STATE | SUM_ERROR_RAISED | SUM_ERROR_HANDLED | FIRST_SEEN | LAST_SEEN |
+-----------+--------------+------------------------------------------+-----------+------------------+-------------------+---------------------+---------------------+
| NULL | 3719 | ER_DEPRECATED_UTF8_ALIAS | HY000 | 34 | 0 | 2020-08-10 21:10:11 | 2020-08-10 21:10:12 |
| NULL | 3778 | ER_WARN_DEPRECATED_UTF8MB3_COLLATION | HY000 | 73 | 0 | 2020-08-10 21:10:11 | 2020-08-10 21:10:12 |
| localhost | 1046 | ER_NO_DB_ERROR | 3D000 | 5 | 0 | 2020-08-12 10:29:50 | 2020-08-12 10:29:50 |
| localhost | 1050 | ER_TABLE_EXISTS_ERROR | 42S01 | 1 | 0 | 2020-08-12 10:44:29 | 2020-08-12 10:44:29 |
| localhost | 1136 | ER_WRONG_VALUE_COUNT_ON_ROW | 21S01 | 1 | 0 | 2020-08-12 10:44:32 | 2020-08-12 10:44:32 |
| localhost | 1159 | ER_NET_READ_INTERRUPTED | 08S01 | 1 | 0 | 2020-08-11 05:33:44 | 2020-08-11 05:33:44 |
| localhost | 1287 | ER_WARN_DEPRECATED_SYNTAX | HY000 | 289 | 0 | 2020-08-10 21:10:22 | 2020-08-12 11:52:25 |
| localhost | 1292 | ER_TRUNCATED_WRONG_VALUE | 22007 | 4 | 0 | 2020-08-12 10:07:46 | 2020-08-12 10:45:57 |
| localhost | 1298 | ER_UNKNOWN_TIME_ZONE | HY000 | 2 | 0 | 2020-08-12 10:44:29 | 2020-08-12 10:44:37 |
| localhost | 1681 | ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT | HY000 | 3 | 0 | 2020-08-10 21:10:19 | 2020-08-10 21:33:58 |
| localhost | 3554 | ER_NO_SYSTEM_TABLE_ACCESS | HY000 | 98 | 0 | 2020-08-10 21:10:22 | 2020-08-12 11:56:46 |
+-----------+--------------+------------------------------------------+-----------+------------------+-------------------+---------------------+---------------------+
11 rows in set (0.01 sec) (Note: This is modeled on the performance_schema tables in MySQL, but for compatibility TiDB leaves performance_schema empty, and adds information_schema tables. I'm fine with that.) |
Good idea. |
Nope, it can have similar semantics to But that's basically it. Adding this can also help cleanup some of the current log spam mentioned in #19053 |
@nullnotnil Do we need to add a frontend page in Dashboard for them? just like |
Yes. There are a few problems you can find with this - for example:
cc @breeswish |
Is it also possible to provide a column, or a table, to map error types, so that DBAs can distinguish whether this error is a client mistake (like syntax errors), or an infra problem (like region unavailable)? |
Feature Request
I really like the work being done in
metric_schema
andinformation_schema
:-) I was analyzing it today for the purposes of creating something similar to the SYS schema in MySQL.SYS is designed to be a set of views that are task-oriented for DBAs (versus i_s and p_s which are just the raw metrics). The main deficiency is that I could not see any metrics related to either the user, or the client's host.
For example, in MySQL I can do this:
This helps me find out if I have one particular rogue host, perhaps because the application was accidentally unpatched. Or maybe I allow reporting users to remotely connect, and I have one that is doing naughty things? SYS is even not as detailed as it could be here. In MySQL 8.0 there are performance_schema metrics per host of each error code:
.. this helps identify that their might be an unpatched client as well.
The other thing that MySQL has, is aggregations per-user. This is helpful for the case that I provide separate users for a multi-tenant database server (TiDB is used as a pool with many apps on it), or a single application schema with many clients. Some examples:
I took a look at #13567 but couldn't see anything related to user/client statistics. Feel free to correct me if this is something planned that I missed :-)
Of course, the other thing missing to implement SYS is helper functions for formatting. This was mentioned already in #14211
The text was updated successfully, but these errors were encountered: