forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Avoid commit-graph lock contention #2198
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
Merged
dscho
merged 4 commits into
git-for-windows:master
from
dscho:avoid-commit-graph-lock-contention
May 19, 2019
Merged
Avoid commit-graph lock contention #2198
dscho
merged 4 commits into
git-for-windows:master
from
dscho:avoid-commit-graph-lock-contention
May 19, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The close_commit_graph() method took a repository struct, but then only uses the raw_object_store within. Change the function prototype to make the method more flexible. Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
The close_all_packs() method is used to close all read handles to pack-files and the multi-pack-index before running 'git gc --auto'. This is particularly important on the Windows platform, where read handles block any writes to those files. Replacing one of these files with a rename() will fail in this situation. The commit-graph also performs a rename, so is susceptable to this problem. We are careful to close the commit-graph before writing, but that doesn't work when a 'git fetch' (or similar) process runs 'git gc --auto' which may write a commit-graph. Here, close the commit-graph as part of close_all_packs(). Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
The close_all_packs() method is now responsible for more than just pack-files. It also closes the commit-graph and the multi-pack-index. Rename the function to be more descriptive of its larger role. The name also fits because the input parameter is a raw_object_store. Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
This topic branch is a backport of gitgitgadget#208, which avoids a lock contention in `git gc --auto` where the `git gc` process holds a read lock to the `commit-graph` file (if `core.commitgraph=true`) and the spawned `git commit-graph write` (if `gc.writecommitgraph=true`) tries to overwrite it. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1953afc
to
441bb2d
Compare
dscho
added a commit
to git-for-windows/build-extra
that referenced
this pull request
May 19, 2019
We [now avoid problems updating the commit graph](git-for-windows/git#2198) when `gc.writeCommitGraph=true`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho
added a commit
that referenced
this pull request
May 19, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 19, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 21, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 21, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 21, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 22, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 22, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 22, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 25, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 25, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 25, 2019
Avoid commit-graph lock contention
dscho
added a commit
that referenced
this pull request
May 29, 2019
Avoid commit-graph lock contention
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a backport of gitgitgadget#208, which avoids a lock contention in
git gc --auto
where thegit gc
process holds a read lock to thecommit-graph
file (ifcore.commitgraph=true
) and the spawnedgit commit-graph write
(ifgc.writecommitgraph=true
) tries to overwrite it.cc @derrickstolee