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
git pull: release file handles to pack files before fetching #3415
git pull: release file handles to pack files before fetching #3415
Conversation
bf8fab1
to
48566dd
Compare
@@ -713,6 +713,7 @@ static void close_commit_graph_one(struct commit_graph *g) | |||
if (!g) | |||
return; | |||
|
|||
clear_commit_graph_data_slab(&commit_graph_data_slab); |
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.
@derrickstolee could I ask you to look over this change, to see whether it is sound?
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.
Makes sense. If we are closing the commit-graph, then the graph might change when we reopen it, leading to different graph_pos
values.
@@ -713,6 +713,7 @@ static void close_commit_graph_one(struct commit_graph *g) | |||
if (!g) | |||
return; | |||
|
|||
clear_commit_graph_data_slab(&commit_graph_data_slab); |
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.
Makes sense. If we are closing the commit-graph, then the graph might change when we reopen it, leading to different graph_pos
values.
The slab has information about the commit graph. That means that it is meaningless (and even misleading) when the commit graph was closed. This seems not to matter currently, but we're about to fix a Windows-specific bug where `git pull` does not close the object store before fetching (risking that an implicit auto-gc fails to remove the now-obsolete pack file(s)), and once we have that bug fix in place, it does matter: after that bug fix, we will open the object store, do some stuff with it, then close it, fetch, and then open it again, and do more stuff. If we close the commit graph without releasing the corresponding slab, we're hit by a symptom like this in t5520.19: BUG: commit-reach.c:85: bad generation skip 9223372036854775807 > 3 at 5cd378271655d43a3b4477520014f02213ad1546 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
On Windows, files cannot be removed nor renamed if there are still handles held by a process. To remedy that, we try to release all open handles to any `.pack` file before e.g. repacking (which would want to remove the original `.pack` file(s) after it is done). Since the `read_cache_unmerged()` and/or the `get_oid()` call in `git pull` can cause `.pack` files to be opened, we need to release the open handles before calling `git fetch`: the latter process might want to spawn an auto-gc, which in turn might want to repack the objects. This commit is similar in spirit to 5bdece0 (gc/repack: release packs when needed, 2018-12-15). This fixes git-for-windows#3336. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
48566dd
to
0e956ae
Compare
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
A bug where Git's garbage collection during a `git pull` failed to delete obsolete files [was fixed](git-for-windows/git#3415). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
git pull: release file handles to pack files before fetching
This is a tentative fix for #3336.