git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 25/27] refs: add LMDB refs storage backend

From
David Turner <dturner@twopensource.com>
Date
Feb 24, 2016, 20:43 UTC
Message-ID
<1456346620.18017.23.camel@twopensource.com>
In-Reply-To
<20160220025826.GA9338@lanh>
On Sat, 2016-02-20 at 09:58 +0700, Duy Nguyen wrote:
Show 48 quoted lines
> > On Fri, 2016-02-19 at 09:54 +0700, Duy Nguyen wrote:
> > > On Fri, Feb 19, 2016 at 3:23 AM, David Turner <
> > > dturner@twopensource.com> wrote:
> > > > > > +static int read_per_worktree_ref(const char *submodule,
> > > > > > const
> > > > > > char
> > > > > > *refname,
> > > > > > +                            struct MDB_val *val, int
> > > > > > *needs_free)
> > > > > 
> > > > > From what I read, I suspect these _per_worktree functions
> > > > > will be
> > > > > identical for the next backend. Should we just hand over the
> > > > > job
> > > > > for
> > > > > files backend? For all entry points that may deal with per
> > > > > -worktree
> > > > > refs, e.g. lmdb_resolve_ref_unsafe, can we check ref_type()
> > > > > first
> > > > > thing, if it's per-worktree we call
> > > > > refs_be_files.resolve_ref_unsafe()
> > > > > instead?  It could even be done at frontend level,
> > > > > e.g. refs.c:resolve_ref_unsafe().
> > > > > 
> > > > > Though I may be talking rubbish here because I don't know how
> > > > > whether
> > > > > it has anything to do with transactions.
> > > > 
> > > > The reason I did it this way is that some ref chains cross
> > > > backend
> > > > boundaries (e.g. HEAD -> refs/heads/master).  But if we have
> > > > other
> > > > backends later, we could generalize.
> > > 
> > > Crossing backends should go through frontend again, imo. But I
> > > don't
> > > really know if it's efficient.
> > 
> > It's pretty tricky to maintain state (e.g. count of symref
> > redirects)
> > across that barrier.  So I'm not sure how to do it cleanly.
> 
> I notice files backend does pretty much the same thing. "files"
> backend looks more like two backends combined in one, one is files,
> the other is packed-refs. And it looks like we could solve it by
> providing a lower level api, read_raw_ref() or something, that
> retrieves the ref without any validation or link following. More on
> this later.

That basica pproach appears to mostly work. I'll send another series with read_raw_ref as soon as I'm done applying all comments on this series.

Show 39 quoted lines
> > > > > I'm not sure I get this comment. D/F conflicts are no longer
> > > > > a
> > > > > thing
> > > > > for lmdb backend, right?
> > > > 
> > > > I'm trying to avoid the lmdb backend creating a set of refs
> > > > that
> > > > the
> > > > files backend can't handle.  This would make collaboration with
> > > > other
> > > > versions of git more difficult.
> > > 
> > > It already is. If you create refs "foo" and "FOO" on case
> > > sensitive
> > > file system and clone it on a case-insensitive one, you face the
> > > same
> > > problem. We may have an optional configuration knob to prevent
> > > incompatibilities with files backend, but I think that should be
> > > done
> > > (and enforced if necessary) outside backends.
> > 
> > Sure, the current state isn't perfect, but why make it worse?
> 
> I see it from a different angle. The current state isn't perfect, but
> we will be moving to a better future where "files" backend may
> eventually be deprecated. Why hold back?
> 
> But this line of reasoning only works if we have a new backend
> capable
> of replacing "files" without regressions or introducing new
> dependency. Which is why I suggest a new backend [1] (or implement
> Shawn's RefTree if it's proven as good with small repos)
> 
> I have no problem if you want to stay strictly compatible with
> "files"
> though.
> 
> [1] http://thread.gmane.org/gmane.comp.version-control.git/285893/foc
> us=286654
Won't RefTree have the same d/f conflict issue?
> OK how about we keep resolve_ref_1() whole and split real backend
> code
> out? Something like these three patches (only built, did not test). A
> bit ugly with continue_symlink, but it's just demonstration.

