-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration failed by "error in table task after rename: duplicate column name: message" #17328
Comments
I don't understand where this could be happening - we'd need to be calling The interesting thing is that not every user reports this - which suggests that whatever is going on is either some kind of race or it's related to something else. |
Yep, I cannot reproduce this bug either. One user was using pgsql while another was using sqlite3. My only guess is whether there is some code triggering |
Is it possible caused by some |
It's impossible. When migrating, web listener is not up, so internal routes will not accept any requests. |
Hmm ... Could this be due to having more than one entry in the version table? I've seen a few people who get weird partial dB upgrades in the past and I don't understand why - maybe that would do it? |
Just remember another issue: #16828 , similar problem, both |
The code here https://github.com/go-gitea/gitea/blob/main/models/migrations/migrations.go#L416-L423 (using auto generated id) can be buggy if a user ran I am not sure whether it is really related. |
Going from 1.14. The relevant call stacks seem to be
is coming before
log(1.14.
|
AHA! Thank you this is exactly the help I needed to understand what the problem is. The problem is on line 193 here: Lines 182 to 193 in 6110ddc
In 1.16 this has been moved to: Lines 131 to 142 in 157de0f
The Now the question is: Why are you running the install page again?! It was not intended that you would run the install page again. |
The underlying problem in go-gitea#17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix go-gitea#17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath I'm using docker, and I create a new image to switch over to when I upgrade. So I guess the reason I run the install page again is that I'm not sure how to not do it; it pops up when I start up the container for the first time. (I imagine it's because my ini file isn't in a volume) |
I set INSTALL_LOCK to true in the gitea.ini file my Dockerfile uses and was able to spin up an instance with 1.14.6 data and 1.15.6 installed. It seems to be running without issue, getting past migration 184. |
* Run Migrate in Install rather than just SyncTables The underlying problem in #17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix #17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport go-gitea#17475 The underlying problem in go-gitea#17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix go-gitea#17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport #17475 The underlying problem in #17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix #17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
Just to record here: we have an issue tracking this problem |
* Run Migrate in Install rather than just SyncTables The underlying problem in go-gitea#17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix go-gitea#17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
Gitea Version
1.15.4
Description
Many users report that the migration fails:
Removing the message field in task table
resolves this problem and can complete the migration.The problem seems to be caused by Gitea accessed the
task
ORM too early (before migration), so thetask
table was changed (message
was added whileerror
also exists) before the migration and then the conflict occurs.The text was updated successfully, but these errors were encountered: