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

Auto-increment on Spider tables with DESC PK does not work properly

Details

    Description

      In the test case below two Spider tables use the same backend and insert auto-incremented values.
      When the Spider tables have an auto-increment with a normal ascending index, it works all right. However, with the descending keys it doesn't, the second insert fails with ER_DUP_ENTRY.

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      install soname 'ha_spider';
      set spider_same_server_link= on;
       
      select @@spider_auto_increment_mode;
       
      eval create server s foreign data wrapper mysql options 
      (host '127.0.0.1', database 'test', user 'root', port $MASTER_MYPORT);
       
      create or replace table t (id int primary key) engine=InnoDB;
       
      create or replace table t_sp1 (id int auto_increment, primary key(id desc))
      engine=Spider COMMENT='wrapper "mysql", srv "s", table "t"';
       
      create or replace table t_sp2 (id int auto_increment, primary key(id desc))
      engine=Spider COMMENT='wrapper "mysql", srv "s", table "t"';
       
      insert into t_sp1 () values (),(),();
      insert into t_sp2 () values (),(),();
       
      select * from t_sp2;
      

      preview-10.8-MDEV-13756-desc-indexes c10e10c6

       mysqltest: At line 21: query 'insert into t_sp2 () values (),(),()' failed: ER_DUP_ENTRY (1062): Duplicate entry '2' for key 'PRIMARY'
      

      Same test case, but with ascending keys:

      insert into t_sp1 () values (),(),();
      insert into t_sp2 () values (),(),();
      select * from t_sp2;
      id
      1
      2
      3
      4
      5
      6
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova added a comment - - edited

            See also MDEV-27420 – one of these should be redundant, either DESC has no meaning for Spider as was initially assumed and thus should be ignored from the start, and then the problem in MDEV-27590 will not exist; or it does have a meaning, then MDEV-27420 is not a bug.

            elenst Elena Stepanova added a comment - - edited See also MDEV-27420 – one of these should be redundant, either DESC has no meaning for Spider as was initially assumed and thus should be ignored from the start, and then the problem in MDEV-27590 will not exist; or it does have a meaning, then MDEV-27420 is not a bug.

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.