From: Jeff King <peff@peff.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: "Shawn Pearce" <spearce@spearce.org>,
marcnarc@xiplink.com, "Ævar Arnfjörð" <avarab@gmail.com>,
"Angelo Borsotti" <angelo.borsotti@gmail.com>,
git <git@vger.kernel.org>
Subject: Re: push race
Date: Tue, 16 Oct 2012 01:37:50 -0400 [thread overview]
Message-ID: <20121016053750.GA22281@sigill.intra.peff.net> (raw)
In-Reply-To: <CACsJy8AJVAoUHft6+rdOjWCpLWWj3m0NgvFd9pToQRQ5uD8_gg@mail.gmail.com>
On Tue, Oct 16, 2012 at 12:15:21PM +0700, Nguyen Thai Ngoc Duy wrote:
> On Tue, Oct 16, 2012 at 11:51 AM, Jeff King <peff@peff.net> wrote:
> >> Its worth nothing that a SHA-1 collision can be identified at the
> >> server because the server performs a byte-for-byte compare of both
> >> copies of the object to make sure they match exactly in every way. Its
> >> not fast, but its safe. :-)
> >
> > Do we? I thought early versions of git did that, but we did not
> > double-check collisions any more for performance reasons. You don't
> > happen to remember where that code is, do you (not that it really
> > matters, but I am just curious)?
>
> We do. I touched that sha-1 collision code last time I updated
> index-pack, to support large blobs. We only do that when we receive an
> object that we already have, which should not happen often unless
> you're under attack, so little performance impact normally. Search
> "collision" in index-pack.c
Ah, thanks, I remember this now. I think that I was thinking of the very
early code to check every sha1 file write. E.g., the code killed off by
aac1794 (Improve sha1 object file writing., 2005-05-03). But that is
ancient history that is not really relevant.
Interesting that we check only in index-pack. If the pushed content is
small enough, we will call unpack-objects. That follows the usual code
path for writing the object, which will prefer the existing copy.
I suspect a site that is heavy on alternates is invoking the index-pack
code path more frequently than necessary (e.g., history gets pushed to
one forked repo, then when it goes to the next one, we may not share the
ref that tells the client we already have the object and receive it a
second time).
-Peff
next prev parent reply other threads:[~2012-10-16 5:38 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
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 [this message]
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=20121016053750.GA22281@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=angelo.borsotti@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=marcnarc@xiplink.com \
--cc=pclouds@gmail.com \
--cc=spearce@spearce.org \
/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).