I'm running a MySQL server on my Macbook (for testing). Version is 5.6.20 from Homebrew. I started running into "Row size too large" errors, and I've been able to reduce it down to this test case. Table:
mysql> describe test;
+-------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| stuff | longtext | YES | | NULL | |
+-------+----------+------+-----+---------+----------------+
Table status:
mysql> show table status where Name = 'test';
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| test | InnoDB | 10 | Compact | 1 | 16384 | 16384 | 0 | 0 | 5242880 | 2 | 2014-08-28 23:51:12 | NULL | NULL | utf8_general_ci | NULL | | |
+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
The error I'm getting when I try to insert a row into the table where the stuff
column has more than 5033932 bytes.
mysql> select length(stuff) from test;
+---------------+
| length(stuff) |
+---------------+
| 5033932 |
+---------------+
mysql> update test set stuff = concat(stuff, 'a');
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
I've searched around for this error, most of the answers involve having too many TEXT columns, and each one has 768 bytes stored inline. As you can see, that is not the case for me. Also, the number 5033932 stays the same regardless of the number of columns I have in the table. In my original application, there were five columns, and the updates still failed when the column size exceeded 5033932.
I've also seen people resolve the issue by switching row formats, which I will try in a bit, but I would like to understand exactly what's causing this error.
Thanks in advance!