Details
-
Task
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
Description
Why
In original, one MariaDB server instance is identified by one address (IP + port). That is not enough for a shared proxy for multi servers. Like HTTP HOST header, which enables virtual host in a web server machine [1]. The similar approach is used in Oracle net listener by adding INSTANCE_NAME [2]. Adding the host name field helps the proxy layer to find the backend server, monitor full throughput easily, and can do the specific logic on different host. For cloud service, let server instance can be identified by <server name, address (IP + port)> will help to simplified workflow for the frontend proxy.
What to do
Since 10.0.5. MariaDB started supporting applications to pass key/value connection attributes when connecting [3].
Adding host name field in connection attributes is a good idea. The connection attributes are passed from client to server in the first communication package. The attributes is optional so that it keeps back compatibility.
MariaDB reserves the attribute names that begin with an underscore (_) for internal use which should not be created by application programs [4]. The proposal is using the same approach to reserve one more name. The attribute is named ‘_host_name’ to record the host name used in the connection string (the connection parameters). This field is used by the server or proxy to figure out which server the client is trying to connect to. The client drivers that support this protocol sends the attribute in the handshake response packet.
The code change involves:
1. Add ‘_host_name’ attributes in MariaDB owned client driver.
2. Add a new document to encourage other community client driver to including this attribute.
3. Support this protocol in MaxScale proxy.
[1]. https://stackoverflow.com/questions/43156023/what-is-http-host-header
[2]. https://docs.oracle.com/cd/E11882_01/network.112/e41945/listenercfg.htm#NETAG299
[3]. https://mariadb.com/kb/en/library/performance-schema-session_account_connect_attrs-table/
[4.] https://dev.mysql.com/doc/refman/5.7/en/performance-schema-connection-attribute-tables.html