mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
ORM engine initialization Error: migrate: Row size too large #4483
Closed
opened 2025-11-02 05:52:16 -06:00 by GiteaMirror
·
27 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v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.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#4483
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Whisprin on GitHub (Dec 13, 2019).
[x]):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@zeripath commented on GitHub (Dec 15, 2019):
What version of MySQL are you running?
@Whisprin commented on GitHub (Dec 15, 2019):
@zeripath
gitea database collation:
utf8mb4_unicode_cisome tables are
utf8mb4_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
@Whisprin commented on GitHub (Dec 15, 2019):
@zeripath Why did you close this issue? I only described a manual workaround, the issue persists
This should be part of the database migration / maintenance script of gitea (see Nextcloud example). Apparently gitea requires a certain row format which is not explicitly specified during table creation.
Some more info: The mariadb defaults have changed in 10.2.2 and gitea required the newer values. However, previously existing tables need to be converted manually.
https://mariadb.com/kb/en/library/innodb-row-formats-overview/
https://mariadb.com/kb/en/library/innodb-file-format/
@zeripath commented on GitHub (Dec 15, 2019):
As far as I could see the issue is specific to old versions of MariaDB. I'm but certain there's really any way we can go about detecting this.
@Whisprin commented on GitHub (Dec 16, 2019):
The issue is independent of the MariaDB version in a sense that upgrading the database doesn't help. Specific MariaDB default configurations are required and tables which existed before need to be converted manually.
From my point of view gitea requires certain db features which are not explicitly specified or documented.
ROW_FORMAT=DYNAMIC;CREATE TABLEqueries in gitea can be extend byROW_FORMAT=DYNAMIC;Only now (after I know the problem and workaround) I found the convert command:
https://github.com/go-gitea/gitea/pull/7144/files
A similar approach can be taken for the row format. (I can draft a PR)
The MySQL default charset could be changed to
utf8mb4:https://github.com/go-gitea/gitea/blob/master/custom/conf/app.ini.sample#L325
@stale[bot] commented on GitHub (Feb 14, 2020):
This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
@jacksgt commented on GitHub (Feb 20, 2020):
I just had the same issue upgrading from Gitea 1.10.2 to 1.11.1 with MariaDB version 10.3.22
This should really be part of the automatic upgrade process.
Thanks to @Whisprin for the SQL commands, they worked for me.
@sapk commented on GitHub (Feb 20, 2020):
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.
@guillep2k commented on GitHub (Feb 20, 2020):
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.
@leetNightshade commented on GitHub (Mar 4, 2020):
I upgraded from 1.6 to 1.11 and am having this issue. I tried running the manual fix as suggested above, but I'm still seeing the same error.
2020/03/04 06:45:24 ...ations/migrations.go:330:Migrate() [I] Migration[77]: add theme to users 2020/03/04 06:45:24 ...orm/dialect_mysql.go:431:GetTables() [I] [SQL] SELECTTABLE_NAME,ENGINE,TABLE_ROWS,AUTO_INCREMENT,TABLE_COMMENTfromINFORMATION_SCHEMA.TABLESWHERETABLE_SCHEMA=? AND (ENGINE='MyISAM' ORENGINE= 'InnoDB' ORENGINE= 'TokuDB') [gitea] 2020/03/04 06:45:24 ...orm/dialect_mysql.go:320:GetColumns() [I] [SQL] SELECTCOLUMN_NAME,IS_NULLABLE,COLUMN_DEFAULT,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENTFROMINFORMATION_SCHEMA.COLUMNSWHERETABLE_SCHEMA= ? ANDTABLE_NAME= ? [gitea user] 2020/03/04 06:45:24 ...orm/dialect_mysql.go:460:GetIndexes() [I] [SQL] SELECTINDEX_NAME,NON_UNIQUE,COLUMN_NAMEFROMINFORMATION_SCHEMA.STATISTICSWHERETABLE_SCHEMA= ? ANDTABLE_NAME= ? [gitea user] 2020/03/04 06:45:24 .../xorm/session_raw.go:196:exec() [I] [SQL] ALTER TABLEuserADDthemeVARCHAR(30) DEFAULT '' NOT NULL ; - took: 3.750008ms 2020/03/04 06:45:24 routers/init.go:72:initDBEngine() [E] ORM engine initialization attempt #1/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@guillep2k commented on GitHub (Mar 4, 2020):
@leetNightshade Can I suggest looking at these answers from SO?
@leetNightshade commented on GitHub (Mar 11, 2020):
"Variable 'innodb_file_format' is a read only variable." Those answers aren't helpful to someone who doesn't know what they're doing. Gitea created this problem, why aren't you guys solving it?
@6543 commented on GitHub (Mar 11, 2020):
@leetNightshade what version of MySql do you run?
@guillep2k commented on GitHub (Mar 11, 2020):
@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).@leetNightshade commented on GitHub (Mar 12, 2020):
I'm running: mariadb Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
@6543 commented on GitHub (Mar 12, 2020):
@leetNightshade just try what guillep2k suggested and the try it again - would be nice if you can tell us the result
@guillep2k commented on GitHub (Mar 12, 2020):
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.@leetNightshade commented on GitHub (Mar 25, 2020):
That did the trick, thank you @guillep2k !!
@zeripath commented on GitHub (Mar 25, 2020):
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.
@Whisprin commented on GitHub (Mar 26, 2020):
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
@lafriks commented on GitHub (Mar 26, 2020):
I created PR to set that for new installations and new tables. Existing tables won't be fixed and @guillep2k script should be used instead.
@Whisprin commented on GitHub (Mar 26, 2020):
Awesome @lafriks
Do you think it would be possible to add the migration or just a message to prompt the user to the doctor command as @sapk suggested earlier?
@lafriks commented on GitHub (Mar 26, 2020):
Migration is not really possible to implement as it requires dumping database and reimport. It would be enough to add that to FAQ as @zeripath suggested imho
@Whisprin commented on GitHub (Mar 26, 2020):
Using ALTER_TABLE the row format can be changed with MySQL built in commands without dumping and reimporting. See comment: https://github.com/go-gitea/gitea/issues/9347#issuecomment-565792626
@devurandom commented on GitHub (May 24, 2020):
Thanks, @Whisprin, that worked and made my Gitea server usable again!
@zeripath commented on GitHub (May 25, 2020):
Or you could have just used
gitea converthttps://docs.gitea.io/en-us/command-line/#convert
@mlthlschr commented on GitHub (Jul 31, 2020):
did not work for me, neither using
gitea convert, nor using the proposal of @Whisprin. Using gitea 1.12.3 and mariadb Ver 15.1 Distrib 10.4.12-MariaDB. EDIT: now it works, after the n-th try.