Skip to content
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: migrating migrated repo fail #13271

Closed
6543 opened this issue Oct 22, 2020 · 6 comments · Fixed by #13505
Closed

Migration: migrating migrated repo fail #13271

6543 opened this issue Oct 22, 2020 · 6 comments · Fixed by #13505
Assignees
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug

Comments

@6543
Copy link
Member

6543 commented Oct 22, 2020

while try to migrate from gitea ( 1.14.0+dev-63-g26d6c1530) to gitea (1.14.0+dev-44-gf0fe5683f) a db deadlock ocure (mysql)

source repo: https://try.gitea.io/abcKing/GitNex

@6543 6543 added type/bug topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them labels Oct 22, 2020
@zeripath
Copy link
Contributor

zeripath commented Oct 23, 2020

Dude!! Seriously this is a bad bad bad issue report!

I presume you mean that you were trying to migrate the repository https://try.gitea.io/abcKing/GitNex from try.gitea.io to a local server and the local server deadlocked? Or do you mean that try deadlocked?

I'm guessing you meant your local server's database is MySQL? (I note try uses MySQL too) Appears I was incorrect here try uses SQLite (thanks @lunny)

Do you have any logs around this point?

Are you sure it's a DB deadlock and not some kind of http loop or other code deadlock? MySQL should have a deadlock breaker meaning that at least one of the deadlocking queries/transactions should get broken.

Have you repeated the procedure with:

[database]
LOG_SQL=true
...

to get the SQL logs for this?

@lunny
Copy link
Member

lunny commented Oct 23, 2020

@zeripath try uses sqlite, so it's easy to let the DB deadlock.

@6543 6543 self-assigned this Oct 23, 2020
@6543
Copy link
Member Author

6543 commented Oct 23, 2020

I'll shuld be more specific 😓 - but do not have logs at the moment, so I only can gess ...

... I'll work on this issue - and if I konw more I'll let you konw

@6543 6543 changed the title Migration: DB deadlock Migration: freeze while try to migrate repo from try.gitea.com to local test gitea Oct 23, 2020
@zeripath
Copy link
Contributor

no worries - it's just that if a user had made this report we'd be all stuck scratching our heads!

@6543
Copy link
Member Author

6543 commented Oct 25, 2020

@zeripath I have an error loged 🎉 - thanks for the error screen on migrations :)

Error 1062: Duplicate entry '+1-13037-0-1--1' for key 'UQE_reaction_s'

@6543
Copy link
Member Author

6543 commented Oct 25, 2020

so I guess: since source repo is already a migrated repo: api returns some entrys who make no sence

the question is how to treat them: drop/show as GhotUser/ ?!?

@6543 6543 changed the title Migration: freeze while try to migrate repo from try.gitea.com to local test gitea Migration: migrating migrated repo fail Oct 25, 2020
zeripath added a commit to zeripath/gitea that referenced this issue Nov 10, 2020
When migrating repositories with reactions with deleted users, the original
author id may be -1. This means that it is possible to end up attempting
to create multiple reactions with the same [ Type, IssueID, CommentID, UserID,
OriginalAuthorID ] thus breaking the constraints.

On SQLite this appears to cause a deadlock but on other dbs this will
cause the migration to fail.

This PR extends the constraint to include the original author username
in the constraint.

Fix go-gitea#13271

Signed-off-by: Andrew Thornton <art27@cantab.net>
zeripath added a commit that referenced this issue Nov 10, 2020
When migrating repositories with reactions with deleted users, the original
author id may be -1. This means that it is possible to end up attempting
to create multiple reactions with the same [ Type, IssueID, CommentID, UserID,
OriginalAuthorID ] thus breaking the constraints.

On SQLite this appears to cause a deadlock but on other dbs this will
cause the migration to fail.

This PR extends the constraint to include the original author username
in the constraint.

Fix #13271

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants