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 variables are not refreshed immediately in a new session #22806

Closed
xhebox opened this issue Feb 19, 2021 · 3 comments
Closed

Global variables are not refreshed immediately in a new session #22806

xhebox opened this issue Feb 19, 2021 · 3 comments
Labels
duplicate Issues or pull requests already exists. type/bug The issue is confirmed as a bug.

Comments

@xhebox
Copy link
Contributor

xhebox commented Feb 19, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

[xhe@PC tidb-test]$ cat t5.sh 
#!/bin/sh

mycli -h 127.0.0.1 -P 4000 -u root --no-warn << "EOF"
set global tidb_enable_alter_placement=on;
EOF

mycli -h 127.0.0.1 -P 4000 -u root --no-warn << "EOF"
select @@global.tidb_enable_alter_placement;
drop table if exists test.t1;
create table test.t1 (a int) partition by hash(a) partitions 2;
alter table test.t1 alter partition p0 alter placement policy role=leader;
EOF
[xhe@PC tidb-test]$ cat t4.sh 
#!/bin/sh
mycli -h 127.0.0.1 -P 4000 -u root --no-warn << "EOF"
select @@global.tidb_enable_alter_placement;
drop table if exists test.t1;
create table test.t1 (a int) partition by hash(a) partitions 2;
alter table test.t1 alter partition p0 alter placement policy role=leader;
EOF
# start a new tiup playground
[xhe@PC tidb-test]$ ./t5.sh 
@@global.tidb_enable_alter_placement
1
(1105, 'alter partition alter placement is experimental and it is switched off by tidb_enable_alter_placement')
[xhe@PC tidb-test]$ ./t4.sh 
@@global.tidb_enable_alter_placement
1
# start a new tiup playground
[xhe@PC tidb-test]$ ./t5.sh 
./@@global.tidb_enable_alter_placement
1
(1105, 'alter partition alter placement is experimental and it is switched off by tidb_enable_alter_placement')
[xhe@PC tidb-test]$ ./t4.sh 
@@global.tidb_enable_alter_placement
1
(1105, 'alter partition alter placement is experimental and it is switched off by tidb_enable_alter_placement')
[xhe@PC tidb-test]$ ./t4.sh 
@@global.tidb_enable_alter_placement
1

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

If I see select @@global.tidb_enable_alter_placement == 1, then the command should execute successfully. In another word, the sessionVars of session should be updated.

3. What did you see instead (Required)

An outdated session variable is causing SQL failure.

4. What is your TiDB version? (Required)

59ccb29, the current/latest master commit.

@xhebox xhebox added the type/bug The issue is confirmed as a bug. label Feb 19, 2021
@xhebox
Copy link
Contributor Author

xhebox commented Feb 19, 2021

a duplicated of #14531

@xhebox xhebox closed this as completed Feb 19, 2021
@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

@xhebox
Copy link
Contributor Author

xhebox commented Feb 19, 2021

/label type/duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues or pull requests already exists. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants