-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Fix the v78 migration script #5776
Fix the v78 migration script #5776
Conversation
Unfortunately the last fix didn't completely fix the migration to v79 of the db due to bug with schema locking during Sync2. This should fix this issue. Fix go-gitea#5759 Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## master #5776 +/- ##
==========================================
- Coverage 37.79% 37.74% -0.05%
==========================================
Files 327 327
Lines 47840 47849 +9
==========================================
- Hits 18079 18062 -17
- Misses 27168 27194 +26
Partials 2593 2593
Continue to review full report at Codecov.
|
Guys before you merge if you could double check with postgres etc that this won't break them/will fix them too that would be excellent. It certainly fixes sqlite. |
Btw #5773 is the reason I noticed this and the reason I know that it definitely works on sqlite. |
|
||
// Then reset the values | ||
sess = x.NewSession() | ||
defer sess.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this two lines is unnecessary but xorm should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hiya @lunny, dropping the index and sync2 have to be in different transactions on sqlite as the schema becomes locked by sync2 which conflicts with the index drop. Therefore the original single transaction fails on sqlite and is rolled back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeripath I know. I mean
sess := x.NewSession()
defer sess.Close()
sess.Begin()
sess.Commit()
sess.Begin()
sess.Commit()
The second NewSession
is uncessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so xorm would just create a new transaction in the same session after the first one is committed.
Fair enough. Clean it up if you like and/or think it will cause problems in future.
Thanks @techknowlogick. |
Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during sess.Sync2. This should fix this issue.
Fix #5759, #5779
Signed-off-by: Andrew Thornton art27@cantab.net