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

Re: reftable [v4]: new ref storage format

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2017, 19:50 UTC
Message-ID
<xmqqh8xpsq9c.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAJo=hJv7scc1L0_MdRkFeLAJGjYm2UkTFNOgj2e4+9Zj7KSiiQ@mail.gmail.com>
Shawn Pearce <spearce@spearce.org> writes:
Show 30 quoted lines
> ### Layout
>
> The `$GIT_DIR/refs` path is a file when reftable is configured, not a
> directory.  This prevents loose references from being stored.
>
> A collection of reftable files are stored in the `$GIT_DIR/reftable/`
> directory:
>
>     00000001_UF4paF
>     00000002_bUVgy4
>
> where reftable files are named by a unique name such as produced by
> the function:
>
>     mktemp "${update_index}_XXXXXX"
>
> The stack ordering file is `$GIT_DIR/refs` and lists the current
> files, one per line, in order, from oldest (base) to newest (most
> recent):
>
>     $ cat .git/refs
>     00000001_UF4paF
>     00000002_bUVgy4
>
> Readers must read `$GIT_DIR/refs` to determine which files are
> relevant right now, and search through the stack in reverse order
> (last reftable is examined first).
>
> Reftable files not listed in `refs` may be new (and about to be added
> to the stack by the active writer), or ancient and ready to be pruned.

I like the general idea, what the file format can represent and how it does so, but I am a bit uneasy about how well this "stacked" part would work for desktop clients. The structure presented here is for optimizing the "we want to learn about many (or all) refs" access pattern, which probably matters a lot on the server implementations, but I do not feel comfortable without knowing how much it penalizes "I want the current value of this single ref" access pattern.

With the traditional "packed-refs plus loose" layout, no matter how many times a handful of selected busy refs are updated during the day, you'd need to open at most two files to find out the current value of a single ref (admittedly, the accessing of the second file, after we realize that there is no loose one, would be very costly). If you make a few commits on a topic branch A, then build a 100 commit series on top of another topic branch B, finding the current value of A is still one open and read of refs/heads/A.

With the reftable format, we'd need to open and read all 100 incremental transactions that touch branch B before realizing that none of them talk about A, and read the next transaction file to find the current value of A. To keep this number low, we'd need quite a frequent compaction.

We can just declare that reftable format is not for desktop clients but for server implementations where frequent compaction would not be an annoyance to the users, but I'd wish we do not have to.

Previous: Shawn PearceNext: Jeff King
Message 28 of 34 in “Re: reftable [v4]: new ref storage format”
  1. Shawn PearceJul 31, 2017
  2. Dave BorowitzJul 31, 2017
  3. Stefan BellerJul 31, 2017
  4. Shawn PearceJul 31, 2017
  5. Junio C HamanoJul 31, 2017
  6. Shawn PearceJul 31, 2017
  7. Shawn PearceAug 1, 2017
  8. Michael HaggertyAug 1, 2017
  9. Shawn PearceAug 1, 2017
  10. Michael HaggertyAug 2, 2017
  11. Shawn PearceAug 1, 2017
  12. Shawn PearceAug 1, 2017
  13. Michael HaggertyAug 2, 2017
  14. Shawn PearceAug 2, 2017
  15. Jeff KingAug 2, 2017
  16. Shawn PearceAug 2, 2017
  17. Junio C HamanoAug 2, 2017
  18. Jeff KingAug 2, 2017
  19. Dave BorowitzAug 2, 2017
  20. Jeff KingAug 2, 2017
  21. Michael HaggertyAug 3, 2017
  22. Shawn PearceAug 3, 2017
  23. Michael HaggertyAug 3, 2017
  24. Shawn PearceAug 4, 2017
  25. Shawn PearceAug 5, 2017
  26. Dave BorowitzAug 1, 2017
  27. Shawn PearceAug 1, 2017
  28. Junio C HamanoAug 2, 2017
  29. Jeff KingAug 2, 2017
  30. Shawn PearceAug 3, 2017
  31. Junio C HamanoAug 3, 2017
  32. Shawn PearceAug 3, 2017
  33. Junio C HamanoAug 3, 2017
  34. Stefan BellerAug 2, 2017

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.