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

Add commit status summary table to reduce query from commit status table #30223

Merged
merged 26 commits into from Apr 12, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented Apr 1, 2024

This PR adds a new table named commit status summary to reduce queries from the commit status table. After this change, commit status summary table will be used for the final result, commit status table will be for details.

…ble. After this change, commit status summary table will be used for final result, commit status table will be for details
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 1, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 1, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/migrations labels Apr 1, 2024
@lunny lunny mentioned this pull request Apr 1, 2024
@lunny lunny added the performance/speed performance issues with slow downs label Apr 1, 2024
@lunny lunny changed the title Add commit status summary table to reduce query from commit status table. After this change, commit status summary table will be used for final result, commit status table will be for details Add commit status summary table to reduce query from commit status table Apr 2, 2024
@lunny lunny mentioned this pull request Apr 3, 2024
13 tasks
@lunny lunny marked this pull request as ready for review April 7, 2024 14:04
@lunny lunny added this to the 1.23.0 milestone Apr 7, 2024
@lunny
Copy link
Member Author

lunny commented Apr 8, 2024

This is ready to be review.

Copy link
Member

@wolfogre wolfogre left a comment

Choose a reason for hiding this comment

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

How can the missing CommitStatusSummary for the old CommitStatus be migrated? I imagine it could be something like "fallback to query CommitStatus if there's no CommitStatusSummary", but I don't see the code. Did I miss it?

Never mind, I see it now.

models/git/commit_status_summary.go Outdated Show resolved Hide resolved
models/migrations/v1_23/v295.go Outdated Show resolved Hide resolved
@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 Apr 8, 2024
Co-authored-by: Jason Song <i@wolfogre.com>
lunny added a commit that referenced this pull request Apr 8, 2024
Partially backport #30223 

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.
lunny added a commit to lunny/gitea that referenced this pull request Apr 8, 2024
Partially backport go-gitea#30223

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.
lafriks pushed a commit that referenced this pull request Apr 8, 2024
Partially backport #30223

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.
@yp05327
Copy link
Contributor

yp05327 commented Apr 10, 2024

There's another issue maybe come from #29444. Should we fix it in this PR or another one?
git_model.CommitStatus.TargetURL is necessary in FindReposLastestCommitStatuses or the link will broken.
image
image

@yp05327 yp05327 self-requested a review April 10, 2024 06:53
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Apr 10, 2024
@lunny
Copy link
Member Author

lunny commented Apr 10, 2024

There's another issue maybe come from #29444. Should we fix it in this PR or another one? git_model.CommitStatus.TargetURL is necessary in FindReposLastestCommitStatuses or the link will broken. image image

It's a cache implementation bug and I will fix it in another PR so that it can be backport easier.

@yp05327
Copy link
Contributor

yp05327 commented Apr 10, 2024

I see, the cache only caches status, so TargetLink will lose.

@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 Apr 10, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 10, 2024
@lunny lunny merged commit fc34481 into go-gitea:main Apr 12, 2024
26 checks passed
@lunny lunny deleted the lunny/commit_status_summary branch April 12, 2024 01:41
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 12, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 12, 2024
* giteaofficial/main:
  Change the default maxPerPage for gitbucket (go-gitea#30392)
  Fix the spacing issue in the Project view (go-gitea#30415)
  Add commit status summary table to reduce query from commit status table (go-gitea#30223)
  Split `issue edit` code from `repo-legacy.js` into its own file (go-gitea#30419)
  Check the token's owner and repository when registering a runner (go-gitea#30406)
  Avoid user does not exist error when detecting schedule actions when the commit author is an external user (go-gitea#30357)
  Update actions variables documents (go-gitea#30394)
  Fix author name alignment in commits table (go-gitea#30396)
silverwind added a commit to silverwind/gitea that referenced this pull request Apr 13, 2024
* origin/main: (1540 commits)
  Add `interface{}` to `any` replacement to `make fmt`, exclude `*.pb.go` (go-gitea#30461)
  Fix network error when open/close organization/individual projects and redirect to project page (go-gitea#30387)
  Avoid losing token when updating mirror settings (go-gitea#30429)
  Fix label rendering (go-gitea#30456)
  Add comment for ContainsRedirectURI about the exact match (go-gitea#30457)
  Update JS and PY deps, lock eslint and related plugins (go-gitea#30452)
  Refactor cache and disable go-chi cache (go-gitea#30417)
  Fix admin notice view-detail (go-gitea#30450)
  Fix mirror error when mirror repo is empty (go-gitea#30432)
  Add `/public/assets/img/webpack` to ignore files again (go-gitea#30451)
  Lock a few tool dependencies to major versions (go-gitea#30439)
  Fix commit status cache which missed target_url (go-gitea#30426)
  Remove jQuery from the commit graph (except Fomantic) (go-gitea#30395)
  Fix rename branch 500 when the target branch is deleted but exist in database (go-gitea#30430)
  Limit the max line length when parsing git grep output (go-gitea#30418)
  Change the default maxPerPage for gitbucket (go-gitea#30392)
  Fix the spacing issue in the Project view (go-gitea#30415)
  Add commit status summary table to reduce query from commit status table (go-gitea#30223)
  Split `issue edit` code from `repo-legacy.js` into its own file (go-gitea#30419)
  Check the token's owner and repository when registering a runner (go-gitea#30406)
  ...
@wxiaoguang wxiaoguang modified the milestones: 1.23.0, 1.22.0 Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/migrations performance/speed performance issues with slow downs size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants