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: unstable sort skips/duplicates issues across pages #18094

Merged
merged 2 commits into from
Dec 29, 2021

Conversation

DuckDuckWhale
Copy link
Contributor

When viewing issues in sorted order, some issues are duplicated across pages and some are missing. This is caused by the lack of tie-breakers in database queries, making pagination inconsistent.

Fixes #13395.

models/issue.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 24, 2021
@codecov-commenter
Copy link

codecov-commenter commented Dec 24, 2021

Codecov Report

Merging #18094 (7f56389) into main (e4e3df6) will increase coverage by 0.00%.
The diff coverage is 42.10%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18094   +/-   ##
=======================================
  Coverage   44.89%   44.89%           
=======================================
  Files         824      824           
  Lines       91581    91589    +8     
=======================================
+ Hits        41111    41116    +5     
+ Misses      43879    43876    -3     
- Partials     6591     6597    +6     
Impacted Files Coverage Δ
models/issue.go 58.91% <42.10%> (-0.06%) ⬇️
modules/queue/queue_bytefifo.go 59.88% <0.00%> (-3.60%) ⬇️
modules/git/utils.go 68.05% <0.00%> (-2.78%) ⬇️
modules/git/repo_base_nogogit.go 80.00% <0.00%> (-2.50%) ⬇️
modules/queue/queue_channel.go 95.00% <0.00%> (-1.67%) ⬇️
modules/process/manager.go 81.39% <0.00%> (-1.56%) ⬇️
modules/queue/workerpool.go 49.23% <0.00%> (-0.77%) ⬇️
models/issue_comment.go 52.40% <0.00%> (-0.57%) ⬇️
routers/api/v1/repo/pull.go 28.69% <0.00%> (-0.51%) ⬇️
models/repo_list.go 84.01% <0.00%> (+0.81%) ⬆️
... and 4 more

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 e4e3df6...7f56389. Read the comment docs.

models/issue.go Outdated Show resolved Hide resolved
models/issue.go Outdated Show resolved Hide resolved
models/issue.go Outdated
case "project-column-sorting":
sess.Asc("project_issue.sorting")
sess.Asc("project_issue.sorting").Desc("issue.id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sess.Asc("project_issue.sorting").Desc("issue.id")
sess.Asc("project_issue.sorting").Asc("issue.id")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how project issue sorting works. What's the reasoning here?

When viewing issues in sorted order, some issues are duplicated across
pages and some are missing.  This is caused by the lack of tie-breakers
in database queries, making pagination inconsistent.
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Dec 25, 2021
@DuckDuckWhale
Copy link
Contributor Author

@lafriks can you also review this PR?

@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 Dec 29, 2021
@lafriks
Copy link
Member

lafriks commented Dec 29, 2021

Looks good from my side

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also LGTM. I think we can merge this, and if there is anything need to change, then we propose a new PR.

@wxiaoguang wxiaoguang merged commit 72f9050 into go-gitea:main Dec 29, 2021
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 29, 2021
* giteaoffical/main:
  Fix: unstable sort skips/duplicates issues across pages (go-gitea#18094)
@6543 6543 added this to the 1.16.0 milestone Dec 30, 2021
@6543 6543 added backport/done All backports for this PR have been created backport/v1.15 labels Dec 30, 2021
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
When viewing issues in sorted order, some issues are duplicated across
pages and some are missing.  This is caused by the lack of tie-breakers
in database queries, making pagination inconsistent.
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created 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.

Missing/Duplicate issue when sorting by nearest due date
8 participants