-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Optimize pulls merging #4921
Optimize pulls merging #4921
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4921 +/- ##
==========================================
+ Coverage 37.88% 37.92% +0.03%
==========================================
Files 328 328
Lines 48084 48141 +57
==========================================
+ Hits 18219 18256 +37
- Misses 27246 27257 +11
- Partials 2619 2628 +9
Continue to review full report at Codecov.
|
Maybe we could create a docker to contain some popluar git repos for testing with Gitea and publish it to dockhub. |
@typeless You can have a look at https://github.com/go-gitea/gitea/blob/801843b0115e29ba2304fa6a5bea1ae169a58e02/integrations/benchmarks_test.go wich introduce a suite of repos and manage short flag for quick test. Benchmark are not currently run on CI so it does not have an impact on test time. You can use short flag when testing/dev and validate only at end by running all benchmarks. |
I gave it a try, but "Rebase and merge" caused this:
Adding the |
@filipnavara Is there a simple way to reproduce it? |
Well, happened on very first attempt I tried. As far as I know |
@filipnavara There is probably a bug. However, the code path following the git-fetch and git-read-tree does have done checkouts (see https://github.com/go-gitea/gitea/pull/4921/files#diff-ca95a2152012afcd9192d0ed961e6b9dL389). Here is also a demo:
This is a demo for merge, which does not require a checkout
|
dfe96f4
to
a1e5657
Compare
0acae62
to
8708de2
Compare
a3fae61
to
521d72f
Compare
Fixed various bugs. @filipnavara the problem you encountered should be fixed. |
Can anyone help review this? I tested it manually (not very systematically though), and it is capable of merging an 11GiB repo (6.2GiB bare) now. |
I'll try to deploy it on our server and report back. Thanks |
@filipnavara Thanks. I have deployed to our server too, and deliberately doing more commits 😄 |
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.
Yes |
1f57c0e
to
f2d59d0
Compare
@filipnavara I just tested on our production server using the rebase merge-style for a 10+ GB repo. That was probably the culprit. Edit: But it seems what you encountered was about merging the PR, not creation of it. |
@typeless On further inspections the "timeouts" were caused by an unrelated issue in the code that sends out notifications. I don't have exact performance data, but this PR makes it good enough for our general usage (~ 6Gb repository at the moment). |
f2d59d0
to
801a730
Compare
By utilizing `git clone -s --no-checkout` rather than cloning the whole repo.
Otherwise, they would match all files with the same name under subdirectories.
801a730
to
70dc42c
Compare
Given that 1.7.0 is released, please consider merging this. |
Need an LGTM to proceed. |
* Optimize pulls merging By utilizing `git clone -s --no-checkout` rather than cloning the whole repo. * Use sparse-checkout to speedup pulls merge * Use bytes.Buffer instead of strings.Builder for backward compatibility * Fix empty diff-tree output for repos with only the initial commit * Fix missing argument for the format string * Rework diff-tree-list generation * Remove logging code * File list for sparse-checkout must be prefix with / Otherwise, they would match all files with the same name under subdirectories. * Update onto the rebased head * Use referecen repo to avoid fetching objects
This is yet-another attempt to fix #601.
It passes the integration tests but not sure if it is sufficiently covered.
Benchmarking is not trivial to be automated within the existing testing framework because
Testing small repo seems to be unreliable and I keep getting interrupted by 'database table is locked' along the way when looping through the pull merging test.I still published this patch in hopes that someone can find any flaws early.