Re: Partial clone design (with connectivity check for locally-created objects)
- Date: Tue, 8 Aug 2017 10:03:11 -0700
- From: Jonathan Nieder <jrnieder@xxxxxxxxx>
- Subject: Re: Partial clone design (with connectivity check for locally-created objects)
Ben Peart wrote:
> We've discussed a couple of different possible solutions, each of
> which have different tradeoffs. Let me try to summarize here and
> perhaps suggest some other possibilities:
Thanks for this. Some comments below.
> Promised list
> This provides an external data structure that allowed us to flag
> objects that came from a remote server (vs created locally).
> The biggest drawback is that this data structure can get very large
> and become difficult/expensive to generate/transfer/maintain.
Agreed. Using a single immutable file to maintain this data with
lock-and-rename update means that I/O when updating it can be a
bottleneck and that contention can be a problem.
> It also (at least in one proposal) required protocol and server side
> changes to support it.
I don't think that's a very big problem. This is the Git project: we
control the protocol and the server. Partial clone requires changing
the protocol and server already.
> Annotated via filename
> This idea is to annotate the file names of objects that came from a
> remote server (pack files and loose objects) with a unique file
> extension (.remote) that indicates whether they are locally created
> or not.
> To make this work, git must understand about both types of loose
> objects and pack files and search in both locations when looking for
I don't understand the drawback you're describing here. To avoid a
number of serious problems, Git already needs to be aware of partial
clone. I don't think anyone has been proposing adding partial clone
to upstream Git without a repository format extension (see
Documentation/technical/repository-version.txt) to prevent older
versions of Git from being confused about such repositories.
If you don't do this, some problems include
- confusing messages due to missing objects
- errors over the wire protocol from trying to serve fetches and
- "git gc" running and not knowing which objects are safe to be
So the relevant issue couldn't be that Git has to be changed at all:
it would be that a change is excessively invasive.
But it's not clear to me that the change you are describing is very
> Another drawback of this is that commands (repack, gc) that optimize
> loose objects and pack files must now be aware of the different
> extensions and handle both while not merging remote and non-remote
> In short, we're creating separate object stores - one for locally
> created objects and one for everything else.
These also seem like non-issues.
Some examples of problems I could imagine:
- is writing multiple files when writing a loose object a problem for
- is one of the operations described (repack, prune, fsck) too slow?
Do you forsee either of those being an issue?
> Now a couple of different ideas:
> Annotated via flags
> The fundamental idea here is that we add the ability to flag locally
> created objects on the object itself.
Do you mean changing the underlying object format that produces an
object's object id? Or do you mean changing the container format?
Changing the container format is exactly what was described in the
previous example ("Annotated via filename"). There are other ways to
change the container format: e.g. if writing multiple files when
writing a loose object is a problem, we could add a field that does
not affect the object id to the loose object format.
> Local list
> Given the number of locally created objects is usually very small in
> comparison to the total number of objects (even just due to
> history), it makes more sense to track locally created objects
> instead of promised/remote objects.
> The biggest advantage of this over the "promised list" is that the
> "local list" being maintained is _significantly_ smaller (often
> orders of magnitude smaller).
> On the surface, this seems like the simplest solution that meets the
> stated requirements.
This has the same problems as the list of promised objects: excessive
I/O and contention when updating the list.
Moreover, it doesn't bring one of the main benefits of the list of
promised objects. Promised objects are not present in the local
repository, so the list of promises provided a way to maintain some
information about them (e.g., object size). Locally created objects
are present in the local repository so they don't need such metadata.
> Object DB
If I understand correctly, this is pushing the issues described in the
other cases into a hook and making them not upstream Git's problem.
But it is still someone's problem. It just means upstream Git doesn't
benefit from their solution to it.
I don't see a need to give up in that way just yet.
I'm also available on #git-devel on freenode.net for real-time
conversation. Logs are at http://bit.ly/aLzrmv. You can prepend a
message with "[off]" to prevent it from showing up in logs. I'm also
happy to try to summarize any conversation that happens there here.