git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Branchaud <mbranchaud@xiplink.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Angelo Borsotti <angelo.borsotti@gmail.com>, git <git@vger.kernel.org>
Subject: Re: push race
Date: Mon, 15 Oct 2012 10:29:08 -0400	[thread overview]
Message-ID: <507C1DB4.2010000@xiplink.com> (raw)
In-Reply-To: <CACBZZX5keWVDZ-rvQfHFChKRC1YwXcUvfiqzgeMjVTydnQCdmg@mail.gmail.com>

On 12-10-15 10:09 AM, Ævar Arnfjörð Bjarmason wrote:
> On Mon, Oct 15, 2012 at 11:14 AM, Angelo Borsotti
> <angelo.borsotti@gmail.com> wrote:
>> Hello,
> 
> FWIW we have a lot of lemmings pushing to the same ref all the time at
> $work, and while I've seen cases where:
> 
>  1. Two clients try to push
>  2. They both get the initial lock
>  3. One of them fails to get the secondary lock (I think updating the ref)
> 
> I've never seen cases where they clobber each other in #3 (and I would
> have known from "dude, where's my commit that I just pushed" reports).
> 
> So while we could fix git to make sure there's no race condition such
> that two clients never get the #2 lock I haven't seen it cause actual
> data issues because of two clients getting the #3 lock.
> 
> It might still happen in some cases, I recommend testing it with e.g.
> lots of pushes in parallel with GNU Parallel.

Here's a previous discussion of a race in concurrent updates to the same ref,
even when the updates are all identical:

http://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=164636

In that thread, Peff outlines the lock procedure for refs:

        1. get the lock
        2. check and remember the sha1
        3. release the lock
        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

Angelo, in your case I think one of your concurrent updates would fail in
step 6.  As you say, this is after the changes have been uploaded.  However,
there's none of the file-overwriting that you fear, because the changes are
stored in git's object database under their SHA hashes.  So there'll only be
an object-level collision if two parties upload the exact same object, in
which case it doesn't matter.

		M.

  parent reply	other threads:[~2012-10-15 14:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15  9:14 push race Angelo Borsotti
2012-10-15 11:05 ` Matthieu Moy
2012-10-15 11:53   ` Nguyen Thai Ngoc Duy
     [not found] ` <CAPc5daUon3eLTDT=3wo_=rTCJWVe=ufCvmSzrjD=0T17Dxkpqw@mail.gmail.com>
2012-10-15 11:50   ` Angelo Borsotti
2012-10-15 14:09 ` Ævar Arnfjörð Bjarmason
2012-10-15 14:13   ` demerphq
2012-10-15 14:29   ` Marc Branchaud [this message]
2012-10-15 15:50     ` Angelo Borsotti
2012-10-15 18:58       ` Jeff King
2012-10-15 18:56     ` Jeff King
2012-10-16  2:09       ` Shawn Pearce
2012-10-16  4:51         ` Jeff King
2012-10-16  5:15           ` Nguyen Thai Ngoc Duy
2012-10-16  5:37             ` Jeff King
2012-10-16 10:45               ` Nguyen Thai Ngoc Duy
2012-10-16 17:02                 ` Jeff King
2012-10-16 17:21                 ` Junio C Hamano
2012-10-16 17:25                   ` Jeff King
2012-10-16 19:09                     ` Junio C Hamano
2012-10-16  6:35       ` Angelo Borsotti

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=507C1DB4.2010000@xiplink.com \
    --to=mbranchaud@xiplink.com \
    --cc=angelo.borsotti@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=marcnarc@xiplink.com \
    /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).