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

CREATE SERVER needs tweaks for compatibility with CONNECT engine

Details

    Description

      The CREATE SERVER command needs to be tweaked to provide better compatibility with CONNECT engine. It can be accomplished as follows:

      #1
      Extend the length of the mysql.servers.Host column to 2048 chars (to support CONNECT engine's use of this column for the host connection URL which can easily run to 500 or even 1,000+ chars with certain sets of connection properties)

      #2
      Extend the length of the mysql.servers.Owner column to 512 chars (to support CONNECT engine's use of this column for storing multiple additional connection options)

      #3
      Fix the forced lower casing of the host column - right now create server forces the host data to lower case, which is incorrect when storing a host connection URL for connect engine that may contain case sensitive parameters such as passwords and security tokens.

      This issue is related to MDEV-13136 which solved part of the problem but requires the above fixes to work properly.

      Attachments

        Issue Links

          Activity

            rdyas Robert Dyas added a comment -

            Can we get this assigned and worked on? Important for our use cases.

            rdyas Robert Dyas added a comment - Can we get this assigned and worked on? Important for our use cases.
            rdyas Robert Dyas added a comment -

            Hi,

            Would it be possible to get this assigned? It is likely a pretty small task.

            rdyas Robert Dyas added a comment - Hi, Would it be possible to get this assigned? It is likely a pretty small task.
            rdyas Robert Dyas added a comment -

            We reported this for 10.3 not 10.2 ... don't know if that matters or not.

            rdyas Robert Dyas added a comment - We reported this for 10.3 not 10.2 ... don't know if that matters or not.

            Shouldn't. CONNECT is the same, and SERVER code, I'm pretty sure, is too.

            serg Sergei Golubchik added a comment - Shouldn't. CONNECT is the same, and SERVER code, I'm pretty sure, is too.

            Hi,
            there is a patch for first two tasks. I applied it only to servers table.
            Regarding above, serg according to your patches for changing username field MDEV-5275 and MDEV-4332 , you applied change to all system tables. Do I need the same here?
            Regarding the third task :

            Fix the forced lower casing of the host column

            I don't get that situation in mysql client.
            Please see bellow:

            MariaDB [mysql]> show create table servers\G
            *************************** 1. row ***************************
                   Table: servers
            Create Table: CREATE TABLE `servers` (
              `Server_name` char(64) NOT NULL DEFAULT '',
              `Host` varchar(2048) NOT NULL DEFAULT '',
              `Db` char(64) NOT NULL DEFAULT '',
              `Username` char(80) NOT NULL DEFAULT '',
              `Password` char(64) NOT NULL DEFAULT '',
              `Port` int(4) NOT NULL DEFAULT 0,
              `Socket` char(64) NOT NULL DEFAULT '',
              `Wrapper` char(64) NOT NULL DEFAULT '',
              `Owner` varchar(512) NOT NULL DEFAULT '',
              PRIMARY KEY (`Server_name`)
            ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'
             
             
            MariaDB [mysql]> INSERT INTO servers VALUES ('t1','localhost','test','root','', 0,'','mysql','root'), ('t2','LOCALHOST','test','root','', 0,'','mysql','root');
            Query OK, 2 rows affected (0.00 sec)
            Records: 2  Duplicates: 0  Warnings: 0
            MariaDB [mysql]> select * from servers;
            +-------------+-----------+------+----------+----------+------+--------+---------+-------+
            | Server_name | Host      | Db   | Username | Password | Port | Socket | Wrapper | Owner |
            +-------------+-----------+------+----------+----------+------+--------+---------+-------+
            | t1          | localhost | test | root     |          |    0 |        | mysql   | root  |
            | t2          | LOCALHOST | test | root     |          |    0 |        | mysql   | root  |
            +-------------+-----------+------+----------+----------+------+--------+---------+-------+
             
            
            

            anel Anel Husakovic added a comment - Hi, there is a patch for first two tasks. I applied it only to servers table. Regarding above, serg according to your patches for changing username field MDEV-5275 and MDEV-4332 , you applied change to all system tables. Do I need the same here? Regarding the third task : Fix the forced lower casing of the host column I don't get that situation in mysql client. Please see bellow: MariaDB [mysql]> show create table servers\G *************************** 1. row *************************** Table: servers Create Table: CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL DEFAULT '', `Host` varchar(2048) NOT NULL DEFAULT '', `Db` char(64) NOT NULL DEFAULT '', `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, `Socket` char(64) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'     MariaDB [mysql]> INSERT INTO servers VALUES ('t1','localhost','test','root','', 0,'','mysql','root'), ('t2','LOCALHOST','test','root','', 0,'','mysql','root'); Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0 MariaDB [mysql]> select * from servers; +-------------+-----------+------+----------+----------+------+--------+---------+-------+ | Server_name | Host | Db | Username | Password | Port | Socket | Wrapper | Owner | +-------------+-----------+------+----------+----------+------+--------+---------+-------+ | t1 | localhost | test | root | | 0 | | mysql | root | | t2 | LOCALHOST | test | root | | 0 | | mysql | root | +-------------+-----------+------+----------+----------+------+--------+---------+-------+  
            rdyas Robert Dyas added a comment -

            RE "Fix the forced lower casing of the host column" and the above comment "I don't get that situation in mysql client."
            Don't use INSERT or UPDATE on the table itself, use the CREATE SERVER or CREATE OR REPLACE SERVER syntax and the host is forced lower case.

            I hope that helps.

            rdyas Robert Dyas added a comment - RE "Fix the forced lower casing of the host column" and the above comment "I don't get that situation in mysql client." Don't use INSERT or UPDATE on the table itself, use the CREATE SERVER or CREATE OR REPLACE SERVER syntax and the host is forced lower case. I hope that helps.

            Hi rdyas,
            I updated the patch with commit 50adbd72d7, hope now is ok.

            MariaDB [test]> CREATE OR REPLACE SERVER s31  FOREIGN DATA WRAPPER mysql  OPTIONS (USER 'Remote', HOST 'Hello_World()', DATABASE 'test'); 
            Query OK, 0 rows affected (0.00 sec)
             
            MariaDB [test]> select * from mysql.servers;
            +-------------+---------------+------+----------+----------+------+--------+---------+-------+
            | Server_name | Host          | Db   | Username | Password | Port | Socket | Wrapper | Owner |
            +-------------+---------------+------+----------+----------+------+--------+---------+-------+
            | s31         | Hello_World() | test | Remote   |          | 3306 |        | mysql   |       |
            +-------------+---------------+------+----------+----------+------+--------+---------+-------+
            1 row in set (0.00 sec)
            
            

            anel Anel Husakovic added a comment - Hi rdyas , I updated the patch with commit 50adbd72d7 , hope now is ok. MariaDB [test]> CREATE OR REPLACE SERVER s31 FOREIGN DATA WRAPPER mysql OPTIONS ( USER 'Remote' , HOST 'Hello_World()' , DATABASE 'test' ); Query OK, 0 rows affected (0.00 sec)   MariaDB [test]> select * from mysql.servers; + -------------+---------------+------+----------+----------+------+--------+---------+-------+ | Server_name | Host | Db | Username | Password | Port | Socket | Wrapper | Owner | + -------------+---------------+------+----------+----------+------+--------+---------+-------+ | s31 | Hello_World() | test | Remote | | 3306 | | mysql | | + -------------+---------------+------+----------+----------+------+--------+---------+-------+ 1 row in set (0.00 sec)
            rdyas Robert Dyas added a comment -

            Looks ok to me... I'll test when the next release is out 10.3.17 I think, right?

            rdyas Robert Dyas added a comment - Looks ok to me... I'll test when the next release is out 10.3.17 I think, right?

            anel, please check why this lowercasing was added, and if it was a bug fix, see whether you did not re-introduce the old bug.

            serg Sergei Golubchik added a comment - anel , please check why this lowercasing was added, and if it was a bug fix, see whether you did not re-introduce the old bug.
            anel Anel Husakovic added a comment - - edited

            Hi serg,
            MDEV-726 CREATE SERVER still not converting hostnames to lower case — introduced the patch (and test case) related to system tables that have to have lower case host name (since Mysql 5.1.53 there was inconsistency in grant statements — mysql patch; host_to_lowercase())
            From my point of view having the reverted patch of MDEV-726, if above is not related to standard and if we need to have it, will not have impact on grant statements.

            anel Anel Husakovic added a comment - - edited Hi serg , MDEV-726 CREATE SERVER still not converting hostnames to lower case — introduced the patch (and test case ) related to system tables that have to have lower case host name (since Mysql 5.1.53 there was inconsistency in grant statements — mysql patch; host_to_lowercase() ) From my point of view having the reverted patch of MDEV-726 , if above is not related to standard and if we need to have it, will not have impact on grant statements.
            rdyas Robert Dyas added a comment -

            Any additional info on this?

            rdyas Robert Dyas added a comment - Any additional info on this?

            hholzgra, what was the point in MDEV-726? Can there be grants on host names in CREATE SERVER?
            Why should CREATE SERVER follow GRANT rules?

            serg Sergei Golubchik added a comment - hholzgra , what was the point in MDEV-726 ? Can there be grants on host names in CREATE SERVER ? Why should CREATE SERVER follow GRANT rules?

            I'm trying to remember ... I was probably thinking along the lines of "DNS host names are case insensitive, so they should be stored in that way over here, too".

            There might have been a support issue related to this, but back then we didn't have a support issue filed in Jira yet, and Eventum search does not turn anything up either.

            As far as I can tell back then in 2012 this was only used by FEDERATED and FEDERATEDX, so the assumption that the `host` column only stores IP addresses or DNS seemed to make sense at that point.

            hholzgra Hartmut Holzgraefe added a comment - I'm trying to remember ... I was probably thinking along the lines of "DNS host names are case insensitive, so they should be stored in that way over here, too". There might have been a support issue related to this, but back then we didn't have a support issue filed in Jira yet, and Eventum search does not turn anything up either. As far as I can tell back then in 2012 this was only used by FEDERATED and FEDERATEDX, so the assumption that the `host` column only stores IP addresses or DNS seemed to make sense at that point.

            ok to push

            serg Sergei Golubchik added a comment - ok to push

            Pushed with 1ad79c818780aafe.

            anel Anel Husakovic added a comment - Pushed with 1ad79c818780aafe .

            People

              anel Anel Husakovic
              rdyas Robert Dyas
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.