Skip to content

gvfs-helper: add prefetch action #227

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

Conversation

derrickstolee
Copy link

@derrickstolee derrickstolee commented Dec 16, 2019

This replaces #223. There was a strangely-subtle issue about reading
the trailing hash from the downloaded packs that caused issues when
reading from the origin remote.

Add gvfs-helper prefetch command line option
and objects.prefetch mode in gvfs-helper server.

Sorry, but this contains a major refactor of the packfile and loose file handling
to let me share it with the prefetch code. As a side benefit, I collapsed the
tempfile creation before the request goes out and merged the install_ code
after the result is returned.

I also changed packfile code to use the packfile-checksum rather than a
timestamp so that we look more like normal Git.

More details are in the commit message.

Teach gvfs-helper to support "/gvfs/prefetch" REST API.
This includes a new `gvfs-helper prefetch --since=<t>` command line option.
And a new `objects.prefetch` verb in `gvfs-helper server` mode.

If `since` argument is omitted, `gvfs-helper` will search the local
shared-cache for the most recent prefetch packfile and start from
there.

The <t> is usually a seconds-since-epoch, but may also be a "friendly"
date -- such as "midnight", "yesterday" and etc. using the existing
date selection mechanism.

Add `gh_client__prefetch()` API to allow `git.exe` to easily call
prefetch (and using the same long-running process as immediate and
queued object fetches).

Expanded t5799 unit tests to include prefetch tests.  Test setup now
also builds some commits-and-trees packfiles for testing purposes with
well-known timestamps.

Expanded t/helper/test-gvfs-protocol.exe to support "/gvfs/prefetch"
REST API.

Massive refactor of existing packfile handling in gvfs-helper.c to
reuse more code between "/gvfs/objects POST" and "/gvfs/prefetch".
With this we now properly name packfiles with the checksum SHA1
rather than a date string.

Refactor also addresses some of the confusing tempfile setup and
install_<result> code processing (introduced to handle the ambiguity
of how POST works with commit objects).

Signed-off-by: Jeff Hostetler <[email protected]>
@derrickstolee derrickstolee force-pushed the gvfs-helper-prefetch-v2 branch from e99039d to 6dd41a2 Compare December 16, 2019 18:13
@derrickstolee derrickstolee force-pushed the gvfs-helper-prefetch-v2 branch from 6dd41a2 to 88f9f28 Compare December 16, 2019 18:15
@derrickstolee derrickstolee marked this pull request as ready for review December 16, 2019 19:49
@derrickstolee derrickstolee changed the title Gvfs helper prefetch v2 gvfs-helper: add prefetch action Dec 16, 2019
Copy link

@jeffhostetler jeffhostetler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thanks for fixing. I'm not sure why the lseek change was necessary (unless there was an odd zero-length read slipping in there or something), but the new version is good.

@derrickstolee
Copy link
Author

This looks good. Thanks for fixing. I'm not sure why the lseek change was necessary (unless there was an odd zero-length read slipping in there or something), but the new version is good.

I'm not sure where there was a zero-length read in there, but I even put it in a loop and it was always a zero-length read. My guess is that the previous "copy" section had over-read due to the use of a buffer in the middle.

@derrickstolee derrickstolee merged commit a2c9b01 into microsoft:vfs-2.24.1 Dec 17, 2019
derrickstolee added a commit that referenced this pull request Dec 17, 2019
This is a follow-up to #227.

1. When a new flag is added to our Git config, we can run `gvfs-helper prefetch` inside of our `git fetch` calls. This will help ensure we have updated commits and trees even if the background prefetches have fallen behind (or are not running).

2. With a new `--no-update-remote-refs` we can avoid updating the `refs/remotes` namespace. This will allow us to run `git fetch --all --no-update-remote-refs +refs/heads/*:refs/hidden/*` and we will get the new refs into a local folder (that doesn't appear anywhere). The most important thing is that users will still see when their remote refs update.
derrickstolee added a commit that referenced this pull request Dec 30, 2019
This replaces #223. There was a strangely-subtle issue about reading
the trailing hash from the downloaded packs that caused issues when
reading from the origin remote.

Add `gvfs-helper prefetch` command line option
and `objects.prefetch` mode in `gvfs-helper server`.

Sorry, but this contains a major refactor of the packfile and loose file handling
to let me share it with the prefetch code.  As a side benefit, I collapsed the
tempfile creation before the request goes out and merged the install_ code
after the result is returned.

I also changed packfile code to use the packfile-checksum rather than a
timestamp so that we look more like normal Git.

More details are in the commit message.
derrickstolee added a commit that referenced this pull request Dec 30, 2019
This is a follow-up to #227.

1. When a new flag is added to our Git config, we can run `gvfs-helper prefetch` inside of our `git fetch` calls. This will help ensure we have updated commits and trees even if the background prefetches have fallen behind (or are not running).

2. With a new `--no-update-remote-refs` we can avoid updating the `refs/remotes` namespace. This will allow us to run `git fetch --all --no-update-remote-refs +refs/heads/*:refs/hidden/*` and we will get the new refs into a local folder (that doesn't appear anywhere). The most important thing is that users will still see when their remote refs update.
derrickstolee added a commit that referenced this pull request Jan 14, 2020
This replaces #223. There was a strangely-subtle issue about reading
the trailing hash from the downloaded packs that caused issues when
reading from the origin remote.

Add `gvfs-helper prefetch` command line option
and `objects.prefetch` mode in `gvfs-helper server`.

Sorry, but this contains a major refactor of the packfile and loose file handling
to let me share it with the prefetch code.  As a side benefit, I collapsed the
tempfile creation before the request goes out and merged the install_ code
after the result is returned.

I also changed packfile code to use the packfile-checksum rather than a
timestamp so that we look more like normal Git.

More details are in the commit message.
derrickstolee added a commit that referenced this pull request Jan 14, 2020
This is a follow-up to #227.

1. When a new flag is added to our Git config, we can run `gvfs-helper prefetch` inside of our `git fetch` calls. This will help ensure we have updated commits and trees even if the background prefetches have fallen behind (or are not running).

2. With a new `--no-update-remote-refs` we can avoid updating the `refs/remotes` namespace. This will allow us to run `git fetch --all --no-update-remote-refs +refs/heads/*:refs/hidden/*` and we will get the new refs into a local folder (that doesn't appear anywhere). The most important thing is that users will still see when their remote refs update.
derrickstolee added a commit that referenced this pull request Feb 21, 2020
This replaces #223. There was a strangely-subtle issue about reading
the trailing hash from the downloaded packs that caused issues when
reading from the origin remote.

Add `gvfs-helper prefetch` command line option
and `objects.prefetch` mode in `gvfs-helper server`.

Sorry, but this contains a major refactor of the packfile and loose file handling
to let me share it with the prefetch code.  As a side benefit, I collapsed the
tempfile creation before the request goes out and merged the install_ code
after the result is returned.

I also changed packfile code to use the packfile-checksum rather than a
timestamp so that we look more like normal Git.

More details are in the commit message.
dscho pushed a commit that referenced this pull request Apr 24, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Apr 29, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request May 14, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request May 14, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jun 3, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jul 17, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jul 17, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jul 17, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jul 18, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit that referenced this pull request Jul 23, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jul 25, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit that referenced this pull request Jul 29, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Sep 18, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Sep 24, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Oct 8, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit that referenced this pull request Dec 3, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Dec 17, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Dec 18, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Dec 18, 2024
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jan 1, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jan 1, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jan 1, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jan 1, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Jan 1, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Feb 10, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Feb 27, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Mar 5, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
dscho pushed a commit that referenced this pull request Mar 5, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit that referenced this pull request Mar 12, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
mjcheetham pushed a commit that referenced this pull request Mar 17, 2025
Includes these pull requests:

 #227
 #228
 #229
 #231
 #240

Signed-off-by: Derrick Stolee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants