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

sysvar cache for globals in show variables is incorrect. #24368

Closed
morgo opened this issue Apr 29, 2021 · 1 comment · Fixed by #24699
Closed

sysvar cache for globals in show variables is incorrect. #24368

morgo opened this issue Apr 29, 2021 · 1 comment · Fixed by #24699
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@morgo
Copy link
Contributor

morgo commented Apr 29, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

SHOW VARIABLES LIKE 'max_connections'; # shows 151
SET GLOBAL max_connections=1234;
SHOW VARIABLES LIKE 'max_connections'; # shows 151; should show 1234

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

Session 1 should show the new value because the variable is GLOBAL-only scope.

3. What did you see instead (Required)

Session 1 shows the global variable unchanged, but because the setting is global-only scope it is expected to show the new value.

This is caused by the following code which caches the global variables into the session's systems cache, which is unsafe:

gVal, err = s.GlobalVarsAccessor.GetGlobalSysVar(key)
if err != nil {
return "", err
}
s.systems[key] = gVal
return gVal, nil
}

Unfortunately this caching is required to make subsequent calls to SHOW VARIABLES fast, but assuming #24359 merges all calls can be fast, and compatibility can be ensured.

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-2749-gdbecb9e74-dirty
Edition: Community
Git Commit Hash: dbecb9e74538393906ac844082e60d520d73bacb
Git Branch: master
UTC Build Time: 2021-04-29 03:20:04
GoVersion: go1.13.15
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
@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
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