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

@@global.default_week_format was not immediately loaded on new session, causing week() to use the wrong mode #21510

Closed
kennytm opened this issue Dec 6, 2020 · 2 comments · Fixed by #21511
Labels
component/session severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@kennytm
Copy link
Contributor

kennytm commented Dec 6, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

First, change the global default_week_format

mysql -u root -h 127.0.0.1 -P 4000 -e "set global default_week_format = 4"

Then execute week() in a new connection.

mysql -u root -h 127.0.0.1 -P 4000 -E -e "select week('2020-02-02'), @@default_week_format, week('2020-02-02')"

2. What did you expect to see? (Required)

*************************** 1. row ***************************
   week('2020-02-02'): 6
@@default_week_format: 4
   week('2020-02-02'): 6

3. What did you see instead (Required)

*************************** 1. row ***************************
   week('2020-02-02'): 5
@@default_week_format: 4
   week('2020-02-02'): 6

The first execution of week('2020-02-02') used mode 0 instead of 4.

4. What is your TiDB version? (Required)

Repro with both v4.0.8 and nightly 62fd2b7

Release Version: v4.0.8
Edition: Community
Git Commit Hash: 66ac9fc31f1733e5eb8d11891ec1b38f9c422817
Git Branch: heads/refs/tags/v4.0.8
UTC Build Time: 2020-10-30 08:21:16
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
Release Version: v4.0.0-beta.2-1734-g62fd2b735
Edition: Community
Git Commit Hash: 62fd2b735934e67580fefade0584e9eeb63f32d3
Git Branch: master
UTC Build Time: 2020-12-04 12:32:58
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@kennytm
Copy link
Contributor Author

kennytm commented Dec 6, 2020

/label component/session,sig/DDL

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/session severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants