I ran into a ‘fun’ error with an application I’ve been working on. Everything was running fine and then one day hoptoad started filling up with exceptions like this:
ActiveRecord::StatementInvalid: Mysql::Error: Got error 139 from storage engine
I hate errors like that. Lucky for me there’s Google:
http://forums.mysql.com/read.php?22,63584,166521#msg-166521
http://bugs.mysql.com/bug.php?id=10035
Turns out that each row in mysql has a limit of 8000 bytes. A ‘text’ column takes up 768 bytes in the row after that it moves the data to an db external page. When you have Rails migrations you forget how many ‘text’ columns you have. Turns out I had 14:
14 x 768 = 10752 bytes
What’s interesting is that you can get away with this setup until one day one of your users enters a lot of data. At that moment you will get the dreaded:
ActiveRecord::StatementInvalid: Mysql::Error: Got error 139 from storage engine
Time to refactor and break the table apart. I did that and broke the one model into smaller models and now everything is wonderful again.