[MDEV-21429] TRUNCATE and OPTIMIZE are being refused due to "row size too large" Created: 2020-01-07  Updated: 2020-08-25  Resolved: 2020-01-07

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: None
Fix Version/s: 10.2.31, 10.3.22, 10.4.12, 10.5.1

Type: Bug Priority: Critical
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20194 Warnings inconsistently issued upon C... Closed
relates to MDEV-20400 Implement a way to query an InnoDB ta... Confirmed
relates to MDEV-21261 When performing instant add column, I... Confirmed
relates to MDEV-23521 Implement an InnoDB row format that c... Open
relates to MDEV-19292 "Row size too large" error when creat... Closed
relates to MDEV-22585 Incorrect note being written to the e... Open

 Description   

By default (innodb_strict_mode=ON), InnoDB attempts to ensure at DDL time that any INSERT to the table has a chance of succeeding. MDEV-19292 recently revised the "row size too large" check in InnoDB. The check still is somewhat inaccurate; that should be addressed in MDEV-20194.

Note: If a table contains multiple long string columns so that each column is part of a column prefix index, then an UPDATE that attempts to modify all those columns at once may fail, because the undo log record might not fit in a single undo log page (of innodb_page_size). In the worst case, the undo log record would grow by about 3KiB of for each updated column.

The DDL-time check (which was introduced in the InnoDB Plugin for MySQL 5.1) is ‘optional’ in the sense that when the maximum B-tree record size or undo log record size would be exceeded, the DML operation will fail and the transaction will be properly rolled back.

The following change to a test case demonstrates the problem:

diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
index 35b86cc4c46..af6c15e0e6b 100644
--- a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
+++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
@@ -18,7 +18,15 @@ CREATE TABLE t1 (
   ,col_10 TEXT
   ,col_11 TEXT
 ) ENGINE=INNODB ROW_FORMAT=COMPACT;
+--enable_warnings
+TRUNCATE TABLE t1;
+OPTIMIZE TABLE t1;
+ALTER TABLE t1 FORCE;
+SET innodb_strict_mode = ON;
+TRUNCATE TABLE t1;
+OPTIMIZE TABLE t1;
+ALTER TABLE t1 FORCE;
 DROP TABLE t1;
+--disable_warnings
 
 SET @@global.log_warnings = 2;
-SET innodb_strict_mode = 1;

We want TRUNCATE and OPTIMIZE and a trivial ALTER TABLE…FORCE to succeed, because the table definition is not actually changing. But, we do want warnings to be issued for all these operations, no matter if innodb_strict_mode is set.


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