I did this a somewhat different way -- will see what you think when I send it.

Previous: Duy NguyenNext: Duy Nguyen
Message 42 of 52 in “refs backends”
  1. 00/27 refs backendsDavid Turner, Feb 18, 2016
  2. 01/27 refs: Move head_ref{,_submodule} to the common codeDavid Turner, Feb 18, 2016
  3. 02/27 refs: move for_each_*ref* functions into common codeDavid Turner, Feb 18, 2016
  4. 03/27 refs: add a backend method structure with transaction functionsDavid Turner, Feb 18, 2016
  5. 04/27 refs: add methods for misc ref operationsDavid Turner, Feb 18, 2016
  6. 05/27 refs: add method for do_for_each_refDavid Turner, Feb 18, 2016
  7. 06/27 refs: add do_for_each_per_worktree_refDavid Turner, Feb 18, 2016
  8. 07/27 refs: add methods for reflogDavid Turner, Feb 18, 2016
  9. 08/27 refs: add method for initial ref transaction commitDavid Turner, Feb 18, 2016
  10. 09/27 refs: add method for delete_refsDavid Turner, Feb 18, 2016
  11. 10/27 refs: add methods to init refs dbDavid Turner, Feb 18, 2016
  12. 11/27 refs: add method to rename refsDavid Turner, Feb 18, 2016
  13. 12/27 refs: forbid cross-backend ref renamesDavid Turner, Feb 18, 2016
  14. Duy NguyenFeb 20, 2016
  15. David TurnerFeb 24, 2016
  16. 13/27 refs: make lock genericDavid Turner, Feb 18, 2016
  17. 14/27 refs: move duplicate check to common codeDavid Turner, Feb 18, 2016
  18. 15/27 refs: allow log-only updatesDavid Turner, Feb 18, 2016
  19. 16/27 refs: don't dereference on renameDavid Turner, Feb 18, 2016
  20. 17/27 refs: on symref reflog expire, lock symref not referrentDavid Turner, Feb 18, 2016
  21. 18/27 refs: resolve symbolic refs firstDavid Turner, Feb 18, 2016
  22. 19/27 refs: always handle non-normal refs in files backendDavid Turner, Feb 18, 2016
  23. 20/27 init: allow alternate ref strorage to be set for new reposDavid Turner, Feb 18, 2016
  24. 21/27 refs: check submodules' ref storage configDavid Turner, Feb 18, 2016
  25. 22/27 clone: allow ref storage backend to be set for cloneDavid Turner, Feb 18, 2016
  26. 23/27 svn: learn ref-storage argumentDavid Turner, Feb 18, 2016
  27. Eric WongFeb 20, 2016
  28. David TurnerFeb 23, 2016
  29. 24/27 refs: add register_ref_storage_backends()David Turner, Feb 18, 2016
  30. 25/27 refs: add LMDB refs storage backendDavid Turner, Feb 18, 2016
  31. Duy NguyenFeb 18, 2016
  32. David TurnerFeb 18, 2016
  33. Junio C HamanoFeb 18, 2016
  34. Duy NguyenFeb 19, 2016
  35. David TurnerFeb 19, 2016
  36. Duy NguyenFeb 20, 2016
  37. David TurnerFeb 24, 2016
  38. Junio C HamanoFeb 20, 2016
  39. David TurnerFeb 19, 2016
  40. Junio C HamanoFeb 19, 2016
  41. Duy NguyenFeb 20, 2016
  42. David TurnerFeb 24, 2016
  43. Duy NguyenFeb 25, 2016
  44. Duy NguyenFeb 20, 2016
  45. David TurnerFeb 24, 2016
  46. Duy NguyenFeb 25, 2016
  47. refs: document transaction semanticsDavid Turner, Feb 25, 2016
  48. David TurnerFeb 25, 2016
  49. Junio C HamanoFeb 25, 2016
  50. David TurnerFeb 25, 2016
  51. 26/27 refs: tests for lmdb backendDavid Turner, Feb 18, 2016
  52. 27/27 tests: add ref-storage argumentDavid Turner, Feb 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.