Skip to content
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

infoschema: fix select * from inspection_summary would return null. (#16099) #17697

Merged
merged 3 commits into from
Jun 5, 2020

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Jun 5, 2020

cherry-pick #16254 #16099

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

  1. Currently it would return empty results without rule condition.

What is changed and how it works?

  1. Make it return all the results for select * from inspection.
  2. Add a column name COMMENT to explain the row.

What's Changed:
before:

mysql> select * from inspection_summary;
Empty set (0.00 sec)

this pr :

mysql> select * from inspection_summary limit 10;
+-------+------------------+------------------------------------------+----------------+----------+-----------+-----------+-----------+------------------------------------------------------------------------------------------------------+
| RULE  | INSTANCE         | METRICS_NAME                             | LABEL          | QUANTILE | AVG_VALUE | MIN_VALUE | MAX_VALUE | COMMENT                                                                                              |
+-------+------------------+------------------------------------------+----------------+----------+-----------+-----------+-----------+------------------------------------------------------------------------------------------------------+
| stats | gncluster-tidb-0 | tidb_statistics_auto_analyze_duration    |                |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB auto analyze time durations within 95 percent histogram buckets                 |
| stats | gncluster-tidb-0 | tidb_statistics_fast_analyze_status      | access_regions |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB fast analyze statistics                                                         |
| stats | gncluster-tidb-0 | tidb_statistics_fast_analyze_status      | region_error   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB fast analyze statistics                                                         |
| stats | gncluster-tidb-0 | tidb_statistics_fast_analyze_status      | sample         |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB fast analyze statistics                                                         |
| stats | gncluster-tidb-0 | tidb_statistics_fast_analyze_status      | scan_keys      |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB fast analyze statistics                                                         |
| stats | gncluster-tidb-0 | tidb_statistics_fast_analyze_status      | seek_keys      |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB fast analyze statistics                                                         |
| stats |                  | tidb_statistics_pseudo_estimation_ops    |                |     NULL |  0.000000 |  0.000000 |  0.000000 | TiDB optimizer using pseudo estimation counts                                                        |
| stats |                  | tidb_statistics_significant_feedback     |                |     NULL |  0.000000 |  0.000000 |  0.000000 | Counter of query feedback whose actual count is much different than calculated by current statistics |
| stats | gncluster-tidb-0 | tidb_statistics_stats_inaccuracy_rate    |                |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB statistics inaccurate rate                                                      |
| stats | gncluster-tidb-0 | tidb_statistics_store_query_feedback_qps | ok             |     NULL |  0.044445 |  0.044443 |  0.044445 | TiDB store quering feedback counts                                                                   |
+-------+------------------+------------------------------------------+----------------+----------+-----------+-----------+-----------+------------------------------------------------------------------------------------------------------+
10 rows in set (21.26 sec)

mysql> select * from inspection_summary where rule='query-summary' and metrics_name='tidb_query_duration';
+---------------+------------------+---------------------+----------+----------+-----------+-----------+-----------+----------------------------------------------+
| RULE          | INSTANCE         | METRICS_NAME        | LABEL    | QUANTILE | AVG_VALUE | MIN_VALUE | MAX_VALUE | COMMENT                                      |
+---------------+------------------+---------------------+----------+----------+-----------+-----------+-----------+----------------------------------------------+
| query-summary | gncluster-tidb-0 | tidb_query_duration | Begin    |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Commit   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Delete   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Execute  |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Insert   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Replace  |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Rollback |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Select   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Set      |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Show     |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Update   |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | Use      |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | general  |     0.99 |  0.000000 |  0.000000 |  0.000000 | The quantile of TiDB query durations(second) |
| query-summary | gncluster-tidb-0 | tidb_query_duration | internal |     0.99 |  0.004050 |  0.003934 |  0.005480 | The quantile of TiDB query durations(second) |
+---------------+------------------+---------------------+----------+----------+-----------+-----------+-----------+----------------------------------------------+
14 rows in set (0.09 sec)

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:

Check List

Tests

  • Unit test
  • Integration test

Release note

  • fix query inspection_summary without condition would return null.

@sre-bot
Copy link
Contributor

sre-bot commented Jun 5, 2020

@crazycs520 crazycs520 added the type/bugfix This PR fixes a bug. label Jun 5, 2020
@crazycs520 crazycs520 added this to the v4.0.1 milestone Jun 5, 2020
@crazycs520
Copy link
Contributor Author

/rebuild

@sre-bot
Copy link
Contributor

sre-bot commented Jun 5, 2020

@crazycs520
Copy link
Contributor Author

/run-all-tests

@github-actions github-actions bot added sig/sql-infra SIG: SQL Infra sig/execution SIG execution labels Jun 5, 2020
@crazycs520
Copy link
Contributor Author

/rebulid

Copy link
Contributor

@lonng lonng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AilinKid
Copy link
Contributor

AilinKid commented Jun 5, 2020

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-unit-test

@crazycs520
Copy link
Contributor Author

/run-integration-ddl-test

@zimulala zimulala merged commit 312fdb6 into pingcap:release-4.0 Jun 5, 2020
@bb7133 bb7133 modified the milestones: v4.0.1, v4.0.2 Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants