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 . The similar approach is used in Oracle net listener by adding INSTANCE_NAME . 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.
Since 10.0.5. MariaDB started supporting applications to pass key/value connection attributes when connecting .
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 . 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.