[MDEV-17833] ALTER TABLE is not enforcing prefix index size limit Created: 2018-11-26  Updated: 2018-12-12  Resolved: 2018-12-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4.1, 10.1.38, 10.0.38, 10.2.20, 10.3.12

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: alter

Issue Links:
Relates
relates to MDEV-17816 InnoDB: Failing assertion: trx->dict_... Closed
relates to MDEV-17885 TRUNCATE on temporary table causes ER... Closed

 Description   

As noted in MDEV-17816, ALTER TABLE fails to enforce the column index prefix size limit in ALGORITHM=INPLACE.
The operation can fail, but in a different way than ALGORITHM=COPY would. Here is an example of a failure:

--source include/have_innodb.inc
 
SET @save_format = @@GLOBAL.innodb_file_format;
SET @save_prefix = @@GLOBAL.innodb_large_prefix;
SET GLOBAL innodb_file_format=barracuda;
SET GLOBAL innodb_large_prefix=ON;
CREATE TABLE t1 (c VARCHAR(1024),
c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL,
c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL,
c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL,
ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL,
cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL,
d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL,
d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL,
d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL,
d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL,
dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL,
UNIQUE KEY(c))
ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t1 VALUES
(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''),
(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
--enable_info
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
--disable_info
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_file_format=@save_format;
SET GLOBAL innodb_large_prefix=@save_prefix;

10.0 14f6b0cdfd696ec0e4f24d914fc3123deaece2f6

mysqltest: At line 24: query 'ALTER TABLE t1 ROW_FORMAT=REDUNDANT' failed: 1118: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

The expected failure is as follows:

mysqltest: At line 24: query 'ALTER TABLE t1 ROW_FORMAT=REDUNDANT' failed: 1709: Index column size too large. The maximum column size is 767 bytes.


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