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

Fix the v78 migration script #5776

Merged

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Jan 19, 2019

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

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>
@bkcsoft bkcsoft added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jan 19, 2019
@codecov-io
Copy link

codecov-io commented Jan 19, 2019

Codecov Report

Merging #5776 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
models/migrations/v78.go 0% <0%> (ø) ⬆️
models/repo_indexer.go 44.49% <0%> (-5.51%) ⬇️
modules/indexer/repo.go 63.35% <0%> (-5.35%) ⬇️
modules/avatar/avatar.go 100% <0%> (+18.75%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 71c832e...150abf8. Read the comment docs.

@bkcsoft bkcsoft added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 19, 2019
@zeripath
Copy link
Contributor Author

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.

@zeripath
Copy link
Contributor Author

Btw #5773 is the reason I noticed this and the reason I know that it definitely works on sqlite.

@techknowlogick techknowlogick added the status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR label Jan 19, 2019
@techknowlogick techknowlogick removed the status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR label Jan 20, 2019
@techknowlogick techknowlogick merged commit b0fbefc into go-gitea:master Jan 20, 2019

// Then reset the values
sess = x.NewSession()
defer sess.Close()
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@zeripath
Copy link
Contributor Author

Thanks @techknowlogick.

@zeripath zeripath deleted the issue-5759-properly-fix-the-migration branch January 20, 2019 08:41
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migration error: rename repo is_bare to repo is_empty
6 participants