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

variable: make lc_messages read only #33708

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

fanrenhoo
Copy link
Contributor

@fanrenhoo fanrenhoo commented Apr 5, 2022

Signed-off-by: fanrenhoo [email protected]

What problem does this PR solve?

Issue Number: close #33707

Problem Summary: messages in TiDB only comes in English, but the lc_messages can be set to anything now. This leads to confusion.

What is changed and how it works?

The system variable lc_messages is now read-only in TiDB.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    test it, now it works fine:
    mysql> SET lc_messages=ru_RU;
    ERROR 1621 (HY000): SESSION variable 'lc_messages' is read-only. Use SET en_US to assign the value

mysql >set lc_messages = 'en_US';
Query OK, 0 rows affected (0.00 sec)

  • No code

Side effects
No

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

Documentation
No

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

Release note

The system variable `lc_messages` is now read-only in TiDB.

@fanrenhoo fanrenhoo requested a review from a team as a code owner April 5, 2022 10:27
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 5, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Defined2014
  • morgo

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 ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 5, 2022
@fanrenhoo
Copy link
Contributor Author

/cc @Alkaagr81

@sre-bot
Copy link
Contributor

sre-bot commented Apr 5, 2022

@morgo morgo self-requested a review April 5, 2022 16:48
Copy link
Collaborator

@Alkaagr81 Alkaagr81 left a comment

Choose a reason for hiding this comment

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

I prefer to set to readonly .If we do a validation function then the more correct validation error is ErrUnsupportedValueForVar . The problem with the current message is this is only for Session not for the Global scope.

sessionctx/variable/noop.go Outdated Show resolved Hide resolved
@Alkaagr81
Copy link
Collaborator

For test case please follow this PR #30084

@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 6, 2022
@fanrenhoo
Copy link
Contributor Author

For test case please follow this PR #30084

You are right! THKS, I used the suggested way to test its OK. I also added test case as suggested. please check. The "ReadOnly:true" before I used on another variable caused server started failed, but lc_messages is totally different, so this is better way. THKS again.

@fanrenhoo fanrenhoo requested a review from Alkaagr81 April 6, 2022 08:03
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 8, 2022
@fanrenhoo
Copy link
Contributor Author

Hi, how about this one? THKS

@Defined2014 Defined2014 changed the title variable: make the lc_messages read only except set to en_US for issue#33707 variable: make the lc_messages read only except set to en_US Apr 18, 2022
@fanrenhoo
Copy link
Contributor Author

Hi, how about this one, THKS

@Alkaagr81
Copy link
Collaborator

LGTM

@fanrenhoo
Copy link
Contributor Author

@morgo Hi, how about this one? THKS

@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 25, 2022
@morgo
Copy link
Contributor

morgo commented Apr 25, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 6d21036

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 25, 2022
@morgo morgo changed the title variable: make the lc_messages read only except set to en_US variable: make the lc_messages read only Apr 25, 2022
@morgo morgo changed the title variable: make the lc_messages read only variable: make lc_messages read only Apr 25, 2022
@ti-chi-bot ti-chi-bot merged commit f10db38 into pingcap:master Apr 25, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Apr 25, 2022

TiDB MergeCI notify

✅ Well Done! New fixed [1] after this pr merged.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/integration-common-test ✅ all 11 tests passed 12 min Fixed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 7 min 21 sec Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 7 min 12 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 7 min 5 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 6 min 47 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 5 min 55 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 4 min 9 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 2 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

espresso98 pushed a commit to espresso98/tidb that referenced this pull request Apr 25, 2022
@kvtb
Copy link

kvtb commented Sep 28, 2022

read only lc_messages breaks phpMyAdmin

https://github.com/phpmyadmin/phpmyadmin/blob/e96fab654df405595b9f42c5a4eba04f80344cc1/libraries/classes/DatabaseInterface.php#L1134-L1135

Maybe better to pretend that it is not read only, but ignore the written value.

@Defined2014
Copy link
Contributor

Defined2014 commented Sep 28, 2022

read only lc_messages breaks phpMyAdmin

https://github.com/phpmyadmin/phpmyadmin/blob/e96fab654df405595b9f42c5a4eba04f80344cc1/libraries/classes/DatabaseInterface.php#L1134-L1135

Maybe better to pretend that it is not read only, but ignore the written value.

opened an issue to trace this #38231. cc @kvtb

@williamdes
Copy link

And please ping me for anything phpMyAdmin related :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

lc_messages doesn't support another languages other than en_US
8 participants