Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15450

Add Host Name Field to MariaDB Client Handshake Protocol

Details

    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

      Attachments

        Issue Links

          Activity

            Thanks for the detailed feature specification. Do you have any patches / prototype code or something related to this?

            otto Otto Kekäläinen added a comment - Thanks for the detailed feature specification. Do you have any patches / prototype code or something related to this?
            xiangyhu xiangyhu added a comment - - edited

            Hi otto, thanks for you comment, I have attached the screenshot which includes the _host_name attribute proposed, please check out.

            Thanks,
            xiangyhu

            xiangyhu xiangyhu added a comment - - edited Hi otto , thanks for you comment, I have attached the screenshot which includes the _host_name attribute proposed, please check out. Thanks, xiangyhu

            Nice. So you already have a patch against MySQL 5.7? Can you rebase it on MariaDB 10.3/10.4 and share?

            otto Otto Kekäläinen added a comment - Nice. So you already have a patch against MySQL 5.7? Can you rebase it on MariaDB 10.3/10.4 and share?
            xiangyhu xiangyhu added a comment -

            otto Yeah sure, I have created pull request at https://github.com/MariaDB/server/pull/751, please help to review!

            Thanks,
            xiangyhu

            xiangyhu xiangyhu added a comment - otto Yeah sure, I have created pull request at https://github.com/MariaDB/server/pull/751 , please help to review! Thanks, xiangyhu
            wlad Vladislav Vaintroub added a comment - - edited

            actually our server supports proxy protocol, and MaxScale uses it too. Would not this do the same thing that proxy protocol does?
            https://mariadb.com/kb/en/library/proxy-protocol-support/

            wlad Vladislav Vaintroub added a comment - - edited actually our server supports proxy protocol, and MaxScale uses it too. Would not this do the same thing that proxy protocol does? https://mariadb.com/kb/en/library/proxy-protocol-support/

            No, that's different, as far as I understand. In the proxy protocol you specify what host you connect from, but here you specify what host you connect to.

            serg Sergei Golubchik added a comment - No, that's different, as far as I understand. In the proxy protocol you specify what host you connect from , but here you specify what host you connect to .

            right,I figured this too, from looking at the patch. The "host_name" was a little confusing, but now it changed to _server_host , and this is more clear.

            wlad Vladislav Vaintroub added a comment - right,I figured this too, from looking at the patch. The "host_name" was a little confusing, but now it changed to _server_host , and this is more clear.

            Reopening until C/C is fixed too

            serg Sergei Golubchik added a comment - Reopening until C/C is fixed too

            People

              wlad Vladislav Vaintroub
              elemount Alex Lee
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.