Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6(EOL), 10.11, 11.4
-
None
-
None
Description
Generating a write set key for a foreign key can cause server abort If the normalized (collation weight) form of the key does not fit into the 3500 byte limited key buffer.
Key generation returns DB_ERROR, which error handling does not recognise and turns into ib::fatal, killing the server.
The condition is reached by ordinary multi column foreign keys on string columns whose collation expands during strnxfrm() the example schema below is within InnoDB's 3072 byte index length limit.
The crash can be reproduced by three CHAR(255) columns in a UCA collation, as a composite primary key and foreign key. U+FB04 (the "ffl" ligature) normalizes to three collation weights, so each column contributes 1530 key bytes.
CREATE TABLE p (a CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
b CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
c CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
PRIMARY KEY (a,b,c)) ENGINE=InnoDB; |
|
|
CREATE TABLE ch (id INT AUTO_INCREMENT PRIMARY KEY, |
a CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
b CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
c CHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, |
KEY k (a,b,c), |
FOREIGN KEY (a,b,c) REFERENCES p (a,b,c)) ENGINE=InnoDB; |
|
|
SET @v = REPEAT(_utf8mb4 0xEFAC84, 255); |
INSERT INTO p VALUES (@v, @v, @v); |
INSERT INTO ch (a,b,c) VALUES (@v, @v, @v); -- server aborts here |
Causing:
WSREP: FK key len exceeded 3060 765 3500
|
[ERROR] WSREP: FK key set failed: 11 (1reference), index: PRIMARY test/p, INSERT INTO ch (a,b,c) VALUES (...)
|
[ERROR] [FATAL] InnoDB: Unknown error Generic error
|
mariadbd got signal 6
|
#6 ib::fatal::~fatal () storage/innobase/ut/ut0ut.cc:487
|
#7 row_mysql_handle_errors () storage/innobase/row/row0mysql.cc:743
|
#8 row_insert_for_mysql () storage/innobase/row/row0mysql.cc:1325
|
#9 ha_innobase::write_row () storage/innobase/handler/ha_innodb.cc:7882
|
#10 handler::ha_write_row () sql/handler.cc:7859
|
#11 Write_record::single_insert () sql/sql_insert.cc:2327
|
#13 mysql_insert () sql/sql_insert.cc:1217
|
Attachments
Issue Links
- relates to
-
MDEV-41028 Galera appliers deadlock on a foreign key referencing a CHAR column in a multi-byte character set
-
- In Review
-