[MDEV-26842] ROW_NUMBER is not set and differs from the message upon WARN_DATA_TRUNCATED produced by inplace ALTER Created: 2021-10-15  Updated: 2021-10-26  Resolved: 2021-10-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: N/A
Fix Version/s: 10.7.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-10075 Provide index of error causing error ... Closed

 Description   

--source include/have_innodb.inc
 
create or replace table t (a varchar(64)) engine=InnoDB;
insert into t values ('foo'),(null);
--error WARN_DATA_TRUNCATED
alter table t add primary key(a), algorithm=INPLACE;
 
get diagnostics condition 1 @n= row_number, @m= message_text;
select @n, @m;

Note: algorithm=INPLACE is default for this ALTER, I only specify it for clarity.

bb-10.7-row_number cb9002bee

MariaDB [test]> get diagnostics condition 1 @n= row_number, @m= message_text; select @n, @m;
Query OK, 0 rows affected (0.000 sec)
 
+------+----------------------------------------+
| @n   | @m                                     |
+------+----------------------------------------+
|    0 | Data truncated for column 'a' at row 2 |
+------+----------------------------------------+
1 row in set (0.000 sec)

If the algorithm is set to COPY (or if the table is MyISAM, then COPY is default), then ROW_NUMBER is set as expected.

There are likely to be many places where inplace ALTER bypasses ROW_NUMBER initialization; the problem here is that the value ends up to be different from the error message.



 Comments   
Comment by Elena Stepanova [ 2021-10-15 ]

Please feel free to demote/remove from 10.7 "must do" list if it's outside the scope.

Comment by Rucha Deodhar [ 2021-10-17 ]

Patch: https://github.com/MariaDB/server/commit/9e8a961ee32ff1b86afa59a10a27797e58dbe2f0

Comment by Sergei Golubchik [ 2021-10-18 ]

9e8a961ee32ff1b86afa59a10a27797e58dbe2f0 is ok to push

Comment by Rucha Deodhar [ 2021-10-19 ]

pushed to bb-10.7-row_number

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