[MDEV-27590] Auto-increment on Spider tables with DESC PK does not work properly Created: 2022-01-23  Updated: 2022-01-26  Resolved: 2022-01-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: N/A
Fix Version/s: 10.8.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-13756 Implement descending index: KEY (a DE... Closed
Relates
relates to MDEV-27420 Spider tables retain DESC attribute o... Closed

 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



 Comments   
Comment by Elena Stepanova [ 2022-01-23 ]

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.

Generated at Thu Feb 08 09:54:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.