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

Spider returns two rows when it should only return one

    XMLWordPrintable

Details

    Description

      For this testcase (change port as needed):

      INSTALL PLUGIN spider SONAME 'ha_spider.so';
      SET SESSION spider_same_server_link=ON;
      DROP DATABASE test;
      CREATE DATABASE test;
      USE test;
      CREATE TABLE t_base (c INT) ENGINE=InnoDB;
      CREATE TABLE t_link (c INT) ENGINE=Spider COMMENT "HOST '127.0.0.1', PORT '30035', USER 'root', PASSWORD '', DATABASE 'test', TABLE 't_base'"
      PARTITION BY RANGE (c)
      (PARTITION p1 VALUES LESS THAN (100) ENGINE = Spider,
       PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = Spider);
      INSERT INTO t_link VALUES (1);
      SELECT * FROM t_link;
      

      There are two rows when queried (whilst only a single one was inserted!):

      10.8.0-opt>SELECT * FROM t_link;
      +------+
      | c    |
      +------+
      |    1 |
      |    1 |
      +------+
      2 rows in set (0.002 sec)
      

      In comparison, this similar testcase:

      INSTALL PLUGIN spider SONAME 'ha_spider.so';
      SET SESSION spider_same_server_link=ON;
      DROP DATABASE test;
      CREATE DATABASE test;
      DROP DATABASE test2;
      CREATE DATABASE test2;
      USE test;
      CREATE TABLE t_base (c INT) ENGINE=InnoDB;
      CREATE TABLE test2.t_base2 (c INT) ENGINE=InnoDB;
      CREATE TABLE t_link (c INT) ENGINE=SPIDER COMMENT "HOST '127.0.0.1', PORT '30035', USER 'root', PASSWORD ''"
      PARTITION BY RANGE (c)
      (PARTITION p1 VALUES LESS THAN (100) ENGINE = Spider COMMENT="DATABASE 'test', TABLE 't_base'",
       PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = Spider COMMENT="DATABASE 'test2', TABLE 't_base2'");
      INSERT INTO t_link VALUES (1);
      SELECT * FROM t_link;
      

      Yields one row:

      10.8.0-opt>SELECT * FROM t_link;
      +------+
      | c    |
      +------+
      |    1 |
      +------+
      1 row in set (0.001 sec)
      

      As discussed with nayuta-yanagisawa, this would seem to be is intended behavior. Spider implicitly assumes that each partition is associated with different tables. However, Spider doesn't check the constraint whilst it should. Likely present in all versions. Proposal to fix in 10.7.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.