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 index produces problem when issues/pulls deleted #6973

Merged
merged 5 commits into from
May 18, 2019

Conversation

lunny
Copy link
Member

@lunny lunny commented May 17, 2019

When an issue of a repo has been deleted( we haven't implement that on gitea currently) or the number counting failed on repository, creating issue/pull will always failed. This PR will fix that problem and when both two issue are created then retry will resolve the problem. This is not the final resolution, but it will not block user creating issue.

@lunny lunny added the type/bug label May 17, 2019
@lunny lunny added this to the 1.9.0 milestone May 17, 2019
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 17, 2019
@lafriks
Copy link
Member

lafriks commented May 17, 2019

Does xorm support to use expressions on inserts? Most correct solution would be to use insert into .... values (xxx, xxx, (select max(col)+1 from ...), xxx) sql statement to have less possibility for race condition

@lunny
Copy link
Member Author

lunny commented May 17, 2019

@lafriks xorm support that but mysql and maybe other databases don't support.

@zeripath
Copy link
Contributor

zeripath commented May 17, 2019

Hmm we're going to have problems with this if we have a very active repository.

This is however a lot better than our current implementation.

@zeripath zeripath closed this May 17, 2019
@zeripath zeripath reopened this May 17, 2019
@GiteaBot GiteaBot 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 May 17, 2019
@lunny
Copy link
Member Author

lunny commented May 18, 2019

Make L-G-T-M work

@lunny lunny merged commit c385dcc into master May 18, 2019
@lunny lunny deleted the lunny/fix_issue_index_number branch May 18, 2019 02:37
@lafriks
Copy link
Member

lafriks commented May 18, 2019

MySQL, postgres and mssql support that, don't know about sqlite tho, need to test that :)

@lunny
Copy link
Member Author

lunny commented May 18, 2019

It should be, see http://www.sqlitetutorial.net/sqlite-functions/sqlite-coalesce/ coalesce is a SQL92 standard I think.

jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
* fix index produces problem when issues/pulls deleted

* fix tests

* fix tests

* fix tests
@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.

5 participants