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

Query pushdown fails when local and remote database names differ

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      Query pushdown fails when local and remote database names differ:

      Say ,Remote Database name : m8

      Local Database name : m8 (Stmt gets pushed)
      Local Database name : m9 (Pushdown fails)

      MariaDB [m8]> explain SELECT OUTR1.a FROM D AS OUTR1, D AS OUTR2 WHERE OUTR1.a=10;
      +------+---------------+-------+------+---------------+------+---------+------+------+-------+
      | id   | select_type   | table | type | possible_keys | key  | key_len | ref  | rows | Extra |
      +------+---------------+-------+------+---------------+------+---------+------+------+-------+
      |    1 | PUSHED SELECT | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | NULL  |
      +------+---------------+-------+------+---------------+------+---------+------+------+-------+
       
      MariaDB [m9]> explain SELECT OUTR1.a FROM D AS OUTR1, D AS OUTR2 WHERE OUTR1.a=10;
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                              |
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------------+
      |    1 | SIMPLE      | OUTR1 | ALL  | NULL          | NULL | NULL    | NULL | 0    | Using where                        |
      |    1 | SIMPLE      | OUTR2 | ALL  | NULL          | NULL | NULL    | NULL | 0    | Using join buffer (flat, BNL join) |
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------------+
      

      Version used:

      -------------
      Branch : main
      commit: f4a85225ea17b2c77c20e761773090a08aa3eceb
      Version : 13.1.0

      How to repeat:

      Slave:

      Start server on port:3306
      create database m8;use m8;
      create user u3@localhost; grant all on *.* to u3@localhost;
      create table D( a int);
      

      Master: Start server with federated engine enabled

      create database m8;use m8;
      create table D(a int)  ENGINE="FEDERATED" CONNECTION='mysql://u3@127.0.0.1:3306/m8/D';
      explain SELECT OUTR1.a FROM D AS OUTR1, D AS OUTR2 WHERE OUTR1.a=10; 
       
      create database m9;use m9;
      create table D(a int)  ENGINE="FEDERATED" CONNECTION='mysql://u3@127.0.0.1:3306/m8/D';
      explain SELECT OUTR1.a FROM D AS OUTR1, D AS OUTR2 WHERE OUTR1.a=10;
      
      

      Attachments

        Activity

          People

            mariadb-pavithrapandith Pavithra Pandith
            mariadb-pavithrapandith Pavithra Pandith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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