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: Add SERVER_CONNECT_ATTRS table #44340

Merged
merged 14 commits into from Jun 13, 2023

Conversation

dveeden
Copy link
Contributor

@dveeden dveeden commented Jun 2, 2023

What problem does this PR solve?

Issue Number: close #44341

Problem Summary:

What is changed and how it works?

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.

Connection Attributes can now be queried via the `INFORMATION_SCHEMA.SESSION_CONNECT_ATTRS` table.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 2, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 2, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed do-not-merge/needs-linked-issue labels Jun 2, 2023
@dveeden dveeden marked this pull request as ready for review June 2, 2023 14:33
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 2, 2023
@ti-chi-bot ti-chi-bot bot requested review from 3pointer and bb7133 June 2, 2023 14:33
@dveeden
Copy link
Contributor Author

dveeden commented Jun 2, 2023

TiDB, with this PR:

sql> SELECT * FROM information_schema.SESSION_CONNECT_ATTRS;
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|  2199023255955 | _client_name    | libmysql   |                0 |
|  2199023255955 | _client_version | 8.0.33     |                1 |
|  2199023255955 | _os             | Linux      |                2 |
|  2199023255955 | _pid            | 712927     |                3 |
|  2199023255955 | _platform       | x86_64     |                4 |
|  2199023255955 | program_name    | mysqlsh    |                5 |
+----------------+-----------------+------------+------------------+
6 rows in set (0.0012 sec)

MySQL 8.0.33

sql> SELECT * FROM performance_schema.session_connect_attrs;
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|             20 | _pid            | 713027     |                0 |
|             20 | _platform       | x86_64     |                1 |
|             20 | _os             | Linux      |                2 |
|             20 | _client_name    | libmysql   |                3 |
|             20 | _client_version | 8.0.33     |                4 |
|             20 | program_name    | mysqlsh    |                5 |
+----------------+-----------------+------------+------------------+
6 rows in set (0.0039 sec)

Note the difference in ORDINAL_POSITION and information_schema vs performance_schema.

Update: Now moved to performance_schema.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 2, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2023
@dveeden
Copy link
Contributor Author

dveeden commented Jun 5, 2023

Comparing TiDB (on port 4000) with MySQL (on port 3306):

[dvaneeden@dve-carbon tidb]$ mysqlsh 'mysql://root@127.0.0.1:4000/test?connection-attributes=[tidb=rocks,]' --table -e "TABLE performance_schema.session_connect_attrs"
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|  2199023255961 | _client_name    | libmysql   |                0 |
|  2199023255961 | _client_version | 8.0.33     |                1 |
|  2199023255961 | _os             | Linux      |                2 |
|  2199023255961 | _pid            | 925769     |                3 |
|  2199023255961 | _platform       | x86_64     |                4 |
|  2199023255961 | program_name    | mysqlsh    |                5 |
|  2199023255961 | tidb            | rocks      |                6 |
+----------------+-----------------+------------+------------------+
[dvaneeden@dve-carbon tidb]$ mysqlsh 'mysql://root:root@127.0.0.1/test?connection-attributes=[tidb=rocks,]' --table -e "TABLE performance_schema.session_connect_attrs"
+----------------+-----------------+------------+------------------+
| PROCESSLIST_ID | ATTR_NAME       | ATTR_VALUE | ORDINAL_POSITION |
+----------------+-----------------+------------+------------------+
|             32 | _platform       | x86_64     |                0 |
|             32 | _os             | Linux      |                1 |
|             32 | _client_name    | libmysql   |                2 |
|             32 | _pid            | 925806     |                3 |
|             32 | tidb            | rocks      |                4 |
|             32 | _client_version | 8.0.33     |                5 |
|             32 | program_name    | mysqlsh    |                6 |
+----------------+-----------------+------------+------------------+

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 5, 2023
@dveeden dveeden requested a review from tiancaiamao June 5, 2023 15:17
@dveeden dveeden requested review from Benjamin2037 and removed request for 3pointer June 7, 2023 14:48
Copy link
Collaborator

@Benjamin2037 Benjamin2037 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 ti-chi-bot bot added the lgtm label Jun 12, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, tiancaiamao

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

The pull request process is described here

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
Copy link

ti-chi-bot bot commented Jun 12, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-09 01:37:37.464197455 +0000 UTC m=+48671.712119279: ☑️ agreed by tiancaiamao.
  • 2023-06-12 18:38:26.02845137 +0000 UTC m=+24502.443055450: ☑️ agreed by Benjamin2037.

@dveeden
Copy link
Contributor Author

dveeden commented Jun 13, 2023

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SESSION_CONNECT_ATTRS table
3 participants