server, sessionctx: improved mysql compatibility with support for init_connect #21545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
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.set global init_connect='select sleep(1)
;`CREATE USER u1
;mysql -uu1
. You should notice a 1 second pause.Side effects
Release note
init_connect
and associated functionality.