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

server, sessionctx: improved mysql compatibility with support for init_connect #21545

Closed
wants to merge 3 commits into from

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Dec 8, 2020

What problem does this PR solve?

Issue Number: close #18894

Problem Summary:

MySQL supports the ability to execute a set of statements on first connection. This PR adds the same feature to TiDB.

It can be useful for some applications, since SQL modes can be set, user variables, etc.

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Integration test

I will work on tidb-test tests. Because this feature is dependent on the MySQL client protocol, it could be in server/tidb_test.go, but the existing tests there do not differentiate user privileges (this only applies to non-super users). I thought it would be better to write a tidb-test.

  • Manual test (add detailed scripts or steps below)
  • Connect as root. Run set global init_connect='select sleep(1);`
  • Create a user CREATE USER u1;
  • Connect as the new user: mysql -uu1. You should notice a 1 second pause.

Side effects

  • Performance regression
    • Regrettably checking if initconnect returned an error is in the query-serving path. This was required to return the client an error.

Release note

  • TiDB now supports the mysql system variable init_connect and associated functionality.

@morgo
Copy link
Contributor Author

morgo commented Feb 4, 2021

Closing for now.

@morgo morgo closed this Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support init_connect
1 participant