git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Michael J Gruber <git@drmicha.warpmail.net>, git@vger.kernel.org
Subject: Re: [PATCH 2/3] Different views on a repository
Date: Fri, 26 Feb 2010 01:45:33 +0100	[thread overview]
Message-ID: <201002260145.33960.agruen@suse.de> (raw)
In-Reply-To: <7vljeh9qcx.fsf@alter.siamese.dyndns.org>

On Thursday 25 February 2010 18:28:46 Junio C Hamano wrote:
> Andreas Gruenbacher <agruen@suse.de> writes:
> > No, it's a server side thing.
> 
> If it were a server side thing, then I would expect no change to
> send/receive pack.
>
> Instead your clients will access distinct URL as if they are different
> repositories.
> 
>     git clone git://example.com/pub/scm/git/A
>     git push example.com:/pub/scm/git/B master
>     git pull http://example.com/pub/scm/git/C
>
> They should not have to care that the server is cheating to save disk
> space, and they should be able to access your server with Git v1.6.0.
> 
> Instead, the server side would:
> 
>  - have separate repositories, A, B and C, as normal repositories;
> 
>  - these repositories share their object stores by having their
>    .git/objects pointing at a shared location via a symlink;
> 
>  - on the server side, gc/prune/fsck will have to be updated so that when
>    the object store of a repository (say A) is shared with something else,
>    they will consider refs in other repositories (B and C) also as the
>    root of traversal.

I was proposing to change receive-pack and upload-pack, both of which are 
running on the server; there was no mention of send-pack.  What I've proposed 
is not a complete solution, but it should suffice to show the idea.

Your alternative proposal would also solve my problem, in a different way.  
With either approach, what looks like separate repositories A, B, and C to 
clients looks like one repository to gc/prune/fsck.

> So if this were a server side solution, I would expect the series would
> add:
> 
>  - a way to set up a shared object store;
> 
>  - a way to maintain a list of backlinks to repositories that share an
>    object store;
> 
>  - a way to create a new repository that shares the object store
>    (e.g. create a symlink to the shared store instead of having its own
>    .git/objects/, and add itself to the list of backlinks for the shared
>    object store);
> 
>  - a way to retire an existing such repository (rm -rf and remove itself
>    from the list of backlinks);
> 
>  - update gc/prune/fsck to honor such a list of backlinks.
> 
> This would help a "forks" setup commonly seen at places like repo.or.cz
> and github.com among others.

Yes. I'm don't know how big a problem this is for those kinds of hosters; in 
our case, it is a big problem.

> One thing that is missing from the above handwaving outline that your
> "different views" offers is a "consolidated view", a pseudo-repository
> that allows you to see refs from individual real (from the client's and
> project participant's point of view) repositories as if they are in
> individual subhierarchies of the ref namespace.

I have been talking about a repository and different subsets or views of that 
repository; you call the former a consolidated view and the latter a 
repository.  Those are really just two sides of the same coin.

> I however suspect that you didn't want such a view in the first place if
> there weren't issues around reachability.  In other words, I suspect that
> you invented it merely as one possible solution to the reachability issue,
> and it was not your goal to have such a consolidated view by itself.

I'm actually not sure.  The "consolidated view" as you put it may be useful 
all by itself; it would be a proper, self sufficient git repository -- a 
really nice property.  it may be too painful to maintain this view though.

When sharing objects across repositories, the worst-case scenario is that 
something goes wrong with the backlinks.  You will eventually lose objects, 
but it may take a while until it happens and until you notice, with a lot of 
damage.  That's nasty.

A combination of the two approaches would be to "link forward" instead of 
"linking back", so that the consolidated view would maintain itself, with a 
server repo setup like this:

	/repos/ABC:
		objects
		refs/tags/A/
		refs/tags/B/
		refs/heads/A/
		refs/heads/B/

	/repos/A:
		refs/tags -> /repos/ABC/refs/tags/A/
		refs/heads -> /repos/ABC/refs/heads/A/
		objects -> /repos/ABC/objects/

	/repos/B:
		refs/tags -> /repos/ABC/refs/tags/B/
		refs/heads -> /repos/ABC/refs/heads/B/
		objects -> /repos/ABC/objects/

This could be made safe by not doing garbage collection if objects is a 
symlink instead of a directory.  (The ABC repo could be garbage collected as 
usual.)  Am I overlooking anything why this can't work?


Thanks,
Andreas

  reply	other threads:[~2010-02-26  0:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 16:41 [RFC][PATCH 0/3] Different views on a repository Andreas Gruenbacher
2010-02-24 15:33 ` [PATCH 1/3] receive-pack: Two small code cleanups Andreas Gruenbacher
2010-02-24 15:57   ` [PATCH 2/3] Different views on a repository Andreas Gruenbacher
2010-02-24 16:14     ` [PATCH 3/3] Different views on a repository: HEAD mapping Andreas Gruenbacher
2010-02-24 17:42     ` [PATCH 2/3] Different views on a repository Shawn O. Pearce
2010-02-25  9:01     ` Michael J Gruber
2010-02-25  9:25       ` Andreas Gruenbacher
2010-02-25 12:30         ` Michael J Gruber
2010-02-25 14:35           ` Andreas Gruenbacher
2010-02-25 17:28             ` Junio C Hamano
2010-02-26  0:45               ` Andreas Gruenbacher [this message]
2010-02-26 21:35                 ` Andreas Gruenbacher
2010-02-24 17:29   ` [PATCH 1/3] receive-pack: Two small code cleanups Shawn O. Pearce
2010-02-25 20:13 ` [RFC][PATCH 0/3] Different views on a repository James Pickens
2010-02-26  4:30 ` Adam Brewster
     [not found] ` <c376da901002252012s507a6921q922e606bdce4b4fa@mail.gmail.com>
2010-02-26 12:01   ` Andreas Gruenbacher

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=201002260145.33960.agruen@suse.de \
    --to=agruen@suse.de \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).