gitea: ORM engine initialization Error: migrate: Row size too large
- Gitea version (or commit ref): 1.10.0
- Git version: 2.24.1
- Operating system: Linux (Arch)
- Database (use
[x]):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist: https://gist.github.com/Whisprin/69ec124abec9fb94fbe713e32f5a652a
Description
After upgrading from Gitea v1.9.5 to 1.10.0 I’m getting a database migration error:
ORM engine initialization attempt #8/10 failed. Error: migrate: do migrate: Error 1118: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 27 (19 by maintainers)
Or you could have just used
gitea converthttps://docs.gitea.io/en-us/command-line/#convert
Nice! 😄. The original poster had one, but I didn’t know what you had.
So, you need to stop Gitea (make sure no gitea processes keep running, even if it seems to have stopped), and export/transform/re-import the database (assuming your database name is
gitea):You will be prompted for the root user’s password two times. The
original.sqlscript remains as a normal backup in case of trouble. Save a copy oforiginal.sqlfor safekeeping purposes.@zeripath
gitea database collation:
utf8mb4_unicode_cisome tables areutf8mb4_unicode_ci, most are:utf8_general_ciI remember there being a similar issue in Nextcloud before, requiring changing the table row format to
DYNAMIC.edit: This worked for me. Manually changing the row format and character set of each table:
Adapted from: https://docs.nextcloud.com/server/11/admin_manual/maintenance/mysql_4byte_support.html#mariadb-support
It’s not a fault with MySQL, it works as intended. It’s a fault of how Gitea is using MySQL and a missing migration. If you need ROW_FORMAT=DYNAMIC specify it explicitly during table creation or at least please mention it in the documentation that dynamic is the expected row format. @zeripath @lunny
This should be added to the docs and maybe the check could be in doctor command first and if stable move to the web startup process.
So we can finally close this issue - which is a fault with MySQL not Gitea - I guess we should put this little script in the FAQ.
That did the trick, thank you @guillep2k !!
@leetNightshade I’m sorry you didn’t find that link useful. Unfortunately that’s a limitation of MySQL/MariaDB. AFAICT the problem you are facing is very common for databases created with old versions of those products. “Modern” versions of MySQL/MariaDB don’t have this problem. What you need to do is to upgrade your engine and look for a way of converting your tables to a newer format.
I’d suggest you perform a backup and upgrade to the latest database engine version possible (e.g. MariaDB 10.4.12). You can then export your database with
mysqldump, modify the backup as instructed here, and import it back (you’ll need to update the script and changeDB=""forDB="gitea"or whatever is the name of your database).We could also add a function (step independent) to the migration function that attempts to create row with a deliberately big length, then delete it. If that fails, we could abort the process, warn the user and point them to the docs.