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

Re: [PATCH 2/2] fetch-pack: avoid repeatedly re-scanning pack directory

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 27, 2013, 10:27 UTC
Message-ID
<20130127102753.GB4228@elie.Belkin>
In-Reply-To
<20130126224043.GB20849@sigill.intra.peff.net>
Hi,
Jeff King wrote:
Show 6 quoted lines
> When we look up a sha1 object for reading, we first check
> packfiles, and then loose objects. If we still haven't found
> it, we re-scan the list of packfiles in `objects/pack`. This
> final step ensures that we can co-exist with a simultaneous
> repack process which creates a new pack and then prunes the
> old object.

I like the context above and what follows it, but I think you forgot to mention what the patch actually does. :)

I guess it is:
	However, in the first scan over refs in fetch-pack.c::everything_local,
	this double-check of packfiles is not necessary since we are only
	trying to get a rough estimate of the last time we fetched from this
	remote repository in order to find good candidate common commits ---
	a missed object would only result in a slightly slower fetch.
	Avoid that slow second scan in the common case by guarding the object
	lookup with has_sha1_file().

Sounds like it would not affect most fetches except by making them a lot faster in the many-refs case, so for what it's worth I like it.

I had not read this codepath before.  I'm left with a few questions:
 * Why is 49bb805e ("Do not ask for objects known to be complete",
   2005-10-19) trying to do?  Are we hurting that in any way?
   For the sake of an example, suppose in my stalled project I
   maintain 20 topic branches against an unmoving mainline I do not
   advertise and you regularly fetch from me.  The cutoff is the
   *newest* commit date of any of my topic branches you already have.
   By declaring you have that topic branch you avoid a complicated
   negotiation to discover that we both have the mainline.  Is that
   the goal?
 * Is has_sha1_file() generally succeptible to the race against repack
   you mentioned?  How is that normally dealt with?
 * Can a slow operation get confused if an object is incorporated into
   a pack and then expelled again by two repacks in sequence?

Thanks, Jonathan

Previous: Jeff KingNext: Junio C Hamano
Message 5 of 21 in “optimizing pack access on "read only" fetch repos”
  1. 0/2 optimizing pack access on "read only" fetch reposJeff King, Jan 26, 2013
  2. 1/2 fetch: run gc --auto after fetchingJeff King, Jan 26, 2013
  3. Jonathan NiederJan 27, 2013
  4. 2/2 fetch-pack: avoid repeatedly re-scanning pack directoryJeff King, Jan 26, 2013
  5. Jonathan NiederJan 27, 2013
  6. Junio C HamanoJan 27, 2013
  7. Jonathan NiederJan 27, 2013
  8. Junio C HamanoJan 27, 2013
  9. Shawn PearceJan 29, 2013
  10. Jeff KingJan 29, 2013
  11. Martin FickJan 29, 2013
  12. Junio C HamanoJan 29, 2013
  13. Jeff KingJan 29, 2013
  14. Junio C HamanoJan 29, 2013
  15. Shawn PearceJan 31, 2013
  16. Jeff KingFeb 1, 2013
  17. Shawn PearceFeb 2, 2013
  18. Duy NguyenJan 29, 2013
  19. Jeff KingJul 12, 2017
  20. Ævar Arnfjörð BjarmasonJul 12, 2017
  21. Jeff KingJul 12, 2017

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.