git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] send-pack: never fetch when checking exclusions

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Oct 11, 2019, 22:08 UTC
Message-ID
<20191011220822.154063-1-jonathantanmy@google.com>
In-Reply-To
<20191011161504.GB19741@sigill.intra.peff.net>
Show 11 quoted lines
> As a general rule (and why I'm raising this issue in reply to Jonathan's
> patch), I think most or all sites that want OBJECT_INFO_QUICK will want
> SKIP_FETCH_OBJECT as well, and vice versa. The reasoning is generally
> the same:
> 
>   - it's OK to racily have a false negative (we'll still be correct, but
>     possibly a little less optimal)
> 
>   - it's expected and normal to be missing the object, so spending time
>     double-checking the pack store wastes measurable time in real-world
>     cases

I took a look on "next" and it's true for these reasons in most cases but not all.

QUICK implies SKIP_FETCH_OBJECT:
  fetch-pack.c: Run with fetch_if_missing=0 (from builtin/fetch.c,
  builtin/fetch-pack.c, or through a lazy fetch) so OK.
  
  builtin/index-pack.c: Run with fetch_if_missing=0, so OK.
  
  builtin/fetch.c: Run with fetch_if_missing=0, so OK.
  
  object-store.h, sha1-file.c: Definition and implementation of this
  flag.
Everything is OK here. Now, SKIP_FETCH_OBJECT implies QUICK:
  cache-tree.c: I added this recently in f981ec18cf ("cache-tree: do not
  lazy-fetch tentative tree", 2019-09-09). No problem with a false
  negative, since we know how to reconstruct the tree. OK.
  
  object-store.h, sha1-file.c: Definition and implementation of this
  flag.
  
  send-pack.c: This patch (which is already in "next"). If we have a
  false negative, we might accidentally send more than we need. But that
  is not too bad.
  
  promisor-remote.c: This is the slightly tricky one. We use this
  information to determine if we got our lazily-fetched object from the
  most recent lazy fetch, or if we should continue attempting to fetch the
  given object from other promisor remotes; so this information is
  important. However, adding QUICK doesn't lose us anything because the
  lack of QUICK only helps us when there is another process packing
  loose objects: if we got our object, our object will be in a pack
  (because of the way the fetch is implemented - in particular, we need
  a pack because we need the ".promisor" file).

So everything is OK except for promisor-remote.c, but even that is OK for another reason.

Having said that, perhaps we should consider promisor-remote.c as low-level code and expect it to know that objects are fetched into a packfile (as opposed to loose objects), so it can safely use QUICK (which is documented as checking packed after packed and loose). If no one disagrees, I can make such a patch after jt/push-avoid-lazy-fetch is merged to master (as is the plan, according to What's Cooking [1]).

[1] https://public-inbox.org/git/xmqq8sprhgzc.fsf@gitster-ct.c.googlers.com/
Previous: Jeff KingNext: Jeff King
Message 7 of 9 in “send-pack: never fetch when checking exclusions”
  1. send-pack: never fetch when checking exclusionsJonathan Tan, Oct 7, 2019
  2. Junio C HamanoOct 8, 2019
  3. send-pack: never fetch when checking exclusionsJonathan Tan, Oct 8, 2019
  4. Jeff KingOct 11, 2019
  5. Derrick StoleeOct 11, 2019
  6. Jeff KingOct 11, 2019
  7. Jonathan TanOct 11, 2019
  8. Jeff KingOct 17, 2019
  9. Junio C HamanoOct 12, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.