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

Should we need to support . in System Variables? #428

Closed
wjhuang2016 opened this issue Aug 1, 2019 · 6 comments · Fixed by #441
Closed

Should we need to support . in System Variables? #428

wjhuang2016 opened this issue Aug 1, 2019 · 6 comments · Fixed by #441

Comments

@wjhuang2016
Copy link
Member

According to https://dev.mysql.com/doc/refman/8.0/en/using-system-variables.html

System variables implemented by a server component are exposed when the component is installed and have names that begin with a component-specific prefix. For example, the log_filter_dragnet error log filter component implements a system variable named log_error_filter_rules, the full name of which is dragnet.log_error_filter_rules. To refer to this variable, use the full name.

The problem I met is in #9812 . Presently, TiDB doesn't support . in a identifier. After MySQL 8.0, validate_password became a component and its variables uses a . instead of _ to sepearate component name.
So I wonder should we need to support . in system variables or just using _?

@tiancaiamao
Copy link
Collaborator

Could you do this in MySQL8 set @@SESSION.validate_password.policy = xxx? @wjhuang2016

@wjhuang2016
Copy link
Member Author

Could you do this in MySQL8 set @@SESSION.validate_password.policy = xxx? @wjhuang2016

No, I couldn't.

mysql> set @@SESSION.validate_password.policy = low;
ERROR 1229 (HY000): Variable 'validate_password.policy' is a GLOBAL variable and should be set with SET GLOBAL
mysql> set @@GLOBAL.validate_password.policy = low;
Query OK, 0 rows affected (0.00 sec)

@tiancaiamao
Copy link
Collaborator

Just now I try it and doubt that "TiDB doesn't support . in a identifier."

git diff:

diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go
index f42c04bf3..fbd5aaba8 100644
--- a/sessionctx/variable/sysvar.go
+++ b/sessionctx/variable/sysvar.go
@@ -227,6 +227,7 @@ var defaultSysVars = []*SysVar{
        {ScopeNone, "ssl_key", ""},
        {ScopeNone, "ssl_cipher", ""},
        {ScopeNone, "tls_version", "TLSv1,TLSv1.1,TLSv1.2"},
+       {ScopeGlobal | ScopeSession, "xx.xx", "666"},
        {ScopeNone, "system_time_zone", "CST"},
        {ScopeGlobal, InnodbPrintAllDeadlocks, "0"},
        {ScopeNone, "innodb_autoinc_lock_mode", "1"},

and use the modified tidb:

mysql> select @@session.xx.xx;
+-----------------+
| @@session.xx.xx |
+-----------------+
| 666             |
+-----------------+
1 row in set (0.01 sec)

mysql> select @@global.xx.xx;
+----------------+
| @@global.xx.xx |
+----------------+
| 666            |
+----------------+
1 row in set (0.00 sec)

@wjhuang2016

@wjhuang2016
Copy link
Member Author

@tiancaiamao
Could you do this set global xx.xx=666;?

@tiancaiamao
Copy link
Collaborator

I see! @wjhuang2016

@tiancaiamao
Copy link
Collaborator

I've filed a PR to address it. @wjhuang2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants