-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
server: session variables was not changed when execute the mysql command 'ComChangeUser' #33699
Comments
problem : https://asktug.com/t/topic/662908 import java.sql.*;
import com.mysql.cj.jdbc.JdbcConnection;
public class Client {
public static void main(String args[]) {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
JdbcConnection con = (JdbcConnection) DriverManager.getConnection("jdbc:mysql://localhost:4000/test", "root", "tidb");
ResultSet rs = con.createStatement().executeQuery("select @a;");
if (rs.next()) {
String i = rs.getString(1);
System.out.println("before set : a= " + i);
}
con.createStatement().execute("set @a = 1;");
rs.close();
rs = con.createStatement().executeQuery("select @a;");
if (rs.next()) {
String i = rs.getString(1);
System.out.println("after set : a= " + i);
}
// switch anther user.
con.changeUser("tidb", "tidb");
rs = con.createStatement().executeQuery("select @a;");
if (rs.next()) {
String i = rs.getString(1);
System.out.println("after changeUser : a= " + i);
}
con.close();
} catch (Exception e) {
System.out.println(e);
}
}
} |
After #24991, TiDB create new ctx object in but in handleChangeUser, this was import with v5.2.0 and affected all version after v5.2.0 |
@knull-cn Thanks! Since you've found the root cause, are you interested in closing it by a PR? |
yes , It is my pleasure. |
!!- Note for cherry-picker -!!: the fix PR for this one would introduce other bug #33892 |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
show session variable should the default values.
3. What did you see instead (Required)
the values was the previous session setted
4. What is your TiDB version? (Required)
v5.3.0
The text was updated successfully, but these errors were encountered: