git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ronnie Sahlberg <sahlberg@google.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Michael Haggerty <mhagger@alum.mit.edu>
Subject: Experimental TDB support for GIT REFS
Date: Fri, 27 Jun 2014 14:30:07 -0700	[thread overview]
Message-ID: <CAL=YDWn-CGZGr5bXNTiZmzr4-w_8CERx3r2bmLWbczqJ0Sn7dg@mail.gmail.com> (raw)

List,

One of my ref transaction aims is to make define a stable public API
for accessing refs.
Once this is done I want to make it possible to replace the current
.git/refs/* model with a
different type of backend.
In my case I want to add support to store all refs and reflogs in a TDB database
but once we have a pluggable backend framework for refs, if someone
wants to store the refs
in a SQL database, that should be fairly trivial too.

There are a few series queued before this becomes possible, but is
anyone wants to test or play with my "git can use TDB database" you
can find an implementation of this at

https://github.com/rsahlberg/git/tree/backend-struct-tdb

Most everything works (except submodules) but the code needs more work.
It is also VERY LIKELY that the database schema WILL CHANGE so this is
only for testing
and you will need to blow the repo away and start all over again at some stage.
I.e. no production use.


To activate TDB support a new flag is added to the init-db and clone commands:

git init --tdb-repo-name=RONNIE .

This creates a new git repo and sets core.tdb_repo_name in the config.
This config variable tells git to dlopen and use libtdb instead of
using the files under .git/refs

repo-name=RONNIE is a string that identifies the repository and all
keys in the database is prefixed
with repo-name + '\0'

By default this will create the two database refs.tdb and logs.tdb in
the repositories .git directory
but it is also possible to store the databases somehwere else by
adding --tdb-repo-dir=/var/lib/git/
when creating the repo.

Since the keys in the database are prefixed with the repo name it is
even possible to store all the
refs for multiple independent repos in the same database :

- First repository
  $ cd <somewhere>
  $ git init-db --tdb-repo-name=MyFirstRepo --tdb-repo-dir=/var/lib/git

- Second repository
  $ cd <somewhere else>
  $ git init-db --tdb-repo-name=MySecondRepo --tdb-repo-dir=/var/lib/git


This can also be a solutions for platforms lacking case sensitive
filesystems where today two refs that only differ in case can not be
used.



The current prototype will still apply the naming collision rules that
the existing files backend has.
For example if you have a ref 'm'  you can not create another ref 'm/foo'.
I left those checks as is in order to not break compatibility between
the TDB backend and the current Files backend.


Please feel free to test this out. And comment.


regards
ronnie sahlberg

             reply	other threads:[~2014-06-27 21:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-27 21:30 Ronnie Sahlberg [this message]
2014-06-28  0:37 ` Experimental TDB support for GIT REFS Shawn Pearce
2014-07-02 17:11   ` Ronnie Sahlberg
2014-07-02 22:34     ` Ronnie Sahlberg

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL=YDWn-CGZGr5bXNTiZmzr4-w_8CERx3r2bmLWbczqJ0Sn7dg@mail.gmail.com' \
    --to=sahlberg@google.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).