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

Different server_version per port #4548

Open
gerryd opened this issue May 17, 2024 · 1 comment · May be fixed by #4784
Open

Different server_version per port #4548

gerryd opened this issue May 17, 2024 · 1 comment · May be fixed by #4784

Comments

@gerryd
Copy link

gerryd commented May 17, 2024

I have a specific use case, where I would need to advertise two different server_version values because of a client issue. Other than the server_version, everything else is the same.

I currently run two separate ProxySQL instances, with one on a non-standard port, but I was thinking it might be useful to be able to override specific settings per listening port. ProxySQL can already listen on multiple ports, though the port can only be used as a value in query rules later on.

Thanks for considering this!

@renecannao
Copy link
Contributor

mysql-server_version applies to all client connections.

The idea of supporting multiple "versions" based on different ports or interfaces makes absolutely sense.

I can think to at least 2 different implementations:

  1. a new table, mapping interface/port to version
  2. a new global variable, with a mapping of interface/port to version

The first implementation (new table) is over-complicated . It requires a new table, new hooks in cluster configuration, new checksums, etc
The second implementation (global variable) is a lot simpler.
So simple, that we don't even need a new global variable.
In fact, we could extend mysql-server_version in such a way that:

  • if the variable is a valid JSON mapping interface/port to version, use it that way
  • otherwise mysql-server_version is interpreted as a simple string and used as-is

Some considerations:

  • the JSON must also have a default value that applies to all interfaces not explicitly set (for example, Admin)
  • the format should look something like the following: {"default":"5.7.10","0.0.0.0:6033":"8.0.30","0.0.0.0:6032":"8.0.31","127.0.0.1:16033":"8.4.2"}
  • the JSON must be parsed only once when LOAD MYSQL VARIABLES TO RUNTIME is executed , or alternatively (perhaps better) when worker threads refresh their variables
  • we can store the mapping as an unordered_map , possibly in MySQL_Thread object

@raghunandanbhat raghunandanbhat linked a pull request Jan 5, 2025 that will close this issue
3 tasks
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