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

FR: Support hostname sysvar #7740

Closed
morgo opened this issue Sep 18, 2018 · 0 comments · Fixed by #7750
Closed

FR: Support hostname sysvar #7740

morgo opened this issue Sep 18, 2018 · 0 comments · Fixed by #7750

Comments

@morgo
Copy link
Contributor

morgo commented Sep 18, 2018

Feature Request

Is your feature request related to a problem? Please describe:

Because tidb server instances are usually configured behind a load balancer, it's not usually possible to tell which server you are connected to.

If there are issues, you may want to record the identity of the server. Or you may even want to know it to evaluate load balancing.

In the case of automated tools (like a logical backup tool), they can use the hostname as the default for the backup file name. Or a status tool might print the hostname so you can confirm which server you are connected to.

Describe the feature you'd like:

With MySQL you can do this by reading the hostname sysvar:

mysql [localhost] {msandbox} ((none)) > SELECT @@hostname;
+------------+
| @@hostname |
+------------+
| ryzen      |
+------------+
1 row in set (0.00 sec)

In TiDB, the hostname sysvar is not supported yet. It looks like a trivial enhancement, I'd like to request that it is:

mysql> SELECT @@hostname;
+------------+
| @@hostname |
+------------+
| localhost  |
+------------+
1 row in set (0.00 sec)

./sessionctx/variable/sysvar.go:

  {ScopeNone, "innodb_checksums", "ON"},
  {ScopeNone, "hostname", "localhost"},
  {ScopeGlobal | ScopeSession, "auto_increment_offset", "1"},

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

Compatibility Feature.

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

Successfully merging a pull request may close this issue.

1 participant