"Row size too large" MySQL Error

Last modified by Eleni Cojocariu on 2026/11/25 14:48

Explanation

Two MySQL errors report the same problem. XWiki logs the first at run time, when it writes a row that does not fit:

MySQLSyntaxErrorException: 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.

The second comes from the mysql client, when a manual character-set conversion of an old database rewrites a table, usually xwikistatsvisit:

ERROR 1118 (42000) at line 1: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

Cause

Both messages suggest changing the row format or widening columns, and XWiki already does both for the tables it owns.

It sets the row format itself. XWiki's MySQL adapter issues ALTER TABLE <table> ROW_FORMAT=<format> for its own tables, using Dynamic by default and Compressed for the tables it compresses, compression is enabled by default on MySQL and MariaDB, through the xwiki.compressionAllowed property of the WEB-INF/hibernate.cfg.xml file. Setting a row format by hand therefore lasts only until XWiki sets its own back.

It has also narrowed the columns that used to overflow the limit. The data migration R130200000XWIKI17200DataMigration, whose stated purpose is to make the rows fit the maximum allowed size, converts to LONGTEXT exactly the columns this error used to come from: activitystream_events (url, title, body, param1 to param5), xwikistatsreferer (referer), xwikistatsvisit (userAgent, cookie) and xwikipreferences (leftPanels, rightPanels, documentBundles). It arrived in XWiki 13.2, was backported to 12.10.6, and runs on its own when the database is upgraded.

So on a current instance the error means one of two things: the database was never upgraded through a version carrying that migration, which is why it most often shows up while converting an old database by hand, or the row that overflows is not one of XWiki's at all.

Solution

  1. Check which XWiki version last upgraded the database, and start the instance on a current XWiki so that the database upgrade runs. The migration applies itself; there is no SQL to type and no column to widen by hand.
  2. Retry what failed, the save that was rejected, or the character-set conversion.
  3. If the database is already migrated and the error persists, the overflowing row belongs to a table XWiki does not own. The message names that table, and the row limit is then the MySQL server's to deal with rather than XWiki's.
  4. XWiki writes the row, or the conversion runs to its end, without the error returning.

Related

Get Connected