Skip to content

*: add SESSION_ALIAS column in processlist table and expensive query log#46890

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
lcwangchao:session_alias_processlist
Sep 13, 2023
Merged

*: add SESSION_ALIAS column in processlist table and expensive query log#46890
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
lcwangchao:session_alias_processlist

Conversation

@lcwangchao
Copy link
Collaborator

@lcwangchao lcwangchao commented Sep 12, 2023

What problem does this PR solve?

Issue Number: close #46889

What is changed and how it works?

A new column SESSION_ALIAS will be added to table information_schema.PROCESSLIST and information_schema.CLUSTER_PROCESSLIST to display session_alias

TiDB root@127.0.0.1:test> set @@session.tidb_session_alias="alias123";
Query OK, 0 rows affected
Time: 0.001s
TiDB root@127.0.0.1:test> select * from information_schema.PROCESSLIST\G
***************************[ 1. row ]***************************
ID             | 2097154
USER           | root
HOST           | 127.0.0.1:56620
DB             | test
COMMAND        | Query
TIME           | 0
STATE          | autocommit
INFO           | select * from information_schema.PROCESSLIST
DIGEST         | 4b5e7cdd5d3ed84d6c1a6d56403a3d512554b534313caf296268abdec1c9ea99
MEM            | 0
DISK           | 0
TxnStart       |
RESOURCE_GROUP | default
SESSION_ALIAS  | alias123

Also add session_alias field to expensive query log:

[2023/09/12 11:59:40.902 +08:00] [WARN] [expensivequery.go:145] [expensive_query] [cost_time=60.932767459s] [conn=2097154] [user=root] [database=test] [txn_start_ts=0] [mem_max="0 Bytes (0 Bytes)"] [sql="select sleep(100)"] [session_alias=alias123]

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

add `SESSION_ALIAS` column in processlist table and expensive query log

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 12, 2023
@lcwangchao lcwangchao force-pushed the session_alias_processlist branch from 88c772a to 0168ee7 Compare September 12, 2023 04:06
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That change is fixed by fieldalignment tool, or else the bazel lint will fail

@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #46890 (24b6075) into master (8f8c433) will decrease coverage by 0.7462%.
Report is 17 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46890        +/-   ##
================================================
- Coverage   73.2895%   72.5434%   -0.7462%     
================================================
  Files          1331       1352        +21     
  Lines        397358     406118      +8760     
================================================
+ Hits         291222     294612      +3390     
- Misses        87547      92839      +5292     
- Partials      18589      18667        +78     
Flag Coverage Δ
integration 27.8111% <33.3333%> (?)
unit 73.2836% <100.0000%> (-0.0060%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9911% <ø> (ø)
br 48.5661% <ø> (-4.3354%) ⬇️

@lcwangchao lcwangchao force-pushed the session_alias_processlist branch from 0168ee7 to 17fcfa9 Compare September 12, 2023 07:10
@lcwangchao lcwangchao force-pushed the session_alias_processlist branch from 17fcfa9 to 9f89761 Compare September 12, 2023 08:51
@lcwangchao
Copy link
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 13, 2023
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bb7133, hawkingrei

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 13, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 13, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-13 06:56:08.005778365 +0000 UTC m=+68533.973366416: ☑️ agreed by hawkingrei.
  • 2023-09-13 10:09:03.451007398 +0000 UTC m=+80109.418595447: ☑️ agreed by bb7133.

@lcwangchao
Copy link
Collaborator Author

/retest

1 similar comment
@lcwangchao
Copy link
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 1159bc8 into pingcap:master Sep 13, 2023
@lcwangchao lcwangchao deleted the session_alias_processlist branch September 14, 2023 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add SESSION_ALIAS column in processlist table and expensive query log

3 participants