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

Connection Redirection Mechanism in MariaDB Client/Server Protocol

Details

    Description

      Why

      Redirection mechanism is widely used in proxy-based scenario.
      Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
      Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

      What to do

      We'll add a new global/session variable, say, redirect_url. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

      Internally the server might have a check to ensure that the value of this variable is a valid url.

      This variable is appended to the default value of session_track_system_variables variable.

      When this variable is changed, the existing SESSION_TRACK_SYSTEM_VARIABLES implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

      Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

      Thoughts

      • perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.

      Possible use cases:

      • always redirect all clients to a new location
        • set @@global.redirect_url or start the server with --redurect-url= or put it in my.cnf
      • redirect to a group of servers randomly
        • create a table with connection urls, one per row.
        • use an sql script that selects a random row from it and sets @@redirect_url to this value
        • specify this script in the --init-connect server parameter
      • dynamically redirect from the master to one of the slaves
        • same as above, but use INFORMATION_SCHEMA.PROCESSLIST to get the list of active slaves.

      and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

      Original specs for comparison:

      What to Do

      Client/Server Protocol change needs both client and server support.
      Ending connection OK_Packet info field might contain redirection information.

      Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
      There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

      info field format is then:

      Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
      

      HostDescription:

      <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
      

      specific redirection option:

      option description
      user if set, must superseed connection user.
      ttl validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'

      Attachments

        1. redirection.pcapng
          1.62 MB
        2. redirection.png
          redirection.png
          229 kB
        3. screenshot-1.png
          screenshot-1.png
          11 kB
        4. screenshot-2.png
          screenshot-2.png
          12 kB
        5. screenshot-3.png
          screenshot-3.png
          12 kB
        6. screenshot-4.png
          screenshot-4.png
          5 kB

        Issue Links

          Activity

            elemount Alex Lee created issue -
            elemount Alex Lee made changes -
            Field Original Value New Value
            Description h1. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h1. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Heading 1||Heading 2||
            |Col A1|Col A2|

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h1. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h1. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            elemount Alex Lee made changes -
            Description h1. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h1. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h1. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h1. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            elemount Alex Lee made changes -
            Description h1. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h1. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            elemount Alex Lee made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            elemount Alex Lee made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|


            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.|

            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            xiangyhu xiangyhu made changes -
            Attachment redirection.pcapng [ 45610 ]
            Attachment redirection.png [ 45611 ]
            libliang libin made changes -
            Attachment screenshot-1.png [ 45838 ]
            libliang libin made changes -
            Attachment screenshot-2.png [ 45839 ]
            libliang libin made changes -
            Attachment screenshot-3.png [ 45842 ]
            libliang libin made changes -
            Attachment screenshot-4.png [ 45843 ]
            diego dupin Diego Dupin made changes -
            diego dupin Diego Dupin made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.
            h2. What to Do
            Client/Server Protocol change needs both client and server support. The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.|

            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.

            info field format is then:


            The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.|

            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            diego dupin Diego Dupin made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.

            info field format is then:


            The routine is
            # Server sets the capability flag [3] in Initial Handshake Packet, indicating server supports MARIADB_SERVER_REDIRECTION.
            | MARIADB_SERVER_REDIRECTION | 1 <<31 | Server support redirection |
            # Client sets the capability flag [3] in Client Handshake Response Packet, indicating client supports MARIADB_SERVER_REDIRECTION.
            # If client sets MARIADB_SERVER_REDIRECTION in Client Handshake Response Packet [3], server can send Redirection Information Packet other than OK_Packet / ERR_Packet / Authentication Switch Packet.
            # Client receives Redirection Information Packet, close the connection, and then use its information to connect the new host.
            # Client will use the redirection information to set up new connections until information expires or login parse error happens. The redirection information packet contains TTL of the information.


            The Redirection Information Packet schema is

            ||Field Type||Field Name||Notes||
            |int<1>|Packet Header|Packet header sets 0xFC to indicate it is a Redirection Information Packet.|
            |int<1>|Protocol Version|Currently protocol version is 0, specifying TCP-IPv4 protocol.|
            |int<2>|Protocol Property|For TCP-IPv4 protocol, it is the port number.|
            |int<2>|Time to Live|TTL is the life time of the validity of this redirected information with unit ‘second’.|
            |string<NUL>|Redirected Host|Redirected host is a valid IPv4 address, an A name pointing to this address, or a CNAME record.|
            |string<NUL>|Redirected User|Default will be the original user in connection string, but can used for proxy user.|

            For recursion of redirection, in the scenario, the recursion is not useful. Should not recommend client side implement recursion of redirection.

            [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
            [2] https://docs.oracle.com/cd/B10501_01/network.920/a96580/concepts.htm
            [3] https://mariadb.com/kb/en/library/1-connecting-connecting/
            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}



            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}



            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|

            diego dupin Diego Dupin made changes -
            diego dupin Diego Dupin made changes -
            diego dupin Diego Dupin made changes -
            diego dupin Diego Dupin made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}



            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}



            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|

            h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending connection [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}



            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}



            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|

            diego dupin Diego Dupin made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 86662 ] MariaDB v4 [ 130819 ]
            markus makela markus makela made changes -
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ]
            julien.fritsch Julien Fritsch made changes -
            Assignee Julien Fritsch [ julien.fritsch ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            AirFocus AirFocus made changes -
            Description h2. Why
            Redirection mechanism is widely used in proxy-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy-based scenario. It is more like HTTP redirects [1] or Oracle redirected connections [2]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.


            h2. What to Do
            Client/Server Protocol change needs both client and server support.
            Ending connection [OK_Packet |https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}



            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}



            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|

            h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects \[1\] or Oracle redirected connections \[2\]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            serg Sergei Golubchik made changes -
            Description h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects \[1\] or Oracle redirected connections \[2\]. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
            * the server can disallow changing of this variable in an active transaction. Or it can delegate this check to connectors, perhaps a connector would want to reconnect and replay the transaction?

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            markus makela markus makela made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 11.3 [ 28565 ]
            serg Sergei Golubchik made changes -
            Description h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
            * the server can disallow changing of this variable in an active transaction. Or it can delegate this check to connectors, perhaps a connector would want to reconnect and replay the transaction?

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
            * the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            serg Sergei Golubchik made changes -
            Description h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.
            * the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ]
            serg Sergei Golubchik made changes -
            ycp Yuchen Pei made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            ycp Yuchen Pei made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Description h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection \[OK_Packet \|https://mariadb.com/kb/en/ok_packet/#fields\] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            h2. Why

            Redirection mechanism is widely used in proxy\-based scenario.
            Currently when multiple servers share one proxy, proxy forwards all the packets between servers and clients. Thus, the proxy adds latency, take many computing resources and impacts the overall performance. Especially for short connections scenarios like WordPress, the latency can be a critical issue.
            Supporting redirection mechanism is helpful for proxy\-based scenario. It is more like HTTP redirects or Oracle redirected connections. Clients get the servers’ address from proxies and connect to servers transparently without latency and computing resource wasted.

            h2. What to do

            We'll add a new global/session variable, say, {{redirect_url}}. The value should be an empty string or a connection string in the conventional format (in the style of a connection url of C/J or C/NodeJS or C/C or FederatedX).

            Internally the server might have a check to ensure that the value of this variable is a valid url.

            This variable is appended to the default value of {{session_track_system_variables}} variable.

            When this variable is changed, the existing {{SESSION_TRACK_SYSTEM_VARIABLES}} implementation will send its new value to the client as a part of the OK packet. It's up to the client or to the connector to use this value or to ignore it.

            Note that the server should not disallow changing of this variable in an active transaction. This is up to connectors, perhaps a connector would want to reconnect and replay the transaction.

            h3. Thoughts

            * perhaps the server should always send this variable if it's set, even if it was not just changed. This will require some tweaking of the sysvar tracker code.

            h3. Possible use cases:

            * always redirect all clients to a new location
            ** set {{@@global.redirect_url}} or start the server with {{--redurect-url=}} or put it in my.cnf
            * redirect to a group of servers randomly
            ** create a table with connection urls, one per row.
            ** use an sql script that selects a random row from it and sets {{@@redirect_url}} to this value
            ** specify this script in the {{--init-connect}} server parameter
            * dynamically redirect from the master to one of the slaves
            ** same as above, but use {{INFORMATION_SCHEMA.PROCESSLIST}} to get the list of active slaves.

            and so on. An ability to redirect any time using SQL to calculate a new location opens limitless possibilities.

            {panel:title=Original specs for comparison:|bgColor=#EEEEEE}
            h2. What to Do

            Client/Server Protocol change needs both client and server support.
            Ending connection [OK_Packet|https://mariadb.com/kb/en/ok_packet/#fields] info field might contain redirection information.

            Either connector support redirection mechanism and will close current connection and redirect to indicated value, or if not supporting redirection (or redirection is disable) then driver will continue using current connection.
            There is no recursion, meaning that connector that have been redirect will not take another redirection in account.

            info field format is then:

            {code:java}
            Location: mysql:[replication:|loadbalance:|sequential:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]]\n
            {code}

            HostDescription:

            {code:java}
            <host>[:<portnumber>] or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
            {code}

            specific redirection option:

            ||option||description||
            |user|if set, must superseed connection user.|
            |ttl|validity timeout in second. This permit caching redirection client side. 0 means no caching 'default'|
            {panel}
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Sergei Golubchik [ serg ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Ramesh Sivaraman [ JIRAUSER48189 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels client protocol proxy Preview_11.3 client protocol proxy
            ramesh Ramesh Sivaraman made changes -
            ramesh Ramesh Sivaraman made changes -
            Assignee Ramesh Sivaraman [ JIRAUSER48189 ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            ycp Yuchen Pei made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            ycp Yuchen Pei made changes -
            Assignee Yuchen Pei [ JIRAUSER52627 ] Ramesh Sivaraman [ JIRAUSER48189 ]
            ramesh Ramesh Sivaraman made changes -
            Assignee Ramesh Sivaraman [ JIRAUSER48189 ] Yuchen Pei [ JIRAUSER52627 ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            ramesh Ramesh Sivaraman made changes -
            Comment [ 1h 30m ]
            ycp Yuchen Pei made changes -
            Fix Version/s 11.3.1 [ 29416 ]
            Fix Version/s 11.3 [ 28565 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Component/s Protocol [ 14604 ]
            Component/s Server [ 13907 ]
            dlenski Daniel Lenski (Inactive) made changes -
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 202147 119111
            markus makela markus makela made changes -

            People

              ycp Yuchen Pei
              elemount Alex Lee
              Votes:
              0 Vote for this issue
              Watchers:
              21 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.