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

Re: concurrent fetches to update same mirror

From
Jeff King <peff@peff.net>
Date
Jan 5, 2011, 20:53 UTC
Message-ID
<20110105205324.GA7808@sigill.intra.peff.net>
In-Reply-To
<AANLkTini61q+NtDr6oytTcfA6QNGN74L60exdLrNmakd@mail.gmail.com>
On Wed, Jan 05, 2011 at 12:51:12PM -0800, Shawn Pearce wrote:
Show 10 quoted lines
> On Wed, Jan 5, 2011 at 12:47, Jeff King <peff@peff.net> wrote:
> >
> > However, in the default configuration, we fetch using a "+" refspec,
> > which forces update of the ref even in the case of a non-fast-forward. I
> > don't know whether that force also would override any lock-checking.
> 
> Nope, it doesn't.  We still use locking to update the refs, to ensure
> the update is seen atomically by a reader.  The + just means don't
> check that the old value is fully reachable from the new after the
> lock as been taken.
Good, that's what IMHO it _should_ do. :)
Show 5 quoted lines
> If both fetch processes try to update the same ref at the same time,
> one will get the lock and continue, and the other will crash with an
> error (because the lock was busy).  If one is slightly slower than the
> other, they will probably update the refs twice, with the slower fetch
> updating what the faster one had just updated.  :-)

I assumed it would take the "old" value at the very beginning of the fetch (before talking with the remote), and then see that the ref was changed under our feet. Or does it simply do it at the end?

... goes to read code ...
-Peff
Previous: Shawn PearceNext: Jeff King
Message 4 of 12 in “concurrent fetches to update same mirror”
  1. Neal KreitzingerJan 5, 2011
  2. Jeff KingJan 5, 2011
  3. Shawn PearceJan 5, 2011
  4. Jeff KingJan 5, 2011
  5. Jeff KingJan 5, 2011
  6. Neal KreitzingerJan 5, 2011
  7. Neal KreitzingerJan 5, 2011
  8. Jeff KingJan 5, 2011
  9. Junio C HamanoJan 5, 2011
  10. Jeff KingJan 6, 2011
  11. Marc BranchaudJan 7, 2011
  12. Marc BranchaudJan 7, 2011

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.