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

session: fix global variable collation_server does not take effect in new session #23932

Merged
merged 33 commits into from
Apr 15, 2021

Conversation

xiongjiwei
Copy link
Contributor

@xiongjiwei xiongjiwei commented Apr 9, 2021

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

after setting the global collation_server , the new session's collation_server variable should use it.

global variable collation_server does not take effect because the loadCommonGlobalVariablesIfNeeded function overwrite the variables, and we had set the collation_server when setting the character_set_server, see #21034

Check List

Tests

  • Unit test

Release note

  • fix global variable collation_server does not take effect in new session

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 9, 2021
@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Apr 9, 2021
@xiongjiwei
Copy link
Contributor Author

/run-all-tests

@xiongjiwei
Copy link
Contributor Author

/cc @pingcap/sql-infra-reviewers

@ti-chi-bot ti-chi-bot requested a review from a team April 9, 2021 08:45
@xiongjiwei xiongjiwei removed the request for review from a team April 9, 2021 08:46
@xiongjiwei
Copy link
Contributor Author

/run-all-tests

@xhebox
Copy link
Contributor

xhebox commented Apr 9, 2021

I am not sure if this is the correct fix. I mean that global variables are promised to be refreshed every 3 mins. They will not take effect immediately.

@xiongjiwei
Copy link
Contributor Author

I am not sure if this is the correct fix. I mean that global variables are promised to be refreshed every 3 mins. They will not take effect immediately.

I have no knowledge about global variables are promised to be refreshed every 3 mins. Are there any materials?

@xhebox
Copy link
Contributor

xhebox commented Apr 9, 2021

Here, I have one issue, #22808. Andy fault, there is a typo, it is 3s, or 2s, not mins.

@morgo
Copy link
Contributor

morgo commented Apr 9, 2021

/LGTM

Here, I have one issue, #22808. Andy fault, there is a typo, it is 3s, or 2s, not mins.

On a single-server it is usually much quicker, this is just the documented time to receive updates asyncronously through etcd on other servers.

We have several examples where there can be a delay (another one is FLUSH PRIVILEGES), and usually fix it by syncronously also updating it locally. So technically the initiating server will apply the instruction twice.

I think the intention is that set global should be instant on the initiating server too, but I know there is a race condition if the new session starts too quickly. I am hoping that we can fix it in future by using a simple map to keep the global cache (similar to what privileges does) and not rely on internal SQL.

Update: My comment here was incorrect. It did nto use etcd to update at the time this was written, but it does now.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 9, 2021
Copy link
Contributor

@xhebox xhebox 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
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • morgo
  • xhebox

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 9, 2021
@xhebox
Copy link
Contributor

xhebox commented Apr 9, 2021

I think the intention is that set global should be instant on the initiating server too

Agreed.

I am hoping that we can fix it in future by using a simple map to keep the global cache (similar to what privileges does) and not rely on internal SQL.

Well, I don't think it is a good idea to merge a PR that is not completely working, though... Anyway, let us merge it as it is proposed. But it should be fine to revert the change back when immediate global cache is implemented, or whatever.

@morgo
Copy link
Contributor

morgo commented Apr 9, 2021

Well, I don't think it is a good idea to merge a PR that is not completely working, though...

If we do a more complete fix, I think it will be a lot of work, and not suitable to cherry pick to 5.0.

Anyway, let us merge it as it is proposed. But it should be fine to revert the change back when immediate global cache is implemented, or whatever.

Agreed. Having the unit test here also helps for this future work.

@morgo
Copy link
Contributor

morgo commented Apr 9, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 19ceee8

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 9, 2021
@morgo
Copy link
Contributor

morgo commented Apr 9, 2021

/run-unit-test

@xiongjiwei
Copy link
Contributor Author

/merge

@ti-chi-bot ti-chi-bot merged commit 58fb30f into pingcap:master Apr 15, 2021
@xiongjiwei
Copy link
Contributor Author

/run-cherry-pick

@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #24156

@CadmusJiang CadmusJiang mentioned this pull request May 12, 2021
ti-chi-bot pushed a commit that referenced this pull request May 31, 2021
@xiongjiwei xiongjiwei deleted the collation-server branch September 23, 2022 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 sig/sql-infra SIG: SQL Infra size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants