From: Shawn Pearce <spearce@spearce.org>
To: Jeff King <peff@peff.net>
Cc: Marc Branchaud <marcnarc@xiplink.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Concurrent pushes updating the same ref
Date: Thu, 6 Jan 2011 08:48:11 -0800 [thread overview]
Message-ID: <AANLkTinGYjExrnHCqcTPu-APzk9WynxwWoKVOLaSkZ2y@mail.gmail.com> (raw)
In-Reply-To: <20110106163035.GA7812@sigill.intra.peff.net>
On Thu, Jan 6, 2011 at 08:30, Jeff King <peff@peff.net> wrote:
>
> Yeah, we probably should try again. The simplest possible (and untested)
> patch is below. However, a few caveats:
>
> 1. This patch unconditionally retries for all lock files. Do all
> callers want that? I wonder if there are any exploratory lock
> acquisitions that would rather return immediately than have some
> delay.
I don't see why not. We shouldn't be exploring to see if a lock is
possible anywhere.
> 2. The number of tries and sleep time are pulled out of a hat.
FWIW, JGit has started to do some of this stuff for Windows. We're
using 10 retries, with a delay of 100 milliseconds between each. This
was also pulled out of a hat, but it seems to have resolved the bug
reports that came in on Windows. We unfortunately have to do retries
on directory and file deletion.
> 3. Even with retries, I don't know if you will get the behavior you
> want. The lock procedure for refs is:
>
> 1. get the lock
> 2. check and remember the sha1
> 3. release the lock
Why are we locking the ref to read it? You can read a ref atomically
without locking.
> 4. do some long-running work (like the actual push)
> 5. get the lock
> 6. check that the sha1 is the same as the remembered one
> 7. update the sha1
> 8. release the lock
>
> Right now you are getting contention on the lock itself. But may
> you not also run afoul of step (6) above? That is, one push updates
> the ref from A to B, then the other one in attempting to go from A
> to B sees that it has already changed to B under our feet and
> complains?
Not if its a force push. :-)
--
Shawn.
next prev parent reply other threads:[~2011-01-06 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-06 15:46 Concurrent pushes updating the same ref Marc Branchaud
2011-01-06 16:30 ` Jeff King
2011-01-06 16:48 ` Shawn Pearce [this message]
2011-01-06 17:28 ` Ilari Liusvaara
2011-01-06 17:12 ` Marc Branchaud
2011-01-10 22:14 ` Marc Branchaud
2011-01-06 19:37 ` Junio C Hamano
2011-01-06 21:51 ` Marc Branchaud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTinGYjExrnHCqcTPu-APzk9WynxwWoKVOLaSkZ2y@mail.gmail.com \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=marcnarc@xiplink.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).