mirror of https://github.com/go-gitea/gitea.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
e28cc79c92
This addresses https://github.com/go-gitea/gitea/issues/18352 It aims to improve performance (and resource use) of the `SyncReleasesWithTags` operation for pull-mirrors. For large repositories with many tags, `SyncReleasesWithTags` can be a costly operation (taking several minutes to complete). The reason is two-fold: 1. on sync, every upstream repo tag is compared (for changes) against existing local entries in the release table to ensure that they are up-to-date. 2. the procedure for getting _each tag_ involves a series of git operations ```bash git show-ref --tags -- v8.2.4477 git cat-file -t 29ab6ce9f36660cffaad3c8789e71162e5db5d2f git cat-file -p 29ab6ce9f36660cffaad3c8789e71162e5db5d2f git rev-list --count 29ab6ce9f36660cffaad3c8789e71162e5db5d2f ``` of which the `git rev-list --count` can be particularly heavy. This PR optimizes performance for pull-mirrors. We utilize the fact that a pull-mirror is always identical to its upstream and rebuild the entire release table on every sync and use a batch `git for-each-ref .. refs/tags` call to retrieve all tags in one go. For large mirror repos, with hundreds of annotated tags, this brings down the duration of the sync operation from several minutes to a few seconds. A few unscientific examples run on my local machine: - https://github.com/spring-projects/spring-boot (223 tags) - before: `0m28,673s` - after: `0m2,244s` - https://github.com/kubernetes/kubernetes (890 tags) - before: `8m00s` - after: `0m8,520s` - https://github.com/vim/vim (13954 tags) - before: `14m20,383s` - after: `0m35,467s` I added a `foreachref` package which contains a flexible way of specifying which reference fields are of interest (`git-for-each-ref(1)`) and to produce a parser for the expected output. These could be reused in other places where `for-each-ref` is used. I'll add unit tests for those if the overall PR looks promising. |
3 years ago | |
---|---|---|
.. | ||
activitypub | 3 years ago | |
analyze | 3 years ago | |
appstate | 3 years ago | |
auth | 3 years ago | |
avatar | 3 years ago | |
base | 3 years ago | |
cache | 3 years ago | |
charset | 3 years ago | |
container | 3 years ago | |
context | 3 years ago | |
convert | 3 years ago | |
csv | 3 years ago | |
doctor | 3 years ago | |
emoji | 3 years ago | |
eventsource | 3 years ago | |
generate | 3 years ago | |
git | 3 years ago | |
gitgraph | 3 years ago | |
graceful | 3 years ago | |
hcaptcha | 4 years ago | |
highlight | 3 years ago | |
hostmatcher | 3 years ago | |
httpcache | 3 years ago | |
httplib | 3 years ago | |
indexer | 3 years ago | |
json | 3 years ago | |
lfs | 3 years ago | |
log | 3 years ago | |
markup | 3 years ago | |
metrics | 3 years ago | |
migration | 3 years ago | |
nosql | 3 years ago | |
notification | 3 years ago | |
options | 3 years ago | |
packages | 3 years ago | |
password | 4 years ago | |
pprof | 3 years ago | |
private | 3 years ago | |
process | 3 years ago | |
proxy | 4 years ago | |
public | 3 years ago | |
queue | 3 years ago | |
recaptcha | 3 years ago | |
references | 3 years ago | |
repository | 3 years ago | |
secret | 3 years ago | |
session | 3 years ago | |
setting | 3 years ago | |
ssh | 3 years ago | |
storage | 3 years ago | |
structs | 3 years ago | |
svg | 3 years ago | |
sync | 5 years ago | |
templates | 3 years ago | |
test | 3 years ago | |
timeutil | 3 years ago | |
translation | 3 years ago | |
typesniffer | 3 years ago | |
updatechecker | 3 years ago | |
upload | 3 years ago | |
uri | 3 years ago | |
user | 5 years ago | |
util | 3 years ago | |
validation | 3 years ago | |
web | 3 years ago |