-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
improve performance of SyncReleasesWithTags #18351
Conversation
A mirror-sync operation not only runs `git remote update`, but also tries to sync any repo releases with the available repo tags. For large repositories with many tags, this can be a costly operation. This commit aims to improve correctness and optimize performance of this operation, in particular for plain git mirrors (which never have any releases). There are two parts to the commit: - first, when looking up releases, we should ignore plain tags in `FindReleaseOptions`. - second, if we don't find any releases, we don't need to query all tags of the repo (as there is nothing to be synced). For large mirror repos, with hundreds of tags, this can bring down the duration of the sync operation from minutes to seconds. Signed-off-by: Peter Gardfjäll <peter.gardfjall.work@gmail.com>
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.
Looks like this breaks the test TestMirrorPull
gitea/integrations/mirror_pull_test.go
Line 85 in 7cc90fb
assert.EqualValues(t, initCount+1, count) |
Yes, I noticed that too. I'll see if I can fix it. |
@@ -247,7 +247,7 @@ func SyncReleasesWithTags(repo *repo_model.Repository, gitRepo *git.Repository) | |||
existingRelTags := make(map[string]struct{}) | |||
opts := models.FindReleasesOptions{ | |||
IncludeDrafts: true, |
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.
Could we also ignore drafts?
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.
IncludeDrafts: true, | |
IncludeDrafts: false, |
I think that my understanding of Initially I thought the I soon noticed that I then thought that one way of optimizing for syncing pull mirrors (which are always identical to the upstream) could be to just rebuild the So, my initial thinking that WDYT, just close or are there any other ideas on if/how performance can be improved for pull mirrors? Edit: would a command such as |
To add to the reasoning setting |
Closing this in favor of #19125 |
This PR addresses #18352
A mirror-sync operation not only runs
git remote update
, but also tries tosync any repo releases with the available repo tags. For large repositories with
many tags, this can be a costly operation, both in time and computational resources.
This commit aims to improve correctness and optimize performance of the
SyncReleasesWithTags
operation, in particular for plain git mirrors (which never have any releases). There are two parts to the commit:first, when looking up releases, we should ignore plain tags in
FindReleaseOptions
.second, if we don't find any releases, we don't need to query all tags of the
repo (as there is nothing to be synced).
For large mirror repos, with hundreds of tags, this can bring down the duration
of the sync operation from minutes to seconds.