[MDEV-26693] ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table Created: 2021-09-26  Updated: 2021-10-26  Resolved: 2021-10-16

Status: Closed
Project: MariaDB Server
Component/s: Server, Storage Engine - Spider
Affects Version/s: 10.7
Fix Version/s: 10.7.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-10075 Provide index of error causing error ... Closed
Relates
relates to MDEV-26654 ROW_NUMBER is wrong upon INSERT into ... Closed

 Description   

ERROR_INDEX upon INSERT here behaves similarly to the one on Federated table in MDEV-26654; however UPDATE shows a difference – it seems all right with Federated, but wrong with Spider. I've grouped the failures by engine for now, but it's possible that INSERT problem is the same for Federated and Spider, while UPDATE problem on Spider is different. Please feel free to rearrange the reports as you deem fit.

install soname 'ha_spider';
set spider_same_server_link=1;
 
CREATE OR REPLACE TABLE t (id INT PRIMARY KEY);
eval CREATE OR REPLACE TABLE spd (id INT PRIMARY KEY) ENGINE=SPIDER COMMENT 'host "127.0.0.1", user "root", password "", port "$MASTER_MYPORT", table "t"';
 
--error ER_DUP_ENTRY
INSERT INTO spd VALUES (1),(2),(1);
GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX;
SELECT @n;
 
DELETE FROM t;
INSERT INTO spd VALUES (1),(2),(3),(13);
--error ER_DUP_ENTRY
UPDATE spd SET id = id + 10;
GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX;
SELECT @n;

Result, 10.7 d552e092

INSERT INTO spd VALUES (1),(2),(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX, @msg = MESSAGE_TEXT;
SELECT @n, @msg;
@n	@msg
4	Duplicate entry '1' for key 'PRIMARY'
DELETE FROM t;
INSERT INTO spd VALUES (1),(2),(3),(13);
UPDATE spd SET id = id + 10;
ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
GET DIAGNOSTICS CONDITION 1 @n = ERROR_INDEX, @msg = MESSAGE_TEXT;
SELECT @n, @msg;
@n	@msg
1	Duplicate entry '13' for key 'PRIMARY'

In the test case above, ERROR_INDEX after the failed INSERT is 4, while the expected value is 3. So, it is off by one, as with Federated in MDEV-26654.

Upon UPDATE, the ERROR_INDEX is 1, while the expected value is 3. So, it's probably not set at all.



 Comments   
Comment by Sergei Golubchik [ 2021-10-16 ]

pushed in bb-10.7-row_number

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