[MDEV-21660] Unexpected ER_INVALID_USE_OF_NULL upon concurrent UPDATE and ALTER Created: 2020-02-04  Updated: 2020-02-05  Resolved: 2020-02-05

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Data Manipulation - Update, Prepared Statements, Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: 10.5.1, 10.4.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-21658 Error on online ADD PRIMARY KEY after... Closed

 Description   

Note: Quite possibly related to MDEV-21658.

--source include/have_innodb.inc
 
--connect (con1,localhost,root,,test)
 
--connection default
CREATE  TABLE t1 (a INT, b INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP COLUMN a;
INSERT INTO t1 (b) VALUES (NULL);
SET SQL_MODE= '';
 
--send
ALTER TABLE t1 ADD PRIMARY KEY (b) ;
--connection con1
PREPARE stmt FROM "UPDATE t1 SET b = 1";
EXECUTE stmt;
 
# Cleanup
--disconnect con1
--connection default
--reap
DROP TABLE t1;

10.4 574354a6

mysqltest: At line 20: query 'reap' failed: 1138: Invalid use of NULL value

Reproducible on 10.4, 10.5.
Not reproducible on 10.3.
Not reproducible with MyISAM.
Not reproducible if UPDATE is executed without a prepared statement.
Not reproducible without ALTER which drops a column.
Not reproducible if ALTER .. DROP is run with ALGORITHM=COPY.

In all "not reproducible" variations above ALTER .. ADD PRIMARY KEY produces a warning Data truncated for column 'b' at row 1 which I think is expected.



 Comments   
Comment by Marko Mäkelä [ 2020-02-05 ]

Thank you for the hint. This bug indeed shares the root cause with MDEV-21658. Once I fixed that, this test did not fail (in 50 attempts).

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