From: Jeff King <peff@peff.net>
To: Brodie Rao <brodie@sf.io>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Bryan Turner <bturner@atlassian.com>,
Stefan Saasen <ssaasen@atlassian.com>
Subject: Re: [PATCH] gc: support temporarily preserving garbage
Date: Thu, 4 Dec 2014 04:10:23 -0500 [thread overview]
Message-ID: <20141204091023.GB27455@peff.net> (raw)
In-Reply-To: <CADQoFhyxFNzazsEaE6Bk2W_KDhogBho8vgJXkDDPsYvC46ZX5Q@mail.gmail.com>
On Wed, Dec 03, 2014 at 01:21:03PM -0800, Brodie Rao wrote:
> > I think it is also not sufficient. This patch seems to cover only
> > objects. But we assume that we can atomically rename() new versions of
> > files into place whenever we like without disrupting existing readers.
> > This is the case for ref updates (and packed-refs), as well as the index
> > file. The destination end of the rename is an unlink() in disguise, and
> > would be susceptible to the same problems.
>
> I'm not aware of renaming over files happening anywhere in gc-related
> code. Do you think that's something that would need to be addressed in
> the rest of the code base before going forward with this garbage
> directory approach? If so, do you have any suggestions on how to
> tackle that problem?
As an example, if you run "git pack-refs --all --prune" (which is run by
"git gc"), it will create a new pack-refs file and rename it into place.
Another git program (say, "git for-each-ref") might be reading the file
at the same time. If you run pack-refs and for-each-ref simultaneously
in tight loops on your problematic NFS setup, what happens?
I have no idea if it breaks or not. I don't have such a misbehaving
system, and I don't know how rename() is implemented on it. But if it
_is_ a problem of the same variety, then I don't see much point in
making an invasive fix to address half of the problem areas, but not the
other half (i.e., if we are still left with a broken git in this setup,
was the invasive fix worth the cost?).
If it is a problem (and again, I am just guessing), I'd imagine you
would need a similar setup to what you proposed for unlink(): before
renaming "packed-refs.lock" into "packed-refs", hard-link it into your
"trash" area. And you'd probably want to intercept rename() there, to
catch all places where we use this technique.
-Peff
next prev parent reply other threads:[~2014-12-04 9:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 1:16 [PATCH] gc: support temporarily preserving garbage Brodie Rao
2014-11-14 23:01 ` Junio C Hamano
2014-11-15 1:49 ` Stefan Saasen
2014-11-17 21:34 ` Jeff King
2014-11-17 23:59 ` Stefan Saasen
2014-11-18 0:21 ` Jeff King
2014-12-03 21:21 ` Brodie Rao
2014-12-04 9:10 ` Jeff King [this message]
2014-12-04 18:04 ` Junio C Hamano
2014-12-05 9:30 ` Jeff King
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=20141204091023.GB27455@peff.net \
--to=peff@peff.net \
--cc=brodie@sf.io \
--cc=bturner@atlassian.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ssaasen@atlassian.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.