git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: Jeff King <peff@peff.net>
Cc: Karl Moskowski <kmoskowski@me.com>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	git@vger.kernel.org
Subject: Re: Bug: Branch Deletion Doesn't Clean Up
Date: Thu, 4 Feb 2016 17:26:13 +0900	[thread overview]
Message-ID: <20160204082613.GA14076@glandium.org> (raw)
In-Reply-To: <20160204081759.GA23259@sigill.intra.peff.net>

On Thu, Feb 04, 2016 at 03:17:59AM -0500, Jeff King wrote:
> On Thu, Feb 04, 2016 at 05:12:20PM +0900, Mike Hommey wrote:
> 
> > > > It seems like git branch -d ascend the hierarchy (up to
> > > > .git/refs/heads/), deleting any empty directories.
> > > 
> > > Yes, though it needs to be coupled with making the branch-creation
> > > process more robust to races (since we might create "refs/heads/foo" in
> > > order to make "refs/heads/foo/bar" while somebody else is deleting it to
> > > get rid of "refs/heads/foo/baz").
> > 
> > Can't we come up with a system that would update packed-refs directly
> > instead of creating files?
> 
> There are a few reasons not to:
> 
>   - it breaks backwards compatibility (unless we continue to create the
>     directory in order to put the dot-lock in it, but then I don't think
>     we've gained anything)

Is that the kind of backwards compatibility that matters, though? I
mean, I won't claim to know all the internals of how refs are used, but
you sound like the theoretical incompatibility would be two different
versions of git racing for update-ref on the same local repository.

Not that it would change anything about the other reasons below.

>   - the usual update method for packed-refs is to take a dot-lock, do a
>     whole-file update, and then atomically rename into place.  That
>     makes writing a ref O(# of refs) instead of O(1), and increases lock
>     contention on the packed-refs file.
> 
>   - if we abandon atomic renames as the update mechanism and just update
>     in place via lseek/write, then we need read-locking, or we need to
>     hope that a reader will never see a sheared write
> 
> But if we're willing to break compatibility, we should ditch packed-refs
> entirely and move to a _real_ concurrent database. And there is work
> underway already to do that (see David Turner's ref-backend-lmdb
> series).

Mike

  reply	other threads:[~2016-02-04  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 19:24 Bug: Branch Deletion Doesn't Clean Up Karl Moskowski
2016-02-04  7:54 ` Jeff King
2016-02-04  7:55 ` Jeff King
2016-02-04  8:12   ` Mike Hommey
2016-02-04  8:17     ` Jeff King
2016-02-04  8:26       ` Mike Hommey [this message]
2016-02-04  8:29         ` 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=20160204082613.GA14076@glandium.org \
    --to=mh@glandium.org \
    --cc=git@vger.kernel.org \
    --cc=kmoskowski@me.com \
    --cc=mhagger@alum.mit.edu \
    --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).